aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorJean Delvare <khali@linux-fr.org>2005-05-16 12:52:38 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2005-06-22 00:51:57 -0400
commit68188ba7de2db9999ff08a4544a78b2f10eb08bd (patch)
tree37e0406d7f2b6ace2bc73043bda0c745d3aa5e37 /drivers
parentff3240946d6a3d9f2ecf273f7330e09eec5484eb (diff)
[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 <khali@linux-fr.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/i2c/chips/asb100.c4
-rw-r--r--drivers/i2c/chips/it87.c4
-rw-r--r--drivers/i2c/chips/lm85.c4
-rw-r--r--drivers/i2c/chips/via686a.c4
-rw-r--r--drivers/i2c/chips/w83781d.c3
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)
169 return reg * 16; 169 return reg * 16;
170} 170}
171 171
172#define ALARMS_FROM_REG(val) (val)
173
174#define DIV_FROM_REG(val) (1 << (val)) 172#define DIV_FROM_REG(val) (1 << (val))
175 173
176/* FAN DIV: 1, 2, 4, or 8 (defaults to 2) 174/* FAN DIV: 1, 2, 4, or 8 (defaults to 2)
@@ -557,7 +555,7 @@ device_create_file(&client->dev, &dev_attr_vrm);
557static ssize_t show_alarms(struct device *dev, struct device_attribute *attr, char *buf) 555static ssize_t show_alarms(struct device *dev, struct device_attribute *attr, char *buf)
558{ 556{
559 struct asb100_data *data = asb100_update_device(dev); 557 struct asb100_data *data = asb100_update_device(dev);
560 return sprintf(buf, "%d\n", ALARMS_FROM_REG(data->alarms)); 558 return sprintf(buf, "%u\n", data->alarms);
561} 559}
562 560
563static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL); 561static 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)
172 ((val)+500)/1000),-128,127)) 172 ((val)+500)/1000),-128,127))
173#define TEMP_FROM_REG(val) (((val)>0x80?(val)-0x100:(val))*1000) 173#define TEMP_FROM_REG(val) (((val)>0x80?(val)-0x100:(val))*1000)
174 174
175#define ALARMS_FROM_REG(val) (val)
176
177#define PWM_TO_REG(val) ((val) >> 1) 175#define PWM_TO_REG(val) ((val) >> 1)
178#define PWM_FROM_REG(val) (((val)&0x7f) << 1) 176#define PWM_FROM_REG(val) (((val)&0x7f) << 1)
179 177
@@ -665,7 +663,7 @@ show_pwm_offset(3);
665static ssize_t show_alarms(struct device *dev, struct device_attribute *attr, char *buf) 663static ssize_t show_alarms(struct device *dev, struct device_attribute *attr, char *buf)
666{ 664{
667 struct it87_data *data = it87_update_device(dev); 665 struct it87_data *data = it87_update_device(dev);
668 return sprintf(buf,"%d\n", ALARMS_FROM_REG(data->alarms)); 666 return sprintf(buf, "%u\n", data->alarms);
669} 667}
670static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL); 668static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL);
671 669
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 )
284/* i2c-vid.h defines vid_from_reg() */ 284/* i2c-vid.h defines vid_from_reg() */
285#define VID_FROM_REG(val,vrm) (vid_from_reg((val),(vrm))) 285#define VID_FROM_REG(val,vrm) (vid_from_reg((val),(vrm)))
286 286
287#define ALARMS_FROM_REG(val) (val)
288
289/* Unlike some other drivers we DO NOT set initial limits. Use 287/* Unlike some other drivers we DO NOT set initial limits. Use
290 * the config file to set limits. Some users have reported 288 * the config file to set limits. Some users have reported
291 * motherboards shutting down when we set limits in a previous 289 * 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);
480static ssize_t show_alarms_reg(struct device *dev, struct device_attribute *attr, char *buf) 478static ssize_t show_alarms_reg(struct device *dev, struct device_attribute *attr, char *buf)
481{ 479{
482 struct lm85_data *data = lm85_update_device(dev); 480 struct lm85_data *data = lm85_update_device(dev);
483 return sprintf(buf, "%ld\n", (long) ALARMS_FROM_REG(data->alarms)); 481 return sprintf(buf, "%u\n", data->alarms);
484} 482}
485 483
486static DEVICE_ATTR(alarms, S_IRUGO, show_alarms_reg, NULL); 484static 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)
292 tempLUT[eightBits + 1] * twoBits) * 25; 292 tempLUT[eightBits + 1] * twoBits) * 25;
293} 293}
294 294
295#define ALARMS_FROM_REG(val) (val)
296
297#define DIV_FROM_REG(val) (1 << (val)) 295#define DIV_FROM_REG(val) (1 << (val))
298#define DIV_TO_REG(val) ((val)==8?3:(val)==4?2:(val)==1?0:1) 296#define DIV_TO_REG(val) ((val)==8?3:(val)==4?2:(val)==1?0:1)
299 297
@@ -570,7 +568,7 @@ show_fan_offset(2);
570/* Alarms */ 568/* Alarms */
571static ssize_t show_alarms(struct device *dev, struct device_attribute *attr, char *buf) { 569static ssize_t show_alarms(struct device *dev, struct device_attribute *attr, char *buf) {
572 struct via686a_data *data = via686a_update_device(dev); 570 struct via686a_data *data = via686a_update_device(dev);
573 return sprintf(buf,"%d\n", ALARMS_FROM_REG(data->alarms)); 571 return sprintf(buf, "%u\n", data->alarms);
574} 572}
575static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL); 573static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL);
576 574
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)
172 : (val)) / 1000, 0, 0xff)) 172 : (val)) / 1000, 0, 0xff))
173#define TEMP_FROM_REG(val) (((val) & 0x80 ? (val)-0x100 : (val)) * 1000) 173#define TEMP_FROM_REG(val) (((val) & 0x80 ? (val)-0x100 : (val)) * 1000)
174 174
175#define ALARMS_FROM_REG(val) (val)
176#define PWM_FROM_REG(val) (val) 175#define PWM_FROM_REG(val) (val)
177#define PWM_TO_REG(val) (SENSORS_LIMIT((val),0,255)) 176#define PWM_TO_REG(val) (SENSORS_LIMIT((val),0,255))
178#define BEEP_MASK_FROM_REG(val,type) ((type) == as99127f ? \ 177#define BEEP_MASK_FROM_REG(val,type) ((type) == as99127f ? \
@@ -523,7 +522,7 @@ static ssize_t
523show_alarms_reg(struct device *dev, struct device_attribute *attr, char *buf) 522show_alarms_reg(struct device *dev, struct device_attribute *attr, char *buf)
524{ 523{
525 struct w83781d_data *data = w83781d_update_device(dev); 524 struct w83781d_data *data = w83781d_update_device(dev);
526 return sprintf(buf, "%ld\n", (long) ALARMS_FROM_REG(data->alarms)); 525 return sprintf(buf, "%u\n", data->alarms);
527} 526}
528 527
529static 528static