tegra: use regulator_bulk_set_supply_names()
Subsystems (6)
cover tegra: use regulator_bulk_set_supply_names()
From: Bartosz Golaszewski <[email protected]>
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(-)
Signature · 1 line
2.23.0
PATCH 1/3 ahci: tegra: use regulator_bulk_set_supply_names()
From: Bartosz Golaszewski <[email protected]>
Use the new regulator helper instead of a for loop.
--- drivers/ata/ahci_tegra.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/ata/ahci_tegra.c +3 -3
@@ -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,
Signature · 1 line
2.23.0
PATCH 2/3 phy: tegra: use regulator_bulk_set_supply_names()
In reply to Bartosz GolaszewskiFrom: Bartosz Golaszewski <[email protected]>
Use the new regulator helper instead of a for loop.
--- drivers/phy/tegra/xusb.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/phy/tegra/xusb.c +3 -3
@@ -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);
Signature · 1 line
2.23.0
PATCH 3/3 usb: host: xhci-tegra: use regulator_bulk_set_supply_names()
In reply to Bartosz GolaszewskiFrom: Bartosz Golaszewski <[email protected]>
Use the new regulator helper instead of a for loop.
--- drivers/usb/host/xhci-tegra.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/usb/host/xhci-tegra.c +3 -2
@@ -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);
Signature · 1 line
2.23.0
Quoted 10 lines · Bartosz Golaszewski
From: Bartosz Golaszewski <[email protected]>
The
regulator_bulk_set_supply_names()helper was merged upstream. Use it in a couple tegra drivers.Bartosz Golaszewski (3):
ahci: tegra: useregulator_bulk_set_supply_names()
phy: tegra: useregulator_bulk_set_supply_names()
usb: host: xhci-tegra: useregulator_bulk_set_supply_names()
Quoted 4 lines
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
wt., 1 paź 2019 o 15:38 Thierry Reding <[email protected]> napisał(a):
Quoted 12 lines · Bartosz Golaszewski
Quoted 10 lines
From: Bartosz Golaszewski <[email protected]>
The
regulator_bulk_set_supply_names()helper was merged upstream. Use it in a couple tegra drivers.Bartosz Golaszewski (3):
ahci: tegra: useregulator_bulk_set_supply_names()
phy: tegra: useregulator_bulk_set_supply_names()
usb: host: xhci-tegra: useregulator_bulk_set_supply_names()
Quoted 8 lines
Quoted 4 lines
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.
Quoted 2 lines
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
Re: [PATCH 1/3] ahci: tegra: use regulator_bulk_set_supply_names()
In reply to Bartosz GolaszewskiQuoted 8 lines · Bartosz Golaszewski
From: Bartosz Golaszewski <[email protected]>
Use the new regulator helper instead of a for loop.
Signed-off-by Bartosz Golaszewski <[email protected]>--- drivers/ata/ahci_tegra.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
Re: [PATCH 2/3] phy: tegra: use regulator_bulk_set_supply_names()
In reply to Bartosz GolaszewskiQuoted 8 lines · Bartosz Golaszewski
From: Bartosz Golaszewski <[email protected]>
Use the new regulator helper instead of a for loop.
Signed-off-by Bartosz Golaszewski <[email protected]>--- drivers/phy/tegra/xusb.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
Re: [PATCH 3/3] usb: host: xhci-tegra: use regulator_bulk_set_supply_names()
In reply to Bartosz GolaszewskiQuoted 8 lines · Bartosz Golaszewski
From: Bartosz Golaszewski <[email protected]>
Use the new regulator helper instead of a for loop.
Signed-off-by Bartosz Golaszewski <[email protected]>--- drivers/usb/host/xhci-tegra.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)