aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/hwmon')
-rw-r--r--drivers/hwmon/w83l785ts.c19
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
179static int w83l785ts_probe(struct i2c_client *new_client, 179static 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
222exit_remove: 221exit_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);
228exit: 225exit:
229 return err; 226 return err;