diff mbox series

[4/7] iio:adc:sun4i-gpadc: Use new IRQF_NO_AUTOEN flag instead of request then disable

Message ID 20210402184544.488862-5-jic23@kernel.org (mailing list archive)
State New, archived
Headers show
Series iio: Use IRQF_NO_AUTOEN | expand

Commit Message

Jonathan Cameron April 2, 2021, 6:45 p.m. UTC
From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

This new flag ensures a requested irq is not autoenabled, thus removing
the need for the disable_irq() that follows and closing off any chance
of spurious interrupts.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Maxime Ripard <maxime.ripard@bootlin.com>
---
 drivers/iio/adc/sun4i-gpadc-iio.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Song Bao Hua (Barry Song) April 2, 2021, 8:13 p.m. UTC | #1
> -----Original Message-----
> From: Jonathan Cameron [mailto:jic23@kernel.org]
> Sent: Saturday, April 3, 2021 7:46 AM
> To: linux-iio@vger.kernel.org
> Cc: Song Bao Hua (Barry Song) <song.bao.hua@hisilicon.com>; Jonathan Cameron
> <jonathan.cameron@huawei.com>; Maxime Ripard <maxime.ripard@bootlin.com>
> Subject: [PATCH 4/7] iio:adc:sun4i-gpadc: Use new IRQF_NO_AUTOEN flag instead
> of request then disable
> 
> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> 
> This new flag ensures a requested irq is not autoenabled, thus removing
> the need for the disable_irq() that follows and closing off any chance
> of spurious interrupts.
> 
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> Cc: Maxime Ripard <maxime.ripard@bootlin.com>
> ---

Reviewed-by: Barry Song <song.bao.hua@hisilicon.com>

>  drivers/iio/adc/sun4i-gpadc-iio.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/iio/adc/sun4i-gpadc-iio.c
> b/drivers/iio/adc/sun4i-gpadc-iio.c
> index 99b43f28e879..2d393a4dfff6 100644
> --- a/drivers/iio/adc/sun4i-gpadc-iio.c
> +++ b/drivers/iio/adc/sun4i-gpadc-iio.c
> @@ -470,7 +470,8 @@ static int sun4i_irq_init(struct platform_device *pdev,
> const char *name,
>  	}
> 
>  	*irq = ret;
> -	ret = devm_request_any_context_irq(&pdev->dev, *irq, handler, 0,
> +	ret = devm_request_any_context_irq(&pdev->dev, *irq, handler,
> +					   IRQF_NO_AUTOEN,
>  					   devname, info);
>  	if (ret < 0) {
>  		dev_err(&pdev->dev, "could not request %s interrupt: %d\n",
> @@ -478,7 +479,6 @@ static int sun4i_irq_init(struct platform_device *pdev,
> const char *name,
>  		return ret;
>  	}
> 
> -	disable_irq(*irq);
>  	atomic_set(atomic, 0);
> 
>  	return 0;
> --
> 2.31.1
Jonathan Cameron April 5, 2021, 2:35 p.m. UTC | #2
On Fri, 2 Apr 2021 20:13:00 +0000
"Song Bao Hua (Barry Song)" <song.bao.hua@hisilicon.com> wrote:

> > -----Original Message-----
> > From: Jonathan Cameron [mailto:jic23@kernel.org]
> > Sent: Saturday, April 3, 2021 7:46 AM
> > To: linux-iio@vger.kernel.org
> > Cc: Song Bao Hua (Barry Song) <song.bao.hua@hisilicon.com>; Jonathan Cameron
> > <jonathan.cameron@huawei.com>; Maxime Ripard <maxime.ripard@bootlin.com>
> > Subject: [PATCH 4/7] iio:adc:sun4i-gpadc: Use new IRQF_NO_AUTOEN flag instead
> > of request then disable
> > 
> > From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> > 
> > This new flag ensures a requested irq is not autoenabled, thus removing
> > the need for the disable_irq() that follows and closing off any chance
> > of spurious interrupts.
> > 
> > Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> > Cc: Maxime Ripard <maxime.ripard@bootlin.com>
> > ---  
> 
> Reviewed-by: Barry Song <song.bao.hua@hisilicon.com>

Applied to the togreg branch of iio.git and pushed out as testing
to let 0-day poke at it.   Other feedback whilst it's doing that
most welcome.

Thanks,

Jonathan

> 
> >  drivers/iio/adc/sun4i-gpadc-iio.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/iio/adc/sun4i-gpadc-iio.c
> > b/drivers/iio/adc/sun4i-gpadc-iio.c
> > index 99b43f28e879..2d393a4dfff6 100644
> > --- a/drivers/iio/adc/sun4i-gpadc-iio.c
> > +++ b/drivers/iio/adc/sun4i-gpadc-iio.c
> > @@ -470,7 +470,8 @@ static int sun4i_irq_init(struct platform_device *pdev,
> > const char *name,
> >  	}
> > 
> >  	*irq = ret;
> > -	ret = devm_request_any_context_irq(&pdev->dev, *irq, handler, 0,
> > +	ret = devm_request_any_context_irq(&pdev->dev, *irq, handler,
> > +					   IRQF_NO_AUTOEN,
> >  					   devname, info);
> >  	if (ret < 0) {
> >  		dev_err(&pdev->dev, "could not request %s interrupt: %d\n",
> > @@ -478,7 +479,6 @@ static int sun4i_irq_init(struct platform_device *pdev,
> > const char *name,
> >  		return ret;
> >  	}
> > 
> > -	disable_irq(*irq);
> >  	atomic_set(atomic, 0);
> > 
> >  	return 0;
> > --
> > 2.31.1  
>
diff mbox series

Patch

diff --git a/drivers/iio/adc/sun4i-gpadc-iio.c b/drivers/iio/adc/sun4i-gpadc-iio.c
index 99b43f28e879..2d393a4dfff6 100644
--- a/drivers/iio/adc/sun4i-gpadc-iio.c
+++ b/drivers/iio/adc/sun4i-gpadc-iio.c
@@ -470,7 +470,8 @@  static int sun4i_irq_init(struct platform_device *pdev, const char *name,
 	}
 
 	*irq = ret;
-	ret = devm_request_any_context_irq(&pdev->dev, *irq, handler, 0,
+	ret = devm_request_any_context_irq(&pdev->dev, *irq, handler,
+					   IRQF_NO_AUTOEN,
 					   devname, info);
 	if (ret < 0) {
 		dev_err(&pdev->dev, "could not request %s interrupt: %d\n",
@@ -478,7 +479,6 @@  static int sun4i_irq_init(struct platform_device *pdev, const char *name,
 		return ret;
 	}
 
-	disable_irq(*irq);
 	atomic_set(atomic, 0);
 
 	return 0;