aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-integrator
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2013-11-21 17:21:10 -0500
committerLinus Walleij <linus.walleij@linaro.org>2014-02-13 05:21:28 -0500
commit31d951e2c985165a57a4885079d8dbfeed231a26 (patch)
tree158fedda3055b0448cd1c9f97f6fcff32e4215c0 /arch/arm/mach-integrator
parente641b987c20832dfaaa51d7792ed928c2b2d2dbf (diff)
ARM: integrator: use managed resources for the IM-PD1
Switch the IM-PD1 driver to use managed resources and cut down on boilerplate. Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'arch/arm/mach-integrator')
-rw-r--r--arch/arm/mach-integrator/impd1.c36
1 files changed, 10 insertions, 26 deletions
diff --git a/arch/arm/mach-integrator/impd1.c b/arch/arm/mach-integrator/impd1.c
index 9f82f9dcbb98..aeeae0d79a18 100644
--- a/arch/arm/mach-integrator/impd1.c
+++ b/arch/arm/mach-integrator/impd1.c
@@ -307,25 +307,23 @@ static struct impd1_device impd1_devs[] = {
307static int impd1_probe(struct lm_device *dev) 307static int impd1_probe(struct lm_device *dev)
308{ 308{
309 struct impd1_module *impd1; 309 struct impd1_module *impd1;
310 int i, ret; 310 int i;
311 311
312 if (dev->id != module_id) 312 if (dev->id != module_id)
313 return -EINVAL; 313 return -EINVAL;
314 314
315 if (!request_mem_region(dev->resource.start, SZ_4K, "LM registers")) 315 if (!devm_request_mem_region(&dev->dev, dev->resource.start,
316 SZ_4K, "LM registers"))
316 return -EBUSY; 317 return -EBUSY;
317 318
318 impd1 = kzalloc(sizeof(struct impd1_module), GFP_KERNEL); 319 impd1 = devm_kzalloc(&dev->dev, sizeof(struct impd1_module),
319 if (!impd1) { 320 GFP_KERNEL);
320 ret = -ENOMEM; 321 if (!impd1)
321 goto release_lm; 322 return -ENOMEM;
322 }
323 323
324 impd1->base = ioremap(dev->resource.start, SZ_4K); 324 impd1->base = devm_ioremap(&dev->dev, dev->resource.start, SZ_4K);
325 if (!impd1->base) { 325 if (!impd1->base)
326 ret = -ENOMEM; 326 return -ENOMEM;
327 goto free_impd1;
328 }
329 327
330 lm_set_drvdata(dev, impd1); 328 lm_set_drvdata(dev, impd1);
331 329
@@ -353,14 +351,6 @@ static int impd1_probe(struct lm_device *dev)
353 } 351 }
354 352
355 return 0; 353 return 0;
356
357 free_impd1:
358 if (impd1 && impd1->base)
359 iounmap(impd1->base);
360 kfree(impd1);
361 release_lm:
362 release_mem_region(dev->resource.start, SZ_4K);
363 return ret;
364} 354}
365 355
366static int impd1_remove_one(struct device *dev, void *data) 356static int impd1_remove_one(struct device *dev, void *data)
@@ -371,16 +361,10 @@ static int impd1_remove_one(struct device *dev, void *data)
371 361
372static void impd1_remove(struct lm_device *dev) 362static void impd1_remove(struct lm_device *dev)
373{ 363{
374 struct impd1_module *impd1 = lm_get_drvdata(dev);
375
376 device_for_each_child(&dev->dev, NULL, impd1_remove_one); 364 device_for_each_child(&dev->dev, NULL, impd1_remove_one);
377 integrator_impd1_clk_exit(dev->id); 365 integrator_impd1_clk_exit(dev->id);
378 366
379 lm_set_drvdata(dev, NULL); 367 lm_set_drvdata(dev, NULL);
380
381 iounmap(impd1->base);
382 kfree(impd1);
383 release_mem_region(dev->resource.start, SZ_4K);
384} 368}
385 369
386static struct lm_driver impd1_driver = { 370static struct lm_driver impd1_driver = {