aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLad, Prabhakar <prabhakar.csengg@gmail.com>2013-06-17 10:20:46 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2013-06-21 10:26:39 -0400
commitb2de4f2584b717cb5a0d0d40a3d2fba1c2063f34 (patch)
tree79b2c55f79fdfe422fc6f3d9d517e1e9d9104333
parentfe424b2fc2674a13b7746b2cb3b0eb88b1fe182d (diff)
[media] media: davinci: vpif_capture: Convert to devm_* api
use devm_request_irq() instead of request_irq(). 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_capture.c36
1 files changed, 12 insertions, 24 deletions
diff --git a/drivers/media/platform/davinci/vpif_capture.c b/drivers/media/platform/davinci/vpif_capture.c
index 091c7a4c8226..a4e0eab47289 100644
--- a/drivers/media/platform/davinci/vpif_capture.c
+++ b/drivers/media/platform/davinci/vpif_capture.c
@@ -2016,14 +2016,14 @@ static __init int vpif_probe(struct platform_device *pdev)
2016 2016
2017 while ((res = platform_get_resource(pdev, IORESOURCE_IRQ, res_idx))) { 2017 while ((res = platform_get_resource(pdev, IORESOURCE_IRQ, res_idx))) {
2018 for (i = res->start; i <= res->end; i++) { 2018 for (i = res->start; i <= res->end; i++) {
2019 if (request_irq(i, vpif_channel_isr, IRQF_SHARED, 2019 err = devm_request_irq(&pdev->dev, i, vpif_channel_isr,
2020 "VPIF_Capture", (void *) 2020 IRQF_SHARED, "VPIF_Capture",
2021 (&vpif_obj.dev[res_idx]->channel_id))) { 2021 (void *)(&vpif_obj.dev[res_idx]->
2022 err = -EBUSY; 2022 channel_id));
2023 for (j = 0; j < i; j++) 2023 if (err) {
2024 free_irq(j, (void *) 2024 err = -EINVAL;
2025 (&vpif_obj.dev[res_idx]->channel_id)); 2025 goto vpif_unregister;
2026 goto vpif_int_err; 2026
2027 } 2027 }
2028 } 2028 }
2029 res_idx++; 2029 res_idx++;
@@ -2040,7 +2040,7 @@ static __init int vpif_probe(struct platform_device *pdev)
2040 video_device_release(ch->video_dev); 2040 video_device_release(ch->video_dev);
2041 } 2041 }
2042 err = -ENOMEM; 2042 err = -ENOMEM;
2043 goto vpif_int_err; 2043 goto vpif_unregister;
2044 } 2044 }
2045 2045
2046 /* Initialize field of video device */ 2046 /* Initialize field of video device */
@@ -2141,13 +2141,9 @@ vpif_sd_error:
2141 /* Note: does nothing if ch->video_dev == NULL */ 2141 /* Note: does nothing if ch->video_dev == NULL */
2142 video_device_release(ch->video_dev); 2142 video_device_release(ch->video_dev);
2143 } 2143 }
2144vpif_int_err: 2144vpif_unregister:
2145 v4l2_device_unregister(&vpif_obj.v4l2_dev); 2145 v4l2_device_unregister(&vpif_obj.v4l2_dev);
2146 for (i = 0; i < res_idx; i++) { 2146
2147 res = platform_get_resource(pdev, IORESOURCE_IRQ, i);
2148 for (j = res->start; j <= res->end; j++)
2149 free_irq(j, (void *)(&vpif_obj.dev[i]->channel_id));
2150 }
2151 return err; 2147 return err;
2152} 2148}
2153 2149
@@ -2160,15 +2156,7 @@ vpif_int_err:
2160static int vpif_remove(struct platform_device *device) 2156static int vpif_remove(struct platform_device *device)
2161{ 2157{
2162 struct channel_obj *ch; 2158 struct channel_obj *ch;
2163 struct resource *res; 2159 int i;
2164 int irq_num, i = 0;
2165
2166 while ((res = platform_get_resource(device, IORESOURCE_IRQ, i))) {
2167 for (irq_num = res->start; irq_num <= res->end; irq_num++)
2168 free_irq(irq_num,
2169 (void *)(&vpif_obj.dev[i]->channel_id));
2170 i++;
2171 }
2172 2160
2173 v4l2_device_unregister(&vpif_obj.v4l2_dev); 2161 v4l2_device_unregister(&vpif_obj.v4l2_dev);
2174 2162