linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Pali Rohár" <pali.rohar@gmail.com>
To: Guenter Roeck <linux@roeck-us.net>, Arnd Bergmann <arnd@arndb.de>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-kernel@vger.kernel.org, "Pali Rohár" <pali.rohar@gmail.com>
Subject: [PATCH 02/10] i8k: Register only temperature sensors which have labels
Date: Sun, 21 Dec 2014 20:54:35 +0100	[thread overview]
Message-ID: <1419191683-31435-3-git-send-email-pali.rohar@gmail.com> (raw)
In-Reply-To: <1419191683-31435-1-git-send-email-pali.rohar@gmail.com>

Detect presense of sensor by calling type function instead trying to read
temperature value. Type function is working also for sensors which are temporary
turned off (e.g on GPU which is turned off). Dell DOS binary NBSVC.MDM is doing
similar checks, so we should do that too.

Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Tested-by: Guenter Roeck <linux@roeck-us.net>
---
 drivers/char/i8k.c |   18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/char/i8k.c b/drivers/char/i8k.c
index 663868b..afcc9fe 100644
--- a/drivers/char/i8k.c
+++ b/drivers/char/i8k.c
@@ -660,19 +660,19 @@ static int __init i8k_init_hwmon(void)
 
 	i8k_hwmon_flags = 0;
 
-	/* CPU temperature attributes, if temperature reading is OK */
-	err = i8k_get_temp(0);
-	if (err >= 0 || err == -ERANGE)
+	/* CPU temperature attributes, if temperature type is OK */
+	err = i8k_get_temp_type(0);
+	if (err >= 0)
 		i8k_hwmon_flags |= I8K_HWMON_HAVE_TEMP1;
 	/* check for additional temperature sensors */
-	err = i8k_get_temp(1);
-	if (err >= 0 || err == -ERANGE)
+	err = i8k_get_temp_type(1);
+	if (err >= 0)
 		i8k_hwmon_flags |= I8K_HWMON_HAVE_TEMP2;
-	err = i8k_get_temp(2);
-	if (err >= 0 || err == -ERANGE)
+	err = i8k_get_temp_type(2);
+	if (err >= 0)
 		i8k_hwmon_flags |= I8K_HWMON_HAVE_TEMP3;
-	err = i8k_get_temp(3);
-	if (err >= 0 || err == -ERANGE)
+	err = i8k_get_temp_type(3);
+	if (err >= 0)
 		i8k_hwmon_flags |= I8K_HWMON_HAVE_TEMP4;
 
 	/* Left fan attributes, if left fan is present */
-- 
1.7.9.5


  parent reply	other threads:[~2014-12-21 19:55 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-21 19:54 [PATCH 00/10] i8k patches Pali Rohár
2014-12-21 19:54 ` [PATCH 01/10] i8k: Add support for temperature sensor labels Pali Rohár
2014-12-21 19:54 ` Pali Rohár [this message]
2014-12-21 19:54 ` [PATCH 03/10] i8k: Return -ENODATA for invalid temperature Pali Rohár
2014-12-21 19:54 ` [PATCH 04/10] MAINTAINERS: Fix up entry for Dell laptop SMM driver Pali Rohár
2014-12-21 19:54 ` [PATCH 05/10] i8k: Rework error retries Pali Rohár
2014-12-21 19:54 ` [PATCH 06/10] i8k: Add support for Dell XPS 13 Pali Rohár
2014-12-21 19:54 ` [PATCH 07/10] i8k: Make fan module parameters an unsigned Pali Rohár
2014-12-21 19:54 ` [PATCH 08/10] i8k: Autodetect maximal fan speed and fan RPM multiplier Pali Rohár
2014-12-21 22:58   ` Guenter Roeck
2014-12-21 19:54 ` [PATCH 09/10] i8k: Remove DMI config data for Latitude E6440 and E6540 Pali Rohár
2014-12-21 22:58   ` Guenter Roeck
2014-12-21 19:54 ` [PATCH 10/10] i8k: Add support for fan labels Pali Rohár
2014-12-21 23:01   ` Guenter Roeck
2014-12-22  8:07     ` Pali Rohár

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=1419191683-31435-3-git-send-email-pali.rohar@gmail.com \
    --to=pali.rohar@gmail.com \
    --cc=arnd@arndb.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    /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).