2024-04-29 14:46:20

by Michał Mirosław

[permalink] [raw]
Subject: [PATCH v2 12/12] regulator/core: use rdev->dev.driver_data

Move rdev->reg_data to rdev->dev.driver_data to follow the linux device
model more closely.

Signed-off-by: Michał Mirosław <[email protected]>
---
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, &regulator_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



2024-04-30 02:55:17

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH v2 12/12] regulator/core: use rdev->dev.driver_data

Hi Michał,

kernel test robot noticed the following build errors:

[auto build test ERROR on broonie-regulator/for-next]
[also build test ERROR on linus/master v6.9-rc6 next-20240429]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Micha-Miros-aw/regulator-core-_regulator_get-simplify-error-returns/20240429-225643
base: https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git for-next
patch link: https://lore.kernel.org/r/0a480abe4913f0169f9693f6f959fbe1a397ae93.1714399603.git.mirq-linux%40rere.qmqm.pl
patch subject: [PATCH v2 12/12] regulator/core: use rdev->dev.driver_data
config: arm-randconfig-001-20240430 (https://download.01.org/0day-ci/archive/20240430/[email protected]/config)
compiler: clang version 19.0.0git (https://github.com/llvm/llvm-project 37ae4ad0eef338776c7e2cffb3896153d43dcd90)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240430/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

In file included from drivers/pinctrl/renesas/pfc-sh73a0.c:12:
In file included from include/linux/regulator/driver.h:18:
In file included from include/linux/regulator/consumer.h:35:
In file included from include/linux/suspend.h:5:
In file included from include/linux/swap.h:9:
In file included from include/linux/memcontrol.h:21:
In file included from include/linux/mm.h:2208:
include/linux/vmstat.h:522:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
522 | return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
| ~~~~~~~~~~~ ^ ~~~
>> drivers/pinctrl/renesas/pfc-sh73a0.c:4027:28: error: no member named 'reg_data' in 'struct regulator_dev'
4027 | struct sh_pfc *pfc = reg->reg_data;
| ~~~ ^
drivers/pinctrl/renesas/pfc-sh73a0.c:4060:28: error: no member named 'reg_data' in 'struct regulator_dev'
4060 | struct sh_pfc *pfc = reg->reg_data;
| ~~~ ^
1 warning and 2 errors generated.


vim +4027 drivers/pinctrl/renesas/pfc-sh73a0.c

5d5166dc39bcbe drivers/pinctrl/sh-pfc/pfc-sh73a0.c Laurent Pinchart 2012-12-15 4020
ea770ad2ec054e drivers/pinctrl/sh-pfc/pfc-sh73a0.c Laurent Pinchart 2013-04-21 4021 /* -----------------------------------------------------------------------------
ea770ad2ec054e drivers/pinctrl/sh-pfc/pfc-sh73a0.c Laurent Pinchart 2013-04-21 4022 * VCCQ MC0 regulator
ea770ad2ec054e drivers/pinctrl/sh-pfc/pfc-sh73a0.c Laurent Pinchart 2013-04-21 4023 */
ea770ad2ec054e drivers/pinctrl/sh-pfc/pfc-sh73a0.c Laurent Pinchart 2013-04-21 4024
ea770ad2ec054e drivers/pinctrl/sh-pfc/pfc-sh73a0.c Laurent Pinchart 2013-04-21 4025 static void sh73a0_vccq_mc0_endisable(struct regulator_dev *reg, bool enable)
ea770ad2ec054e drivers/pinctrl/sh-pfc/pfc-sh73a0.c Laurent Pinchart 2013-04-21 4026 {
ea770ad2ec054e drivers/pinctrl/sh-pfc/pfc-sh73a0.c Laurent Pinchart 2013-04-21 @4027 struct sh_pfc *pfc = reg->reg_data;
5b46ac3a772363 drivers/pinctrl/sh-pfc/pfc-sh73a0.c Laurent Pinchart 2013-12-11 4028 void __iomem *addr = pfc->windows[1].virt + 4;
ea770ad2ec054e drivers/pinctrl/sh-pfc/pfc-sh73a0.c Laurent Pinchart 2013-04-21 4029 unsigned long flags;
ea770ad2ec054e drivers/pinctrl/sh-pfc/pfc-sh73a0.c Laurent Pinchart 2013-04-21 4030 u32 value;
ea770ad2ec054e drivers/pinctrl/sh-pfc/pfc-sh73a0.c Laurent Pinchart 2013-04-21 4031
ea770ad2ec054e drivers/pinctrl/sh-pfc/pfc-sh73a0.c Laurent Pinchart 2013-04-21 4032 spin_lock_irqsave(&pfc->lock, flags);
ea770ad2ec054e drivers/pinctrl/sh-pfc/pfc-sh73a0.c Laurent Pinchart 2013-04-21 4033
ea770ad2ec054e drivers/pinctrl/sh-pfc/pfc-sh73a0.c Laurent Pinchart 2013-04-21 4034 value = ioread32(addr);
ea770ad2ec054e drivers/pinctrl/sh-pfc/pfc-sh73a0.c Laurent Pinchart 2013-04-21 4035
ea770ad2ec054e drivers/pinctrl/sh-pfc/pfc-sh73a0.c Laurent Pinchart 2013-04-21 4036 if (enable)
ea770ad2ec054e drivers/pinctrl/sh-pfc/pfc-sh73a0.c Laurent Pinchart 2013-04-21 4037 value |= BIT(28);
ea770ad2ec054e drivers/pinctrl/sh-pfc/pfc-sh73a0.c Laurent Pinchart 2013-04-21 4038 else
ea770ad2ec054e drivers/pinctrl/sh-pfc/pfc-sh73a0.c Laurent Pinchart 2013-04-21 4039 value &= ~BIT(28);
ea770ad2ec054e drivers/pinctrl/sh-pfc/pfc-sh73a0.c Laurent Pinchart 2013-04-21 4040
ea770ad2ec054e drivers/pinctrl/sh-pfc/pfc-sh73a0.c Laurent Pinchart 2013-04-21 4041 iowrite32(value, addr);
ea770ad2ec054e drivers/pinctrl/sh-pfc/pfc-sh73a0.c Laurent Pinchart 2013-04-21 4042
ea770ad2ec054e drivers/pinctrl/sh-pfc/pfc-sh73a0.c Laurent Pinchart 2013-04-21 4043 spin_unlock_irqrestore(&pfc->lock, flags);
ea770ad2ec054e drivers/pinctrl/sh-pfc/pfc-sh73a0.c Laurent Pinchart 2013-04-21 4044 }
ea770ad2ec054e drivers/pinctrl/sh-pfc/pfc-sh73a0.c Laurent Pinchart 2013-04-21 4045

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

2024-04-30 04:53:20

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH v2 12/12] regulator/core: use rdev->dev.driver_data

Hi Michał,

kernel test robot noticed the following build errors:

[auto build test ERROR on broonie-regulator/for-next]
[also build test ERROR on linus/master v6.9-rc6 next-20240429]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Micha-Miros-aw/regulator-core-_regulator_get-simplify-error-returns/20240429-225643
base: https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git for-next
patch link: https://lore.kernel.org/r/0a480abe4913f0169f9693f6f959fbe1a397ae93.1714399603.git.mirq-linux%40rere.qmqm.pl
patch subject: [PATCH v2 12/12] regulator/core: use rdev->dev.driver_data
config: m68k-allmodconfig (https://download.01.org/0day-ci/archive/20240430/[email protected]/config)
compiler: m68k-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240430/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

drivers/pinctrl/renesas/pfc-sh73a0.c: In function 'sh73a0_vccq_mc0_endisable':
>> drivers/pinctrl/renesas/pfc-sh73a0.c:4027:33: error: 'struct regulator_dev' has no member named 'reg_data'
4027 | struct sh_pfc *pfc = reg->reg_data;
| ^~
drivers/pinctrl/renesas/pfc-sh73a0.c: In function 'sh73a0_vccq_mc0_is_enabled':
drivers/pinctrl/renesas/pfc-sh73a0.c:4060:33: error: 'struct regulator_dev' has no member named 'reg_data'
4060 | struct sh_pfc *pfc = reg->reg_data;
| ^~


vim +4027 drivers/pinctrl/renesas/pfc-sh73a0.c

5d5166dc39bcbe drivers/pinctrl/sh-pfc/pfc-sh73a0.c Laurent Pinchart 2012-12-15 4020
ea770ad2ec054e drivers/pinctrl/sh-pfc/pfc-sh73a0.c Laurent Pinchart 2013-04-21 4021 /* -----------------------------------------------------------------------------
ea770ad2ec054e drivers/pinctrl/sh-pfc/pfc-sh73a0.c Laurent Pinchart 2013-04-21 4022 * VCCQ MC0 regulator
ea770ad2ec054e drivers/pinctrl/sh-pfc/pfc-sh73a0.c Laurent Pinchart 2013-04-21 4023 */
ea770ad2ec054e drivers/pinctrl/sh-pfc/pfc-sh73a0.c Laurent Pinchart 2013-04-21 4024
ea770ad2ec054e drivers/pinctrl/sh-pfc/pfc-sh73a0.c Laurent Pinchart 2013-04-21 4025 static void sh73a0_vccq_mc0_endisable(struct regulator_dev *reg, bool enable)
ea770ad2ec054e drivers/pinctrl/sh-pfc/pfc-sh73a0.c Laurent Pinchart 2013-04-21 4026 {
ea770ad2ec054e drivers/pinctrl/sh-pfc/pfc-sh73a0.c Laurent Pinchart 2013-04-21 @4027 struct sh_pfc *pfc = reg->reg_data;
5b46ac3a772363 drivers/pinctrl/sh-pfc/pfc-sh73a0.c Laurent Pinchart 2013-12-11 4028 void __iomem *addr = pfc->windows[1].virt + 4;
ea770ad2ec054e drivers/pinctrl/sh-pfc/pfc-sh73a0.c Laurent Pinchart 2013-04-21 4029 unsigned long flags;
ea770ad2ec054e drivers/pinctrl/sh-pfc/pfc-sh73a0.c Laurent Pinchart 2013-04-21 4030 u32 value;
ea770ad2ec054e drivers/pinctrl/sh-pfc/pfc-sh73a0.c Laurent Pinchart 2013-04-21 4031
ea770ad2ec054e drivers/pinctrl/sh-pfc/pfc-sh73a0.c Laurent Pinchart 2013-04-21 4032 spin_lock_irqsave(&pfc->lock, flags);
ea770ad2ec054e drivers/pinctrl/sh-pfc/pfc-sh73a0.c Laurent Pinchart 2013-04-21 4033
ea770ad2ec054e drivers/pinctrl/sh-pfc/pfc-sh73a0.c Laurent Pinchart 2013-04-21 4034 value = ioread32(addr);
ea770ad2ec054e drivers/pinctrl/sh-pfc/pfc-sh73a0.c Laurent Pinchart 2013-04-21 4035
ea770ad2ec054e drivers/pinctrl/sh-pfc/pfc-sh73a0.c Laurent Pinchart 2013-04-21 4036 if (enable)
ea770ad2ec054e drivers/pinctrl/sh-pfc/pfc-sh73a0.c Laurent Pinchart 2013-04-21 4037 value |= BIT(28);
ea770ad2ec054e drivers/pinctrl/sh-pfc/pfc-sh73a0.c Laurent Pinchart 2013-04-21 4038 else
ea770ad2ec054e drivers/pinctrl/sh-pfc/pfc-sh73a0.c Laurent Pinchart 2013-04-21 4039 value &= ~BIT(28);
ea770ad2ec054e drivers/pinctrl/sh-pfc/pfc-sh73a0.c Laurent Pinchart 2013-04-21 4040
ea770ad2ec054e drivers/pinctrl/sh-pfc/pfc-sh73a0.c Laurent Pinchart 2013-04-21 4041 iowrite32(value, addr);
ea770ad2ec054e drivers/pinctrl/sh-pfc/pfc-sh73a0.c Laurent Pinchart 2013-04-21 4042
ea770ad2ec054e drivers/pinctrl/sh-pfc/pfc-sh73a0.c Laurent Pinchart 2013-04-21 4043 spin_unlock_irqrestore(&pfc->lock, flags);
ea770ad2ec054e drivers/pinctrl/sh-pfc/pfc-sh73a0.c Laurent Pinchart 2013-04-21 4044 }
ea770ad2ec054e drivers/pinctrl/sh-pfc/pfc-sh73a0.c Laurent Pinchart 2013-04-21 4045

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

2024-05-01 11:11:23

by Michał Mirosław

[permalink] [raw]
Subject: Re: [PATCH v2 12/12] regulator/core: use rdev->dev.driver_data

On Tue, Apr 30, 2024 at 12:53:02PM +0800, kernel test robot wrote:
> Hi Micha?,
>
> kernel test robot noticed the following build errors:
[...]
> drivers/pinctrl/renesas/pfc-sh73a0.c: In function 'sh73a0_vccq_mc0_endisable':
> >> drivers/pinctrl/renesas/pfc-sh73a0.c:4027:33: error: 'struct regulator_dev' has no member named 'reg_data'
> 4027 | struct sh_pfc *pfc = reg->reg_data;
> | ^~
> drivers/pinctrl/renesas/pfc-sh73a0.c: In function 'sh73a0_vccq_mc0_is_enabled':
> drivers/pinctrl/renesas/pfc-sh73a0.c:4060:33: error: 'struct regulator_dev' has no member named 'reg_data'
> 4060 | struct sh_pfc *pfc = reg->reg_data;
> | ^~

A patch for the driver coming in v3.

Best Regards
Micha? Miros?aw