aboutsummaryrefslogtreecommitdiff
path: root/drivers/hwmon/adm1029.c
diff options
context:
space:
mode:
authorFrans Meulenbroeks <fransmeulenbroeks@gmail.com>2012-01-08 19:34:18 +0100
committerGuenter Roeck <guenter.roeck@ericsson.com>2012-03-18 18:26:31 -0700
commit08f509077499907c8bae59818771ce18d3179aa9 (patch)
tree2c7855e24158a1860ab66ae09a92a1a3a4bebd53 /drivers/hwmon/adm1029.c
parent4d7c5d4f40246f0f50767a1fe6445e067a972c64 (diff)
hwmon: (adm1029) fix checkpatch issues
fixed: ERROR: space prohibited after that open parenthesis '(' +#define DIV_FROM_REG(val) ( 1 << (((val) >> 6) - 1)) WARNING: simple_strtol is obsolete, use kstrtol instead + long val = simple_strtol(buf, NULL, 10); ERROR: do not use assignment in if condition + if ((err = sysfs_create_group(&client->dev.kobj, &adm1029_group))) Signed-off-by: Frans Meulenbroeks <fransmeulenbroeks@gmail.com> Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
Diffstat (limited to 'drivers/hwmon/adm1029.c')
-rw-r--r--drivers/hwmon/adm1029.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/drivers/hwmon/adm1029.c b/drivers/hwmon/adm1029.c
index 0b8a3b145bd..d789c334476 100644
--- a/drivers/hwmon/adm1029.c
+++ b/drivers/hwmon/adm1029.c
@@ -78,7 +78,7 @@ static const unsigned short normal_i2c[] = { 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d,
#define TEMP_FROM_REG(val) ((val) * 1000)
-#define DIV_FROM_REG(val) ( 1 << (((val) >> 6) - 1))
+#define DIV_FROM_REG(val) (1 << (((val) >> 6) - 1))
/* Registers to be checked by adm1029_update_device() */
static const u8 ADM1029_REG_TEMP[] = {
@@ -200,8 +200,11 @@ static ssize_t set_fan_div(struct device *dev,
struct i2c_client *client = to_i2c_client(dev);
struct adm1029_data *data = i2c_get_clientdata(client);
struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
- long val = simple_strtol(buf, NULL, 10);
u8 reg;
+ long val;
+ int ret = kstrtol(buf, 10, &val);
+ if (ret < 0)
+ return ret;
mutex_lock(&data->update_lock);
@@ -355,7 +358,8 @@ static int adm1029_probe(struct i2c_client *client,
}
/* Register sysfs hooks */
- if ((err = sysfs_create_group(&client->dev.kobj, &adm1029_group)))
+ err = sysfs_create_group(&client->dev.kobj, &adm1029_group);
+ if (err)
goto exit_free;
data->hwmon_dev = hwmon_device_register(&client->dev);