Messages in this thread Patch in this message | ![/](/images/icornerl.gif) | | Date | Mon, 29 Apr 2024 16:45:33 +0200 | Subject | [PATCH v2 12/12] regulator/core: use rdev->dev.driver_data | From | Michał Mirosław <> |
| |
Move rdev->reg_data to rdev->dev.driver_data to follow the linux device model more closely.
Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl> --- drivers/regulator/core.c | 15 +-------------- include/linux/regulator/driver.h | 8 +++++--- include/linux/regulator/machine.h | 2 +- 3 files changed, 7 insertions(+), 18 deletions(-)
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index 010f4db2ce60..ea2a5efd9a4b 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -5630,7 +5630,7 @@ regulator_register(struct device *dev, } ww_mutex_init(&rdev->mutex, ®ulator_ww_class); - rdev->reg_data = config->driver_data; + dev_set_drvdata(&rdev->dev, config->driver_data); rdev->owner = regulator_desc->owner; rdev->desc = regulator_desc; if (config->regmap) @@ -5895,19 +5895,6 @@ void regulator_has_full_constraints(void) } EXPORT_SYMBOL_GPL(regulator_has_full_constraints); -/** - * rdev_get_drvdata - get rdev regulator driver data - * @rdev: regulator - * - * Get rdev regulator driver private data. This call can be used in the - * regulator driver context. - */ -void *rdev_get_drvdata(struct regulator_dev *rdev) -{ - return rdev->reg_data; -} -EXPORT_SYMBOL_GPL(rdev_get_drvdata); - /** * rdev_get_id - get regulator ID * @rdev: regulator diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h index c1334601cf02..680c23b13249 100644 --- a/include/linux/regulator/driver.h +++ b/include/linux/regulator/driver.h @@ -632,8 +632,6 @@ struct regulator_dev { struct delayed_work disable_work; - void *reg_data; /* regulator_dev data */ - struct dentry *debugfs; struct regulator_enable_gpio *ena_pin; @@ -707,7 +705,11 @@ void regulator_irq_helper_cancel(void **handle); int regulator_irq_map_event_simple(int irq, struct regulator_irq_data *rid, unsigned long *dev_mask); -void *rdev_get_drvdata(struct regulator_dev *rdev); +static inline void *rdev_get_drvdata(const struct regulator_dev *rdev) +{ + return dev_get_drvdata(&rdev->dev); +} + struct device *rdev_get_dev(struct regulator_dev *rdev); struct regmap *rdev_get_regmap(struct regulator_dev *rdev); int rdev_get_id(struct regulator_dev *rdev); diff --git a/include/linux/regulator/machine.h b/include/linux/regulator/machine.h index 7c39dbc33290..378f051d4e70 100644 --- a/include/linux/regulator/machine.h +++ b/include/linux/regulator/machine.h @@ -274,7 +274,7 @@ struct regulator_consumer_supply { * @num_consumer_supplies: Number of consumer device supplies. * @consumer_supplies: Consumer device supply configuration. * - * @driver_data: Pointer copied to regulator_dev.reg_data. + * @driver_data: Pointer copied to regulator_dev's drvdata. */ struct regulator_init_data { const char *supply_regulator; /* or NULL for system supply */ -- 2.39.2
| ![\](/images/icornerr.gif) |