diff options
author | Guenter Roeck <linux@roeck-us.net> | 2012-01-15 01:33:01 -0500 |
---|---|---|
committer | Guenter Roeck <guenter.roeck@ericsson.com> | 2012-03-18 21:27:10 -0400 |
commit | 4d387df74e175659ad9c8a16ae8e5b364b7d3f56 (patch) | |
tree | 0826ebba1b914e5b2ff7127ec32433eca9b0d309 /drivers/hwmon/thmc50.c | |
parent | 85a0c0d1a17cd83f4c2cec09c3ae69ed210f23b2 (diff) |
hwmon: (thmc50) Fix checkpatch issues
Fixed:
ERROR: code indent should use tabs where possible
ERROR: do not use assignment in if condition
WARNING: simple_strtol is obsolete, use kstrtol instead
WARNING: simple_strtoul is obsolete, use kstrtoul 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: Krzysztof Helt <krzysztof.h1@wp.pl>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'drivers/hwmon/thmc50.c')
-rw-r--r-- | drivers/hwmon/thmc50.c | 71 |
1 files changed, 44 insertions, 27 deletions
diff --git a/drivers/hwmon/thmc50.c b/drivers/hwmon/thmc50.c index bd83bc0cd8c..add9f019b24 100644 --- a/drivers/hwmon/thmc50.c +++ b/drivers/hwmon/thmc50.c | |||
@@ -1,24 +1,24 @@ | |||
1 | /* | 1 | /* |
2 | thmc50.c - Part of lm_sensors, Linux kernel modules for hardware | 2 | * thmc50.c - Part of lm_sensors, Linux kernel modules for hardware |
3 | monitoring | 3 | * monitoring |
4 | Copyright (C) 2007 Krzysztof Helt <krzysztof.h1@wp.pl> | 4 | * Copyright (C) 2007 Krzysztof Helt <krzysztof.h1@wp.pl> |
5 | Based on 2.4 driver by Frodo Looijaard <frodol@dds.nl> and | 5 | * Based on 2.4 driver by Frodo Looijaard <frodol@dds.nl> and |
6 | Philip Edelbrock <phil@netroedge.com> | 6 | * Philip Edelbrock <phil@netroedge.com> |
7 | 7 | * | |
8 | This program is free software; you can redistribute it and/or modify | 8 | * This program is free software; you can redistribute it and/or modify |
9 | it under the terms of the GNU General Public License as published by | 9 | * it under the terms of the GNU General Public License as published by |
10 | the Free Software Foundation; either version 2 of the License, or | 10 | * the Free Software Foundation; either version 2 of the License, or |
11 | (at your option) any later version. | 11 | * (at your option) any later version. |
12 | 12 | * | |
13 | This program is distributed in the hope that it will be useful, | 13 | * This program is distributed in the hope that it will be useful, |
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | GNU General Public License for more details. | 16 | * GNU General Public License for more details. |
17 | 17 | * | |
18 | You should have received a copy of the GNU General Public License | 18 | * You should have received a copy of the GNU General Public License |
19 | along with this program; if not, write to the Free Software | 19 | * along with this program; if not, write to the Free Software |
20 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 20 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
21 | */ | 21 | */ |
22 | 22 | ||
23 | #include <linux/module.h> | 23 | #include <linux/module.h> |
24 | #include <linux/init.h> | 24 | #include <linux/init.h> |
@@ -124,8 +124,13 @@ static ssize_t set_analog_out(struct device *dev, | |||
124 | { | 124 | { |
125 | struct i2c_client *client = to_i2c_client(dev); | 125 | struct i2c_client *client = to_i2c_client(dev); |
126 | struct thmc50_data *data = i2c_get_clientdata(client); | 126 | struct thmc50_data *data = i2c_get_clientdata(client); |
127 | int tmp = simple_strtoul(buf, NULL, 10); | ||
128 | int config; | 127 | int config; |
128 | unsigned long tmp; | ||
129 | int err; | ||
130 | |||
131 | err = kstrtoul(buf, 10, &tmp); | ||
132 | if (err) | ||
133 | return err; | ||
129 | 134 | ||
130 | mutex_lock(&data->update_lock); | 135 | mutex_lock(&data->update_lock); |
131 | data->analog_out = SENSORS_LIMIT(tmp, 0, 255); | 136 | data->analog_out = SENSORS_LIMIT(tmp, 0, 255); |
@@ -173,7 +178,12 @@ static ssize_t set_temp_min(struct device *dev, struct device_attribute *attr, | |||
173 | int nr = to_sensor_dev_attr(attr)->index; | 178 | int nr = to_sensor_dev_attr(attr)->index; |
174 | struct i2c_client *client = to_i2c_client(dev); | 179 | struct i2c_client *client = to_i2c_client(dev); |
175 | struct thmc50_data *data = i2c_get_clientdata(client); | 180 | struct thmc50_data *data = i2c_get_clientdata(client); |
176 | int val = simple_strtol(buf, NULL, 10); | 181 | long val; |
182 | int err; | ||
183 | |||
184 | err = kstrtol(buf, 10, &val); | ||
185 | if (err) | ||
186 | return err; | ||
177 | 187 | ||
178 | mutex_lock(&data->update_lock); | 188 | mutex_lock(&data->update_lock); |
179 | data->temp_min[nr] = SENSORS_LIMIT(val / 1000, -128, 127); | 189 | data->temp_min[nr] = SENSORS_LIMIT(val / 1000, -128, 127); |
@@ -197,7 +207,12 @@ static ssize_t set_temp_max(struct device *dev, struct device_attribute *attr, | |||
197 | int nr = to_sensor_dev_attr(attr)->index; | 207 | int nr = to_sensor_dev_attr(attr)->index; |
198 | struct i2c_client *client = to_i2c_client(dev); | 208 | struct i2c_client *client = to_i2c_client(dev); |
199 | struct thmc50_data *data = i2c_get_clientdata(client); | 209 | struct thmc50_data *data = i2c_get_clientdata(client); |
200 | int val = simple_strtol(buf, NULL, 10); | 210 | long val; |
211 | int err; | ||
212 | |||
213 | err = kstrtol(buf, 10, &val); | ||
214 | if (err) | ||
215 | return err; | ||
201 | 216 | ||
202 | mutex_lock(&data->update_lock); | 217 | mutex_lock(&data->update_lock); |
203 | data->temp_max[nr] = SENSORS_LIMIT(val / 1000, -128, 127); | 218 | data->temp_max[nr] = SENSORS_LIMIT(val / 1000, -128, 127); |
@@ -360,14 +375,16 @@ static int thmc50_probe(struct i2c_client *client, | |||
360 | thmc50_init_client(client); | 375 | thmc50_init_client(client); |
361 | 376 | ||
362 | /* Register sysfs hooks */ | 377 | /* Register sysfs hooks */ |
363 | if ((err = sysfs_create_group(&client->dev.kobj, &thmc50_group))) | 378 | err = sysfs_create_group(&client->dev.kobj, &thmc50_group); |
379 | if (err) | ||
364 | goto exit_free; | 380 | goto exit_free; |
365 | 381 | ||
366 | /* Register ADM1022 sysfs hooks */ | 382 | /* Register ADM1022 sysfs hooks */ |
367 | if (data->has_temp3) | 383 | if (data->has_temp3) { |
368 | if ((err = sysfs_create_group(&client->dev.kobj, | 384 | err = sysfs_create_group(&client->dev.kobj, &temp3_group); |
369 | &temp3_group))) | 385 | if (err) |
370 | goto exit_remove_sysfs_thmc50; | 386 | goto exit_remove_sysfs_thmc50; |
387 | } | ||
371 | 388 | ||
372 | /* Register a new directory entry with module sensors */ | 389 | /* Register a new directory entry with module sensors */ |
373 | data->hwmon_dev = hwmon_device_register(&client->dev); | 390 | data->hwmon_dev = hwmon_device_register(&client->dev); |