From patchwork Tue Jan 11 00:23:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prabhakar Mahadev Lad X-Patchwork-Id: 531324 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5627AC433FE for ; Tue, 11 Jan 2022 00:23:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345882AbiAKAXb (ORCPT ); Mon, 10 Jan 2022 19:23:31 -0500 Received: from relmlor2.renesas.com ([210.160.252.172]:4418 "EHLO relmlie6.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S238204AbiAKAXa (ORCPT ); Mon, 10 Jan 2022 19:23:30 -0500 X-IronPort-AV: E=Sophos;i="5.88,278,1635174000"; d="scan'208";a="106595510" Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie6.idc.renesas.com with ESMTP; 11 Jan 2022 09:23:29 +0900 Received: from localhost.localdomain (unknown [10.226.36.204]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id BD5E14157D0D; Tue, 11 Jan 2022 09:23:26 +0900 (JST) From: Lad Prabhakar To: linux-media@vger.kernel.org, Mauro Carvalho Chehab , Hans Verkuil , Robert Foss , Todor Tomov , Andy Gross , Bjorn Andersson Cc: Rob Herring , Andy Shevchenko , Prabhakar , Lad Prabhakar , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 02/13] media: camss: Use platform_get_irq_byname() to get the interrupt Date: Tue, 11 Jan 2022 00:23:03 +0000 Message-Id: <20220111002314.15213-3-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220111002314.15213-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20220111002314.15213-1-prabhakar.mahadev-lad.rj@bp.renesas.com> Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org platform_get_resource_byname(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_byname(). Signed-off-by: Lad Prabhakar --- v1->v2 * No change. --- drivers/media/platform/qcom/camss/camss-csid.c | 12 ++++-------- drivers/media/platform/qcom/camss/camss-csiphy.c | 12 ++++-------- drivers/media/platform/qcom/camss/camss-ispif.c | 12 ++++-------- drivers/media/platform/qcom/camss/camss-vfe.c | 12 ++++-------- 4 files changed, 16 insertions(+), 32 deletions(-) diff --git a/drivers/media/platform/qcom/camss/camss-csid.c b/drivers/media/platform/qcom/camss/camss-csid.c index a1637b78568b..ac3504e98668 100644 --- a/drivers/media/platform/qcom/camss/camss-csid.c +++ b/drivers/media/platform/qcom/camss/camss-csid.c @@ -544,7 +544,6 @@ int msm_csid_subdev_init(struct camss *camss, struct csid_device *csid, { struct device *dev = camss->dev; struct platform_device *pdev = to_platform_device(dev); - struct resource *r; int i, j; int ret; @@ -571,14 +570,11 @@ int msm_csid_subdev_init(struct camss *camss, struct csid_device *csid, /* Interrupt */ - r = platform_get_resource_byname(pdev, IORESOURCE_IRQ, - res->interrupt[0]); - if (!r) { - dev_err(dev, "missing IRQ\n"); - return -EINVAL; - } + ret = platform_get_irq_byname(pdev, res->interrupt[0]); + if (ret < 0) + return ret; - csid->irq = r->start; + csid->irq = ret; snprintf(csid->irq_name, sizeof(csid->irq_name), "%s_%s%d", dev_name(dev), MSM_CSID_NAME, csid->id); ret = devm_request_irq(dev, csid->irq, csid->ops->isr, diff --git a/drivers/media/platform/qcom/camss/camss-csiphy.c b/drivers/media/platform/qcom/camss/camss-csiphy.c index 24eec16197e7..6b225d06f35a 100644 --- a/drivers/media/platform/qcom/camss/camss-csiphy.c +++ b/drivers/media/platform/qcom/camss/camss-csiphy.c @@ -568,7 +568,6 @@ int msm_csiphy_subdev_init(struct camss *camss, { struct device *dev = camss->dev; struct platform_device *pdev = to_platform_device(dev); - struct resource *r; int i, j; int ret; @@ -611,14 +610,11 @@ int msm_csiphy_subdev_init(struct camss *camss, /* Interrupt */ - r = platform_get_resource_byname(pdev, IORESOURCE_IRQ, - res->interrupt[0]); - if (!r) { - dev_err(dev, "missing IRQ\n"); - return -EINVAL; - } + ret = platform_get_irq_byname(pdev, res->interrupt[0]); + if (ret < 0) + return ret; - csiphy->irq = r->start; + csiphy->irq = ret; snprintf(csiphy->irq_name, sizeof(csiphy->irq_name), "%s_%s%d", dev_name(dev), MSM_CSIPHY_NAME, csiphy->id); diff --git a/drivers/media/platform/qcom/camss/camss-ispif.c b/drivers/media/platform/qcom/camss/camss-ispif.c index ba5d65f6ef34..4ee11bb979cd 100644 --- a/drivers/media/platform/qcom/camss/camss-ispif.c +++ b/drivers/media/platform/qcom/camss/camss-ispif.c @@ -1100,7 +1100,6 @@ int msm_ispif_subdev_init(struct camss *camss, struct device *dev = camss->dev; struct ispif_device *ispif = camss->ispif; struct platform_device *pdev = to_platform_device(dev); - struct resource *r; int i; int ret; @@ -1153,14 +1152,11 @@ int msm_ispif_subdev_init(struct camss *camss, /* Interrupt */ - r = platform_get_resource_byname(pdev, IORESOURCE_IRQ, res->interrupt); - - if (!r) { - dev_err(dev, "missing IRQ\n"); - return -EINVAL; - } + ret = platform_get_irq_byname(pdev, res->interrupt); + if (ret < 0) + return ret; - ispif->irq = r->start; + ispif->irq = ret; snprintf(ispif->irq_name, sizeof(ispif->irq_name), "%s_%s", dev_name(dev), MSM_ISPIF_NAME); if (camss->version == CAMSS_8x16) diff --git a/drivers/media/platform/qcom/camss/camss-vfe.c b/drivers/media/platform/qcom/camss/camss-vfe.c index 71f78b40e7f5..7c2311d70546 100644 --- a/drivers/media/platform/qcom/camss/camss-vfe.c +++ b/drivers/media/platform/qcom/camss/camss-vfe.c @@ -1279,7 +1279,6 @@ int msm_vfe_subdev_init(struct camss *camss, struct vfe_device *vfe, { struct device *dev = camss->dev; struct platform_device *pdev = to_platform_device(dev); - struct resource *r; int i, j; int ret; @@ -1312,14 +1311,11 @@ int msm_vfe_subdev_init(struct camss *camss, struct vfe_device *vfe, /* Interrupt */ - r = platform_get_resource_byname(pdev, IORESOURCE_IRQ, - res->interrupt[0]); - if (!r) { - dev_err(dev, "missing IRQ\n"); - return -EINVAL; - } + ret = platform_get_irq_byname(pdev, res->interrupt[0]); + if (ret < 0) + return ret; - vfe->irq = r->start; + vfe->irq = ret; snprintf(vfe->irq_name, sizeof(vfe->irq_name), "%s_%s%d", dev_name(dev), MSM_VFE_NAME, vfe->id); ret = devm_request_irq(dev, vfe->irq, vfe->ops->isr, From patchwork Tue Jan 11 00:23:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prabhakar Mahadev Lad X-Patchwork-Id: 531323 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E1BABC433FE for ; Tue, 11 Jan 2022 00:23:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345906AbiAKAXh (ORCPT ); Mon, 10 Jan 2022 19:23:37 -0500 Received: from relmlor2.renesas.com ([210.160.252.172]:4418 "EHLO relmlie6.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1345900AbiAKAXf (ORCPT ); Mon, 10 Jan 2022 19:23:35 -0500 X-IronPort-AV: E=Sophos;i="5.88,278,1635174000"; d="scan'208";a="106595518" Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie6.idc.renesas.com with ESMTP; 11 Jan 2022 09:23:35 +0900 Received: from localhost.localdomain (unknown [10.226.36.204]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id C71CD4157D3F; Tue, 11 Jan 2022 09:23:32 +0900 (JST) From: Lad Prabhakar To: linux-media@vger.kernel.org, Mauro Carvalho Chehab , Hans Verkuil , Marek Szyprowski , Andrzej Hajda Cc: Rob Herring , Andy Shevchenko , Prabhakar , Lad Prabhakar , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 04/13] media: s5p-mfc: Use platform_get_irq() to get the interrupt Date: Tue, 11 Jan 2022 00:23:05 +0000 Message-Id: <20220111002314.15213-5-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220111002314.15213-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20220111002314.15213-1-prabhakar.mahadev-lad.rj@bp.renesas.com> Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org 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(). Signed-off-by: Lad Prabhakar Reviewed-by: Andrzej Hajda --- v1->v2 * Included RB tag --- drivers/media/platform/s5p-mfc/s5p_mfc.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc.c b/drivers/media/platform/s5p-mfc/s5p_mfc.c index f6732f031e96..761341934925 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc.c @@ -1268,7 +1268,6 @@ static int s5p_mfc_probe(struct platform_device *pdev) { struct s5p_mfc_dev *dev; struct video_device *vfd; - struct resource *res; int ret; pr_debug("%s++\n", __func__); @@ -1294,12 +1293,10 @@ static int s5p_mfc_probe(struct platform_device *pdev) if (IS_ERR(dev->regs_base)) return PTR_ERR(dev->regs_base); - res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); - if (!res) { - dev_err(&pdev->dev, "failed to get irq resource\n"); - return -ENOENT; - } - dev->irq = res->start; + ret = platform_get_irq(pdev, 0); + if (ret < 0) + return ret; + dev->irq = ret; ret = devm_request_irq(&pdev->dev, dev->irq, s5p_mfc_irq, 0, pdev->name, dev); if (ret) { From patchwork Tue Jan 11 00:23:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prabhakar Mahadev Lad X-Patchwork-Id: 531322 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 74C37C433EF for ; Tue, 11 Jan 2022 00:23:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345931AbiAKAXp (ORCPT ); Mon, 10 Jan 2022 19:23:45 -0500 Received: from relmlor1.renesas.com ([210.160.252.171]:60648 "EHLO relmlie5.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1345928AbiAKAXl (ORCPT ); Mon, 10 Jan 2022 19:23:41 -0500 X-IronPort-AV: E=Sophos;i="5.88,278,1635174000"; d="scan'208";a="106050156" Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie5.idc.renesas.com with ESMTP; 11 Jan 2022 09:23:41 +0900 Received: from localhost.localdomain (unknown [10.226.36.204]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id 6F80E4157D3A; Tue, 11 Jan 2022 09:23:39 +0900 (JST) From: Lad Prabhakar To: linux-media@vger.kernel.org, Mauro Carvalho Chehab , Hans Verkuil , "Lad, Prabhakar" Cc: Rob Herring , Andy Shevchenko , Lad Prabhakar , linux-kernel@vger.kernel.org Subject: [PATCH v2 06/13] media: davinci: vpif: Use platform_get_irq_optional() to get the interrupt Date: Tue, 11 Jan 2022 00:23:07 +0000 Message-Id: <20220111002314.15213-7-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220111002314.15213-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20220111002314.15213-1-prabhakar.mahadev-lad.rj@bp.renesas.com> Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org 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_optional(). While at it, propagate error code in case devm_request_irq() fails instead of returning -EINVAL in vpif_display.c. Signed-off-by: Lad Prabhakar --- v1->v2 * Used DEFINE_RES_IRQ_NAMED() macro * Considered IRQ0 as no IRQ. --- drivers/media/platform/davinci/vpif.c | 18 ++++++++------ drivers/media/platform/davinci/vpif_capture.c | 24 ++++++++++++------- drivers/media/platform/davinci/vpif_display.c | 21 ++++++++++------ 3 files changed, 40 insertions(+), 23 deletions(-) diff --git a/drivers/media/platform/davinci/vpif.c b/drivers/media/platform/davinci/vpif.c index 5a89d885d0e3..2dbb464399cc 100644 --- a/drivers/media/platform/davinci/vpif.c +++ b/drivers/media/platform/davinci/vpif.c @@ -20,8 +20,10 @@ #include #include #include +#include #include #include +#include #include #include #include @@ -425,9 +427,10 @@ EXPORT_SYMBOL(vpif_channel_getfid); static int vpif_probe(struct platform_device *pdev) { - static struct resource *res_irq; + static struct resource res_irq; struct platform_device *pdev_capture, *pdev_display; struct device_node *endpoint = NULL; + int irq; vpif_base = devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(vpif_base)) @@ -453,19 +456,20 @@ static int vpif_probe(struct platform_device *pdev) * For DT platforms, manually create platform_devices for * capture/display drivers. */ - res_irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0); - if (!res_irq) { - dev_warn(&pdev->dev, "Missing IRQ resource.\n"); + irq = platform_get_irq(pdev, 0); + if (irq < 0) { pm_runtime_put(&pdev->dev); - return -EINVAL; + return irq; } + res_irq = (struct resource)DEFINE_RES_IRQ_NAMED(irq, of_node_full_name(pdev->dev.of_node)); + res_irq.flags |= irq_get_trigger_type(irq); pdev_capture = devm_kzalloc(&pdev->dev, sizeof(*pdev_capture), GFP_KERNEL); if (pdev_capture) { pdev_capture->name = "vpif_capture"; pdev_capture->id = -1; - pdev_capture->resource = res_irq; + pdev_capture->resource = &res_irq; pdev_capture->num_resources = 1; pdev_capture->dev.dma_mask = pdev->dev.dma_mask; pdev_capture->dev.coherent_dma_mask = pdev->dev.coherent_dma_mask; @@ -480,7 +484,7 @@ static int vpif_probe(struct platform_device *pdev) if (pdev_display) { pdev_display->name = "vpif_display"; pdev_display->id = -1; - pdev_display->resource = res_irq; + pdev_display->resource = &res_irq; pdev_display->num_resources = 1; pdev_display->dev.dma_mask = pdev->dev.dma_mask; pdev_display->dev.coherent_dma_mask = pdev->dev.coherent_dma_mask; diff --git a/drivers/media/platform/davinci/vpif_capture.c b/drivers/media/platform/davinci/vpif_capture.c index 8fe55374c5a3..aaf8a0ec98ff 100644 --- a/drivers/media/platform/davinci/vpif_capture.c +++ b/drivers/media/platform/davinci/vpif_capture.c @@ -1607,7 +1607,6 @@ static __init int vpif_probe(struct platform_device *pdev) { struct vpif_subdev_info *subdevdata; struct i2c_adapter *i2c_adap; - struct resource *res; int subdev_count; int res_idx = 0; int i, err; @@ -1632,15 +1631,22 @@ static __init int vpif_probe(struct platform_device *pdev) goto vpif_free; } - while ((res = platform_get_resource(pdev, IORESOURCE_IRQ, res_idx))) { - err = devm_request_irq(&pdev->dev, res->start, vpif_channel_isr, - IRQF_SHARED, VPIF_DRIVER_NAME, - (void *)(&vpif_obj.dev[res_idx]-> - channel_id)); - if (err) { - err = -EINVAL; + while (1) { + int irq; + + err = platform_get_irq_optional(pdev, res_idx); + if (err < 0 && err != -ENXIO) + goto vpif_unregister; + if (err > 0) + irq = err; + else + break; + + err = devm_request_irq(&pdev->dev, irq, vpif_channel_isr, + IRQF_SHARED, VPIF_DRIVER_NAME, + (void *)(&vpif_obj.dev[res_idx]->channel_id)); + if (err) goto vpif_unregister; - } res_idx++; } diff --git a/drivers/media/platform/davinci/vpif_display.c b/drivers/media/platform/davinci/vpif_display.c index 59f6b782e104..c4a0c4a4448c 100644 --- a/drivers/media/platform/davinci/vpif_display.c +++ b/drivers/media/platform/davinci/vpif_display.c @@ -1221,7 +1221,6 @@ static __init int vpif_probe(struct platform_device *pdev) { struct vpif_subdev_info *subdevdata; struct i2c_adapter *i2c_adap; - struct resource *res; int subdev_count; int res_idx = 0; int i, err; @@ -1245,13 +1244,21 @@ static __init int vpif_probe(struct platform_device *pdev) goto vpif_free; } - while ((res = platform_get_resource(pdev, IORESOURCE_IRQ, res_idx))) { - err = devm_request_irq(&pdev->dev, res->start, vpif_channel_isr, - IRQF_SHARED, VPIF_DRIVER_NAME, - (void *)(&vpif_obj.dev[res_idx]-> - channel_id)); + while (1) { + int irq; + + err = platform_get_irq_optional(pdev, res_idx); + if (err < 0 && err != -ENXIO) + goto vpif_unregister; + if (err > 0) + irq = err; + else + break; + + err = devm_request_irq(&pdev->dev, irq, vpif_channel_isr, + IRQF_SHARED, VPIF_DRIVER_NAME, + (void *)(&vpif_obj.dev[res_idx]->channel_id)); if (err) { - err = -EINVAL; vpif_err("VPIF IRQ request failed\n"); goto vpif_unregister; } From patchwork Tue Jan 11 00:23:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prabhakar Mahadev Lad X-Patchwork-Id: 531321 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id ED2F3C4332F for ; Tue, 11 Jan 2022 00:23:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345960AbiAKAXt (ORCPT ); Mon, 10 Jan 2022 19:23:49 -0500 Received: from relmlor1.renesas.com ([210.160.252.171]:24144 "EHLO relmlie5.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1345923AbiAKAXr (ORCPT ); Mon, 10 Jan 2022 19:23:47 -0500 X-IronPort-AV: E=Sophos;i="5.88,278,1635174000"; d="scan'208";a="106050168" Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie5.idc.renesas.com with ESMTP; 11 Jan 2022 09:23:46 +0900 Received: from localhost.localdomain (unknown [10.226.36.204]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id 005794157D12; Tue, 11 Jan 2022 09:23:44 +0900 (JST) From: Lad Prabhakar To: linux-media@vger.kernel.org, Mauro Carvalho Chehab , Hans Verkuil Cc: Rob Herring , Andy Shevchenko , Prabhakar , Lad Prabhakar , linux-kernel@vger.kernel.org Subject: [PATCH v2 08/13] media: marvell-ccic: Use platform_get_irq() to get the interrupt Date: Tue, 11 Jan 2022 00:23:09 +0000 Message-Id: <20220111002314.15213-9-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220111002314.15213-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20220111002314.15213-1-prabhakar.mahadev-lad.rj@bp.renesas.com> Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org 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(). Signed-off-by: Lad Prabhakar --- v1->v2 * No change. --- drivers/media/platform/marvell-ccic/mmp-driver.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/media/platform/marvell-ccic/mmp-driver.c b/drivers/media/platform/marvell-ccic/mmp-driver.c index 343ab4f7d807..df16899ab1cb 100644 --- a/drivers/media/platform/marvell-ccic/mmp-driver.c +++ b/drivers/media/platform/marvell-ccic/mmp-driver.c @@ -270,12 +270,10 @@ static int mmpcam_probe(struct platform_device *pdev) * Finally, set up our IRQ now that the core is ready to * deal with it. */ - res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); - if (res == NULL) { - ret = -ENODEV; + ret = platform_get_irq(pdev, 0); + if (ret < 0) goto out; - } - cam->irq = res->start; + cam->irq = ret; ret = devm_request_irq(&pdev->dev, cam->irq, mmpcam_irq, IRQF_SHARED, "mmp-camera", mcam); if (ret) From patchwork Tue Jan 11 00:23:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prabhakar Mahadev Lad X-Patchwork-Id: 531320 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D5901C433EF for ; Tue, 11 Jan 2022 00:24:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345926AbiAKAYE (ORCPT ); Mon, 10 Jan 2022 19:24:04 -0500 Received: from relmlor2.renesas.com ([210.160.252.172]:57594 "EHLO relmlie6.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1345920AbiAKAXy (ORCPT ); Mon, 10 Jan 2022 19:23:54 -0500 X-IronPort-AV: E=Sophos;i="5.88,278,1635174000"; d="scan'208";a="106595559" Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie6.idc.renesas.com with ESMTP; 11 Jan 2022 09:23:53 +0900 Received: from localhost.localdomain (unknown [10.226.36.204]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id 376C44157D34; Tue, 11 Jan 2022 09:23:51 +0900 (JST) From: Lad Prabhakar To: linux-media@vger.kernel.org, Mauro Carvalho Chehab , Hans Verkuil , Sylwester Nawrocki , Krzysztof Kozlowski Cc: Rob Herring , Andy Shevchenko , Prabhakar , Lad Prabhakar , linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 10/13] media: exynos4-is: Use platform_get_irq() to get the interrupt Date: Tue, 11 Jan 2022 00:23:11 +0000 Message-Id: <20220111002314.15213-11-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220111002314.15213-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20220111002314.15213-1-prabhakar.mahadev-lad.rj@bp.renesas.com> Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org 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(). Signed-off-by: Lad Prabhakar --- v1->v2 * No change. --- drivers/media/platform/exynos4-is/fimc-core.c | 11 +++++------ drivers/media/platform/exynos4-is/fimc-lite.c | 11 +++++------ 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/drivers/media/platform/exynos4-is/fimc-core.c b/drivers/media/platform/exynos4-is/fimc-core.c index bfdee771cef9..91cc8d58a663 100644 --- a/drivers/media/platform/exynos4-is/fimc-core.c +++ b/drivers/media/platform/exynos4-is/fimc-core.c @@ -926,6 +926,7 @@ static int fimc_probe(struct platform_device *pdev) struct fimc_dev *fimc; struct resource *res; int ret = 0; + int irq; fimc = devm_kzalloc(dev, sizeof(*fimc), GFP_KERNEL); if (!fimc) @@ -965,11 +966,9 @@ static int fimc_probe(struct platform_device *pdev) if (IS_ERR(fimc->regs)) return PTR_ERR(fimc->regs); - res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); - if (res == NULL) { - dev_err(dev, "Failed to get IRQ resource\n"); - return -ENXIO; - } + irq = platform_get_irq(pdev, 0); + if (irq < 0) + return irq; ret = fimc_clk_get(fimc); if (ret) @@ -986,7 +985,7 @@ static int fimc_probe(struct platform_device *pdev) if (ret < 0) return ret; - ret = devm_request_irq(dev, res->start, fimc_irq_handler, + ret = devm_request_irq(dev, irq, fimc_irq_handler, 0, dev_name(dev), fimc); if (ret < 0) { dev_err(dev, "failed to install irq (%d)\n", ret); diff --git a/drivers/media/platform/exynos4-is/fimc-lite.c b/drivers/media/platform/exynos4-is/fimc-lite.c index aaa3af0493ce..9b7cc9564cf1 100644 --- a/drivers/media/platform/exynos4-is/fimc-lite.c +++ b/drivers/media/platform/exynos4-is/fimc-lite.c @@ -1454,6 +1454,7 @@ static int fimc_lite_probe(struct platform_device *pdev) struct fimc_lite *fimc; struct resource *res; int ret; + int irq; if (!dev->of_node) return -ENODEV; @@ -1485,17 +1486,15 @@ static int fimc_lite_probe(struct platform_device *pdev) if (IS_ERR(fimc->regs)) return PTR_ERR(fimc->regs); - res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); - if (res == NULL) { - dev_err(dev, "Failed to get IRQ resource\n"); - return -ENXIO; - } + irq = platform_get_irq(pdev, 0); + if (irq < 0) + return irq; ret = fimc_lite_clk_get(fimc); if (ret) return ret; - ret = devm_request_irq(dev, res->start, flite_irq_handler, + ret = devm_request_irq(dev, irq, flite_irq_handler, 0, dev_name(dev), fimc); if (ret) { dev_err(dev, "Failed to install irq (%d)\n", ret); From patchwork Tue Jan 11 00:23:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prabhakar Mahadev Lad X-Patchwork-Id: 531319 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 57B2EC433F5 for ; Tue, 11 Jan 2022 00:24:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345978AbiAKAYk (ORCPT ); Mon, 10 Jan 2022 19:24:40 -0500 Received: from relmlor1.renesas.com ([210.160.252.171]:52994 "EHLO relmlie5.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1345992AbiAKAYB (ORCPT ); Mon, 10 Jan 2022 19:24:01 -0500 X-IronPort-AV: E=Sophos;i="5.88,278,1635174000"; d="scan'208";a="106050200" Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie5.idc.renesas.com with ESMTP; 11 Jan 2022 09:24:00 +0900 Received: from localhost.localdomain (unknown [10.226.36.204]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id 3B9F74157D12; Tue, 11 Jan 2022 09:23:57 +0900 (JST) From: Lad Prabhakar To: linux-media@vger.kernel.org, Mauro Carvalho Chehab , Hans Verkuil , Minghsiu Tsai , Houlong Wei , Andrew-CT Chen , Tiffany Lin , Matthias Brugger Cc: Rob Herring , Andy Shevchenko , Prabhakar , Lad Prabhakar , linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 12/13] media: mtk-vpu: Drop unnecessary call to platform_get_resource() Date: Tue, 11 Jan 2022 00:23:13 +0000 Message-Id: <20220111002314.15213-13-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220111002314.15213-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20220111002314.15213-1-prabhakar.mahadev-lad.rj@bp.renesas.com> Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org mtk_vpu_probe() calls platform_get_resource(pdev, IORESOURCE_IRQ, ..) to check if IRQ resource exists and later calls platform_get_irq(pdev, ..) to get the actual IRQ. This patch drops an unnecessary call to platform_get_resource() and checks the return value of platform_get_irq(pdev, ..) to make sure the IRQ line is valid. Signed-off-by: Lad Prabhakar --- v1->v2 * No change. --- drivers/media/platform/mtk-vpu/mtk_vpu.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/drivers/media/platform/mtk-vpu/mtk_vpu.c b/drivers/media/platform/mtk-vpu/mtk_vpu.c index 7bd715fc844d..47b684b92f81 100644 --- a/drivers/media/platform/mtk-vpu/mtk_vpu.c +++ b/drivers/media/platform/mtk-vpu/mtk_vpu.c @@ -810,7 +810,6 @@ static int mtk_vpu_probe(struct platform_device *pdev) { struct mtk_vpu *vpu; struct device *dev; - struct resource *res; int ret = 0; dev_dbg(&pdev->dev, "initialization\n"); @@ -908,13 +907,10 @@ static int mtk_vpu_probe(struct platform_device *pdev) init_waitqueue_head(&vpu->run.wq); init_waitqueue_head(&vpu->ack_wq); - res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); - if (!res) { - dev_err(dev, "get IRQ resource failed.\n"); - ret = -ENXIO; + ret = platform_get_irq(pdev, 0); + if (ret < 0) goto free_p_mem; - } - vpu->reg.irq = platform_get_irq(pdev, 0); + vpu->reg.irq = ret; ret = devm_request_irq(dev, vpu->reg.irq, vpu_irq_handler, 0, pdev->name, vpu); if (ret) {