public inbox for linux-hwmon@vger.kernel.org
 help / color / mirror / Atom feed
From: "Dr. David Alan Gilbert" <linux@treblig.org>
To: linux@roeck-us.net, jdelvare@suse.com, linux-hwmon@vger.kernel.org
Cc: "Dr. David Alan Gilbert" <linux@treblig.org>
Subject: [PATCH 3/3] hwmon: (w83627ehf) Now only one intrusion channel
Date: Wed, 25 Dec 2019 02:32:25 +0000	[thread overview]
Message-ID: <20191225023225.2785-4-linux@treblig.org> (raw)
In-Reply-To: <20191225023225.2785-1-linux@treblig.org>

The 2nd intrusion channel was only used on the nct6776

Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>
---
 drivers/hwmon/w83627ehf.c | 19 ++++++-------------
 1 file changed, 6 insertions(+), 13 deletions(-)

diff --git a/drivers/hwmon/w83627ehf.c b/drivers/hwmon/w83627ehf.c
index e13bec80af0b..5a7239eb1c15 100644
--- a/drivers/hwmon/w83627ehf.c
+++ b/drivers/hwmon/w83627ehf.c
@@ -1091,14 +1091,12 @@ static int
 clear_caseopen(struct device *dev, struct w83627ehf_data *data, int channel,
 	       long val)
 {
-	u16 masks[] = { 0x80, 0x40 };
-	u16 reg, mask;
+	const u16 mask = 0x80;
+	u16 reg;
 
-	if (val != 0 || channel > 1)
+	if (val != 0 || channel != 0)
 		return -EINVAL;
 
-	mask = masks[channel];
-
 	mutex_lock(&data->update_lock);
 	reg = w83627ehf_read_value(data, W83627EHF_REG_CASEOPEN_CLR);
 	w83627ehf_write_value(data, W83627EHF_REG_CASEOPEN_CLR, reg | mask);
@@ -1418,9 +1416,7 @@ w83627ehf_is_visible(const void *drvdata, enum hwmon_sensor_types type,
 		break;
 
 	case hwmon_intrusion:
-		if (channel == 0)
-			return 0644;
-		return 0;
+		return 0644;
 
 	default: /* Shouldn't happen */
 		return 0;
@@ -1545,12 +1541,10 @@ static int
 w83627ehf_do_read_intrusion(struct w83627ehf_data *data, u32 attr,
 			    int channel, long *val)
 {
-	unsigned int masks[] = { 0x10, 0x40 };
-
-	if (attr != hwmon_intrusion_alarm || channel > 1)
+	if (attr != hwmon_intrusion_alarm || channel != 0)
 		return -EOPNOTSUPP; /* shouldn't happen */
 
-	*val = !!(data->caseopen & masks[channel]);
+	*val = !!(data->caseopen & 0x10);
 	return 0;
 }
 
@@ -1688,7 +1682,6 @@ static const struct hwmon_channel_info *w83627ehf_info[] = {
 		HWMON_T_ALARM | HWMON_T_INPUT | HWMON_T_LABEL | HWMON_T_MAX |
 			HWMON_T_MAX_HYST | HWMON_T_OFFSET | HWMON_T_TYPE),
 	HWMON_CHANNEL_INFO(intrusion,
-		HWMON_INTRUSION_ALARM,
 		HWMON_INTRUSION_ALARM),
 	NULL
 };
-- 
2.24.1


  parent reply	other threads:[~2019-12-25  2:34 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-25  2:32 [PATCH 0/3] hwmon: (w83627ehf) remove nct6775 and nct6776 support Dr. David Alan Gilbert
2019-12-25  2:32 ` [PATCH 1/3] " Dr. David Alan Gilbert
2019-12-25  2:32 ` [PATCH 2/3] hwmon: (w83627ehf) Remove code not needed after nct677* removal Dr. David Alan Gilbert
2019-12-25  2:32 ` Dr. David Alan Gilbert [this message]
2019-12-26 17:49 ` [PATCH 0/3] hwmon: (w83627ehf) remove nct6775 and nct6776 support 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=20191225023225.2785-4-linux@treblig.org \
    --to=linux@treblig.org \
    --cc=jdelvare@suse.com \
    --cc=linux-hwmon@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