From: Guenter Roeck <linux@roeck-us.net>
To: Alexander Amelkin <a.amelkin@yadro.com>, linux-hwmon@vger.kernel.org
Cc: openbmc@lists.ozlabs.org,
Alexander Soldatov <a.soldatov@yadro.com>,
"Edward A . James" <eajames@us.ibm.com>,
Joel Stanley <joel@jms.id.au>
Subject: Re: [PATCH 1/1] hwmon (occ): Add temp sensor value check
Date: Wed, 17 Apr 2019 06:03:57 -0700 [thread overview]
Message-ID: <87cd75da-8d15-4b1f-47a2-cb55ed214df9@roeck-us.net> (raw)
In-Reply-To: <1555500396-11976-1-git-send-email-a.amelkin@yadro.com>
On 4/17/19 4:26 AM, Alexander Amelkin wrote:
> From: Alexander Soldatov <a.soldatov@yadro.com>
>
> The occ driver supports two formats for the temp sensor value.
>
> The OCC firmware for P8 supports only the first format, for which
> no range checking or error processing is performed in the driver.
> Inspecting the OCC sources for P8 reveals that OCC may send
> a special value 0xFFFF to indicate that a sensor read timeout
> has occured, see
>
occurred
> https://github.com/open-power/occ/blob/master_p8/src/occ/cmdh/cmdh_fsp_cmds.c#L395
>
> That situation wasn't handled in the driver. This patch adds invalid
> temp value check for the sensor data format 1 and handles it the same
> way as it is done for the format 2, where EREMOTEIO is reported for
> this case.
>
ETIMEDOUT ? Though that is really a corner case, so I guess both are fine.
> Signed-off-by: Alexander Soldatov <a.soldatov@yadro.com>
> Signed-off-by: Alexander Amelkin <a.amelkin@yadro.com>
> Reviewed-by: Alexander Amelkin <a.amelkin@yadro.com>
> Cc: Edward A. James <eajames@us.ibm.com>
> Cc: Joel Stanley <joel@jms.id.au>
> ---
> drivers/hwmon/occ/common.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/hwmon/occ/common.c b/drivers/hwmon/occ/common.c
> index 4679acb..825631c 100644
> --- a/drivers/hwmon/occ/common.c
> +++ b/drivers/hwmon/occ/common.c
> @@ -235,6 +235,10 @@ static ssize_t occ_show_temp_1(struct device *dev,
> val = get_unaligned_be16(&temp->sensor_id);
> break;
> case 1:
> + /* If a sensor timed out long enough,
"timed out" is sufficient. "timed out long enough" is difficult to understand.
> + OCC returns 0xFFFF for that sensor.*/
/*
* This is how multi-line comments look like
*/
Please run checkpatch on your patches.
Thanks,
Guenter
> + if (temp->value == 0xFFFF)
> + return -EREMOTEIO;
> val = get_unaligned_be16(&temp->value) * 1000;
> break;
> default:
>
next prev parent reply other threads:[~2019-04-17 13:04 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-17 11:26 [PATCH 1/1] hwmon (occ): Add temp sensor value check Alexander Amelkin
2019-04-17 13:03 ` Guenter Roeck [this message]
2019-04-17 17:46 ` Alexander Amelkin
2019-04-17 18:03 ` [PATCH v2 " Alexander Amelkin
2019-04-17 18:35 ` Eddie James
2019-04-17 19:36 ` 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=87cd75da-8d15-4b1f-47a2-cb55ed214df9@roeck-us.net \
--to=linux@roeck-us.net \
--cc=a.amelkin@yadro.com \
--cc=a.soldatov@yadro.com \
--cc=eajames@us.ibm.com \
--cc=joel@jms.id.au \
--cc=linux-hwmon@vger.kernel.org \
--cc=openbmc@lists.ozlabs.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;
as well as URLs for NNTP newsgroup(s).