All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* Regression in lm90 driver regarding GMT g781
@ 2024-04-20 16:34 Aleksander Mazur
  2024-04-20 18:14 ` Guenter Roeck
  0 siblings, 1 reply; 5+ messages in thread
From: Aleksander Mazur @ 2024-04-20 16:34 UTC (permalink / raw
  To: linux-hwmon

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?

-- 
Aleksander Mazur

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Regression in lm90 driver regarding GMT g781
  2024-04-20 16:34 Regression in lm90 driver regarding GMT g781 Aleksander Mazur
@ 2024-04-20 18:14 ` Guenter Roeck
  2024-04-20 20:38   ` Aleksander Mazur
  0 siblings, 1 reply; 5+ messages in thread
From: Guenter Roeck @ 2024-04-20 18:14 UTC (permalink / raw
  To: Aleksander Mazur; +Cc: linux-hwmon

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Regression in lm90 driver regarding GMT g781
  2024-04-20 18:14 ` Guenter Roeck
@ 2024-04-20 20:38   ` Aleksander Mazur
  2024-04-20 21:20     ` Guenter Roeck
  0 siblings, 1 reply; 5+ messages in thread
From: Aleksander Mazur @ 2024-04-20 20:38 UTC (permalink / raw
  To: Guenter Roeck, Matti Vaittinen; +Cc: linux-hwmon

Dnia 2024-04-20, o godz. 11:14:06
Guenter Roeck <linux@roeck-us.net> 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).

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

-- 
Aleksander Mazur

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Regression in lm90 driver regarding GMT g781
  2024-04-20 20:38   ` Aleksander Mazur
@ 2024-04-20 21:20     ` Guenter Roeck
  2024-04-22  5:52       ` Matti Vaittinen
  0 siblings, 1 reply; 5+ messages in thread
From: Guenter Roeck @ 2024-04-20 21:20 UTC (permalink / raw
  To: Aleksander Mazur; +Cc: Matti Vaittinen, linux-hwmon

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@roeck-us.net> 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. 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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Regression in lm90 driver regarding GMT g781
  2024-04-20 21:20     ` Guenter Roeck
@ 2024-04-22  5:52       ` Matti Vaittinen
  0 siblings, 0 replies; 5+ messages in thread
From: Matti Vaittinen @ 2024-04-22  5:52 UTC (permalink / raw
  To: Guenter Roeck, Aleksander Mazur; +Cc: linux-hwmon, Mark Brown

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@roeck-us.net> 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! ~~


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-04-22  5:52 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-20 16:34 Regression in lm90 driver regarding GMT g781 Aleksander Mazur
2024-04-20 18:14 ` Guenter Roeck
2024-04-20 20:38   ` Aleksander Mazur
2024-04-20 21:20     ` Guenter Roeck
2024-04-22  5:52       ` Matti Vaittinen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.