diff options
Diffstat (limited to 'drivers/hwmon/pmbus/ucd9200.c')
-rw-r--r-- | drivers/hwmon/pmbus/ucd9200.c | 43 |
1 files changed, 8 insertions, 35 deletions
diff --git a/drivers/hwmon/pmbus/ucd9200.c b/drivers/hwmon/pmbus/ucd9200.c index 6e1c1a80ab85..033d6aca47d3 100644 --- a/drivers/hwmon/pmbus/ucd9200.c +++ b/drivers/hwmon/pmbus/ucd9200.c | |||
@@ -81,7 +81,8 @@ static int ucd9200_probe(struct i2c_client *client, | |||
81 | "Device mismatch: Configured %s, detected %s\n", | 81 | "Device mismatch: Configured %s, detected %s\n", |
82 | id->name, mid->name); | 82 | id->name, mid->name); |
83 | 83 | ||
84 | info = kzalloc(sizeof(struct pmbus_driver_info), GFP_KERNEL); | 84 | info = devm_kzalloc(&client->dev, sizeof(struct pmbus_driver_info), |
85 | GFP_KERNEL); | ||
85 | if (!info) | 86 | if (!info) |
86 | return -ENOMEM; | 87 | return -ENOMEM; |
87 | 88 | ||
@@ -89,7 +90,7 @@ static int ucd9200_probe(struct i2c_client *client, | |||
89 | block_buffer); | 90 | block_buffer); |
90 | if (ret < 0) { | 91 | if (ret < 0) { |
91 | dev_err(&client->dev, "Failed to read phase information\n"); | 92 | dev_err(&client->dev, "Failed to read phase information\n"); |
92 | goto out; | 93 | return ret; |
93 | } | 94 | } |
94 | 95 | ||
95 | /* | 96 | /* |
@@ -106,8 +107,7 @@ static int ucd9200_probe(struct i2c_client *client, | |||
106 | } | 107 | } |
107 | if (!info->pages) { | 108 | if (!info->pages) { |
108 | dev_err(&client->dev, "No rails configured\n"); | 109 | dev_err(&client->dev, "No rails configured\n"); |
109 | ret = -ENODEV; | 110 | return -ENODEV; |
110 | goto out; | ||
111 | } | 111 | } |
112 | dev_info(&client->dev, "%d rails configured\n", info->pages); | 112 | dev_info(&client->dev, "%d rails configured\n", info->pages); |
113 | 113 | ||
@@ -137,7 +137,7 @@ static int ucd9200_probe(struct i2c_client *client, | |||
137 | if (ret < 0) { | 137 | if (ret < 0) { |
138 | dev_err(&client->dev, | 138 | dev_err(&client->dev, |
139 | "Failed to initialize PHASE registers\n"); | 139 | "Failed to initialize PHASE registers\n"); |
140 | goto out; | 140 | return ret; |
141 | } | 141 | } |
142 | } | 142 | } |
143 | if (info->pages > 1) | 143 | if (info->pages > 1) |
@@ -160,48 +160,21 @@ static int ucd9200_probe(struct i2c_client *client, | |||
160 | if (mid->driver_data == ucd9240) | 160 | if (mid->driver_data == ucd9240) |
161 | info->func[0] |= PMBUS_HAVE_FAN12 | PMBUS_HAVE_STATUS_FAN12; | 161 | info->func[0] |= PMBUS_HAVE_FAN12 | PMBUS_HAVE_STATUS_FAN12; |
162 | 162 | ||
163 | ret = pmbus_do_probe(client, mid, info); | 163 | return pmbus_do_probe(client, mid, info); |
164 | if (ret < 0) | ||
165 | goto out; | ||
166 | return 0; | ||
167 | out: | ||
168 | kfree(info); | ||
169 | return ret; | ||
170 | } | ||
171 | |||
172 | static int ucd9200_remove(struct i2c_client *client) | ||
173 | { | ||
174 | const struct pmbus_driver_info *info; | ||
175 | |||
176 | info = pmbus_get_driver_info(client); | ||
177 | pmbus_do_remove(client); | ||
178 | kfree(info); | ||
179 | return 0; | ||
180 | } | 164 | } |
181 | 165 | ||
182 | |||
183 | /* This is the driver that will be inserted */ | 166 | /* This is the driver that will be inserted */ |
184 | static struct i2c_driver ucd9200_driver = { | 167 | static struct i2c_driver ucd9200_driver = { |
185 | .driver = { | 168 | .driver = { |
186 | .name = "ucd9200", | 169 | .name = "ucd9200", |
187 | }, | 170 | }, |
188 | .probe = ucd9200_probe, | 171 | .probe = ucd9200_probe, |
189 | .remove = ucd9200_remove, | 172 | .remove = pmbus_do_remove, |
190 | .id_table = ucd9200_id, | 173 | .id_table = ucd9200_id, |
191 | }; | 174 | }; |
192 | 175 | ||
193 | static int __init ucd9200_init(void) | 176 | module_i2c_driver(ucd9200_driver); |
194 | { | ||
195 | return i2c_add_driver(&ucd9200_driver); | ||
196 | } | ||
197 | |||
198 | static void __exit ucd9200_exit(void) | ||
199 | { | ||
200 | i2c_del_driver(&ucd9200_driver); | ||
201 | } | ||
202 | 177 | ||
203 | MODULE_AUTHOR("Guenter Roeck"); | 178 | MODULE_AUTHOR("Guenter Roeck"); |
204 | MODULE_DESCRIPTION("PMBus driver for TI UCD922x, UCD924x"); | 179 | MODULE_DESCRIPTION("PMBus driver for TI UCD922x, UCD924x"); |
205 | MODULE_LICENSE("GPL"); | 180 | MODULE_LICENSE("GPL"); |
206 | module_init(ucd9200_init); | ||
207 | module_exit(ucd9200_exit); | ||