From: Lars Povlsen <lars.povlsen@microchip.com>
To: Guenter Roeck <linux@roeck-us.net>
Cc: linux-hwmon@vger.kernel.org, Jean Delvare <jdelvare@suse.com>,
Daniel Lezcano <daniel.lezcano@linaro.org>,
linux-kernel@vger.kernel.org,
Microchip Linux Driver Support <UNGLinuxDriver@microchip.com>,
Lars Povlsen <lars.povlsen@microchip.com>,
Amit Kucheria <amitk@kernel.org>, Zhang Rui <rui.zhang@intel.com>,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] hwmon: sparx5: Fix initial reading of temperature
Date: Fri, 4 Sep 2020 10:33:11 +0200 [thread overview]
Message-ID: <87v9guvt4o.fsf@soft-dev15.microsemi.net> (raw)
In-Reply-To: <8ca270c9-5561-3176-61cf-7a9fbee10d1f@roeck-us.net>
Guenter Roeck writes:
> On 9/3/20 6:47 AM, Lars Povlsen wrote:
>> If the temperature is read before the internal calibration is
>> completed, the driver returns -EIO. Instead it should return -EAGAIN
>> to encourage repeating the operation.
>>
>> Signed-off-by: Lars Povlsen <lars.povlsen@microchip.com>
>> ---
>> drivers/hwmon/sparx5-temp.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/hwmon/sparx5-temp.c b/drivers/hwmon/sparx5-temp.c
>> index 1a2b1026b026..98be48e3a22a 100644
>> --- a/drivers/hwmon/sparx5-temp.c
>> +++ b/drivers/hwmon/sparx5-temp.c
>> @@ -56,7 +56,7 @@ static int s5_read(struct device *dev, enum hwmon_sensor_types type,
>> case hwmon_temp_input:
>> stat = readl_relaxed(hwmon->base + TEMP_STAT);
>> if (!(stat & TEMP_STAT_VALID))
>> - return -EIO;
>> + return -EAGAIN;
>
> The problem is that this may result in a hard loop and effectively hang the system,
> or at least the calling process. It may be better to return -ENODATA in this situation.
>
Guenther,
Thank you for your response.
The motivation for the patch was as I tried to use thermal support to
control a fan, and I noticed an initial quip from
thermal_core.c:update_temperature() - it will throw a dev_warn() for
anything else than an "EAGAIN". The EAGAIN also seems to be used by
several other hwmon drivers in similar situations.
The bottom line is that I would like to get rid of the warning
message. Changing the error code to ENODATA does not fix what I am
trying to accomplish.
Do you have any suggestions on how to achieve the objective?
Sincerely,
---Lars
> Guenter
>
>> value = stat & TEMP_STAT_TEMP;
>> /*
>> * From register documentation:
>> --
>> 2.27.0
>>
--
Lars Povlsen,
Microchip
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2020-09-04 8:34 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-03 13:47 [PATCH] hwmon: sparx5: Fix initial reading of temperature Lars Povlsen
2020-09-03 13:52 ` Guenter Roeck
2020-09-04 8:33 ` Lars Povlsen [this message]
2020-09-04 14:08 ` Guenter Roeck
2020-09-04 16:40 ` 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=87v9guvt4o.fsf@soft-dev15.microsemi.net \
--to=lars.povlsen@microchip.com \
--cc=UNGLinuxDriver@microchip.com \
--cc=amitk@kernel.org \
--cc=daniel.lezcano@linaro.org \
--cc=jdelvare@suse.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=rui.zhang@intel.com \
/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 NNTP newsgroup(s).