regulator: provide rdev_get_regmap()
PATCH 1/1 regulator: provide rdev_get_regmap()
From: Bartosz Golaszewski <[email protected]>
Provide a helper allowing to access regulator's regmap.
Signed-off-by Bartosz Golaszewski <[email protected]>
---
Hi Mark,
please consider adding this helper to regulator core. I used it in my max77650 driver and it nicely simplified the code, since there's no more need for a driver-wide data structure as callbacks only need to access the regulator description and register offsets (stored in global constant regulator description structures).
drivers/regulator/core.c | 6 ++++++ include/linux/regulator/driver.h | 1 + 2 files changed, 7 insertions(+)
drivers/regulator/core.c +6 -0
@@ -5251,6 +5251,12 @@ struct device *rdev_get_dev(struct regulator_dev *rdev) }EXPORT_SYMBOL_GPL (rdev_get_dev); +struct regmap *rdev_get_regmap (struct regulator_dev *rdev) +{ +return rdev->regmap; +} +EXPORT_SYMBOL_GPL (rdev_get_regmap); +void *regulator_get_init_drvdata (struct regulator_init_data *reg_init_data) {return reg_init_data->driver_data;
include/linux/regulator/driver.h +1 -0
@@ -503,6 +503,7 @@ int regulator_notifier_call_chain(struct regulator_dev *rdev,void *rdev_get_drvdata (struct regulator_dev *rdev);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);int regulator_mode_to_status (unsigned int );
Signature · 1 line
2.19.1