linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] tegra: use regulator_bulk_set_supply_names()
@ 2019-10-01 13:23 Bartosz Golaszewski
  2019-10-01 13:23 ` [PATCH 1/3] ahci: " Bartosz Golaszewski
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Bartosz Golaszewski @ 2019-10-01 13:23 UTC (permalink / raw)
  To: Jens Axboe, Thierry Reding, Jonathan Hunter, JC Kuo,
	Kishon Vijay Abraham I, Mathias Nyman, Greg Kroah-Hartman
  Cc: linux-ide, linux-tegra, linux-kernel, linux-usb, Bartosz Golaszewski

From: Bartosz Golaszewski <bgolaszewski@baylibre.com>

The regulator_bulk_set_supply_names() helper was merged upstream. Use it
in a couple tegra drivers.

Bartosz Golaszewski (3):
  ahci: tegra: use regulator_bulk_set_supply_names()
  phy: tegra: use regulator_bulk_set_supply_names()
  usb: host: xhci-tegra: use regulator_bulk_set_supply_names()

 drivers/ata/ahci_tegra.c      | 6 +++---
 drivers/phy/tegra/xusb.c      | 6 +++---
 drivers/usb/host/xhci-tegra.c | 5 +++--
 3 files changed, 9 insertions(+), 8 deletions(-)

-- 
2.23.0


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

* [PATCH 1/3] ahci: tegra: use regulator_bulk_set_supply_names()
  2019-10-01 13:23 [PATCH 0/3] tegra: use regulator_bulk_set_supply_names() Bartosz Golaszewski
@ 2019-10-01 13:23 ` Bartosz Golaszewski
  2019-10-02 12:26   ` Thierry Reding
  2019-10-01 13:23 ` [PATCH 2/3] phy: " Bartosz Golaszewski
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 9+ messages in thread
From: Bartosz Golaszewski @ 2019-10-01 13:23 UTC (permalink / raw)
  To: Jens Axboe, Thierry Reding, Jonathan Hunter, JC Kuo,
	Kishon Vijay Abraham I, Mathias Nyman, Greg Kroah-Hartman
  Cc: linux-ide, linux-tegra, linux-kernel, linux-usb, Bartosz Golaszewski

From: Bartosz Golaszewski <bgolaszewski@baylibre.com>

Use the new regulator helper instead of a for loop.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
---
 drivers/ata/ahci_tegra.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/ata/ahci_tegra.c b/drivers/ata/ahci_tegra.c
index e3163dae5e85..cb55ebc1725b 100644
--- a/drivers/ata/ahci_tegra.c
+++ b/drivers/ata/ahci_tegra.c
@@ -483,7 +483,6 @@ static int tegra_ahci_probe(struct platform_device *pdev)
 	struct tegra_ahci_priv *tegra;
 	struct resource *res;
 	int ret;
-	unsigned int i;
 
 	hpriv = ahci_platform_get_resources(pdev, 0);
 	if (IS_ERR(hpriv))
@@ -543,8 +542,9 @@ static int tegra_ahci_probe(struct platform_device *pdev)
 	if (!tegra->supplies)
 		return -ENOMEM;
 
-	for (i = 0; i < tegra->soc->num_supplies; i++)
-		tegra->supplies[i].supply = tegra->soc->supply_names[i];
+	regulator_bulk_set_supply_names(tegra->supplies,
+					tegra->soc->supply_names,
+					tegra->soc->num_supplies);
 
 	ret = devm_regulator_bulk_get(&pdev->dev,
 				      tegra->soc->num_supplies,
-- 
2.23.0


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

* [PATCH 2/3] phy: tegra: use regulator_bulk_set_supply_names()
  2019-10-01 13:23 [PATCH 0/3] tegra: use regulator_bulk_set_supply_names() Bartosz Golaszewski
  2019-10-01 13:23 ` [PATCH 1/3] ahci: " Bartosz Golaszewski
@ 2019-10-01 13:23 ` Bartosz Golaszewski
  2019-10-02 12:26   ` Thierry Reding
  2019-10-01 13:23 ` [PATCH 3/3] usb: host: xhci-tegra: " Bartosz Golaszewski
  2019-10-01 13:38 ` [PATCH 0/3] tegra: " Thierry Reding
  3 siblings, 1 reply; 9+ messages in thread
From: Bartosz Golaszewski @ 2019-10-01 13:23 UTC (permalink / raw)
  To: Jens Axboe, Thierry Reding, Jonathan Hunter, JC Kuo,
	Kishon Vijay Abraham I, Mathias Nyman, Greg Kroah-Hartman
  Cc: linux-ide, linux-tegra, linux-kernel, linux-usb, Bartosz Golaszewski

From: Bartosz Golaszewski <bgolaszewski@baylibre.com>

Use the new regulator helper instead of a for loop.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
---
 drivers/phy/tegra/xusb.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/phy/tegra/xusb.c b/drivers/phy/tegra/xusb.c
index 2ea8497af82a..faf1137d1432 100644
--- a/drivers/phy/tegra/xusb.c
+++ b/drivers/phy/tegra/xusb.c
@@ -862,7 +862,6 @@ static int tegra_xusb_padctl_probe(struct platform_device *pdev)
 	struct tegra_xusb_padctl *padctl;
 	const struct of_device_id *match;
 	struct resource *res;
-	unsigned int i;
 	int err;
 
 	/* for backwards compatibility with old device trees */
@@ -907,8 +906,9 @@ static int tegra_xusb_padctl_probe(struct platform_device *pdev)
 		goto remove;
 	}
 
-	for (i = 0; i < padctl->soc->num_supplies; i++)
-		padctl->supplies[i].supply = padctl->soc->supply_names[i];
+	regulator_bulk_set_supply_names(padctl->supplies,
+					padctl->soc->supply_names,
+					padctl->soc->num_supplies);
 
 	err = devm_regulator_bulk_get(&pdev->dev, padctl->soc->num_supplies,
 				      padctl->supplies);
-- 
2.23.0


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

* [PATCH 3/3] usb: host: xhci-tegra: use regulator_bulk_set_supply_names()
  2019-10-01 13:23 [PATCH 0/3] tegra: use regulator_bulk_set_supply_names() Bartosz Golaszewski
  2019-10-01 13:23 ` [PATCH 1/3] ahci: " Bartosz Golaszewski
  2019-10-01 13:23 ` [PATCH 2/3] phy: " Bartosz Golaszewski
@ 2019-10-01 13:23 ` Bartosz Golaszewski
  2019-10-02 12:26   ` Thierry Reding
  2019-10-01 13:38 ` [PATCH 0/3] tegra: " Thierry Reding
  3 siblings, 1 reply; 9+ messages in thread
From: Bartosz Golaszewski @ 2019-10-01 13:23 UTC (permalink / raw)
  To: Jens Axboe, Thierry Reding, Jonathan Hunter, JC Kuo,
	Kishon Vijay Abraham I, Mathias Nyman, Greg Kroah-Hartman
  Cc: linux-ide, linux-tegra, linux-kernel, linux-usb, Bartosz Golaszewski

From: Bartosz Golaszewski <bgolaszewski@baylibre.com>

Use the new regulator helper instead of a for loop.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
---
 drivers/usb/host/xhci-tegra.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/host/xhci-tegra.c b/drivers/usb/host/xhci-tegra.c
index 2ff7c911fbd0..a3c4c9287f9e 100644
--- a/drivers/usb/host/xhci-tegra.c
+++ b/drivers/usb/host/xhci-tegra.c
@@ -1128,8 +1128,9 @@ static int tegra_xusb_probe(struct platform_device *pdev)
 		goto put_powerdomains;
 	}
 
-	for (i = 0; i < tegra->soc->num_supplies; i++)
-		tegra->supplies[i].supply = tegra->soc->supply_names[i];
+	regulator_bulk_set_supply_names(tegra->supplies,
+					tegra->soc->supply_names,
+					tegra->soc->num_supplies);
 
 	err = devm_regulator_bulk_get(&pdev->dev, tegra->soc->num_supplies,
 				      tegra->supplies);
-- 
2.23.0


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

* Re: [PATCH 0/3] tegra: use regulator_bulk_set_supply_names()
  2019-10-01 13:23 [PATCH 0/3] tegra: use regulator_bulk_set_supply_names() Bartosz Golaszewski
                   ` (2 preceding siblings ...)
  2019-10-01 13:23 ` [PATCH 3/3] usb: host: xhci-tegra: " Bartosz Golaszewski
@ 2019-10-01 13:38 ` Thierry Reding
  2019-10-02  9:09   ` Bartosz Golaszewski
  3 siblings, 1 reply; 9+ messages in thread
From: Thierry Reding @ 2019-10-01 13:38 UTC (permalink / raw)
  To: Bartosz Golaszewski
  Cc: Jens Axboe, Jonathan Hunter, JC Kuo, Kishon Vijay Abraham I,
	Mathias Nyman, Greg Kroah-Hartman, linux-ide, linux-tegra,
	linux-kernel, linux-usb, Bartosz Golaszewski

[-- Attachment #1: Type: text/plain, Size: 854 bytes --]

On Tue, Oct 01, 2019 at 03:23:30PM +0200, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> 
> The regulator_bulk_set_supply_names() helper was merged upstream. Use it
> in a couple tegra drivers.
> 
> Bartosz Golaszewski (3):
>   ahci: tegra: use regulator_bulk_set_supply_names()
>   phy: tegra: use regulator_bulk_set_supply_names()
>   usb: host: xhci-tegra: use regulator_bulk_set_supply_names()
> 
>  drivers/ata/ahci_tegra.c      | 6 +++---
>  drivers/phy/tegra/xusb.c      | 6 +++---
>  drivers/usb/host/xhci-tegra.c | 5 +++--
>  3 files changed, 9 insertions(+), 8 deletions(-)

I really don't see the point here. You've got a positive diffstat here,
which means all that churn is without benefit.

Is there some subsequent work based on this that will actually improve
things?

Thierry

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH 0/3] tegra: use regulator_bulk_set_supply_names()
  2019-10-01 13:38 ` [PATCH 0/3] tegra: " Thierry Reding
@ 2019-10-02  9:09   ` Bartosz Golaszewski
  0 siblings, 0 replies; 9+ messages in thread
From: Bartosz Golaszewski @ 2019-10-02  9:09 UTC (permalink / raw)
  To: Thierry Reding
  Cc: Jens Axboe, Jonathan Hunter, JC Kuo, Kishon Vijay Abraham I,
	Mathias Nyman, Greg Kroah-Hartman, linux-ide, linux-tegra,
	Linux Kernel Mailing List, linux-usb, Bartosz Golaszewski

wt., 1 paź 2019 o 15:38 Thierry Reding <thierry.reding@gmail.com> napisał(a):
>
> On Tue, Oct 01, 2019 at 03:23:30PM +0200, Bartosz Golaszewski wrote:
> > From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> >
> > The regulator_bulk_set_supply_names() helper was merged upstream. Use it
> > in a couple tegra drivers.
> >
> > Bartosz Golaszewski (3):
> >   ahci: tegra: use regulator_bulk_set_supply_names()
> >   phy: tegra: use regulator_bulk_set_supply_names()
> >   usb: host: xhci-tegra: use regulator_bulk_set_supply_names()
> >
> >  drivers/ata/ahci_tegra.c      | 6 +++---
> >  drivers/phy/tegra/xusb.c      | 6 +++---
> >  drivers/usb/host/xhci-tegra.c | 5 +++--
> >  3 files changed, 9 insertions(+), 8 deletions(-)
>
> I really don't see the point here. You've got a positive diffstat here,
> which means all that churn is without benefit.
>

A hand-coded for loop is replaced with a single function call. The
actual generated code is smaller - I posted bloat-o-meter results last
time. The only reason the number of lines of code doesn't really
change is because the line is broken due to the function and argument
names being too long.

> Is there some subsequent work based on this that will actually improve
> things?

I'd argue that replacing a common operation that's reimplemented
explicitly by hand in many places with a helper function is already an
improvement. Consolidation is almost always good.

That being said, I like your idea about the regulator_get_from_names
helper, but it will take more time as we have to cover optional
multiple regulators as well. In other words: it's on my TODO list, but
in the meantime there's no harm in using this since Mark decided to
make it a part of the regulator API anyway.

Bart

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

* Re: [PATCH 1/3] ahci: tegra: use regulator_bulk_set_supply_names()
  2019-10-01 13:23 ` [PATCH 1/3] ahci: " Bartosz Golaszewski
@ 2019-10-02 12:26   ` Thierry Reding
  0 siblings, 0 replies; 9+ messages in thread
From: Thierry Reding @ 2019-10-02 12:26 UTC (permalink / raw)
  To: Bartosz Golaszewski
  Cc: Jens Axboe, Jonathan Hunter, JC Kuo, Kishon Vijay Abraham I,
	Mathias Nyman, Greg Kroah-Hartman, linux-ide, linux-tegra,
	linux-kernel, linux-usb, Bartosz Golaszewski

[-- Attachment #1: Type: text/plain, Size: 404 bytes --]

On Tue, Oct 01, 2019 at 03:23:31PM +0200, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> 
> Use the new regulator helper instead of a for loop.
> 
> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> ---
>  drivers/ata/ahci_tegra.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)

Acked-by: Thierry Reding <treding@nvidia.com>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH 2/3] phy: tegra: use regulator_bulk_set_supply_names()
  2019-10-01 13:23 ` [PATCH 2/3] phy: " Bartosz Golaszewski
@ 2019-10-02 12:26   ` Thierry Reding
  0 siblings, 0 replies; 9+ messages in thread
From: Thierry Reding @ 2019-10-02 12:26 UTC (permalink / raw)
  To: Bartosz Golaszewski
  Cc: Jens Axboe, Jonathan Hunter, JC Kuo, Kishon Vijay Abraham I,
	Mathias Nyman, Greg Kroah-Hartman, linux-ide, linux-tegra,
	linux-kernel, linux-usb, Bartosz Golaszewski

[-- Attachment #1: Type: text/plain, Size: 404 bytes --]

On Tue, Oct 01, 2019 at 03:23:32PM +0200, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> 
> Use the new regulator helper instead of a for loop.
> 
> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> ---
>  drivers/phy/tegra/xusb.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)

Acked-by: Thierry Reding <treding@nvidia.com>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH 3/3] usb: host: xhci-tegra: use regulator_bulk_set_supply_names()
  2019-10-01 13:23 ` [PATCH 3/3] usb: host: xhci-tegra: " Bartosz Golaszewski
@ 2019-10-02 12:26   ` Thierry Reding
  0 siblings, 0 replies; 9+ messages in thread
From: Thierry Reding @ 2019-10-02 12:26 UTC (permalink / raw)
  To: Bartosz Golaszewski
  Cc: Jens Axboe, Jonathan Hunter, JC Kuo, Kishon Vijay Abraham I,
	Mathias Nyman, Greg Kroah-Hartman, linux-ide, linux-tegra,
	linux-kernel, linux-usb, Bartosz Golaszewski

[-- Attachment #1: Type: text/plain, Size: 408 bytes --]

On Tue, Oct 01, 2019 at 03:23:33PM +0200, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> 
> Use the new regulator helper instead of a for loop.
> 
> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> ---
>  drivers/usb/host/xhci-tegra.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)

Acked-by: Thierry Reding <treding@nvidia.com>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

end of thread, other threads:[~2019-10-02 12:26 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-01 13:23 [PATCH 0/3] tegra: use regulator_bulk_set_supply_names() Bartosz Golaszewski
2019-10-01 13:23 ` [PATCH 1/3] ahci: " Bartosz Golaszewski
2019-10-02 12:26   ` Thierry Reding
2019-10-01 13:23 ` [PATCH 2/3] phy: " Bartosz Golaszewski
2019-10-02 12:26   ` Thierry Reding
2019-10-01 13:23 ` [PATCH 3/3] usb: host: xhci-tegra: " Bartosz Golaszewski
2019-10-02 12:26   ` Thierry Reding
2019-10-01 13:38 ` [PATCH 0/3] tegra: " Thierry Reding
2019-10-02  9:09   ` Bartosz Golaszewski

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).