All of lore.kernel.org
 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: "Steven Honeyman" <stevenhoneyman@gmail.com>,
	"Jean Delvare" <jdelvare@suse.de>,
	"Gabriele Mazzotta" <gabriele.mzt@gmail.com>,
	"Jochen Eisinger" <jochen@penguin-breeder.org>,
	Valdis.Kletnieks@vt.edu, linux-kernel@vger.kernel.org,
	"Pali Rohár" <pali.rohar@gmail.com>
Subject: [PATCH 2/9] i8k: Register only temperature sensors which have labels
Date: Mon, 12 Jan 2015 14:31:58 +0100	[thread overview]
Message-ID: <1421069525-12875-3-git-send-email-pali.rohar@gmail.com> (raw)
In-Reply-To: <1421069525-12875-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:[~2015-01-12 13:32 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-12 13:31 [PATCH 0/9] i8k patches Pali Rohár
2015-01-12 13:31 ` [PATCH 1/9] i8k: Add support for temperature sensor labels Pali Rohár
2015-01-12 13:31 ` Pali Rohár [this message]
2015-01-12 13:31 ` [PATCH 3/9] i8k: Return -ENODATA for invalid temperature Pali Rohár
2015-01-12 13:32 ` [PATCH 4/9] i8k: Rework error retries Pali Rohár
2015-01-12 13:32 ` [PATCH 5/9] i8k: Add support for Dell XPS 13 Pali Rohár
2015-01-12 13:32 ` [PATCH 6/9] i8k: Make fan module parameters an unsigned Pali Rohár
2015-01-12 13:32 ` [PATCH 7/9] i8k: Autodetect fan RPM multiplier Pali Rohár
2015-01-12 14:19   ` Guenter Roeck
2015-01-12 14:37     ` Greg Kroah-Hartman
2015-01-12 14:51       ` Guenter Roeck
2015-01-12 13:32 ` [PATCH 8/9] i8k: Remove DMI config data for Latitude E6440 and E6540 Pali Rohár
2015-01-12 13:32 ` [PATCH 9/9] i8k: Add support for fan labels Pali Rohár
2015-01-12 14:50   ` 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=1421069525-12875-3-git-send-email-pali.rohar@gmail.com \
    --to=pali.rohar@gmail.com \
    --cc=Valdis.Kletnieks@vt.edu \
    --cc=arnd@arndb.de \
    --cc=gabriele.mzt@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jdelvare@suse.de \
    --cc=jochen@penguin-breeder.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=stevenhoneyman@gmail.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 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.