diff mbox series

media: camss: move to use request_irq by IRQF_NO_AUTOEN flag

Message ID 1617776679-4226-1-git-send-email-tiantao6@hisilicon.com (mailing list archive)
State New
Headers show
Series media: camss: move to use request_irq by IRQF_NO_AUTOEN flag | expand

Commit Message

Tian Tao April 7, 2021, 6:24 a.m. UTC
disable_irq() after request_irq() still has a time gap in which
interrupts can come. request_irq() with IRQF_NO_AUTOEN flag will
disable IRQ auto-enable because of requesting.

this patch is made base on "add IRQF_NO_AUTOEN for request_irq" which
is being merged: https://lore.kernel.org/patchwork/patch/1388765/

Signed-off-by: Tian Tao <tiantao6@hisilicon.com>
---
 drivers/media/platform/qcom/camss/camss-csid.c   | 5 ++---
 drivers/media/platform/qcom/camss/camss-csiphy.c | 5 ++---
 2 files changed, 4 insertions(+), 6 deletions(-)

Comments

Robert Foss April 7, 2021, 10:30 a.m. UTC | #1
On Wed, 7 Apr 2021 at 08:24, Tian Tao <tiantao6@hisilicon.com> wrote:
>
> disable_irq() after request_irq() still has a time gap in which
> interrupts can come. request_irq() with IRQF_NO_AUTOEN flag will
> disable IRQ auto-enable because of requesting.
>
> this patch is made base on "add IRQF_NO_AUTOEN for request_irq" which
> is being merged: https://lore.kernel.org/patchwork/patch/1388765/
>
> Signed-off-by: Tian Tao <tiantao6@hisilicon.com>
> ---
>  drivers/media/platform/qcom/camss/camss-csid.c   | 5 ++---
>  drivers/media/platform/qcom/camss/camss-csiphy.c | 5 ++---
>  2 files changed, 4 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/media/platform/qcom/camss/camss-csid.c b/drivers/media/platform/qcom/camss/camss-csid.c
> index 463760c..46c19bf 100644
> --- a/drivers/media/platform/qcom/camss/camss-csid.c
> +++ b/drivers/media/platform/qcom/camss/camss-csid.c
> @@ -586,14 +586,13 @@ int msm_csid_subdev_init(struct camss *camss, struct csid_device *csid,
>         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,
> -                              IRQF_TRIGGER_RISING, csid->irq_name, csid);
> +                              IRQF_TRIGGER_RISING | IRQF_NO_AUTOEN,
> +                              csid->irq_name, csid);
>         if (ret < 0) {
>                 dev_err(dev, "request_irq failed: %d\n", ret);
>                 return ret;
>         }
>
> -       disable_irq(csid->irq);
> -
>         /* Clocks */
>
>         csid->nclocks = 0;
> diff --git a/drivers/media/platform/qcom/camss/camss-csiphy.c b/drivers/media/platform/qcom/camss/camss-csiphy.c
> index 6ceb6d7..fefb4f3 100644
> --- a/drivers/media/platform/qcom/camss/camss-csiphy.c
> +++ b/drivers/media/platform/qcom/camss/camss-csiphy.c
> @@ -625,14 +625,13 @@ int msm_csiphy_subdev_init(struct camss *camss,
>                  dev_name(dev), MSM_CSIPHY_NAME, csiphy->id);
>
>         ret = devm_request_irq(dev, csiphy->irq, csiphy->ops->isr,
> -                              IRQF_TRIGGER_RISING, csiphy->irq_name, csiphy);
> +                              IRQF_TRIGGER_RISING | IRQF_NO_AUTOEN,
> +                              csiphy->irq_name, csiphy);
>         if (ret < 0) {
>                 dev_err(dev, "request_irq failed: %d\n", ret);
>                 return ret;
>         }
>
> -       disable_irq(csiphy->irq);
> -
>         /* Clocks */
>
>         csiphy->nclocks = 0;
> --

When IRQF_NO_AUTOEN[1] lands I'd be happy to see this patch applied as well.

[1]  https://lore.kernel.org/patchwork/patch/1388765/

Reviewed-by: Robert Foss <robert.foss@linaro.org>
diff mbox series

Patch

diff --git a/drivers/media/platform/qcom/camss/camss-csid.c b/drivers/media/platform/qcom/camss/camss-csid.c
index 463760c..46c19bf 100644
--- a/drivers/media/platform/qcom/camss/camss-csid.c
+++ b/drivers/media/platform/qcom/camss/camss-csid.c
@@ -586,14 +586,13 @@  int msm_csid_subdev_init(struct camss *camss, struct csid_device *csid,
 	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,
-			       IRQF_TRIGGER_RISING, csid->irq_name, csid);
+			       IRQF_TRIGGER_RISING | IRQF_NO_AUTOEN,
+			       csid->irq_name, csid);
 	if (ret < 0) {
 		dev_err(dev, "request_irq failed: %d\n", ret);
 		return ret;
 	}
 
-	disable_irq(csid->irq);
-
 	/* Clocks */
 
 	csid->nclocks = 0;
diff --git a/drivers/media/platform/qcom/camss/camss-csiphy.c b/drivers/media/platform/qcom/camss/camss-csiphy.c
index 6ceb6d7..fefb4f3 100644
--- a/drivers/media/platform/qcom/camss/camss-csiphy.c
+++ b/drivers/media/platform/qcom/camss/camss-csiphy.c
@@ -625,14 +625,13 @@  int msm_csiphy_subdev_init(struct camss *camss,
 		 dev_name(dev), MSM_CSIPHY_NAME, csiphy->id);
 
 	ret = devm_request_irq(dev, csiphy->irq, csiphy->ops->isr,
-			       IRQF_TRIGGER_RISING, csiphy->irq_name, csiphy);
+			       IRQF_TRIGGER_RISING | IRQF_NO_AUTOEN,
+			       csiphy->irq_name, csiphy);
 	if (ret < 0) {
 		dev_err(dev, "request_irq failed: %d\n", ret);
 		return ret;
 	}
 
-	disable_irq(csiphy->irq);
-
 	/* Clocks */
 
 	csiphy->nclocks = 0;