From: Guenter Roeck <linux@roeck-us.net>
To: Dmitry Osipenko <digetx@gmail.com>,
Hardware Monitoring <linux-hwmon@vger.kernel.org>
Cc: Jean Delvare <jdelvare@suse.com>, Jon Hunter <jonathanh@nvidia.com>
Subject: Re: [PATCH] hwmon: Handle failure to register sensor with thermal zone correctly
Date: Mon, 21 Feb 2022 10:23:49 -0800 [thread overview]
Message-ID: <7b06ddaf-d7dc-46ef-6fd0-a026f464f1bf@roeck-us.net> (raw)
In-Reply-To: <af0576cb-96d6-266a-3fc3-5670d9cffd8d@gmail.com>
On 2/21/22 09:59, Dmitry Osipenko wrote:
> 21.02.2022 20:12, Guenter Roeck пишет:
>> On 2/21/22 08:56, Dmitry Osipenko wrote:
>>> 21.02.2022 19:44, Guenter Roeck пишет:
>>>> diff --git a/drivers/hwmon/hwmon.c b/drivers/hwmon/hwmon.c
>>>> index 3501a3ead4ba..4bfe3791a5ba 100644
>>>> --- a/drivers/hwmon/hwmon.c
>>>> +++ b/drivers/hwmon/hwmon.c
>>>> @@ -214,12 +214,14 @@ static int hwmon_thermal_add_sensor(struct
>>>> device *dev, int index)
>>>> tzd = devm_thermal_zone_of_sensor_register(dev, index, tdata,
>>>> &hwmon_thermal_ops);
>>>> - /*
>>>> - * If CONFIG_THERMAL_OF is disabled, this returns -ENODEV,
>>>> - * so ignore that error but forward any other error.
>>>> - */
>>>> - if (IS_ERR(tzd) && (PTR_ERR(tzd) != -ENODEV))
>>>> - return PTR_ERR(tzd);
>>>> + if (IS_ERR(tzd)) {
>>>> + if (PTR_ERR(tzd) != -ENODEV)
>>>> + return PTR_ERR(tzd);
>>>> + dev_warn(dev, "Failed to register temp%d_input with thermal
>>>> zone\n",
>>>> + index + 1);
>>>
>>> Do we really need this warning? I suppose it should be okay if sensor
>>> isn't attached to any device in a device-tree and just reports
>>> temperature.
>>
>> I'd rather leave it there for the time being. It will only affect
>> devicetree
>> systems (turns out there is already a check for of_node elsewhere). Thermal
>> zone specification is not always easy and there may be a mismatch between
>> what is reported by the driver and what the user (programmer) expects to
>> see (which I think is what happens here). I don't want to silently
>> ignore such problems without any notification.
>>
>> We could make it dev_notice and/or change the message (instead of
>> "Failed to
>> ..." just say "temp%d_input not registered with thermal zone" , maybe ?).
>
> I'd change it to:
>
> dev_info(dev, "temp%d_input not attached to any thermal zone\n", index + 1);
>
Makes sense. I just sent v2 with that change.
> I'd also add an info message to print out to which tzd attachment happened.
Oh, I don't know. Kernel logs are already way too noisy. Either case that would
not be a bug fix, so such a change should not be part of this patch.
Thanks,
Guenter
prev parent reply other threads:[~2022-02-21 18:27 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-21 16:44 [PATCH] hwmon: Handle failure to register sensor with thermal zone correctly Guenter Roeck
2022-02-21 16:56 ` Dmitry Osipenko
2022-02-21 17:12 ` Guenter Roeck
2022-02-21 17:59 ` Dmitry Osipenko
2022-02-21 18:23 ` Guenter Roeck [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=7b06ddaf-d7dc-46ef-6fd0-a026f464f1bf@roeck-us.net \
--to=linux@roeck-us.net \
--cc=digetx@gmail.com \
--cc=jdelvare@suse.com \
--cc=jonathanh@nvidia.com \
--cc=linux-hwmon@vger.kernel.org \
/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