From: Dmitry Osipenko <digetx@gmail.com>
To: Guenter Roeck <linux@roeck-us.net>,
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 20:59:18 +0300 [thread overview]
Message-ID: <af0576cb-96d6-266a-3fc3-5670d9cffd8d@gmail.com> (raw)
In-Reply-To: <e8c4f814-e017-26bf-501c-6ed1da0963e9@roeck-us.net>
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);
I'd also add an info message to print out to which tzd attachment happened.
next prev parent reply other threads:[~2022-02-21 18:10 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 [this message]
2022-02-21 18:23 ` Guenter Roeck
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=af0576cb-96d6-266a-3fc3-5670d9cffd8d@gmail.com \
--to=digetx@gmail.com \
--cc=jdelvare@suse.com \
--cc=jonathanh@nvidia.com \
--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