diff options
author | Guenter Roeck <linux@roeck-us.net> | 2012-06-02 14:48:01 -0400 |
---|---|---|
committer | Guenter Roeck <linux@roeck-us.net> | 2012-07-22 00:48:43 -0400 |
commit | f187fc040b31d9e7ff90be08d3140732a8450bc4 (patch) | |
tree | 0cca25cad1cb1b3b9333081df1d348ffce26ae9a /drivers/hwmon | |
parent | 2625996b7556f4b23ff73a8280e867372ab54bc4 (diff) |
hwmon: (w83l785ts) Simplify code and improve readability
In probe function, rename new_client variable to client, and introduce
local variable dev to point to client->dev, to simplify the code and
improve readability.
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Acked-by: Jean Delvare <khali@linux-fr.org>
Diffstat (limited to 'drivers/hwmon')
-rw-r--r-- | drivers/hwmon/w83l785ts.c | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/drivers/hwmon/w83l785ts.c b/drivers/hwmon/w83l785ts.c index 5f14e3897058..6d45d23ef752 100644 --- a/drivers/hwmon/w83l785ts.c +++ b/drivers/hwmon/w83l785ts.c | |||
@@ -176,10 +176,11 @@ static int w83l785ts_detect(struct i2c_client *client, | |||
176 | return 0; | 176 | return 0; |
177 | } | 177 | } |
178 | 178 | ||
179 | static int w83l785ts_probe(struct i2c_client *new_client, | 179 | static int w83l785ts_probe(struct i2c_client *client, |
180 | const struct i2c_device_id *id) | 180 | const struct i2c_device_id *id) |
181 | { | 181 | { |
182 | struct w83l785ts_data *data; | 182 | struct w83l785ts_data *data; |
183 | struct device *dev = &client->dev; | ||
183 | int err = 0; | 184 | int err = 0; |
184 | 185 | ||
185 | data = kzalloc(sizeof(struct w83l785ts_data), GFP_KERNEL); | 186 | data = kzalloc(sizeof(struct w83l785ts_data), GFP_KERNEL); |
@@ -188,7 +189,7 @@ static int w83l785ts_probe(struct i2c_client *new_client, | |||
188 | goto exit; | 189 | goto exit; |
189 | } | 190 | } |
190 | 191 | ||
191 | i2c_set_clientdata(new_client, data); | 192 | i2c_set_clientdata(client, data); |
192 | data->valid = 0; | 193 | data->valid = 0; |
193 | mutex_init(&data->update_lock); | 194 | mutex_init(&data->update_lock); |
194 | 195 | ||
@@ -200,18 +201,16 @@ static int w83l785ts_probe(struct i2c_client *new_client, | |||
200 | * Nothing yet, assume it is already started. | 201 | * Nothing yet, assume it is already started. |
201 | */ | 202 | */ |
202 | 203 | ||
203 | err = device_create_file(&new_client->dev, | 204 | err = device_create_file(dev, &sensor_dev_attr_temp1_input.dev_attr); |
204 | &sensor_dev_attr_temp1_input.dev_attr); | ||
205 | if (err) | 205 | if (err) |
206 | goto exit_remove; | 206 | goto exit_remove; |
207 | 207 | ||
208 | err = device_create_file(&new_client->dev, | 208 | err = device_create_file(dev, &sensor_dev_attr_temp1_max.dev_attr); |
209 | &sensor_dev_attr_temp1_max.dev_attr); | ||
210 | if (err) | 209 | if (err) |
211 | goto exit_remove; | 210 | goto exit_remove; |
212 | 211 | ||
213 | /* Register sysfs hooks */ | 212 | /* Register sysfs hooks */ |
214 | data->hwmon_dev = hwmon_device_register(&new_client->dev); | 213 | data->hwmon_dev = hwmon_device_register(dev); |
215 | if (IS_ERR(data->hwmon_dev)) { | 214 | if (IS_ERR(data->hwmon_dev)) { |
216 | err = PTR_ERR(data->hwmon_dev); | 215 | err = PTR_ERR(data->hwmon_dev); |
217 | goto exit_remove; | 216 | goto exit_remove; |
@@ -220,10 +219,8 @@ static int w83l785ts_probe(struct i2c_client *new_client, | |||
220 | return 0; | 219 | return 0; |
221 | 220 | ||
222 | exit_remove: | 221 | exit_remove: |
223 | device_remove_file(&new_client->dev, | 222 | device_remove_file(dev, &sensor_dev_attr_temp1_input.dev_attr); |
224 | &sensor_dev_attr_temp1_input.dev_attr); | 223 | device_remove_file(dev, &sensor_dev_attr_temp1_max.dev_attr); |
225 | device_remove_file(&new_client->dev, | ||
226 | &sensor_dev_attr_temp1_max.dev_attr); | ||
227 | kfree(data); | 224 | kfree(data); |
228 | exit: | 225 | exit: |
229 | return err; | 226 | return err; |