Re: [PATCH 0/3] tegra: use regulator_bulk_set_supply_names()
From: Bartosz Golaszewski
Date: Wed Oct 02 2019 - 05:09:39 EST
wt., 1 paÅ 2019 o 15:38 Thierry Reding <thierry.reding@xxxxxxxxx> napisaÅ(a):
>
> On Tue, Oct 01, 2019 at 03:23:30PM +0200, Bartosz Golaszewski wrote:
> > From: Bartosz Golaszewski <bgolaszewski@xxxxxxxxxxxx>
> >
> > 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