All of lore.kernel.org
 help / color / mirror / Atom feed
* [lm-sensors] [PATCH 03/10] hwmon: (lm85) Drop dead code
@ 2008-04-12 17:55 Jean Delvare
  2008-05-01  4:52 ` Juerg Haefliger
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: Jean Delvare @ 2008-04-12 17:55 UTC (permalink / raw)
  To: lm-sensors

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>
---
 Documentation/hwmon/lm85 |   11 ++----
 drivers/hwmon/lm85.c     |   82 +---------------------------------------------
 2 files changed, 6 insertions(+), 87 deletions(-)

--- linux-2.6.25-rc8.orig/drivers/hwmon/lm85.c	2008-04-04 10:45:10.000000000 +0200
+++ linux-2.6.25-rc8/drivers/hwmon/lm85.c	2008-04-04 15:41:53.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 */
@@ -264,13 +244,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
@@ -331,23 +304,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];
@@ -1336,10 +1301,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;
@@ -1366,11 +1327,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;
@@ -1482,12 +1438,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,
@@ -1584,9 +1535,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;
@@ -1595,32 +1543,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.25-rc8.orig/Documentation/hwmon/lm85	2008-04-04 15:41:52.000000000 +0200
+++ linux-2.6.25-rc8/Documentation/hwmon/lm85	2008-04-04 15:46:40.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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [lm-sensors] [PATCH 03/10] hwmon: (lm85) Drop dead code
  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
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Juerg Haefliger @ 2008-05-01  4:52 UTC (permalink / raw)
  To: lm-sensors

Hi Jean,


> 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>
> ---
>  Documentation/hwmon/lm85 |   11 ++----
>  drivers/hwmon/lm85.c     |   82 +---------------------------------------------
>  2 files changed, 6 insertions(+), 87 deletions(-)
> 
> --- linux-2.6.25-rc8.orig/drivers/hwmon/lm85.c	2008-04-04 10:45:10.000000000 +0200
> +++ linux-2.6.25-rc8/drivers/hwmon/lm85.c	2008-04-04 15:41:53.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 */
> @@ -264,13 +244,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
> @@ -331,23 +304,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];
> @@ -1336,10 +1301,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;
> @@ -1366,11 +1327,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;
> @@ -1482,12 +1438,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,
> @@ -1584,9 +1535,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;
> @@ -1595,32 +1543,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.25-rc8.orig/Documentation/hwmon/lm85	2008-04-04 15:41:52.000000000 +0200
> +++ linux-2.6.25-rc8/Documentation/hwmon/lm85	2008-04-04 15:46:40.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


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?

...juerg

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [lm-sensors] [PATCH 03/10] hwmon: (lm85) Drop dead code
  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
  2008-05-01 17:55 ` Philip Pokorny
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Jean Delvare @ 2008-05-01  6:47 UTC (permalink / raw)
  To: lm-sensors

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [lm-sensors] [PATCH 03/10] hwmon: (lm85) Drop dead code
  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
@ 2008-05-01 17:55 ` Philip Pokorny
  2008-05-01 18:16 ` Juerg Haefliger
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Philip Pokorny @ 2008-05-01 17:55 UTC (permalink / raw)
  To: lm-sensors

Jean Delvare wrote:
> 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.
>   
The code to use all of those registers was posted in 2004:

http://lists.lm-sensors.org/pipermail/lm-sensors/2004-August/008563.html

But was apparently not picked up because there was an objection to the 
size of the patch?

The patch was streamlined to try and match the "standard" for PWM 
control (which doesn't map to the LM85 registers very well) and reposted:

http://lists.lm-sensors.org/pipermail/lm-sensors/2004-September/009059.html

but without the additional functionality unfortunately.

Wouldn't the better course of action be to add the accessors for these 
tuneables rather than remove the functionality from the driver? Of 
course, that means that I probably need to do the work, but I don't have 
the time to do this right now.

So could I ask that we *not* remove this "dead" code, but leave it in 
for now so that when someone does get around to adding the accessor 
functions, they won't have to submit a patch to reverse this "dead" code 
elimination?

Thanks,
Phil P

-- 
Philip Pokorny, RHCE, Chief Arch. & Sr. Dir. HW & Field Eng.
Tel: 415-954-2823   Cell: 415-370-0835
Fax: 415-954-2899   Toll Free: 888-PENGUIN
PENGUIN COMPUTING, INC.
www.penguincomputing.com


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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [lm-sensors] [PATCH 03/10] hwmon: (lm85) Drop dead code
  2008-04-12 17:55 [lm-sensors] [PATCH 03/10] hwmon: (lm85) Drop dead code Jean Delvare
                   ` (2 preceding siblings ...)
  2008-05-01 17:55 ` Philip Pokorny
@ 2008-05-01 18:16 ` Juerg Haefliger
  2008-05-01 18:44 ` Jean Delvare
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Juerg Haefliger @ 2008-05-01 18:16 UTC (permalink / raw)
  To: lm-sensors

Hi Philip,


> Jean Delvare wrote:
>
> > 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.
> >
> >
>  The code to use all of those registers was posted in 2004:
>
>  http://lists.lm-sensors.org/pipermail/lm-sensors/2004-August/008563.html
>
>  But was apparently not picked up because there was an objection to the size
> of the patch?
>
>  The patch was streamlined to try and match the "standard" for PWM control
> (which doesn't map to the LM85 registers very well) and reposted:
>
>  http://lists.lm-sensors.org/pipermail/lm-sensors/2004-September/009059.html
>
>  but without the additional functionality unfortunately.
>
>  Wouldn't the better course of action be to add the accessors for these
> tuneables rather than remove the functionality from the driver? Of course,
> that means that I probably need to do the work, but I don't have the time to
> do this right now.
>
>  So could I ask that we *not* remove this "dead" code, but leave it in for
> now so that when someone does get around to adding the accessor functions,
> they won't have to submit a patch to reverse this "dead" code elimination?

The code Jean wants to remove hasn't been used for a very long time
and who is to guarantee that it doesn't take another couple years
until it is finally put to use? In the meantime the driver is bloated
and slowed down due to accessing unused registers. It's not too hard
to add that stuff back. I don't like the term 'until someone gets
around to adding the functions'. That sound like 'never' to me or
certainly not in the near future so I vote for ripping it out.

Just my 2 cents.
...juerg



>  Thanks,
>  Phil P
>
>  --
>  Philip Pokorny, RHCE, Chief Arch. & Sr. Dir. HW & Field Eng.
>  Tel: 415-954-2823   Cell: 415-370-0835
>  Fax: 415-954-2899   Toll Free: 888-PENGUIN
>  PENGUIN COMPUTING, INC.
>  www.penguincomputing.com
>
>

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [lm-sensors] [PATCH 03/10] hwmon: (lm85) Drop dead code
  2008-04-12 17:55 [lm-sensors] [PATCH 03/10] hwmon: (lm85) Drop dead code Jean Delvare
                   ` (3 preceding siblings ...)
  2008-05-01 18:16 ` Juerg Haefliger
@ 2008-05-01 18:44 ` Jean Delvare
  2008-05-02  5:16 ` Juerg Haefliger
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Jean Delvare @ 2008-05-01 18:44 UTC (permalink / raw)
  To: lm-sensors

Hi Juerg, hi Philip,

On Thu, 1 May 2008 11:16:03 -0700, Juerg Haefliger wrote:
> > Jean Delvare wrote:
> > > 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.
> >
> >  The code to use all of those registers was posted in 2004:
> >
> >  http://lists.lm-sensors.org/pipermail/lm-sensors/2004-August/008563.html
> >
> >  But was apparently not picked up because there was an objection to the size
> > of the patch?
> >
> >  The patch was streamlined to try and match the "standard" for PWM control
> > (which doesn't map to the LM85 registers very well) and reposted:
> >
> >  http://lists.lm-sensors.org/pipermail/lm-sensors/2004-September/009059.html
> >
> >  but without the additional functionality unfortunately.
> >
> >  Wouldn't the better course of action be to add the accessors for these
> > tuneables rather than remove the functionality from the driver? Of course,
> > that means that I probably need to do the work, but I don't have the time to
> > do this right now.
> >
> >  So could I ask that we *not* remove this "dead" code, but leave it in for
> > now so that when someone does get around to adding the accessor functions,
> > they won't have to submit a patch to reverse this "dead" code elimination?
> 
> The code Jean wants to remove hasn't been used for a very long time
> and who is to guarantee that it doesn't take another couple years
> until it is finally put to use? In the meantime the driver is bloated
> and slowed down due to accessing unused registers. It's not too hard
> to add that stuff back. I don't like the term 'until someone gets
> around to adding the functions'. That sound like 'never' to me or
> certainly not in the near future so I vote for ripping it out.

+1

Nobody cared about these "extra features" for 3.5 years, I have no
reason to believe that anyone will care in the next few months or
years, if ever. This visible lack of interest is the reason why I
decided to just get rid of the dead code (together with my limited time
to work on the driver, and the lack of test hardware.)

Note that I totally expected that someone would complain about me
removing this code. It's always the same story, dead or broken code can
stay in the kernel and burden the maintainers and users forever, nobody
cares, but as soon as someone proposes to clean things up, everybody
complains that it's "unfortunate".

Anyway, as Juerg wrote, it's trivial to add the code back if/when you
find the time to work on this, with the added bonus that you get more
freedom in what exactly you want to implement and how.

As an additional note, I am not convinced that we actually want to add
all these fancy features to the driver. The first reason is that they
don't look terribly useful to me. The second is that the lm85 driver is
supposed to implement support for a relatively generic type of device.
All the fancy features are model specific, so if you add them all you
end up with a very large driver, which eats memory and is hard to
maintain. If you really want to implement all these extra features then
I think that what you want is a dedicated driver (as Juerg did for the
DME1737 for example.)

Thanks,
-- 
Jean Delvare

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [lm-sensors] [PATCH 03/10] hwmon: (lm85) Drop dead code
  2008-04-12 17:55 [lm-sensors] [PATCH 03/10] hwmon: (lm85) Drop dead code Jean Delvare
                   ` (4 preceding siblings ...)
  2008-05-01 18:44 ` Jean Delvare
@ 2008-05-02  5:16 ` Juerg Haefliger
  2008-05-02  7:23 ` Jean Delvare
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Juerg Haefliger @ 2008-05-02  5:16 UTC (permalink / raw)
  To: lm-sensors

Hi Jean,

I still can't apply it (against 2.6.25):

juergh@jabba:~/src/linux-2.6/linux$ quilt push
Applying patch 03_10.patch
patching file drivers/hwmon/lm85.c
Hunk #9 FAILED at 1544.
Hunk #10 FAILED at 96.
Hunk #11 FAILED at 201.
3 out of 11 hunks FAILED -- rejects in file drivers/hwmon/lm85.c

What am I missing?

...juerg



On Wed, Apr 30, 2008 at 11:47 PM, Jean Delvare <khali@linux-fr.org> wrote:
> 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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [lm-sensors] [PATCH 03/10] hwmon: (lm85) Drop dead code
  2008-04-12 17:55 [lm-sensors] [PATCH 03/10] hwmon: (lm85) Drop dead code Jean Delvare
                   ` (5 preceding siblings ...)
  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
  8 siblings, 0 replies; 10+ messages in thread
From: Jean Delvare @ 2008-05-02  7:23 UTC (permalink / raw)
  To: lm-sensors

On Thu, 1 May 2008 22:16:12 -0700, Juerg Haefliger wrote:
> I still can't apply it (against 2.6.25):
> 
> juergh@jabba:~/src/linux-2.6/linux$ quilt push
> Applying patch 03_10.patch
> patching file drivers/hwmon/lm85.c
> Hunk #9 FAILED at 1544.
> Hunk #10 FAILED at 96.
> Hunk #11 FAILED at 201.
> 3 out of 11 hunks FAILED -- rejects in file drivers/hwmon/lm85.c
> 
> What am I missing?

I don't know, all my lm85 patches apply fine here on top of 2.6.25.

I don't want to spam the list by resending the full patch set after
each review, so I've copied all the patches to a temporary directory
on my home server:
  http://jdelvare.pck.nerim.net/sensors/lm85/
You can download the files from there and they should apply fine in
sequence. I'll also try to remember updating them when I refresh the
source. When you're done with the reviews, let me know and I'll resend
the whole series on the list.

Oh, and of course, if you review more than 3 patches, don't worry, you
get credit from me to review your future patches ;)

-- 
Jean Delvare

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [lm-sensors] [PATCH 03/10] hwmon: (lm85) Drop dead code
  2008-04-12 17:55 [lm-sensors] [PATCH 03/10] hwmon: (lm85) Drop dead code Jean Delvare
                   ` (6 preceding siblings ...)
  2008-05-02  7:23 ` Jean Delvare
@ 2008-05-03 23:51 ` Juerg Haefliger
  2008-06-25 13:20 ` Mark M. Hoffman
  8 siblings, 0 replies; 10+ messages in thread
From: Juerg Haefliger @ 2008-05-03 23:51 UTC (permalink / raw)
  To: lm-sensors

Looks good and applies cleanly now.

Acked-by: Juerg Haefliger <juergh at gmail.com>


On Fri, May 2, 2008 at 12:23 AM, Jean Delvare <khali@linux-fr.org> wrote:
> On Thu, 1 May 2008 22:16:12 -0700, Juerg Haefliger wrote:
>  > I still can't apply it (against 2.6.25):
>  >
>  > juergh@jabba:~/src/linux-2.6/linux$ quilt push
>  > Applying patch 03_10.patch
>  > patching file drivers/hwmon/lm85.c
>  > Hunk #9 FAILED at 1544.
>  > Hunk #10 FAILED at 96.
>  > Hunk #11 FAILED at 201.
>  > 3 out of 11 hunks FAILED -- rejects in file drivers/hwmon/lm85.c
>  >
>  > What am I missing?
>
>  I don't know, all my lm85 patches apply fine here on top of 2.6.25.
>
>  I don't want to spam the list by resending the full patch set after
>  each review, so I've copied all the patches to a temporary directory
>  on my home server:
>   http://jdelvare.pck.nerim.net/sensors/lm85/
>  You can download the files from there and they should apply fine in
>  sequence. I'll also try to remember updating them when I refresh the
>  source. When you're done with the reviews, let me know and I'll resend
>  the whole series on the list.
>
>  Oh, and of course, if you review more than 3 patches, don't worry, you
>  get credit from me to review your future patches ;)
>
>  --
>  Jean Delvare
>

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [lm-sensors] [PATCH 03/10] hwmon: (lm85) Drop dead code
  2008-04-12 17:55 [lm-sensors] [PATCH 03/10] hwmon: (lm85) Drop dead code Jean Delvare
                   ` (7 preceding siblings ...)
  2008-05-03 23:51 ` Juerg Haefliger
@ 2008-06-25 13:20 ` Mark M. Hoffman
  8 siblings, 0 replies; 10+ messages in thread
From: Mark M. Hoffman @ 2008-06-25 13:20 UTC (permalink / raw)
  To: lm-sensors

Hi Jean:

* Jean Delvare <khali@linux-fr.org> [2008-05-01 08:47:33 +0200]:
> 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(-)

Applied to hwmon-2.6.git/testing, thanks.

-- 
Mark M. Hoffman
mhoffman@lightlink.com


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

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2008-06-25 13:20 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

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.