[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ac61decf-8ab7-46c1-83f0-d3f79f737bbf@roeck-us.net>
Date: Wed, 25 Oct 2023 12:41:00 -0700
From: Guenter Roeck <linux@...ck-us.net>
To: Aleksa Savic <savicaleksa83@...il.com>
Cc: linux-hwmon@...r.kernel.org, leonard.anderweit@...il.com,
Jack Doan <me@...kdoan.com>, Jean Delvare <jdelvare@...e.com>,
Jonathan Corbet <corbet@....net>, linux-doc@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/2] hwmon: (aquacomputer_d5next) Check if temp sensors
of legacy devices are connected
On Mon, Oct 16, 2023 at 10:35:57AM +0200, Aleksa Savic wrote:
> Return -ENODATA if a temp sensor of a legacy device
> does not contain a reading.
>
Why is the sensor instantiated in the first place ?
Returning -ENODATA for every reading is not desirable.
If this can happen, the is_visible function should check
for it and skip affected sensors.
Guenter
> Originally-from: Leonard Anderweit <leonard.anderweit@...il.com>
> Signed-off-by: Aleksa Savic <savicaleksa83@...il.com>
> ---
> drivers/hwmon/aquacomputer_d5next.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/hwmon/aquacomputer_d5next.c b/drivers/hwmon/aquacomputer_d5next.c
> index 023807859be7..46ff4fd4f87d 100644
> --- a/drivers/hwmon/aquacomputer_d5next.c
> +++ b/drivers/hwmon/aquacomputer_d5next.c
> @@ -926,7 +926,10 @@ static int aqc_legacy_read(struct aqc_data *priv)
> for (i = 0; i < priv->num_temp_sensors; i++) {
> sensor_value = get_unaligned_le16(priv->buffer + priv->temp_sensor_start_offset +
> i * AQC_SENSOR_SIZE);
> - priv->temp_input[i] = sensor_value * 10;
> + if (sensor_value == AQC_SENSOR_NA)
> + priv->temp_input[i] = -ENODATA;
> + else
> + priv->temp_input[i] = sensor_value * 10;
> }
>
> /* Special-case sensor readings */
Powered by blists - more mailing lists