diff mbox series

media: davinci: Use platform_get_irq() to get the interrupt

Message ID 20220308064228.2078109-1-chi.minghao@zte.com.cn (mailing list archive)
State New, archived
Headers show
Series media: davinci: Use platform_get_irq() to get the interrupt | expand

Commit Message

CGEL March 8, 2022, 6:42 a.m. UTC
From: Minghao Chi (CGEL ZTE) <chi.minghao@zte.com.cn>

platform_get_resource(pdev, IORESOURCE_IRQ, ..) relies on static
allocation of IRQ resources in DT core code, this causes an issue
when using hierarchical interrupt domains using "interrupts" property
in the node as this bypasses the hierarchical setup and messes up the
irq chaining.

In preparation for removal of static setup of IRQ resource from DT core
code use platform_get_irq().

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Minghao Chi (CGEL ZTE) <chi.minghao@zte.com.cn>
---
 drivers/media/platform/davinci/vpfe_capture.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

Comments

Lad, Prabhakar March 8, 2022, 11:40 p.m. UTC | #1
On Tue, Mar 8, 2022 at 6:42 AM <cgel.zte@gmail.com> wrote:
>
> From: Minghao Chi (CGEL ZTE) <chi.minghao@zte.com.cn>
>
> platform_get_resource(pdev, IORESOURCE_IRQ, ..) relies on static
> allocation of IRQ resources in DT core code, this causes an issue
> when using hierarchical interrupt domains using "interrupts" property
> in the node as this bypasses the hierarchical setup and messes up the
> irq chaining.
>
> In preparation for removal of static setup of IRQ resource from DT core
> code use platform_get_irq().
>
> Reported-by: Zeal Robot <zealci@zte.com.cn>
> Signed-off-by: Minghao Chi (CGEL ZTE) <chi.minghao@zte.com.cn>
> ---
>  drivers/media/platform/davinci/vpfe_capture.c | 15 +++++++--------
>  1 file changed, 7 insertions(+), 8 deletions(-)
>
NAK!

vpfe_capture driver doesn't support DT.

Cheers,
Prabhakar

> diff --git a/drivers/media/platform/davinci/vpfe_capture.c b/drivers/media/platform/davinci/vpfe_capture.c
> index 0a2226b321d7..b3cafa16a1ad 100644
> --- a/drivers/media/platform/davinci/vpfe_capture.c
> +++ b/drivers/media/platform/davinci/vpfe_capture.c
> @@ -1674,11 +1674,10 @@ static int vpfe_probe(struct platform_device *pdev)
>  {
>         struct vpfe_subdev_info *sdinfo;
>         struct vpfe_config *vpfe_cfg;
> -       struct resource *res1;
>         struct vpfe_device *vpfe_dev;
>         struct i2c_adapter *i2c_adap;
>         struct video_device *vfd;
> -       int ret, i, j;
> +       int ret, i, j, irq;
>         int num_subdevs = 0;
>
>         /* Get the pointer to the device object */
> @@ -1717,24 +1716,24 @@ static int vpfe_probe(struct platform_device *pdev)
>
>         strscpy(ccdc_cfg->name, vpfe_cfg->ccdc, sizeof(ccdc_cfg->name));
>         /* Get VINT0 irq resource */
> -       res1 = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
> -       if (!res1) {
> +       irq = platform_get_irq(pdev, 0);
> +       if (irq < 0) {
>                 v4l2_err(pdev->dev.driver,
>                          "Unable to get interrupt for VINT0\n");
>                 ret = -ENODEV;
>                 goto probe_free_ccdc_cfg_mem;
>         }
> -       vpfe_dev->ccdc_irq0 = res1->start;
> +       vpfe_dev->ccdc_irq0 = irq;
>
>         /* Get VINT1 irq resource */
> -       res1 = platform_get_resource(pdev, IORESOURCE_IRQ, 1);
> -       if (!res1) {
> +       irq = platform_get_irq(pdev, 1);
> +       if (irq < 0) {
>                 v4l2_err(pdev->dev.driver,
>                          "Unable to get interrupt for VINT1\n");
>                 ret = -ENODEV;
>                 goto probe_free_ccdc_cfg_mem;
>         }
> -       vpfe_dev->ccdc_irq1 = res1->start;
> +       vpfe_dev->ccdc_irq1 = irq;
>
>         ret = request_irq(vpfe_dev->ccdc_irq0, vpfe_isr, 0,
>                           "vpfe_capture0", vpfe_dev);
> --
> 2.25.1
>
diff mbox series

Patch

diff --git a/drivers/media/platform/davinci/vpfe_capture.c b/drivers/media/platform/davinci/vpfe_capture.c
index 0a2226b321d7..b3cafa16a1ad 100644
--- a/drivers/media/platform/davinci/vpfe_capture.c
+++ b/drivers/media/platform/davinci/vpfe_capture.c
@@ -1674,11 +1674,10 @@  static int vpfe_probe(struct platform_device *pdev)
 {
 	struct vpfe_subdev_info *sdinfo;
 	struct vpfe_config *vpfe_cfg;
-	struct resource *res1;
 	struct vpfe_device *vpfe_dev;
 	struct i2c_adapter *i2c_adap;
 	struct video_device *vfd;
-	int ret, i, j;
+	int ret, i, j, irq;
 	int num_subdevs = 0;
 
 	/* Get the pointer to the device object */
@@ -1717,24 +1716,24 @@  static int vpfe_probe(struct platform_device *pdev)
 
 	strscpy(ccdc_cfg->name, vpfe_cfg->ccdc, sizeof(ccdc_cfg->name));
 	/* Get VINT0 irq resource */
-	res1 = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
-	if (!res1) {
+	irq = platform_get_irq(pdev, 0);
+	if (irq < 0) {
 		v4l2_err(pdev->dev.driver,
 			 "Unable to get interrupt for VINT0\n");
 		ret = -ENODEV;
 		goto probe_free_ccdc_cfg_mem;
 	}
-	vpfe_dev->ccdc_irq0 = res1->start;
+	vpfe_dev->ccdc_irq0 = irq;
 
 	/* Get VINT1 irq resource */
-	res1 = platform_get_resource(pdev, IORESOURCE_IRQ, 1);
-	if (!res1) {
+	irq = platform_get_irq(pdev, 1);
+	if (irq < 0) {
 		v4l2_err(pdev->dev.driver,
 			 "Unable to get interrupt for VINT1\n");
 		ret = -ENODEV;
 		goto probe_free_ccdc_cfg_mem;
 	}
-	vpfe_dev->ccdc_irq1 = res1->start;
+	vpfe_dev->ccdc_irq1 = irq;
 
 	ret = request_irq(vpfe_dev->ccdc_irq0, vpfe_isr, 0,
 			  "vpfe_capture0", vpfe_dev);