diff options
author | Lad, Prabhakar <prabhakar.csengg@gmail.com> | 2013-06-17 10:20:42 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2013-06-21 10:25:09 -0400 |
commit | c7f808d19d344a33f6687a0558553a415eca2902 (patch) | |
tree | e675d1120d87dd4e005c6dce5e23b12e15951e57 | |
parent | 01105690c40ceafc28df15e8b3eae6cd668229d5 (diff) |
[media] media: davinci: vpif: Convert to devm_* api
Use devm_ioremap_resource instead of reques_mem_region()/ioremap().
This ensures more consistent error values and simplifies error paths.
Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r-- | drivers/media/platform/davinci/vpif.c | 27 |
1 files changed, 4 insertions, 23 deletions
diff --git a/drivers/media/platform/davinci/vpif.c b/drivers/media/platform/davinci/vpif.c index 761c8259a8af..164c1b7b4e6f 100644 --- a/drivers/media/platform/davinci/vpif.c +++ b/drivers/media/platform/davinci/vpif.c | |||
@@ -37,8 +37,6 @@ MODULE_LICENSE("GPL"); | |||
37 | #define VPIF_CH2_MAX_MODES (15) | 37 | #define VPIF_CH2_MAX_MODES (15) |
38 | #define VPIF_CH3_MAX_MODES (02) | 38 | #define VPIF_CH3_MAX_MODES (02) |
39 | 39 | ||
40 | static resource_size_t res_len; | ||
41 | static struct resource *res; | ||
42 | spinlock_t vpif_lock; | 40 | spinlock_t vpif_lock; |
43 | 41 | ||
44 | void __iomem *vpif_base; | 42 | void __iomem *vpif_base; |
@@ -421,23 +419,12 @@ EXPORT_SYMBOL(vpif_channel_getfid); | |||
421 | 419 | ||
422 | static int vpif_probe(struct platform_device *pdev) | 420 | static int vpif_probe(struct platform_device *pdev) |
423 | { | 421 | { |
424 | int status = 0; | 422 | static struct resource *res; |
425 | 423 | ||
426 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 424 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
427 | if (!res) | 425 | vpif_base = devm_ioremap_resource(&pdev->dev, res); |
428 | return -ENOENT; | 426 | if (IS_ERR(vpif_base)) |
429 | 427 | return PTR_ERR(vpif_base); | |
430 | res_len = resource_size(res); | ||
431 | |||
432 | res = request_mem_region(res->start, res_len, res->name); | ||
433 | if (!res) | ||
434 | return -EBUSY; | ||
435 | |||
436 | vpif_base = ioremap(res->start, res_len); | ||
437 | if (!vpif_base) { | ||
438 | status = -EBUSY; | ||
439 | goto fail; | ||
440 | } | ||
441 | 428 | ||
442 | pm_runtime_enable(&pdev->dev); | 429 | pm_runtime_enable(&pdev->dev); |
443 | pm_runtime_get(&pdev->dev); | 430 | pm_runtime_get(&pdev->dev); |
@@ -445,17 +432,11 @@ static int vpif_probe(struct platform_device *pdev) | |||
445 | spin_lock_init(&vpif_lock); | 432 | spin_lock_init(&vpif_lock); |
446 | dev_info(&pdev->dev, "vpif probe success\n"); | 433 | dev_info(&pdev->dev, "vpif probe success\n"); |
447 | return 0; | 434 | return 0; |
448 | |||
449 | fail: | ||
450 | release_mem_region(res->start, res_len); | ||
451 | return status; | ||
452 | } | 435 | } |
453 | 436 | ||
454 | static int vpif_remove(struct platform_device *pdev) | 437 | static int vpif_remove(struct platform_device *pdev) |
455 | { | 438 | { |
456 | pm_runtime_disable(&pdev->dev); | 439 | pm_runtime_disable(&pdev->dev); |
457 | iounmap(vpif_base); | ||
458 | release_mem_region(res->start, res_len); | ||
459 | return 0; | 440 | return 0; |
460 | } | 441 | } |
461 | 442 | ||