Skip to contentSkip to conversation

Regression in lm90 driver regarding GMT g781

DISCUSSION Aleksander Mazur 3 participants 5 messages Apr 20, 2024 – Apr 22, 2024 Hardware monitoring

lore
Share & tools
lore
#0 lore raw

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:

Quoted 1 line

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?

Signature · 1 line
Aleksander Mazur
maintainer
#1 lore raw
Quoted 7 lines · Aleksander Mazur

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:

Quoted 8 lines
Quoted 1 line

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

#2 lore raw

Dnia 2024-04-20, o godz. 11:14:06
Guenter Roeck <[email protected]> napisał(a):

Quoted 13 lines · Aleksander Mazur
Quoted 12 lines

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:

Quoted 1 line

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.

Quoted 7 lines
Quoted 3 lines

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).

Shouldn't devm_regulator_get_enable*() stubs return success instead of -ENODEV?

Signature · 1 line
Aleksander Mazur
maintainer
#3 lore raw
Quoted 20 lines · Aleksander Mazur

Dnia 2024-04-20, o godz. 11:14:06
Guenter Roeck <[email protected]> napisał(a):

Quoted 17 lines · Aleksander Mazur
Quoted 15 lines

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:

Quoted 1 line

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?

Quoted 6 lines
Quoted 3 lines

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()").

Quoted 2 lines

Shouldn't devm_regulator_get_enable*() stubs return success instead of -ENODEV?

One might think so, but apparently the author thought otherwise. 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

#4 lore raw
Quoted 32 lines · Guenter Roeck
Quoted 20 lines · Aleksander Mazur

Dnia 2024-04-20, o godz. 11:14:06
Guenter Roeck <[email protected]> napisał(a):

Quoted 17 lines · Aleksander Mazur
Quoted 15 lines

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:

Quoted 1 line

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?

Quoted 6 lines
Quoted 3 lines

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()").

Quoted 4 lines
Quoted 2 lines

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

Quoted 12 lines

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

Signature · 5 lines
Matti Vaittinen
Linux kernel developer at ROHM Semiconductors
Oulu Finland

~~ When things go utterly wrong vim users can always type :help! ~~