diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-03-21 13:37:25 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-03-21 13:37:25 -0400 |
commit | 31f6765266417c0d99f0e922fe82848a7c9c2ae9 (patch) | |
tree | 2d5914dac0a918baad37decd3845b8c206051420 /drivers/hwmon/pmbus/ucd9000.c | |
parent | d15d76448bb58c7832e954b6a8f1e301720b7866 (diff) | |
parent | 312869ec935ab3bb67b7ba641a7d11230555aff5 (diff) |
Merge tag 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging
Pull hwmon changes for v3.4 from Guenter Roeck:
"Mostly cleanup. No new drivers this time around, but support for
several chips added to existing drivers: TPS40400, TPS40422, MTD040,
MAX34446, ZL9101M, ZL9117M, and LM96080. Also, added watchdog support
for SCH56xx, and additional attributes for a couple of drivers."
* tag 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging: (137 commits)
hwmon: (sch56xx) Add support for the integrated watchdog (v2)
hwmon: (w83627ehf) Add support for temperature offset registers
hwmon: (jc42) Remove unnecessary device IDs
hwmon: (zl6100) Add support for ZL9101M and ZL9117M
hwmon: (adm1275) Add support for ADM1075
hwmon: (max34440) Add support for MAX34446
hwmon: (pmbus) Add more virtual registers
hwmon: (pmbus) Add support for Lineage Power MDT040
hwmon: (pmbus) Add support for TI TPS40400 and TPS40422
hwmon: (max34440) Add support for 'lowest' output voltage attribute
hwmon: (jc42) Convert to use devm_kzalloc
hwmon: (max16065) Convert to use devm_kzalloc
hwmon: (smm665) Convert to use devm_kzalloc
hwmon: (ltc4261) Convert to use devm_kzalloc
hwmon: (pmbus) Simplify remove functions
hwmon: (pmbus) Convert pmbus drivers to use devm_kzalloc
hwmon: (lineage-pem) Convert to use devm_kzalloc
hwmon: (hwmon-vid) Fix checkpatch issues
hwmon: (hwmon-vid) Add new entries to VRM model table
hwmon: (lm80) Add detection of NatSemi/TI LM96080
...
Diffstat (limited to 'drivers/hwmon/pmbus/ucd9000.c')
-rw-r--r-- | drivers/hwmon/pmbus/ucd9000.c | 47 |
1 files changed, 9 insertions, 38 deletions
diff --git a/drivers/hwmon/pmbus/ucd9000.c b/drivers/hwmon/pmbus/ucd9000.c index 4ff6cf289f85..fbb1479d3ad4 100644 --- a/drivers/hwmon/pmbus/ucd9000.c +++ b/drivers/hwmon/pmbus/ucd9000.c | |||
@@ -155,7 +155,8 @@ static int ucd9000_probe(struct i2c_client *client, | |||
155 | "Device mismatch: Configured %s, detected %s\n", | 155 | "Device mismatch: Configured %s, detected %s\n", |
156 | id->name, mid->name); | 156 | id->name, mid->name); |
157 | 157 | ||
158 | data = kzalloc(sizeof(struct ucd9000_data), GFP_KERNEL); | 158 | data = devm_kzalloc(&client->dev, sizeof(struct ucd9000_data), |
159 | GFP_KERNEL); | ||
159 | if (!data) | 160 | if (!data) |
160 | return -ENOMEM; | 161 | return -ENOMEM; |
161 | info = &data->info; | 162 | info = &data->info; |
@@ -164,13 +165,12 @@ static int ucd9000_probe(struct i2c_client *client, | |||
164 | if (ret < 0) { | 165 | if (ret < 0) { |
165 | dev_err(&client->dev, | 166 | dev_err(&client->dev, |
166 | "Failed to read number of active pages\n"); | 167 | "Failed to read number of active pages\n"); |
167 | goto out; | 168 | return ret; |
168 | } | 169 | } |
169 | info->pages = ret; | 170 | info->pages = ret; |
170 | if (!info->pages) { | 171 | if (!info->pages) { |
171 | dev_err(&client->dev, "No pages configured\n"); | 172 | dev_err(&client->dev, "No pages configured\n"); |
172 | ret = -ENODEV; | 173 | return -ENODEV; |
173 | goto out; | ||
174 | } | 174 | } |
175 | 175 | ||
176 | /* The internal temperature sensor is always active */ | 176 | /* The internal temperature sensor is always active */ |
@@ -181,8 +181,7 @@ static int ucd9000_probe(struct i2c_client *client, | |||
181 | block_buffer); | 181 | block_buffer); |
182 | if (ret <= 0) { | 182 | if (ret <= 0) { |
183 | dev_err(&client->dev, "Failed to read configuration data\n"); | 183 | dev_err(&client->dev, "Failed to read configuration data\n"); |
184 | ret = -ENODEV; | 184 | return -ENODEV; |
185 | goto out; | ||
186 | } | 185 | } |
187 | for (i = 0; i < ret; i++) { | 186 | for (i = 0; i < ret; i++) { |
188 | int page = UCD9000_MON_PAGE(block_buffer[i]); | 187 | int page = UCD9000_MON_PAGE(block_buffer[i]); |
@@ -218,7 +217,7 @@ static int ucd9000_probe(struct i2c_client *client, | |||
218 | UCD9000_FAN_CONFIG, | 217 | UCD9000_FAN_CONFIG, |
219 | data->fan_data[i]); | 218 | data->fan_data[i]); |
220 | if (ret < 0) | 219 | if (ret < 0) |
221 | goto out; | 220 | return ret; |
222 | } | 221 | } |
223 | i2c_smbus_write_byte_data(client, UCD9000_FAN_CONFIG_INDEX, 0); | 222 | i2c_smbus_write_byte_data(client, UCD9000_FAN_CONFIG_INDEX, 0); |
224 | 223 | ||
@@ -227,49 +226,21 @@ static int ucd9000_probe(struct i2c_client *client, | |||
227 | | PMBUS_HAVE_FAN34 | PMBUS_HAVE_STATUS_FAN34; | 226 | | PMBUS_HAVE_FAN34 | PMBUS_HAVE_STATUS_FAN34; |
228 | } | 227 | } |
229 | 228 | ||
230 | ret = pmbus_do_probe(client, mid, info); | 229 | return pmbus_do_probe(client, mid, info); |
231 | if (ret < 0) | ||
232 | goto out; | ||
233 | return 0; | ||
234 | |||
235 | out: | ||
236 | kfree(data); | ||
237 | return ret; | ||
238 | } | ||
239 | |||
240 | static int ucd9000_remove(struct i2c_client *client) | ||
241 | { | ||
242 | struct ucd9000_data *data; | ||
243 | |||
244 | data = to_ucd9000_data(pmbus_get_driver_info(client)); | ||
245 | pmbus_do_remove(client); | ||
246 | kfree(data); | ||
247 | return 0; | ||
248 | } | 230 | } |
249 | 231 | ||
250 | |||
251 | /* This is the driver that will be inserted */ | 232 | /* This is the driver that will be inserted */ |
252 | static struct i2c_driver ucd9000_driver = { | 233 | static struct i2c_driver ucd9000_driver = { |
253 | .driver = { | 234 | .driver = { |
254 | .name = "ucd9000", | 235 | .name = "ucd9000", |
255 | }, | 236 | }, |
256 | .probe = ucd9000_probe, | 237 | .probe = ucd9000_probe, |
257 | .remove = ucd9000_remove, | 238 | .remove = pmbus_do_remove, |
258 | .id_table = ucd9000_id, | 239 | .id_table = ucd9000_id, |
259 | }; | 240 | }; |
260 | 241 | ||
261 | static int __init ucd9000_init(void) | 242 | module_i2c_driver(ucd9000_driver); |
262 | { | ||
263 | return i2c_add_driver(&ucd9000_driver); | ||
264 | } | ||
265 | |||
266 | static void __exit ucd9000_exit(void) | ||
267 | { | ||
268 | i2c_del_driver(&ucd9000_driver); | ||
269 | } | ||
270 | 243 | ||
271 | MODULE_AUTHOR("Guenter Roeck"); | 244 | MODULE_AUTHOR("Guenter Roeck"); |
272 | MODULE_DESCRIPTION("PMBus driver for TI UCD90xxx"); | 245 | MODULE_DESCRIPTION("PMBus driver for TI UCD90xxx"); |
273 | MODULE_LICENSE("GPL"); | 246 | MODULE_LICENSE("GPL"); |
274 | module_init(ucd9000_init); | ||
275 | module_exit(ucd9000_exit); | ||