[PATCH] media: davinci: Use platform_get_irq() to get the interrupt

From: cgel . zte
Date: Tue Mar 08 2022 - 01:42:49 EST


From: Minghao Chi (CGEL ZTE) <chi.minghao@xxxxxxxxxx>

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@xxxxxxxxxx>
Signed-off-by: Minghao Chi (CGEL ZTE) <chi.minghao@xxxxxxxxxx>
---
drivers/media/platform/davinci/vpfe_capture.c | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)

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