Linux-Hwmon Archive mirror
 help / color / mirror / Atom feed
From: Matti Vaittinen <mazziesaccount@gmail.com>
To: Guenter Roeck <linux@roeck-us.net>, Aleksander Mazur <deweloper@wp.pl>
Cc: linux-hwmon@vger.kernel.org, Mark Brown <broonie@kernel.org>
Subject: Re: Regression in lm90 driver regarding GMT g781
Date: Mon, 22 Apr 2024 08:52:04 +0300	[thread overview]
Message-ID: <2cc46844-75af-4da3-aa56-3f69a5ed3dfb@gmail.com> (raw)
In-Reply-To: <04831e1c-9957-4750-b438-9d5395b8fa45@roeck-us.net>

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! ~~


      reply	other threads:[~2024-04-22  5:52 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2cc46844-75af-4da3-aa56-3f69a5ed3dfb@gmail.com \
    --to=mazziesaccount@gmail.com \
    --cc=broonie@kernel.org \
    --cc=deweloper@wp.pl \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux@roeck-us.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).