From 68188ba7de2db9999ff08a4544a78b2f10eb08bd Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Mon, 16 May 2005 18:52:38 +0200 Subject: [PATCH] [PATCH] I2C: Kill common macro abuse in chip drivers This patch kills a common macro abuse in i2c chip drivers: defining ALARMS_FROM_REG returning its argument unchanged. Dropping the macro makes the code somewhat more readable IMHO. Signed-off-by: Jean Delvare Signed-off-by: Greg Kroah-Hartman --- drivers/i2c/chips/asb100.c | 4 +--- drivers/i2c/chips/it87.c | 4 +--- drivers/i2c/chips/lm85.c | 4 +--- drivers/i2c/chips/via686a.c | 4 +--- drivers/i2c/chips/w83781d.c | 3 +-- 5 files changed, 5 insertions(+), 14 deletions(-) diff --git a/drivers/i2c/chips/asb100.c b/drivers/i2c/chips/asb100.c index 342b1a98a8cc..70d996d6fe0a 100644 --- a/drivers/i2c/chips/asb100.c +++ b/drivers/i2c/chips/asb100.c @@ -169,8 +169,6 @@ static int ASB100_PWM_FROM_REG(u8 reg) return reg * 16; } -#define ALARMS_FROM_REG(val) (val) - #define DIV_FROM_REG(val) (1 << (val)) /* FAN DIV: 1, 2, 4, or 8 (defaults to 2) @@ -557,7 +555,7 @@ device_create_file(&client->dev, &dev_attr_vrm); static ssize_t show_alarms(struct device *dev, struct device_attribute *attr, char *buf) { struct asb100_data *data = asb100_update_device(dev); - return sprintf(buf, "%d\n", ALARMS_FROM_REG(data->alarms)); + return sprintf(buf, "%u\n", data->alarms); } static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL); diff --git a/drivers/i2c/chips/it87.c b/drivers/i2c/chips/it87.c index 16dbfd8dac1b..7984bf920d31 100644 --- a/drivers/i2c/chips/it87.c +++ b/drivers/i2c/chips/it87.c @@ -172,8 +172,6 @@ static inline u8 FAN_TO_REG(long rpm, int div) ((val)+500)/1000),-128,127)) #define TEMP_FROM_REG(val) (((val)>0x80?(val)-0x100:(val))*1000) -#define ALARMS_FROM_REG(val) (val) - #define PWM_TO_REG(val) ((val) >> 1) #define PWM_FROM_REG(val) (((val)&0x7f) << 1) @@ -665,7 +663,7 @@ show_pwm_offset(3); static ssize_t show_alarms(struct device *dev, struct device_attribute *attr, char *buf) { struct it87_data *data = it87_update_device(dev); - return sprintf(buf,"%d\n", ALARMS_FROM_REG(data->alarms)); + return sprintf(buf, "%u\n", data->alarms); } static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL); diff --git a/drivers/i2c/chips/lm85.c b/drivers/i2c/chips/lm85.c index d618d1031301..b4d7fd418264 100644 --- a/drivers/i2c/chips/lm85.c +++ b/drivers/i2c/chips/lm85.c @@ -284,8 +284,6 @@ static int ZONE_TO_REG( int zone ) /* i2c-vid.h defines vid_from_reg() */ #define VID_FROM_REG(val,vrm) (vid_from_reg((val),(vrm))) -#define ALARMS_FROM_REG(val) (val) - /* Unlike some other drivers we DO NOT set initial limits. Use * the config file to set limits. Some users have reported * motherboards shutting down when we set limits in a previous @@ -480,7 +478,7 @@ static DEVICE_ATTR(vrm, S_IRUGO | S_IWUSR, show_vrm_reg, store_vrm_reg); static ssize_t show_alarms_reg(struct device *dev, struct device_attribute *attr, char *buf) { struct lm85_data *data = lm85_update_device(dev); - return sprintf(buf, "%ld\n", (long) ALARMS_FROM_REG(data->alarms)); + return sprintf(buf, "%u\n", data->alarms); } static DEVICE_ATTR(alarms, S_IRUGO, show_alarms_reg, NULL); diff --git a/drivers/i2c/chips/via686a.c b/drivers/i2c/chips/via686a.c index e7a686267942..3140ae8882a9 100644 --- a/drivers/i2c/chips/via686a.c +++ b/drivers/i2c/chips/via686a.c @@ -292,8 +292,6 @@ static inline long TEMP_FROM_REG10(u16 val) tempLUT[eightBits + 1] * twoBits) * 25; } -#define ALARMS_FROM_REG(val) (val) - #define DIV_FROM_REG(val) (1 << (val)) #define DIV_TO_REG(val) ((val)==8?3:(val)==4?2:(val)==1?0:1) @@ -570,7 +568,7 @@ show_fan_offset(2); /* Alarms */ static ssize_t show_alarms(struct device *dev, struct device_attribute *attr, char *buf) { struct via686a_data *data = via686a_update_device(dev); - return sprintf(buf,"%d\n", ALARMS_FROM_REG(data->alarms)); + return sprintf(buf, "%u\n", data->alarms); } static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL); diff --git a/drivers/i2c/chips/w83781d.c b/drivers/i2c/chips/w83781d.c index f47aee88e20c..4a5b06ba57d3 100644 --- a/drivers/i2c/chips/w83781d.c +++ b/drivers/i2c/chips/w83781d.c @@ -172,7 +172,6 @@ FAN_TO_REG(long rpm, int div) : (val)) / 1000, 0, 0xff)) #define TEMP_FROM_REG(val) (((val) & 0x80 ? (val)-0x100 : (val)) * 1000) -#define ALARMS_FROM_REG(val) (val) #define PWM_FROM_REG(val) (val) #define PWM_TO_REG(val) (SENSORS_LIMIT((val),0,255)) #define BEEP_MASK_FROM_REG(val,type) ((type) == as99127f ? \ @@ -523,7 +522,7 @@ static ssize_t show_alarms_reg(struct device *dev, struct device_attribute *attr, char *buf) { struct w83781d_data *data = w83781d_update_device(dev); - return sprintf(buf, "%ld\n", (long) ALARMS_FROM_REG(data->alarms)); + return sprintf(buf, "%u\n", data->alarms); } static -- 2.30.2