aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/ultra45_env.c
diff options
context:
space:
mode:
authorGuenter Roeck <linux@roeck-us.net>2012-01-15 01:42:41 -0500
committerGuenter Roeck <guenter.roeck@ericsson.com>2012-03-18 21:27:10 -0400
commita80b10ccac53087a6ad47f45e29a3800e84448fa (patch)
treef772138dab0ca754be59fb1cbbcb07b3f1cb5cc2 /drivers/hwmon/ultra45_env.c
parent4d387df74e175659ad9c8a16ae8e5b364b7d3f56 (diff)
hwmon: (ultra45_env) Fix checkpatch issues
Fixed: WARNING: line over 80 characters WARNING: simple_strtol is obsolete, use kstrtol instead Modify multi-line comments to follow Documentation/CodingStyle. Not fixed (false positive): ERROR: Macros with multiple statements should be enclosed in a do - while loop Cc: David S. Miller <davem@davemloft.net> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'drivers/hwmon/ultra45_env.c')
-rw-r--r--drivers/hwmon/ultra45_env.c34
1 files changed, 24 insertions, 10 deletions
diff --git a/drivers/hwmon/ultra45_env.c b/drivers/hwmon/ultra45_env.c
index b9a87e89bab4..c315c59f61fe 100644
--- a/drivers/hwmon/ultra45_env.c
+++ b/drivers/hwmon/ultra45_env.c
@@ -1,4 +1,5 @@
1/* ultra45_env.c: Driver for Ultra45 PIC16F747 environmental monitor. 1/*
2 * ultra45_env.c: Driver for Ultra45 PIC16F747 environmental monitor.
2 * 3 *
3 * Copyright (C) 2008 David S. Miller <davem@davemloft.net> 4 * Copyright (C) 2008 David S. Miller <davem@davemloft.net>
4 */ 5 */
@@ -82,7 +83,8 @@ static void env_write(struct env *p, u8 ireg, u8 val)
82 spin_unlock(&p->lock); 83 spin_unlock(&p->lock);
83} 84}
84 85
85/* There seems to be a adr7462 providing these values, thus a lot 86/*
87 * There seems to be a adr7462 providing these values, thus a lot
86 * of these calculations are borrowed from the adt7470 driver. 88 * of these calculations are borrowed from the adt7470 driver.
87 */ 89 */
88#define FAN_PERIOD_TO_RPM(x) ((90000 * 60) / (x)) 90#define FAN_PERIOD_TO_RPM(x) ((90000 * 60) / (x))
@@ -90,7 +92,8 @@ static void env_write(struct env *p, u8 ireg, u8 val)
90#define FAN_PERIOD_INVALID (0xff << 8) 92#define FAN_PERIOD_INVALID (0xff << 8)
91#define FAN_DATA_VALID(x) ((x) && (x) != FAN_PERIOD_INVALID) 93#define FAN_DATA_VALID(x) ((x) && (x) != FAN_PERIOD_INVALID)
92 94
93static ssize_t show_fan_speed(struct device *dev, struct device_attribute *attr, char *buf) 95static ssize_t show_fan_speed(struct device *dev, struct device_attribute *attr,
96 char *buf)
94{ 97{
95 int fan_nr = to_sensor_dev_attr(attr)->index; 98 int fan_nr = to_sensor_dev_attr(attr)->index;
96 struct env *p = dev_get_drvdata(dev); 99 struct env *p = dev_get_drvdata(dev);
@@ -111,10 +114,15 @@ static ssize_t set_fan_speed(struct device *dev, struct device_attribute *attr,
111 const char *buf, size_t count) 114 const char *buf, size_t count)
112{ 115{
113 int fan_nr = to_sensor_dev_attr(attr)->index; 116 int fan_nr = to_sensor_dev_attr(attr)->index;
114 int rpm = simple_strtol(buf, NULL, 10); 117 unsigned long rpm;
115 struct env *p = dev_get_drvdata(dev); 118 struct env *p = dev_get_drvdata(dev);
116 int period; 119 int period;
117 u8 val; 120 u8 val;
121 int err;
122
123 err = kstrtoul(buf, 10, &rpm);
124 if (err)
125 return err;
118 126
119 if (!rpm) 127 if (!rpm)
120 return -EINVAL; 128 return -EINVAL;
@@ -126,7 +134,8 @@ static ssize_t set_fan_speed(struct device *dev, struct device_attribute *attr,
126 return count; 134 return count;
127} 135}
128 136
129static ssize_t show_fan_fault(struct device *dev, struct device_attribute *attr, char *buf) 137static ssize_t show_fan_fault(struct device *dev, struct device_attribute *attr,
138 char *buf)
130{ 139{
131 int fan_nr = to_sensor_dev_attr(attr)->index; 140 int fan_nr = to_sensor_dev_attr(attr)->index;
132 struct env *p = dev_get_drvdata(dev); 141 struct env *p = dev_get_drvdata(dev);
@@ -148,7 +157,8 @@ fan(4);
148 157
149static SENSOR_DEVICE_ATTR(psu_fan_fault, S_IRUGO, show_fan_fault, NULL, 6); 158static SENSOR_DEVICE_ATTR(psu_fan_fault, S_IRUGO, show_fan_fault, NULL, 6);
150 159
151static ssize_t show_temp(struct device *dev, struct device_attribute *attr, char *buf) 160static ssize_t show_temp(struct device *dev, struct device_attribute *attr,
161 char *buf)
152{ 162{
153 int temp_nr = to_sensor_dev_attr(attr)->index; 163 int temp_nr = to_sensor_dev_attr(attr)->index;
154 struct env *p = dev_get_drvdata(dev); 164 struct env *p = dev_get_drvdata(dev);
@@ -168,7 +178,8 @@ static SENSOR_DEVICE_ATTR(lsi1064_local_temp, S_IRUGO, show_temp, NULL, 6);
168static SENSOR_DEVICE_ATTR(front_panel_temp, S_IRUGO, show_temp, NULL, 7); 178static SENSOR_DEVICE_ATTR(front_panel_temp, S_IRUGO, show_temp, NULL, 7);
169static SENSOR_DEVICE_ATTR(psu_temp, S_IRUGO, show_temp, NULL, 13); 179static SENSOR_DEVICE_ATTR(psu_temp, S_IRUGO, show_temp, NULL, 13);
170 180
171static ssize_t show_stat_bit(struct device *dev, struct device_attribute *attr, char *buf) 181static ssize_t show_stat_bit(struct device *dev, struct device_attribute *attr,
182 char *buf)
172{ 183{
173 int index = to_sensor_dev_attr(attr)->index; 184 int index = to_sensor_dev_attr(attr)->index;
174 struct env *p = dev_get_drvdata(dev); 185 struct env *p = dev_get_drvdata(dev);
@@ -181,9 +192,11 @@ static ssize_t show_stat_bit(struct device *dev, struct device_attribute *attr,
181static SENSOR_DEVICE_ATTR(fan_failure, S_IRUGO, show_stat_bit, NULL, 0); 192static SENSOR_DEVICE_ATTR(fan_failure, S_IRUGO, show_stat_bit, NULL, 0);
182static SENSOR_DEVICE_ATTR(env_bus_busy, S_IRUGO, show_stat_bit, NULL, 1); 193static SENSOR_DEVICE_ATTR(env_bus_busy, S_IRUGO, show_stat_bit, NULL, 1);
183static SENSOR_DEVICE_ATTR(env_data_stale, S_IRUGO, show_stat_bit, NULL, 2); 194static SENSOR_DEVICE_ATTR(env_data_stale, S_IRUGO, show_stat_bit, NULL, 2);
184static SENSOR_DEVICE_ATTR(tpm_self_test_passed, S_IRUGO, show_stat_bit, NULL, 3); 195static SENSOR_DEVICE_ATTR(tpm_self_test_passed, S_IRUGO, show_stat_bit, NULL,
196 3);
185 197
186static ssize_t show_fwver(struct device *dev, struct device_attribute *attr, char *buf) 198static ssize_t show_fwver(struct device *dev, struct device_attribute *attr,
199 char *buf)
187{ 200{
188 struct env *p = dev_get_drvdata(dev); 201 struct env *p = dev_get_drvdata(dev);
189 u8 val; 202 u8 val;
@@ -194,7 +207,8 @@ static ssize_t show_fwver(struct device *dev, struct device_attribute *attr, cha
194 207
195static SENSOR_DEVICE_ATTR(firmware_version, S_IRUGO, show_fwver, NULL, 0); 208static SENSOR_DEVICE_ATTR(firmware_version, S_IRUGO, show_fwver, NULL, 0);
196 209
197static ssize_t show_name(struct device *dev, struct device_attribute *attr, char *buf) 210static ssize_t show_name(struct device *dev, struct device_attribute *attr,
211 char *buf)
198{ 212{
199 return sprintf(buf, "ultra45\n"); 213 return sprintf(buf, "ultra45\n");
200} 214}