Skip to contentSkip to conversation

regulator: tps6586x: Having slew rate settings for other than SM0/1 is not fatal

PATCH In review Axel Lin 3 participants 7 messages Feb 16, 2013 – Feb 20, 2013 Voltage and current regulator framework

lore
Share & tools
lore

Axel Lin

author
#0 lore raw

PATCH 1/1 regulator: tps6586x: Having slew rate settings for other than SM0/1 is not fatal

Ignore the setting and show "Only SM0/SM1 can set slew rate" warning is enough, then we can return 0 instead of -EINVAL in tps6586x_regulator_set_slew_rate().

Otherwise, probe() fails.

---
 drivers/regulator/tps6586x-regulator.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/regulator/tps6586x-regulator.c +1 -1
index e68382d..51da3f9 100644
@@ -246,7 +246,7 @@ static int tps6586x_regulator_set_slew_rate(struct platform_device *pdev,
 		break;
 	default:
 		dev_warn(&pdev->dev, "Only SM0/SM1 can set slew rate\n");
-		return -EINVAL;
+		return 0;
 	}
 
 	return tps6586x_write(parent, reg,
Signature · 1 line
1.7.9.5
#1 lore raw
Quoted 4 lines · Axel Lin

Ignore the setting and show "Only SM0/SM1 can set slew rate" warning is enough, then we can return 0 instead of -EINVAL in tps6586x_regulator_set_slew_rate().

Otherwise, probe() fails.

Why does probe() fail; what is trying to set a slew rate on a regulator that doesn't support it? At least a few days ago in linux-next, this patch wasn't needed AFAIK. Is the problem something new?

#2 lore raw
Quoted 10 lines · Stephen Warren
Quoted 4 lines · Axel Lin

Ignore the setting and show "Only SM0/SM1 can set slew rate" warning is enough, then we can return 0 instead of -EINVAL in tps6586x_regulator_set_slew_rate().

Otherwise, probe() fails.

Why does probe() fail; what is trying to set a slew rate on a regulator that doesn't support it? At least a few days ago in linux-next, this patch wasn't needed AFAIK. Is the problem something new?

I rather suspect Axel is doing this based on code inspection and review rather than testing (either that or he has an enormous lab somewhere full of all sorts of hardware!) - what he's saying is that the error handling here seems excessive.

#3 lore raw
Quoted 9 lines · Mark Brown
Quoted 7 lines · Stephen Warren
Quoted 5 lines · Axel Lin

Ignore the setting and show "Only SM0/SM1 can set slew rate" warning is enough, then we can return 0 instead of -EINVAL in tps6586x_regulator_set_slew_rate().

Otherwise, probe() fails.

Quoted 8 lines
Quoted 4 lines

Why does probe() fail; what is trying to set a slew rate on a regulator that doesn't support it? At least a few days ago in linux-next, this patch wasn't needed AFAIK. Is the problem something new?

I rather suspect Axel is doing this based on code inspection and review rather than testing (either that or he has an enormous lab somewhere full of all sorts of hardware!)

Makes sense.

Quoted 2 lines

- what he's saying is that the error handling here seems excessive.

Why shouldn't the driver return an error if it's asked to do something that's impossible?

#4 lore raw
Quoted 7 lines · Stephen Warren
Quoted 2 lines · Mark Brown

- what he's saying is that the error handling here seems excessive.

Why shouldn't the driver return an error if it's asked to do something that's impossible?

I'm having a hard time caring too much to be honest. On the one hand it means that if that feature gets added for some reason new DTs won't work on older kernels, on the other hand perhaps the hardware doesn't support doing this at all.

author
#5 lore raw
In reply to Stephen Warren

2013/2/20 Stephen Warren <[email protected]>:

Quoted 10 lines · Axel Lin
Quoted 4 lines

Ignore the setting and show "Only SM0/SM1 can set slew rate" warning is enough, then we can return 0 instead of -EINVAL in tps6586x_regulator_set_slew_rate().

Otherwise, probe() fails.

Why does probe() fail; what is trying to set a slew rate on a regulator that doesn't support it? At least a few days ago in linux-next, this patch wasn't needed AFAIK. Is the problem something new?

Oh, sorry for my poor Engilish.
I mean probe fails because of having slew rate settings for other than SM0/1 seems not necessary.

In tps6586x_regulator_set_slew_rate() it uses dev_warn rather than dev_err for the default case.
We can either using "dev_warn with return 0" or use "dev_err with return -EINVAL"
in tps6586x_regulator_set_slew_rate().

It looks to me that having slew rate settings for other than SM0/1 should be ok if it actually is harmless ( because we can just ignore the setting ).

BTW, I read the code but I don't have this hardware.

Axel

#6 lore raw
Quoted 16 lines · Axel Lin

2013/2/20 Stephen Warren <[email protected]>:

Quoted 10 lines · Axel Lin
Quoted 4 lines

Ignore the setting and show "Only SM0/SM1 can set slew rate" warning is enough, then we can return 0 instead of -EINVAL in tps6586x_regulator_set_slew_rate().

Otherwise, probe() fails.

Why does probe() fail; what is trying to set a slew rate on a regulator that doesn't support it? At least a few days ago in linux-next, this patch wasn't needed AFAIK. Is the problem something new?

Oh, sorry for my poor Engilish.
I mean probe fails because of having slew rate settings for other than SM0/1 seems not necessary.

Quoted 5 lines

In tps6586x_regulator_set_slew_rate() it uses dev_warn rather than dev_err for the default case.
We can either using "dev_warn with return 0" or use "dev_err with return -EINVAL"
in tps6586x_regulator_set_slew_rate().

Oh right, I understand. s/dev_warn/dev_err/ seems more appropriate to me, I think.