[PATCH] mfd: rk808: Abstracting childs from the interface being used

Alexander Shiyan eagle.alexander923 at gmail.com
Thu Jun 20 22:33:11 PDT 2024


The patch is part of the preparation for adding the SPI interface support.

Signed-off-by: Alexander Shiyan <eagle.alexander923 at gmail.com>
---
 drivers/mfd/rk808.c                 | 2 +-
 drivers/regulator/rk808-regulator.c | 5 ++---
 include/linux/mfd/rk808.h           | 3 +--
 3 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/mfd/rk808.c b/drivers/mfd/rk808.c
index 77493a7b5b..adb9d8ca0a 100644
--- a/drivers/mfd/rk808.c
+++ b/drivers/mfd/rk808.c
@@ -330,7 +330,7 @@ static int rk808_probe(struct device *dev)
 		return -EINVAL;
 	}
 
-	rk808->i2c = client;
+	rk808->dev = &client->dev;
 	i2c_set_clientdata(client, rk808);
 
 	rk808->regmap = regmap_init_i2c_smbus(client, rk808->regmap_cfg);
diff --git a/drivers/regulator/rk808-regulator.c b/drivers/regulator/rk808-regulator.c
index adb0262314..b361dae8cf 100644
--- a/drivers/regulator/rk808-regulator.c
+++ b/drivers/regulator/rk808-regulator.c
@@ -12,7 +12,6 @@
 #include <driver.h>
 #include <gpio.h>
 #include <init.h>
-#include <i2c/i2c.h>
 #include <of_device.h>
 #include <linux/regmap.h>
 #include <linux/regulator/of_regulator.h>
@@ -770,7 +769,7 @@ static int rk808_regulator_register(struct rk808 *rk808, int id,
 				    struct of_regulator_match *match,
 				    struct rk_regulator_cfg *cfg)
 {
-	struct device *dev = &rk808->i2c->dev;
+	struct device *dev = rk808->dev;
 	int ret;
 
 	if (!match->of_node) {
@@ -935,7 +934,7 @@ static int rk808_regulator_probe(struct device *dev)
 		return -EINVAL;
 	}
 
-	ret = rk808_regulator_dt_parse(&rk808->i2c->dev, matches, nregulators);
+	ret = rk808_regulator_dt_parse(rk808->dev, matches, nregulators);
 	if (ret < 0)
 		return ret;
 
diff --git a/include/linux/mfd/rk808.h b/include/linux/mfd/rk808.h
index d8e465f885..7804ea80f6 100644
--- a/include/linux/mfd/rk808.h
+++ b/include/linux/mfd/rk808.h
@@ -707,12 +707,11 @@ enum {
 	RK818_ID = 0x8180,
 };
 
-struct i2c_client;
 struct regmap;
 struct regmap_config;
 
 struct rk808 {
-	struct i2c_client		*i2c;
+	struct device			*dev;
 	struct regmap			*regmap;
 	long				variant;
 	const struct regmap_config	*regmap_cfg;
-- 
2.39.1




More information about the barebox mailing list