aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorGuenter Roeck <linux@roeck-us.net>2012-01-15 00:29:27 -0500
committerGuenter Roeck <guenter.roeck@ericsson.com>2012-03-18 21:27:26 -0400
commit8958dfb74a8b8673824d21efabaf565777c549fe (patch)
tree4e00131ed476e933f7e86d30b3fd089902a06685 /drivers
parent09770b261914166f326dcff5e43794a5f53e0f6a (diff)
hwmon: (max1619): Fix checkpatch issues
Fixed: ERROR: do not use assignment in if condition ERROR: trailing whitespace WARNING: line over 80 characters WARNING: please, no spaces at the start of a line WARNING: simple_strtol is obsolete, use kstrtol instead Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/hwmon/max1619.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/drivers/hwmon/max1619.c b/drivers/hwmon/max1619.c
index 135822e05c4d..ecac04a7b7d6 100644
--- a/drivers/hwmon/max1619.c
+++ b/drivers/hwmon/max1619.c
@@ -125,7 +125,7 @@ struct max1619_data {
125 u8 temp_input2, temp_low2, temp_high2; /* remote */ 125 u8 temp_input2, temp_low2, temp_high2; /* remote */
126 u8 temp_crit2; 126 u8 temp_crit2;
127 u8 temp_hyst2; 127 u8 temp_hyst2;
128 u8 alarms; 128 u8 alarms;
129}; 129};
130 130
131/* 131/*
@@ -133,7 +133,8 @@ struct max1619_data {
133 */ 133 */
134 134
135#define show_temp(value) \ 135#define show_temp(value) \
136static ssize_t show_##value(struct device *dev, struct device_attribute *attr, char *buf) \ 136static ssize_t show_##value(struct device *dev, struct device_attribute *attr, \
137 char *buf) \
137{ \ 138{ \
138 struct max1619_data *data = max1619_update_device(dev); \ 139 struct max1619_data *data = max1619_update_device(dev); \
139 return sprintf(buf, "%d\n", temp_from_reg(data->value)); \ 140 return sprintf(buf, "%d\n", temp_from_reg(data->value)); \
@@ -146,13 +147,17 @@ show_temp(temp_crit2);
146show_temp(temp_hyst2); 147show_temp(temp_hyst2);
147 148
148#define set_temp2(value, reg) \ 149#define set_temp2(value, reg) \
149static ssize_t set_##value(struct device *dev, struct device_attribute *attr, const char *buf, \ 150static ssize_t set_##value(struct device *dev, struct device_attribute *attr, \
151 const char *buf, \
150 size_t count) \ 152 size_t count) \
151{ \ 153{ \
152 struct i2c_client *client = to_i2c_client(dev); \ 154 struct i2c_client *client = to_i2c_client(dev); \
153 struct max1619_data *data = i2c_get_clientdata(client); \ 155 struct max1619_data *data = i2c_get_clientdata(client); \
154 long val = simple_strtol(buf, NULL, 10); \ 156 long val; \
155 \ 157 int err = kstrtol(buf, 10, &val); \
158 if (err) \
159 return err; \
160\
156 mutex_lock(&data->update_lock); \ 161 mutex_lock(&data->update_lock); \
157 data->value = temp_to_reg(val); \ 162 data->value = temp_to_reg(val); \
158 i2c_smbus_write_byte_data(client, reg, data->value); \ 163 i2c_smbus_write_byte_data(client, reg, data->value); \
@@ -165,7 +170,8 @@ set_temp2(temp_high2, MAX1619_REG_W_REMOTE_HIGH);
165set_temp2(temp_crit2, MAX1619_REG_W_REMOTE_CRIT); 170set_temp2(temp_crit2, MAX1619_REG_W_REMOTE_CRIT);
166set_temp2(temp_hyst2, MAX1619_REG_W_TCRIT_HYST); 171set_temp2(temp_hyst2, MAX1619_REG_W_TCRIT_HYST);
167 172
168static ssize_t show_alarms(struct device *dev, struct device_attribute *attr, char *buf) 173static ssize_t show_alarms(struct device *dev, struct device_attribute *attr,
174 char *buf)
169{ 175{
170 struct max1619_data *data = max1619_update_device(dev); 176 struct max1619_data *data = max1619_update_device(dev);
171 return sprintf(buf, "%d\n", data->alarms); 177 return sprintf(buf, "%d\n", data->alarms);
@@ -275,7 +281,8 @@ static int max1619_probe(struct i2c_client *new_client,
275 max1619_init_client(new_client); 281 max1619_init_client(new_client);
276 282
277 /* Register sysfs hooks */ 283 /* Register sysfs hooks */
278 if ((err = sysfs_create_group(&new_client->dev.kobj, &max1619_group))) 284 err = sysfs_create_group(&new_client->dev.kobj, &max1619_group);
285 if (err)
279 goto exit_free; 286 goto exit_free;
280 287
281 data->hwmon_dev = hwmon_device_register(&new_client->dev); 288 data->hwmon_dev = hwmon_device_register(&new_client->dev);