From: Guenter Roeck <linux@roeck-us.net> To: Lars Povlsen <lars.povlsen@microchip.com> Cc: Jean Delvare <jdelvare@suse.com>, Microchip Linux Driver Support <UNGLinuxDriver@microchip.com>, linux-hwmon@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Zhang Rui <rui.zhang@intel.com>, Daniel Lezcano <daniel.lezcano@linaro.org>, Amit Kucheria <amitk@kernel.org> Subject: Re: [PATCH] hwmon: sparx5: Fix initial reading of temperature Date: Fri, 4 Sep 2020 07:08:43 -0700 [thread overview] Message-ID: <57a29906-7831-dbfa-8344-f464308fcbc8@roeck-us.net> (raw) In-Reply-To: <87v9guvt4o.fsf@soft-dev15.microsemi.net> On 9/4/20 1:33 AM, Lars Povlsen wrote: > > 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. > Sigh. I know that -EAGAIN is used, but it has its own problems - userspace is inclined to retry directly, causing hard loops. Ok, lets go with -EAGAIN then. Can't be helped. I'll apply your patch. Guenter > 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 >>> >
WARNING: multiple messages have this Message-ID (diff)
From: Guenter Roeck <linux@roeck-us.net> To: Lars Povlsen <lars.povlsen@microchip.com> 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>, 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 07:08:43 -0700 [thread overview] Message-ID: <57a29906-7831-dbfa-8344-f464308fcbc8@roeck-us.net> (raw) In-Reply-To: <87v9guvt4o.fsf@soft-dev15.microsemi.net> On 9/4/20 1:33 AM, Lars Povlsen wrote: > > 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. > Sigh. I know that -EAGAIN is used, but it has its own problems - userspace is inclined to retry directly, causing hard loops. Ok, lets go with -EAGAIN then. Can't be helped. I'll apply your patch. Guenter > 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 >>> > _______________________________________________ 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 14:10 UTC|newest] Thread overview: 10+ 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:47 ` Lars Povlsen 2020-09-03 13:52 ` Guenter Roeck 2020-09-03 13:52 ` Guenter Roeck 2020-09-04 8:33 ` Lars Povlsen 2020-09-04 8:33 ` Lars Povlsen 2020-09-04 14:08 ` Guenter Roeck [this message] 2020-09-04 14:08 ` Guenter Roeck 2020-09-04 16:40 ` 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=57a29906-7831-dbfa-8344-f464308fcbc8@roeck-us.net \ --to=linux@roeck-us.net \ --cc=UNGLinuxDriver@microchip.com \ --cc=amitk@kernel.org \ --cc=daniel.lezcano@linaro.org \ --cc=jdelvare@suse.com \ --cc=lars.povlsen@microchip.com \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-hwmon@vger.kernel.org \ --cc=linux-kernel@vger.kernel.org \ --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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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.