Re: [PATCH] sdhci: Forward EPROBE_DEFER on vmmc and vqmmc regulators

From: Mike Looijmans
Date: Mon Apr 07 2014 - 09:11:35 EST


ïOn 04/07/2014 02:51 PM, Arnd Bergmann wrote:
On Monday 07 April 2014 14:32:20 Mike Looijmans wrote:
On 04/07/2014 02:25 PM, Arnd Bergmann wrote:

Judging from the kernel output, regulator_get_optional returns -ENODEV if the
supply wasn't found.

Maybe the API is confusing (or wrong?) here.

If you change the code as per your suggestion, the SD will not work unless you
explicitly assign supplies. And judging from what I've seen so far, I am the
first to have ever attached a power supply to this controller...

It's certainly not very "optional" if it returns an error here.

You could try to special-case the "-ENODEV" return here, but I think it
would be better to change the regulator interface to be less confusing.


Judging from the code:
http://lxr.free-electrons.com/source/drivers/regulator/core.c#L1476

The behaviour is supposed to be something like "regulator_get_optional" will return an error if the supply wasn't found, but "regulator_get" will create a dummy supply for you instead of returning an error code.

So "regulator_get_optional" means: "I handle my own problems, just gimme the bad news". But "regulator_get" appears to imply: "I will shoot the messenger, so do whatever you can to get me something to say 'enable' to".

In this case, the IS_NULL part is wrong indeed, it will never return NULL.

I still think it's unrelated to my patch and should be submitted separately.

Mike.


Met vriendelijke groet / kind regards,

Mike Looijmans

TOPIC Embedded Systems
Eindhovenseweg 32-C, NL-5683 KH Best
Postbus 440, NL-5680 AK Best
Telefoon: (+31) (0) 499 33 69 79
Telefax: (+31) (0) 499 33 69 70
E-mail: mike.looijmans@xxxxxxxx
Website: www.topic.nl

Please consider the environment before printing this e-mail

Visit us at the Hannover Messe 7 - 11 April 2014 - Hall 002/D10 (Dutch Pavillion)
http://www.hannovermesse.de/exhibitor/topic-embedded-products/V229623

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/