diff options
author | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-01-17 16:15:55 -0500 |
---|---|---|
committer | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-01-17 16:15:55 -0500 |
commit | 8dea78da5cee153b8af9c07a2745f6c55057fe12 (patch) | |
tree | a8f4d49d63b1ecc92f2fddceba0655b2472c5bd9 /drivers/hwmon/ltc4261.c | |
parent | 406089d01562f1e2bf9f089fd7637009ebaad589 (diff) |
Patched in Tegra support.
Diffstat (limited to 'drivers/hwmon/ltc4261.c')
-rw-r--r-- | drivers/hwmon/ltc4261.c | 32 |
1 files changed, 24 insertions, 8 deletions
diff --git a/drivers/hwmon/ltc4261.c b/drivers/hwmon/ltc4261.c index 84a2d2872b2..4b50601027d 100644 --- a/drivers/hwmon/ltc4261.c +++ b/drivers/hwmon/ltc4261.c | |||
@@ -33,7 +33,6 @@ | |||
33 | #include <linux/i2c.h> | 33 | #include <linux/i2c.h> |
34 | #include <linux/hwmon.h> | 34 | #include <linux/hwmon.h> |
35 | #include <linux/hwmon-sysfs.h> | 35 | #include <linux/hwmon-sysfs.h> |
36 | #include <linux/jiffies.h> | ||
37 | 36 | ||
38 | /* chip registers */ | 37 | /* chip registers */ |
39 | #define LTC4261_STATUS 0x00 /* readonly */ | 38 | #define LTC4261_STATUS 0x00 /* readonly */ |
@@ -86,7 +85,6 @@ static struct ltc4261_data *ltc4261_update_device(struct device *dev) | |||
86 | "Failed to read ADC value: error %d\n", | 85 | "Failed to read ADC value: error %d\n", |
87 | val); | 86 | val); |
88 | ret = ERR_PTR(val); | 87 | ret = ERR_PTR(val); |
89 | data->valid = 0; | ||
90 | goto abort; | 88 | goto abort; |
91 | } | 89 | } |
92 | data->regs[i] = val; | 90 | data->regs[i] = val; |
@@ -236,9 +234,11 @@ static int ltc4261_probe(struct i2c_client *client, | |||
236 | return -ENODEV; | 234 | return -ENODEV; |
237 | } | 235 | } |
238 | 236 | ||
239 | data = devm_kzalloc(&client->dev, sizeof(*data), GFP_KERNEL); | 237 | data = kzalloc(sizeof(*data), GFP_KERNEL); |
240 | if (!data) | 238 | if (!data) { |
241 | return -ENOMEM; | 239 | ret = -ENOMEM; |
240 | goto out_kzalloc; | ||
241 | } | ||
242 | 242 | ||
243 | i2c_set_clientdata(client, data); | 243 | i2c_set_clientdata(client, data); |
244 | mutex_init(&data->update_lock); | 244 | mutex_init(&data->update_lock); |
@@ -249,7 +249,7 @@ static int ltc4261_probe(struct i2c_client *client, | |||
249 | /* Register sysfs hooks */ | 249 | /* Register sysfs hooks */ |
250 | ret = sysfs_create_group(&client->dev.kobj, <c4261_group); | 250 | ret = sysfs_create_group(&client->dev.kobj, <c4261_group); |
251 | if (ret) | 251 | if (ret) |
252 | return ret; | 252 | goto out_sysfs_create_group; |
253 | 253 | ||
254 | data->hwmon_dev = hwmon_device_register(&client->dev); | 254 | data->hwmon_dev = hwmon_device_register(&client->dev); |
255 | if (IS_ERR(data->hwmon_dev)) { | 255 | if (IS_ERR(data->hwmon_dev)) { |
@@ -261,6 +261,9 @@ static int ltc4261_probe(struct i2c_client *client, | |||
261 | 261 | ||
262 | out_hwmon_device_register: | 262 | out_hwmon_device_register: |
263 | sysfs_remove_group(&client->dev.kobj, <c4261_group); | 263 | sysfs_remove_group(&client->dev.kobj, <c4261_group); |
264 | out_sysfs_create_group: | ||
265 | kfree(data); | ||
266 | out_kzalloc: | ||
264 | return ret; | 267 | return ret; |
265 | } | 268 | } |
266 | 269 | ||
@@ -271,6 +274,8 @@ static int ltc4261_remove(struct i2c_client *client) | |||
271 | hwmon_device_unregister(data->hwmon_dev); | 274 | hwmon_device_unregister(data->hwmon_dev); |
272 | sysfs_remove_group(&client->dev.kobj, <c4261_group); | 275 | sysfs_remove_group(&client->dev.kobj, <c4261_group); |
273 | 276 | ||
277 | kfree(data); | ||
278 | |||
274 | return 0; | 279 | return 0; |
275 | } | 280 | } |
276 | 281 | ||
@@ -291,8 +296,19 @@ static struct i2c_driver ltc4261_driver = { | |||
291 | .id_table = ltc4261_id, | 296 | .id_table = ltc4261_id, |
292 | }; | 297 | }; |
293 | 298 | ||
294 | module_i2c_driver(ltc4261_driver); | 299 | static int __init ltc4261_init(void) |
300 | { | ||
301 | return i2c_add_driver(<c4261_driver); | ||
302 | } | ||
303 | |||
304 | static void __exit ltc4261_exit(void) | ||
305 | { | ||
306 | i2c_del_driver(<c4261_driver); | ||
307 | } | ||
295 | 308 | ||
296 | MODULE_AUTHOR("Guenter Roeck <linux@roeck-us.net>"); | 309 | MODULE_AUTHOR("Guenter Roeck <guenter.roeck@ericsson.com>"); |
297 | MODULE_DESCRIPTION("LTC4261 driver"); | 310 | MODULE_DESCRIPTION("LTC4261 driver"); |
298 | MODULE_LICENSE("GPL"); | 311 | MODULE_LICENSE("GPL"); |
312 | |||
313 | module_init(ltc4261_init); | ||
314 | module_exit(ltc4261_exit); | ||