linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 1/1] gpio: wcove: make irq_chip immutable
@ 2022-06-01 15:48 Andy Shevchenko
  2022-06-01 15:51 ` Sathyanarayanan Kuppuswamy
  0 siblings, 1 reply; 4+ messages in thread
From: Andy Shevchenko @ 2022-06-01 15:48 UTC (permalink / raw)
  To: Andy Shevchenko, linux-gpio, linux-kernel
  Cc: Andy Shevchenko, Kuppuswamy Sathyanarayanan, Linus Walleij,
	Bartosz Golaszewski

Since recently, the kernel is nagging about mutable irq_chips:

   "not an immutable chip, please consider fixing it!"

Drop the unneeded copy, flag it as IRQCHIP_IMMUTABLE, add the new
helper functions and call the appropriate gpiolib functions.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/gpio/gpio-wcove.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/gpio/gpio-wcove.c b/drivers/gpio/gpio-wcove.c
index 16a0fae1e32e..c18b6b47384f 100644
--- a/drivers/gpio/gpio-wcove.c
+++ b/drivers/gpio/gpio-wcove.c
@@ -299,6 +299,8 @@ static void wcove_irq_unmask(struct irq_data *data)
 	if (gpio >= WCOVE_GPIO_NUM)
 		return;
 
+	gpiochip_enable_irq(chip, gpio);
+
 	wg->set_irq_mask = false;
 	wg->update |= UPDATE_IRQ_MASK;
 }
@@ -314,15 +316,19 @@ static void wcove_irq_mask(struct irq_data *data)
 
 	wg->set_irq_mask = true;
 	wg->update |= UPDATE_IRQ_MASK;
+
+	gpiochip_disable_irq(chip, gpio);
 }
 
-static struct irq_chip wcove_irqchip = {
+static const struct irq_chip wcove_irqchip = {
 	.name			= "Whiskey Cove",
 	.irq_mask		= wcove_irq_mask,
 	.irq_unmask		= wcove_irq_unmask,
 	.irq_set_type		= wcove_irq_type,
 	.irq_bus_lock		= wcove_bus_lock,
 	.irq_bus_sync_unlock	= wcove_bus_sync_unlock,
+	.flags			= IRQCHIP_IMMUTABLE,
+	GPIOCHIP_IRQ_RESOURCE_HELPERS,
 };
 
 static irqreturn_t wcove_gpio_irq_handler(int irq, void *data)
@@ -452,7 +458,7 @@ static int wcove_gpio_probe(struct platform_device *pdev)
 	}
 
 	girq = &wg->chip.irq;
-	girq->chip = &wcove_irqchip;
+	gpio_irq_chip_set_chip(girq, &wcove_irqchip);
 	/* This will let us handle the parent IRQ in the driver */
 	girq->parent_handler = NULL;
 	girq->num_parents = 0;
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v1 1/1] gpio: wcove: make irq_chip immutable
  2022-06-01 15:48 [PATCH v1 1/1] gpio: wcove: make irq_chip immutable Andy Shevchenko
@ 2022-06-01 15:51 ` Sathyanarayanan Kuppuswamy
  2022-06-01 16:09   ` Andy Shevchenko
  0 siblings, 1 reply; 4+ messages in thread
From: Sathyanarayanan Kuppuswamy @ 2022-06-01 15:51 UTC (permalink / raw)
  To: Andy Shevchenko, linux-gpio, linux-kernel
  Cc: Andy Shevchenko, Linus Walleij, Bartosz Golaszewski



On 6/1/22 8:48 AM, Andy Shevchenko wrote:
> Since recently, the kernel is nagging about mutable irq_chips:
> 
>     "not an immutable chip, please consider fixing it!"
> 
> Drop the unneeded copy, flag it as IRQCHIP_IMMUTABLE, add the new
> helper functions and call the appropriate gpiolib functions.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Looks good to me

Reviewed-by: Kuppuswamy Sathyanarayanan 
<sathyanarayanan.kuppuswamy@linux.intel.com>

> ---
>   drivers/gpio/gpio-wcove.c | 10 ++++++++--
>   1 file changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpio/gpio-wcove.c b/drivers/gpio/gpio-wcove.c
> index 16a0fae1e32e..c18b6b47384f 100644
> --- a/drivers/gpio/gpio-wcove.c
> +++ b/drivers/gpio/gpio-wcove.c
> @@ -299,6 +299,8 @@ static void wcove_irq_unmask(struct irq_data *data)
>   	if (gpio >= WCOVE_GPIO_NUM)
>   		return;
>   
> +	gpiochip_enable_irq(chip, gpio);
> +
>   	wg->set_irq_mask = false;
>   	wg->update |= UPDATE_IRQ_MASK;
>   }
> @@ -314,15 +316,19 @@ static void wcove_irq_mask(struct irq_data *data)
>   
>   	wg->set_irq_mask = true;
>   	wg->update |= UPDATE_IRQ_MASK;
> +
> +	gpiochip_disable_irq(chip, gpio);
>   }
>   
> -static struct irq_chip wcove_irqchip = {
> +static const struct irq_chip wcove_irqchip = {
>   	.name			= "Whiskey Cove",
>   	.irq_mask		= wcove_irq_mask,
>   	.irq_unmask		= wcove_irq_unmask,
>   	.irq_set_type		= wcove_irq_type,
>   	.irq_bus_lock		= wcove_bus_lock,
>   	.irq_bus_sync_unlock	= wcove_bus_sync_unlock,
> +	.flags			= IRQCHIP_IMMUTABLE,
> +	GPIOCHIP_IRQ_RESOURCE_HELPERS,
>   };
>   
>   static irqreturn_t wcove_gpio_irq_handler(int irq, void *data)
> @@ -452,7 +458,7 @@ static int wcove_gpio_probe(struct platform_device *pdev)
>   	}
>   
>   	girq = &wg->chip.irq;
> -	girq->chip = &wcove_irqchip;
> +	gpio_irq_chip_set_chip(girq, &wcove_irqchip);
>   	/* This will let us handle the parent IRQ in the driver */
>   	girq->parent_handler = NULL;
>   	girq->num_parents = 0;

-- 
Sathyanarayanan Kuppuswamy
Linux Kernel Developer

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v1 1/1] gpio: wcove: make irq_chip immutable
  2022-06-01 15:51 ` Sathyanarayanan Kuppuswamy
@ 2022-06-01 16:09   ` Andy Shevchenko
  2022-06-01 16:48     ` Andy Shevchenko
  0 siblings, 1 reply; 4+ messages in thread
From: Andy Shevchenko @ 2022-06-01 16:09 UTC (permalink / raw)
  To: Sathyanarayanan Kuppuswamy
  Cc: linux-gpio, linux-kernel, Andy Shevchenko, Linus Walleij,
	Bartosz Golaszewski

On Wed, Jun 01, 2022 at 08:51:03AM -0700, Sathyanarayanan Kuppuswamy wrote:
> On 6/1/22 8:48 AM, Andy Shevchenko wrote:
> > Since recently, the kernel is nagging about mutable irq_chips:
> > 
> >     "not an immutable chip, please consider fixing it!"
> > 
> > Drop the unneeded copy, flag it as IRQCHIP_IMMUTABLE, add the new
> > helper functions and call the appropriate gpiolib functions.
> > 
> > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> 
> Looks good to me
> 
> Reviewed-by: Kuppuswamy Sathyanarayanan
> <sathyanarayanan.kuppuswamy@linux.intel.com>

Thanks!

Please fix your tools so it won't split tag line and `b4` may automatically test it.


-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v1 1/1] gpio: wcove: make irq_chip immutable
  2022-06-01 16:09   ` Andy Shevchenko
@ 2022-06-01 16:48     ` Andy Shevchenko
  0 siblings, 0 replies; 4+ messages in thread
From: Andy Shevchenko @ 2022-06-01 16:48 UTC (permalink / raw)
  To: Sathyanarayanan Kuppuswamy
  Cc: linux-gpio, linux-kernel, Andy Shevchenko, Linus Walleij,
	Bartosz Golaszewski

On Wed, Jun 01, 2022 at 07:09:17PM +0300, Andy Shevchenko wrote:
> On Wed, Jun 01, 2022 at 08:51:03AM -0700, Sathyanarayanan Kuppuswamy wrote:
> > On 6/1/22 8:48 AM, Andy Shevchenko wrote:
> > > Since recently, the kernel is nagging about mutable irq_chips:
> > > 
> > >     "not an immutable chip, please consider fixing it!"
> > > 
> > > Drop the unneeded copy, flag it as IRQCHIP_IMMUTABLE, add the new
> > > helper functions and call the appropriate gpiolib functions.
> > > 
> > > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> > 
> > Looks good to me
> > 
> > Reviewed-by: Kuppuswamy Sathyanarayanan
> > <sathyanarayanan.kuppuswamy@linux.intel.com>
> 
> Thanks!
> 
> Please fix your tools so it won't split tag line and `b4` may automatically test it.


Pushed to my review and testing queue, thanks!

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-06-01 16:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-01 15:48 [PATCH v1 1/1] gpio: wcove: make irq_chip immutable Andy Shevchenko
2022-06-01 15:51 ` Sathyanarayanan Kuppuswamy
2022-06-01 16:09   ` Andy Shevchenko
2022-06-01 16:48     ` Andy Shevchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).