On 4/21/24 00:20, Guenter Roeck wrote:
On Sat, Apr 20, 2024 at 10:38:24PM +0200, Aleksander Mazur wrote:
Dnia 2024-04-20, o godz. 11:14:06
Guenter Roeck <linux@xxxxxxxxxxxx> napisał(a):
On Sat, Apr 20, 2024 at 06:34:27PM +0200, Aleksander Mazur wrote:
Hello,
I have a Wyse C00X thin client which is apparently equipped with GMT g781.
It is (or used to be) supported by lm90 driver. (I have a log from 2020
where it was simply working fine; it was kernel version 5.6.0 then.)
Now, with 6.8.7, I get following error:
lm90 0-004c: Failed to enable regulator: -ENODEV
However, when I just turned this message into a warning and let the driver
continue, it seems to work fine, providing temp1 and temp2 as previously.
Do you have an idea what could cause such a regression, and if this change
(I mean: simply not returning error from devm_regulator_get_enable) is safe?
Do you have CONFIG_REGULATOR enabled in your system ?
Guenter
No, it's disabled (and it was disabled in 5.6.0 as well).
I thought so. It works in v6.1 and earlier kernels because
devm_regulator_get() returns NULL if CONFIG_REGULATOR=n.
The driver used that function prior to commit ad804a4d82fc
("hwmon: (lm90) simplify using devm_regulator_get_enable()").
Shouldn't devm_regulator_get_enable*() stubs return success instead of -ENODEV?
One might think so, but apparently the author thought otherwise.
Apparently the author has not known what he is doing :)
I have a faint memory that I chose to return an error because some of
the other stubs did that. Looking at the header, it seems the variants
of *_regulator_get_optional() and *_regulator_get_exclusive() return an
error, which may be where I picked the return value.
Now, thinking of the use-cases and the comment in the stub of the
regulator_get() - I think we should just return success from the stub.
I'll send a patch and let's see what Mark says.
Sorry for the hassle.
-- Matti
It looks
like the function can not be used for drivers which have to work with
CONFIG_REGULATOR=n. The only option I can see is to revert commit
ad804a4d82fc because that commit doesn't just simplify the code but also
make regulator support mandatory. Matti, do you have a better idea ?
Other hwmon drivers are affected as well, so we'll need a common solution.
Aleksander, for your use case, you can just drop the offending code
until the fix (or revert) makes it upstream. Sorry for the trouble.
Thanks,
Guenter
--
Matti Vaittinen
Linux kernel developer at ROHM Semiconductors
Oulu Finland
~~ When things go utterly wrong vim users can always type :help! ~~