diff options
-rw-r--r-- | drivers/mfd/pcf50633-core.c | 36 |
1 files changed, 10 insertions, 26 deletions
diff --git a/drivers/mfd/pcf50633-core.c b/drivers/mfd/pcf50633-core.c index 189c2f07b83f..29c122bf28ea 100644 --- a/drivers/mfd/pcf50633-core.c +++ b/drivers/mfd/pcf50633-core.c | |||
@@ -204,7 +204,7 @@ static int __devinit pcf50633_probe(struct i2c_client *client, | |||
204 | return -ENOENT; | 204 | return -ENOENT; |
205 | } | 205 | } |
206 | 206 | ||
207 | pcf = kzalloc(sizeof(*pcf), GFP_KERNEL); | 207 | pcf = devm_kzalloc(&client->dev, sizeof(*pcf), GFP_KERNEL); |
208 | if (!pcf) | 208 | if (!pcf) |
209 | return -ENOMEM; | 209 | return -ENOMEM; |
210 | 210 | ||
@@ -212,12 +212,11 @@ static int __devinit pcf50633_probe(struct i2c_client *client, | |||
212 | 212 | ||
213 | mutex_init(&pcf->lock); | 213 | mutex_init(&pcf->lock); |
214 | 214 | ||
215 | pcf->regmap = regmap_init_i2c(client, &pcf50633_regmap_config); | 215 | pcf->regmap = devm_regmap_init_i2c(client, &pcf50633_regmap_config); |
216 | if (IS_ERR(pcf->regmap)) { | 216 | if (IS_ERR(pcf->regmap)) { |
217 | ret = PTR_ERR(pcf->regmap); | 217 | ret = PTR_ERR(pcf->regmap); |
218 | dev_err(pcf->dev, "Failed to allocate register map: %d\n", | 218 | dev_err(pcf->dev, "Failed to allocate register map: %d\n", ret); |
219 | ret); | 219 | return ret; |
220 | goto err_free; | ||
221 | } | 220 | } |
222 | 221 | ||
223 | i2c_set_clientdata(client, pcf); | 222 | i2c_set_clientdata(client, pcf); |
@@ -228,7 +227,7 @@ static int __devinit pcf50633_probe(struct i2c_client *client, | |||
228 | if (version < 0 || variant < 0) { | 227 | if (version < 0 || variant < 0) { |
229 | dev_err(pcf->dev, "Unable to probe pcf50633\n"); | 228 | dev_err(pcf->dev, "Unable to probe pcf50633\n"); |
230 | ret = -ENODEV; | 229 | ret = -ENODEV; |
231 | goto err_regmap; | 230 | return ret; |
232 | } | 231 | } |
233 | 232 | ||
234 | dev_info(pcf->dev, "Probed device version %d variant %d\n", | 233 | dev_info(pcf->dev, "Probed device version %d variant %d\n", |
@@ -237,16 +236,11 @@ static int __devinit pcf50633_probe(struct i2c_client *client, | |||
237 | pcf50633_irq_init(pcf, client->irq); | 236 | pcf50633_irq_init(pcf, client->irq); |
238 | 237 | ||
239 | /* Create sub devices */ | 238 | /* Create sub devices */ |
240 | pcf50633_client_dev_register(pcf, "pcf50633-input", | 239 | pcf50633_client_dev_register(pcf, "pcf50633-input", &pcf->input_pdev); |
241 | &pcf->input_pdev); | 240 | pcf50633_client_dev_register(pcf, "pcf50633-rtc", &pcf->rtc_pdev); |
242 | pcf50633_client_dev_register(pcf, "pcf50633-rtc", | 241 | pcf50633_client_dev_register(pcf, "pcf50633-mbc", &pcf->mbc_pdev); |
243 | &pcf->rtc_pdev); | 242 | pcf50633_client_dev_register(pcf, "pcf50633-adc", &pcf->adc_pdev); |
244 | pcf50633_client_dev_register(pcf, "pcf50633-mbc", | 243 | pcf50633_client_dev_register(pcf, "pcf50633-backlight", &pcf->bl_pdev); |
245 | &pcf->mbc_pdev); | ||
246 | pcf50633_client_dev_register(pcf, "pcf50633-adc", | ||
247 | &pcf->adc_pdev); | ||
248 | pcf50633_client_dev_register(pcf, "pcf50633-backlight", | ||
249 | &pcf->bl_pdev); | ||
250 | 244 | ||
251 | 245 | ||
252 | for (i = 0; i < PCF50633_NUM_REGULATORS; i++) { | 246 | for (i = 0; i < PCF50633_NUM_REGULATORS; i++) { |
@@ -274,13 +268,6 @@ static int __devinit pcf50633_probe(struct i2c_client *client, | |||
274 | pdata->probe_done(pcf); | 268 | pdata->probe_done(pcf); |
275 | 269 | ||
276 | return 0; | 270 | return 0; |
277 | |||
278 | err_regmap: | ||
279 | regmap_exit(pcf->regmap); | ||
280 | err_free: | ||
281 | kfree(pcf); | ||
282 | |||
283 | return ret; | ||
284 | } | 271 | } |
285 | 272 | ||
286 | static int __devexit pcf50633_remove(struct i2c_client *client) | 273 | static int __devexit pcf50633_remove(struct i2c_client *client) |
@@ -300,9 +287,6 @@ static int __devexit pcf50633_remove(struct i2c_client *client) | |||
300 | for (i = 0; i < PCF50633_NUM_REGULATORS; i++) | 287 | for (i = 0; i < PCF50633_NUM_REGULATORS; i++) |
301 | platform_device_unregister(pcf->regulator_pdev[i]); | 288 | platform_device_unregister(pcf->regulator_pdev[i]); |
302 | 289 | ||
303 | regmap_exit(pcf->regmap); | ||
304 | kfree(pcf); | ||
305 | |||
306 | return 0; | 290 | return 0; |
307 | } | 291 | } |
308 | 292 | ||