summaryrefslogtreecommitdiff
path: root/drivers/hwmon/pmbus/ucd9000.c
diff options
context:
space:
mode:
authorDmitry Torokhov <dmitry.torokhov@gmail.com>2012-05-24 12:13:01 +0400
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2012-05-24 12:13:01 +0400
commite644dae645e167d154c0526358940986682a72b0 (patch)
tree972993c6568085b8d407fc7e13de10f4b93c651d /drivers/hwmon/pmbus/ucd9000.c
parent899c612d74d4a242158a4db20367388d6299c028 (diff)
parent86809173ce32ef03bd4d0389dfc72df0c805e9c4 (diff)
downloadlinux-e644dae645e167d154c0526358940986682a72b0.tar.xz
Merge branch 'next' into for-linus
Diffstat (limited to 'drivers/hwmon/pmbus/ucd9000.c')
-rw-r--r--drivers/hwmon/pmbus/ucd9000.c47
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,
"Device mismatch: Configured %s, detected %s\n",
id->name, mid->name);
- data = kzalloc(sizeof(struct ucd9000_data), GFP_KERNEL);
+ data = devm_kzalloc(&client->dev, sizeof(struct ucd9000_data),
+ GFP_KERNEL);
if (!data)
return -ENOMEM;
info = &data->info;
@@ -164,13 +165,12 @@ static int ucd9000_probe(struct i2c_client *client,
if (ret < 0) {
dev_err(&client->dev,
"Failed to read number of active pages\n");
- goto out;
+ return ret;
}
info->pages = ret;
if (!info->pages) {
dev_err(&client->dev, "No pages configured\n");
- ret = -ENODEV;
- goto out;
+ return -ENODEV;
}
/* The internal temperature sensor is always active */
@@ -181,8 +181,7 @@ static int ucd9000_probe(struct i2c_client *client,
block_buffer);
if (ret <= 0) {
dev_err(&client->dev, "Failed to read configuration data\n");
- ret = -ENODEV;
- goto out;
+ return -ENODEV;
}
for (i = 0; i < ret; i++) {
int page = UCD9000_MON_PAGE(block_buffer[i]);
@@ -218,7 +217,7 @@ static int ucd9000_probe(struct i2c_client *client,
UCD9000_FAN_CONFIG,
data->fan_data[i]);
if (ret < 0)
- goto out;
+ return ret;
}
i2c_smbus_write_byte_data(client, UCD9000_FAN_CONFIG_INDEX, 0);
@@ -227,49 +226,21 @@ static int ucd9000_probe(struct i2c_client *client,
| PMBUS_HAVE_FAN34 | PMBUS_HAVE_STATUS_FAN34;
}
- ret = pmbus_do_probe(client, mid, info);
- if (ret < 0)
- goto out;
- return 0;
-
-out:
- kfree(data);
- return ret;
-}
-
-static int ucd9000_remove(struct i2c_client *client)
-{
- struct ucd9000_data *data;
-
- data = to_ucd9000_data(pmbus_get_driver_info(client));
- pmbus_do_remove(client);
- kfree(data);
- return 0;
+ return pmbus_do_probe(client, mid, info);
}
-
/* This is the driver that will be inserted */
static struct i2c_driver ucd9000_driver = {
.driver = {
.name = "ucd9000",
},
.probe = ucd9000_probe,
- .remove = ucd9000_remove,
+ .remove = pmbus_do_remove,
.id_table = ucd9000_id,
};
-static int __init ucd9000_init(void)
-{
- return i2c_add_driver(&ucd9000_driver);
-}
-
-static void __exit ucd9000_exit(void)
-{
- i2c_del_driver(&ucd9000_driver);
-}
+module_i2c_driver(ucd9000_driver);
MODULE_AUTHOR("Guenter Roeck");
MODULE_DESCRIPTION("PMBus driver for TI UCD90xxx");
MODULE_LICENSE("GPL");
-module_init(ucd9000_init);
-module_exit(ucd9000_exit);