diff mbox

[2/5] regulator: fan53555: set regulator name from constraints name

Message ID 1410722585-13393-3-git-send-email-heiko@sntech.de (mailing list archive)
State New, archived
Headers show

Commit Message

Heiko Stübner Sept. 14, 2014, 7:23 p.m. UTC
There is a high potential of more than one of those regulators existing
on a board, so name the regulator according to the name provided in the
initdata instead of statically.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
---
 drivers/regulator/fan53555.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Comments

Mark Brown Sept. 15, 2014, 4:59 p.m. UTC | #1
On Sun, Sep 14, 2014 at 09:23:02PM +0200, Heiko Stuebner wrote:
> There is a high potential of more than one of those regulators existing
> on a board, so name the regulator according to the name provided in the
> initdata instead of statically.

No, this is pointless and broken.  The core will already use the
board-specific name to identify the regulator in diagnostics and so on,
the name being supplied here is supposed to describe the regulator
within the device.
Heiko Stübner Sept. 15, 2014, 10:08 p.m. UTC | #2
Am Montag, 15. September 2014, 09:59:23 schrieb Mark Brown:
> On Sun, Sep 14, 2014 at 09:23:02PM +0200, Heiko Stuebner wrote:
> > There is a high potential of more than one of those regulators existing
> > on a board, so name the regulator according to the name provided in the
> > initdata instead of statically.
> 
> No, this is pointless and broken.  The core will already use the
> board-specific name to identify the regulator in diagnostics and so on,
> the name being supplied here is supposed to describe the regulator
> within the device.

ok, sorry for the mess-up

I've just tested, patches 3-5 apply and work correctly without this one, so do 
you want to apply them like this or a resend of last 3?


Heiko
Mark Brown Sept. 15, 2014, 10:36 p.m. UTC | #3
On Tue, Sep 16, 2014 at 12:08:12AM +0200, Heiko Stübner wrote:

> I've just tested, patches 3-5 apply and work correctly without this one, so do 
> you want to apply them like this or a resend of last 3?

No, please implement the changes I asked for in the DT stuff.
diff mbox

Patch

diff --git a/drivers/regulator/fan53555.c b/drivers/regulator/fan53555.c
index c912ba7..d143790 100644
--- a/drivers/regulator/fan53555.c
+++ b/drivers/regulator/fan53555.c
@@ -206,7 +206,12 @@  static int fan53555_regulator_register(struct fan53555_device_info *di,
 {
 	struct regulator_desc *rdesc = &di->desc;
 
-	rdesc->name = "fan53555-reg";
+	rdesc->name = devm_kstrdup(di->dev,
+				   di->regulator->constraints.name,
+				   GFP_KERNEL);
+	if (!rdesc->name)
+		return -ENOMEM;
+
 	rdesc->supply_name = "vin";
 	rdesc->ops = &fan53555_regulator_ops;
 	rdesc->type = REGULATOR_VOLTAGE;