linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] regulator: Use of_node_name_eq for node name comparisons
@ 2018-12-05 19:50 Rob Herring
  2018-12-05 22:13 ` Adam Thomson
  2019-03-13 17:21 ` Lucas Stach
  0 siblings, 2 replies; 5+ messages in thread
From: Rob Herring @ 2018-12-05 19:50 UTC (permalink / raw)
  To: devicetree, linux-kernel
  Cc: Liam Girdwood, Mark Brown, Support Opensource, Sangbeom Kim,
	Krzysztof Kozlowski, Bartlomiej Zolnierkiewicz,
	linux-samsung-soc

Convert string compares of DT node names to use of_node_name_eq helper
instead. This removes direct access to the node name pointer.

For instances using of_node_cmp, this has the side effect of now using
case sensitive comparisons. This should not matter for any FDT based
system which all of these are.

Cc: Liam Girdwood <lgirdwood@gmail.com>
Cc: Mark Brown <broonie@kernel.org>
Cc: Support Opensource <support.opensource@diasemi.com>
Cc: Sangbeom Kim <sbkim73@samsung.com>
Cc: Krzysztof Kozlowski <krzk@kernel.org>
Cc: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Cc: linux-samsung-soc@vger.kernel.org
Signed-off-by: Rob Herring <robh@kernel.org>
---
 drivers/regulator/88pm8607.c               | 2 +-
 drivers/regulator/da9052-regulator.c       | 2 +-
 drivers/regulator/max8997-regulator.c      | 2 +-
 drivers/regulator/mc13xxx-regulator-core.c | 2 +-
 drivers/regulator/qcom-rpmh-regulator.c    | 2 +-
 drivers/regulator/s5m8767.c                | 2 +-
 6 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/regulator/88pm8607.c b/drivers/regulator/88pm8607.c
index fd86446e499b..28f55248eb90 100644
--- a/drivers/regulator/88pm8607.c
+++ b/drivers/regulator/88pm8607.c
@@ -328,7 +328,7 @@ static int pm8607_regulator_dt_init(struct platform_device *pdev,
 		return -ENODEV;
 	}
 	for_each_child_of_node(nproot, np) {
-		if (!of_node_cmp(np->name, info->desc.name)) {
+		if (of_node_name_eq(np, info->desc.name)) {
 			config->init_data =
 				of_get_regulator_init_data(&pdev->dev, np,
 							   &info->desc);
diff --git a/drivers/regulator/da9052-regulator.c b/drivers/regulator/da9052-regulator.c
index 37e4025203e3..207cb3859dcc 100644
--- a/drivers/regulator/da9052-regulator.c
+++ b/drivers/regulator/da9052-regulator.c
@@ -435,7 +435,7 @@ static int da9052_regulator_probe(struct platform_device *pdev)
 			return -ENODEV;
 
 		for_each_child_of_node(nproot, np) {
-			if (!of_node_cmp(np->name,
+			if (of_node_name_eq(np,
 					 regulator->info->reg_desc.name)) {
 				config.init_data = of_get_regulator_init_data(
 					&pdev->dev, np,
diff --git a/drivers/regulator/max8997-regulator.c b/drivers/regulator/max8997-regulator.c
index 3bf5ddfaaea8..4d2487279a0a 100644
--- a/drivers/regulator/max8997-regulator.c
+++ b/drivers/regulator/max8997-regulator.c
@@ -925,7 +925,7 @@ static int max8997_pmic_dt_parse_pdata(struct platform_device *pdev,
 	pdata->regulators = rdata;
 	for_each_child_of_node(regulators_np, reg_np) {
 		for (i = 0; i < ARRAY_SIZE(regulators); i++)
-			if (!of_node_cmp(reg_np->name, regulators[i].name))
+			if (of_node_name_eq(reg_np, regulators[i].name))
 				break;
 
 		if (i == ARRAY_SIZE(regulators)) {
diff --git a/drivers/regulator/mc13xxx-regulator-core.c b/drivers/regulator/mc13xxx-regulator-core.c
index 65eb1e0350cf..2243138d8a58 100644
--- a/drivers/regulator/mc13xxx-regulator-core.c
+++ b/drivers/regulator/mc13xxx-regulator-core.c
@@ -186,7 +186,7 @@ struct mc13xxx_regulator_init_data *mc13xxx_parse_regulators_dt(
 		for (i = 0; i < num_regulators; i++) {
 			if (!regulators[i].desc.name)
 				continue;
-			if (!of_node_cmp(child->name,
+			if (of_node_name_eq(child,
 					 regulators[i].desc.name)) {
 				p->id = i;
 				p->init_data = of_get_regulator_init_data(
diff --git a/drivers/regulator/qcom-rpmh-regulator.c b/drivers/regulator/qcom-rpmh-regulator.c
index 39ccf53fdeb3..b2c2d01d1637 100644
--- a/drivers/regulator/qcom-rpmh-regulator.c
+++ b/drivers/regulator/qcom-rpmh-regulator.c
@@ -410,7 +410,7 @@ static int rpmh_regulator_init_vreg(struct rpmh_vreg *vreg, struct device *dev,
 	vreg->dev = dev;
 
 	for (rpmh_data = pmic_rpmh_data; rpmh_data->name; rpmh_data++)
-		if (!strcmp(rpmh_data->name, node->name))
+		if (of_node_name_eq(node, rpmh_data->name))
 			break;
 
 	if (!rpmh_data->name) {
diff --git a/drivers/regulator/s5m8767.c b/drivers/regulator/s5m8767.c
index 219b9afda0cb..654f65abcb5a 100644
--- a/drivers/regulator/s5m8767.c
+++ b/drivers/regulator/s5m8767.c
@@ -561,7 +561,7 @@ static int s5m8767_pmic_dt_parse_pdata(struct platform_device *pdev,
 	pdata->opmode = rmode;
 	for_each_child_of_node(regulators_np, reg_np) {
 		for (i = 0; i < ARRAY_SIZE(regulators); i++)
-			if (!of_node_cmp(reg_np->name, regulators[i].name))
+			if (of_node_name_eq(reg_np, regulators[i].name))
 				break;
 
 		if (i == ARRAY_SIZE(regulators)) {
-- 
2.19.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* RE: [PATCH] regulator: Use of_node_name_eq for node name comparisons
  2018-12-05 19:50 [PATCH] regulator: Use of_node_name_eq for node name comparisons Rob Herring
@ 2018-12-05 22:13 ` Adam Thomson
  2019-03-13 17:21 ` Lucas Stach
  1 sibling, 0 replies; 5+ messages in thread
From: Adam Thomson @ 2018-12-05 22:13 UTC (permalink / raw)
  To: Rob Herring, devicetree, linux-kernel
  Cc: Liam Girdwood, Mark Brown, Support Opensource, Sangbeom Kim,
	Krzysztof Kozlowski, Bartlomiej Zolnierkiewicz,
	linux-samsung-soc

On 05 December 2018 19:51, Rob Herring wrote:

> Convert string compares of DT node names to use of_node_name_eq helper
> instead. This removes direct access to the node name pointer.
> 
> For instances using of_node_cmp, this has the side effect of now using case
> sensitive comparisons. This should not matter for any FDT based system which all
> of these are.
> 
> Cc: Liam Girdwood <lgirdwood@gmail.com>
> Cc: Mark Brown <broonie@kernel.org>
> Cc: Support Opensource <support.opensource@diasemi.com>
> Cc: Sangbeom Kim <sbkim73@samsung.com>
> Cc: Krzysztof Kozlowski <krzk@kernel.org>
> Cc: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
> Cc: linux-samsung-soc@vger.kernel.org
> Signed-off-by: Rob Herring <robh@kernel.org>

For da9052 regulator driver:

Acked-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>

> ---
>  drivers/regulator/88pm8607.c               | 2 +-
>  drivers/regulator/da9052-regulator.c       | 2 +-
>  drivers/regulator/max8997-regulator.c      | 2 +-
>  drivers/regulator/mc13xxx-regulator-core.c | 2 +-
>  drivers/regulator/qcom-rpmh-regulator.c    | 2 +-
>  drivers/regulator/s5m8767.c                | 2 +-
>  6 files changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/regulator/88pm8607.c b/drivers/regulator/88pm8607.c index
> fd86446e499b..28f55248eb90 100644
> --- a/drivers/regulator/88pm8607.c
> +++ b/drivers/regulator/88pm8607.c
> @@ -328,7 +328,7 @@ static int pm8607_regulator_dt_init(struct
> platform_device *pdev,
>  		return -ENODEV;
>  	}
>  	for_each_child_of_node(nproot, np) {
> -		if (!of_node_cmp(np->name, info->desc.name)) {
> +		if (of_node_name_eq(np, info->desc.name)) {
>  			config->init_data =
>  				of_get_regulator_init_data(&pdev->dev, np,
>  							   &info->desc);
> diff --git a/drivers/regulator/da9052-regulator.c b/drivers/regulator/da9052-
> regulator.c
> index 37e4025203e3..207cb3859dcc 100644
> --- a/drivers/regulator/da9052-regulator.c
> +++ b/drivers/regulator/da9052-regulator.c
> @@ -435,7 +435,7 @@ static int da9052_regulator_probe(struct platform_device
> *pdev)
>  			return -ENODEV;
> 
>  		for_each_child_of_node(nproot, np) {
> -			if (!of_node_cmp(np->name,
> +			if (of_node_name_eq(np,
>  					 regulator->info->reg_desc.name)) {
>  				config.init_data = of_get_regulator_init_data(
>  					&pdev->dev, np,
> diff --git a/drivers/regulator/max8997-regulator.c b/drivers/regulator/max8997-
> regulator.c
> index 3bf5ddfaaea8..4d2487279a0a 100644
> --- a/drivers/regulator/max8997-regulator.c
> +++ b/drivers/regulator/max8997-regulator.c
> @@ -925,7 +925,7 @@ static int max8997_pmic_dt_parse_pdata(struct
> platform_device *pdev,
>  	pdata->regulators = rdata;
>  	for_each_child_of_node(regulators_np, reg_np) {
>  		for (i = 0; i < ARRAY_SIZE(regulators); i++)
> -			if (!of_node_cmp(reg_np->name, regulators[i].name))
> +			if (of_node_name_eq(reg_np, regulators[i].name))
>  				break;
> 
>  		if (i == ARRAY_SIZE(regulators)) {
> diff --git a/drivers/regulator/mc13xxx-regulator-core.c
> b/drivers/regulator/mc13xxx-regulator-core.c
> index 65eb1e0350cf..2243138d8a58 100644
> --- a/drivers/regulator/mc13xxx-regulator-core.c
> +++ b/drivers/regulator/mc13xxx-regulator-core.c
> @@ -186,7 +186,7 @@ struct mc13xxx_regulator_init_data
> *mc13xxx_parse_regulators_dt(
>  		for (i = 0; i < num_regulators; i++) {
>  			if (!regulators[i].desc.name)
>  				continue;
> -			if (!of_node_cmp(child->name,
> +			if (of_node_name_eq(child,
>  					 regulators[i].desc.name)) {
>  				p->id = i;
>  				p->init_data = of_get_regulator_init_data( diff --
> git a/drivers/regulator/qcom-rpmh-regulator.c b/drivers/regulator/qcom-rpmh-
> regulator.c
> index 39ccf53fdeb3..b2c2d01d1637 100644
> --- a/drivers/regulator/qcom-rpmh-regulator.c
> +++ b/drivers/regulator/qcom-rpmh-regulator.c
> @@ -410,7 +410,7 @@ static int rpmh_regulator_init_vreg(struct rpmh_vreg
> *vreg, struct device *dev,
>  	vreg->dev = dev;
> 
>  	for (rpmh_data = pmic_rpmh_data; rpmh_data->name; rpmh_data++)
> -		if (!strcmp(rpmh_data->name, node->name))
> +		if (of_node_name_eq(node, rpmh_data->name))
>  			break;
> 
>  	if (!rpmh_data->name) {
> diff --git a/drivers/regulator/s5m8767.c b/drivers/regulator/s5m8767.c index
> 219b9afda0cb..654f65abcb5a 100644
> --- a/drivers/regulator/s5m8767.c
> +++ b/drivers/regulator/s5m8767.c
> @@ -561,7 +561,7 @@ static int s5m8767_pmic_dt_parse_pdata(struct
> platform_device *pdev,
>  	pdata->opmode = rmode;
>  	for_each_child_of_node(regulators_np, reg_np) {
>  		for (i = 0; i < ARRAY_SIZE(regulators); i++)
> -			if (!of_node_cmp(reg_np->name, regulators[i].name))
> +			if (of_node_name_eq(reg_np, regulators[i].name))
>  				break;
> 
>  		if (i == ARRAY_SIZE(regulators)) {
> --
> 2.19.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] regulator: Use of_node_name_eq for node name comparisons
  2018-12-05 19:50 [PATCH] regulator: Use of_node_name_eq for node name comparisons Rob Herring
  2018-12-05 22:13 ` Adam Thomson
@ 2019-03-13 17:21 ` Lucas Stach
  2019-03-13 17:36   ` Fabio Estevam
  1 sibling, 1 reply; 5+ messages in thread
From: Lucas Stach @ 2019-03-13 17:21 UTC (permalink / raw)
  To: Rob Herring, Mark Brown; +Cc: Liam Girdwood, devicetree, linux-kernel

Hi Rob, hi Mark,

Am Mittwoch, den 05.12.2018, 13:50 -0600 schrieb Rob Herring:
> Convert string compares of DT node names to use of_node_name_eq helper
> instead. This removes direct access to the node name pointer.
> 
> For instances using of_node_cmp, this has the side effect of now using
> case sensitive comparisons. This should not matter for any FDT based
> system which all of these are.
[...]
> diff --git a/drivers/regulator/mc13xxx-regulator-core.c b/drivers/regulator/mc13xxx-regulator-core.c
> index 65eb1e0350cf..2243138d8a58 100644
> --- a/drivers/regulator/mc13xxx-regulator-core.c
> +++ b/drivers/regulator/mc13xxx-regulator-core.c
> @@ -186,7 +186,7 @@ struct mc13xxx_regulator_init_data *mc13xxx_parse_regulators_dt(
> >  		for (i = 0; i < num_regulators; i++) {
> >  			if (!regulators[i].desc.name)
> >  				continue;
> > -			if (!of_node_cmp(child->name,
> > +			if (of_node_name_eq(child,
> >  					 regulators[i].desc.name))
> > 

Unfortunately this change causes a regression on systems with MC13xxx
regulators. The desc.name field is filled with an uppercase name of the
regulator, while the existing DTs (as far as I know) all use lowercase
node names, so the matching in the function above doesn't work anymore.

Any opinions about how to proceed here?

Regards,
Lucas

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] regulator: Use of_node_name_eq for node name comparisons
  2019-03-13 17:21 ` Lucas Stach
@ 2019-03-13 17:36   ` Fabio Estevam
  2019-03-13 17:51     ` Lucas Stach
  0 siblings, 1 reply; 5+ messages in thread
From: Fabio Estevam @ 2019-03-13 17:36 UTC (permalink / raw)
  To: Lucas Stach
  Cc: Rob Herring, Mark Brown, Liam Girdwood,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	linux-kernel

Hi Lucas,

On Wed, Mar 13, 2019 at 2:22 PM Lucas Stach <l.stach@pengutronix.de> wrote:

> Unfortunately this change causes a regression on systems with MC13xxx
> regulators. The desc.name field is filled with an uppercase name of the
> regulator, while the existing DTs (as far as I know) all use lowercase
> node names, so the matching in the function above doesn't work anymore.
>
> Any opinions about how to proceed here?

Does this patch fix the problem?
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?h=next-20190306&id=ec520911ecc7eaf01a

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] regulator: Use of_node_name_eq for node name comparisons
  2019-03-13 17:36   ` Fabio Estevam
@ 2019-03-13 17:51     ` Lucas Stach
  0 siblings, 0 replies; 5+ messages in thread
From: Lucas Stach @ 2019-03-13 17:51 UTC (permalink / raw)
  To: Fabio Estevam
  Cc: Rob Herring, Mark Brown, Liam Girdwood,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	linux-kernel

Hi Fabio,

Am Mittwoch, den 13.03.2019, 14:36 -0300 schrieb Fabio Estevam:
> Hi Lucas,
> 
> > On Wed, Mar 13, 2019 at 2:22 PM Lucas Stach <l.stach@pengutronix.de> wrote:
> 
> > Unfortunately this change causes a regression on systems with MC13xxx
> > regulators. The desc.name field is filled with an uppercase name of the
> > regulator, while the existing DTs (as far as I know) all use lowercase
> > node names, so the matching in the function above doesn't work anymore.
> > 
> > Any opinions about how to proceed here?
> 
> Does this patch fix the problem?
> https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?h=next-20190306&id=ec520911ecc7eaf01a

I wasn't aware of this patch. I haven't tested it yet, but this looks
like it should fix the problem. I just wasn't sure if that's the route
we want to go, as I don't know if there are any out of tree DTs that
use uppercase node names.

But as there seems to be agreement to just change the regulator names
to lowercase, I consider this issue fixed.

Regards,
Lucas

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-03-13 17:51 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-05 19:50 [PATCH] regulator: Use of_node_name_eq for node name comparisons Rob Herring
2018-12-05 22:13 ` Adam Thomson
2019-03-13 17:21 ` Lucas Stach
2019-03-13 17:36   ` Fabio Estevam
2019-03-13 17:51     ` Lucas Stach

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).