public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Aleksa Savic <savicaleksa83@gmail.com>
To: linux-hwmon@vger.kernel.org
Cc: leonard.anderweit@gmail.com,
	Aleksa Savic <savicaleksa83@gmail.com>,
	Jack Doan <me@jackdoan.com>, Jean Delvare <jdelvare@suse.com>,
	Guenter Roeck <linux@roeck-us.net>,
	Jonathan Corbet <corbet@lwn.net>,
	linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 1/2] hwmon: (aquacomputer_d5next) Check if temp sensors of legacy devices are connected
Date: Mon, 16 Oct 2023 10:35:57 +0200	[thread overview]
Message-ID: <20231016083559.139341-2-savicaleksa83@gmail.com> (raw)
In-Reply-To: <20231016083559.139341-1-savicaleksa83@gmail.com>

Return -ENODATA if a temp sensor of a legacy device
does not contain a reading.

Originally-from: Leonard Anderweit <leonard.anderweit@gmail.com>
Signed-off-by: Aleksa Savic <savicaleksa83@gmail.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 */
-- 
2.41.0


  reply	other threads:[~2023-10-16  8:38 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-16  8:35 [PATCH 0/2] hwmon: (aquacomputer_d5next) Add support for Aquacomputer High Flow USB and MPS Flow Aleksa Savic
2023-10-16  8:35 ` Aleksa Savic [this message]
2023-10-25 19:41   ` [PATCH 1/2] hwmon: (aquacomputer_d5next) Check if temp sensors of legacy devices are connected Guenter Roeck
2023-10-25 20:04     ` Aleksa Savic
2023-10-16  8:35 ` [PATCH 2/2] hwmon: (aquacomputer_d5next) Add support for Aquacomputer High Flow USB and MPS Flow Aleksa Savic
2023-10-28 16:24   ` Guenter Roeck
2023-10-29 15:58     ` Aleksa Savic
2023-10-29 16:59       ` Guenter Roeck
2023-10-29 17:13         ` Aleksa Savic

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=20231016083559.139341-2-savicaleksa83@gmail.com \
    --to=savicaleksa83@gmail.com \
    --cc=corbet@lwn.net \
    --cc=jdelvare@suse.com \
    --cc=leonard.anderweit@gmail.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=me@jackdoan.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