All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jean Delvare <khali@linux-fr.org>
To: lm-sensors@vger.kernel.org
Subject: Re: [lm-sensors] [PATCH 03/10] hwmon: (lm85) Drop dead code
Date: Thu, 01 May 2008 06:47:33 +0000	[thread overview]
Message-ID: <20080501084733.075e586f@hyperion.delvare> (raw)
In-Reply-To: <20080412195552.421b4a28@hyperion.delvare>

Hi Juerg,

On Wed, 30 Apr 2008 21:52:45 -0700, Juerg Haefliger wrote:
> Wow, sure a lot of unused junk. The patch looks good but doesn't apply 
> cleanly over the revised patch 02/10. Could you please refresh and 
> resend it?

Sure, here you go:

Drop a lot of useless register defines, conversion macros, data structure
members and update code. All these register values were read from the
device but nothing is done out of them, so this is all dead code in
practice.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
---
Refreshed to apply cleanly on top of the updated patch 2/10.

 Documentation/hwmon/lm85 |   11 ++----
 drivers/hwmon/lm85.c     |   82 +---------------------------------------------
 2 files changed, 6 insertions(+), 87 deletions(-)

--- linux-2.6.26-rc0.orig/drivers/hwmon/lm85.c	2008-04-29 13:43:54.000000000 +0200
+++ linux-2.6.26-rc0/drivers/hwmon/lm85.c	2008-04-29 13:54:33.000000000 +0200
@@ -56,16 +56,9 @@ I2C_CLIENT_INSMOD_6(lm85b, lm85c, adm102
 
 #define	LM85_REG_PWM(nr)		(0x30 + (nr))
 
-#define	ADT7463_REG_OPPOINT(nr)		(0x33 + (nr))
-
-#define	ADT7463_REG_TMIN_CTL1		0x36
-#define	ADT7463_REG_TMIN_CTL2		0x37
-
-#define	LM85_REG_DEVICE			0x3d
 #define	LM85_REG_COMPANY		0x3e
 #define	LM85_REG_VERSTEP		0x3f
 /* These are the recognized values for the above regs */
-#define	LM85_DEVICE_ADX			0x27
 #define	LM85_COMPANY_NATIONAL		0x01
 #define	LM85_COMPANY_ANALOG_DEV		0x41
 #define	LM85_COMPANY_SMSC		0x5c
@@ -91,27 +84,14 @@ I2C_CLIENT_INSMOD_6(lm85b, lm85c, adm102
 #define	LM85_REG_AFAN_CONFIG(nr)	(0x5c + (nr))
 #define	LM85_REG_AFAN_RANGE(nr)		(0x5f + (nr))
 #define	LM85_REG_AFAN_SPIKE1		0x62
-#define	LM85_REG_AFAN_SPIKE2		0x63
 #define	LM85_REG_AFAN_MINPWM(nr)	(0x64 + (nr))
 #define	LM85_REG_AFAN_LIMIT(nr)		(0x67 + (nr))
 #define	LM85_REG_AFAN_CRITICAL(nr)	(0x6a + (nr))
 #define	LM85_REG_AFAN_HYST1		0x6d
 #define	LM85_REG_AFAN_HYST2		0x6e
 
-#define	LM85_REG_TACH_MODE		0x74
-#define	LM85_REG_SPINUP_CTL		0x75
-
-#define	ADM1027_REG_TEMP_OFFSET(nr)	(0x70 + (nr))
-#define	ADM1027_REG_CONFIG2		0x73
-#define	ADM1027_REG_INTMASK1		0x74
-#define	ADM1027_REG_INTMASK2		0x75
 #define	ADM1027_REG_EXTEND_ADC1		0x76
 #define	ADM1027_REG_EXTEND_ADC2		0x77
-#define	ADM1027_REG_CONFIG3		0x78
-#define	ADM1027_REG_FAN_PPR		0x7b
-
-#define	ADT7463_REG_THERM		0x79
-#define	ADT7463_REG_THERM_LIMIT		0x7A
 
 #define EMC6D100_REG_ALARM3             0x7d
 /* IN5, IN6 and IN7 */
@@ -263,13 +243,6 @@ static int ZONE_TO_REG(int zone)
 #define HYST_TO_REG(val)	SENSORS_LIMIT(((val) + 500) / 1000, 0, 15)
 #define HYST_FROM_REG(val)	((val) * 1000)
 
-#define OFFSET_TO_REG(val)	SENSORS_LIMIT((val) / 25, -127, 127)
-#define OFFSET_FROM_REG(val)	((val) * 25)
-
-#define PPR_MASK(fan)		(0x03 << ((fan) * 2))
-#define PPR_TO_REG(val, fan)	(SENSORS_LIMIT((val) - 1, 0, 3) << ((fan) * 2))
-#define PPR_FROM_REG(val, fan)	((((val) >> ((fan) * 2)) & 0x03) + 1)
-
 /* Chip sampling rates
  *
  * Some sensors are not updated more frequently than once per second
@@ -330,23 +303,15 @@ struct lm85_data {
 	s8 temp[3];		/* Register value */
 	s8 temp_min[3];		/* Register value */
 	s8 temp_max[3];		/* Register value */
-	s8 temp_offset[3];	/* Register value */
 	u16 fan[4];		/* Register value */
 	u16 fan_min[4];		/* Register value */
 	u8 pwm[3];		/* Register value */
-	u8 spinup_ctl;		/* Register encoding, combined */
-	u8 tach_mode;		/* Register encoding, combined */
 	u8 temp_ext[3];		/* Decoded values */
 	u8 in_ext[8];		/* Decoded values */
-	u8 fan_ppr;		/* Register value */
-	u8 smooth[3];		/* Register encoding */
+	u8 smooth[1];		/* Register encoding */
 	u8 vid;			/* Register value */
 	u8 vrm;			/* VRM version */
 	u8 syncpwm3;		/* Saved PWM3 for TACH 2,3,4 config */
-	u8 oppoint[3];		/* Register value */
-	u16 tmin_ctl;		/* Register value */
-	unsigned long therm_total; /* Cummulative therm count */
-	u8 therm_limit;		/* Register value */
 	u32 alarms;		/* Register encoding, combined */
 	struct lm85_autofan autofan[3];
 	struct lm85_zone zone[3];
@@ -1335,10 +1300,6 @@ static int lm85_read_value(struct i2c_cl
 		res = i2c_smbus_read_byte_data(client, reg) & 0xff;
 		res |= i2c_smbus_read_byte_data(client, reg + 1) << 8;
 		break;
-	case ADT7463_REG_TMIN_CTL1:  /* Read WORD MSB, LSB */
-		res = i2c_smbus_read_byte_data(client, reg) << 8;
-		res |= i2c_smbus_read_byte_data(client, reg + 1) & 0xff;
-		break;
 	default:	/* Read BYTE data */
 		res = i2c_smbus_read_byte_data(client, reg);
 		break;
@@ -1365,11 +1326,6 @@ static int lm85_write_value(struct i2c_c
 		res |= i2c_smbus_write_byte_data(client, reg + 1,
 						 (value >> 8) & 0xff);
 		break;
-	case ADT7463_REG_TMIN_CTL1:  /* Write WORD MSB, LSB */
-		res = i2c_smbus_write_byte_data(client, reg,
-						(value >> 8) & 0xff);
-		res |= i2c_smbus_write_byte_data(client, reg + 1, value & 0xff);
-		break;
 	default:	/* Write BYTE data */
 		res = i2c_smbus_write_byte_data(client, reg, value);
 		break;
@@ -1483,12 +1439,7 @@ static struct lm85_data *lm85_update_dev
 
 		data->alarms = lm85_read_value(client, LM85_REG_ALARM1);
 
-		if (data->type = adt7463) {
-			if (data->therm_total < ULONG_MAX - 256) {
-			    data->therm_total +-				lm85_read_value(client, ADT7463_REG_THERM);
-			}
-		} else if (data->type = emc6d100) {
+		if (data->type = emc6d100) {
 			/* Three more voltage sensors */
 			for (i = 5; i <= 7; ++i) {
 				data->in[i] = lm85_read_value(client,
@@ -1585,9 +1536,6 @@ static struct lm85_data *lm85_update_dev
 		data->autofan[0].min_off = (i & 0x20) != 0;
 		data->autofan[1].min_off = (i & 0x40) != 0;
 		data->autofan[2].min_off = (i & 0x80) != 0;
-		i = lm85_read_value(client, LM85_REG_AFAN_SPIKE2);
-		data->smooth[1] = (i >> 4) & 0x0f;
-		data->smooth[2] = i & 0x0f;
 
 		i = lm85_read_value(client, LM85_REG_AFAN_HYST1);
 		data->zone[0].hyst = (i >> 4) & 0x0f;
@@ -1596,32 +1544,6 @@ static struct lm85_data *lm85_update_dev
 		i = lm85_read_value(client, LM85_REG_AFAN_HYST2);
 		data->zone[2].hyst = (i >> 4) & 0x0f;
 
-		if (data->type = lm85b || data->type = lm85c) {
-			data->tach_mode = lm85_read_value(client,
-				LM85_REG_TACH_MODE);
-			data->spinup_ctl = lm85_read_value(client,
-				LM85_REG_SPINUP_CTL);
-		} else if (data->type = adt7463 || data->type = adm1027) {
-			if (data->type = adt7463) {
-				for (i = 0; i <= 2; ++i) {
-				    data->oppoint[i] = lm85_read_value(client,
-					ADT7463_REG_OPPOINT(i));
-				}
-				data->tmin_ctl = lm85_read_value(client,
-					ADT7463_REG_TMIN_CTL1);
-				data->therm_limit = lm85_read_value(client,
-					ADT7463_REG_THERM_LIMIT);
-			}
-			for (i = 0; i <= 2; ++i) {
-				data->temp_offset[i] = lm85_read_value(client,
-						ADM1027_REG_TEMP_OFFSET(i));
-			}
-			data->tach_mode = lm85_read_value(client,
-				ADM1027_REG_CONFIG3);
-			data->fan_ppr = lm85_read_value(client,
-				ADM1027_REG_FAN_PPR);
-		}
-
 		data->last_config = jiffies;
 	}  /* last_config */
 
--- linux-2.6.26-rc0.orig/Documentation/hwmon/lm85	2008-04-28 14:22:33.000000000 +0200
+++ linux-2.6.26-rc0/Documentation/hwmon/lm85	2008-04-29 13:54:14.000000000 +0200
@@ -96,11 +96,6 @@ initial testing of the ADM1027 it was 1.
 confirmed this "bug". The ADT7463 is reported to work as described in the
 documentation. The current lm85 driver does not show the offset register.
 
-The ADT7463 has a THERM asserted counter. This counter has a 22.76ms
-resolution and a range of 5.8 seconds. The driver implements a 32-bit
-accumulator of the counter value to extend the range to over a year. The
-counter will stay at it's max value until read.
-
 See the vendor datasheets for more information. There is application note
 from National (AN-1260) with some additional information about the LM85.
 The Analog Devices datasheet is very detailed and describes a procedure for
@@ -206,13 +201,15 @@ Configuration choices:
 
 The National LM85's have two vendor specific configuration
 features. Tach. mode and Spinup Control. For more details on these,
-see the LM85 datasheet or Application Note AN-1260.
+see the LM85 datasheet or Application Note AN-1260. These features
+are not currently supported by the lm85 driver.
 
 The Analog Devices ADM1027 has several vendor specific enhancements.
 The number of pulses-per-rev of the fans can be set, Tach monitoring
 can be optimized for PWM operation, and an offset can be applied to
 the temperatures to compensate for systemic errors in the
-measurements.
+measurements. These features are not currently supported by the lm85
+driver.
 
 In addition to the ADM1027 features, the ADT7463 also has Tmin control
 and THERM asserted counts. Automatic Tmin control acts to adjust the


-- 
Jean Delvare

_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

  parent reply	other threads:[~2008-05-01  6:47 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-12 17:55 [lm-sensors] [PATCH 03/10] hwmon: (lm85) Drop dead code Jean Delvare
2008-05-01  4:52 ` Juerg Haefliger
2008-05-01  6:47 ` Jean Delvare [this message]
2008-05-01 17:55 ` Philip Pokorny
2008-05-01 18:16 ` Juerg Haefliger
2008-05-01 18:44 ` Jean Delvare
2008-05-02  5:16 ` Juerg Haefliger
2008-05-02  7:23 ` Jean Delvare
2008-05-03 23:51 ` Juerg Haefliger
2008-06-25 13:20 ` Mark M. Hoffman

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=20080501084733.075e586f@hyperion.delvare \
    --to=khali@linux-fr.org \
    --cc=lm-sensors@vger.kernel.org \
    /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.