All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1 1/2] pinctrl: baytrail: Allocate IRQ chip dynamic
@ 2019-10-24 14:33 Andy Shevchenko
  2019-10-24 14:33 ` [PATCH v1 2/2] pinctrl: baytrail: Group GPIO IRQ chip initialization Andy Shevchenko
  2019-10-25 10:02 ` [PATCH v1 1/2] pinctrl: baytrail: Allocate IRQ chip dynamic Mika Westerberg
  0 siblings, 2 replies; 4+ messages in thread
From: Andy Shevchenko @ 2019-10-24 14:33 UTC (permalink / raw)
  To: Mika Westerberg, linux-gpio, Linus Walleij; +Cc: Andy Shevchenko

Keeping the IRQ chip definition static shares it with multiple instances
of the GPIO chip in the system. This is bad and now we get this warning
from GPIO library:

"detected irqchip that is shared with multiple gpiochips: please fix the driver."

Hence, move the IRQ chip definition from being driver static into the struct
intel_pinctrl. So a unique IRQ chip is used for each GPIO chip instance.

Fixes: 9f573b98ca50 ("pinctrl: baytrail: Update irq chip operations")
Depends-on: aee0f04d5f3b ("pinctrl: intel: baytrail: Pass irqchip when adding gpiochip")
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/pinctrl/intel/pinctrl-baytrail.c | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/drivers/pinctrl/intel/pinctrl-baytrail.c b/drivers/pinctrl/intel/pinctrl-baytrail.c
index 450cb5bf6a9f..9d0e32dbf970 100644
--- a/drivers/pinctrl/intel/pinctrl-baytrail.c
+++ b/drivers/pinctrl/intel/pinctrl-baytrail.c
@@ -107,6 +107,7 @@ struct byt_gpio_pin_context {
 
 struct byt_gpio {
 	struct gpio_chip chip;
+	struct irq_chip irqchip;
 	struct platform_device *pdev;
 	struct pinctrl_dev *pctl_dev;
 	struct pinctrl_desc pctl_desc;
@@ -1394,15 +1395,6 @@ static int byt_irq_type(struct irq_data *d, unsigned int type)
 	return 0;
 }
 
-static struct irq_chip byt_irqchip = {
-	.name		= "BYT-GPIO",
-	.irq_ack	= byt_irq_ack,
-	.irq_mask	= byt_irq_mask,
-	.irq_unmask	= byt_irq_unmask,
-	.irq_set_type	= byt_irq_type,
-	.flags		= IRQCHIP_SKIP_SET_WAKE,
-};
-
 static void byt_gpio_irq_handler(struct irq_desc *desc)
 {
 	struct irq_data *data = irq_desc_get_irq_data(desc);
@@ -1535,8 +1527,15 @@ static int byt_gpio_probe(struct byt_gpio *vg)
 	if (irq_rc && irq_rc->start) {
 		struct gpio_irq_chip *girq;
 
+		vg->irqchip.name = "BYT-GPIO",
+		vg->irqchip.irq_ack = byt_irq_ack,
+		vg->irqchip.irq_mask = byt_irq_mask,
+		vg->irqchip.irq_unmask = byt_irq_unmask,
+		vg->irqchip.irq_set_type = byt_irq_type,
+		vg->irqchip.flags = IRQCHIP_SKIP_SET_WAKE,
+
 		girq = &gc->irq;
-		girq->chip = &byt_irqchip;
+		girq->chip = &vg->irqchip;
 		girq->init_hw = byt_gpio_irq_init_hw;
 		girq->parent_handler = byt_gpio_irq_handler;
 		girq->num_parents = 1;
-- 
2.23.0


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

* [PATCH v1 2/2] pinctrl: baytrail: Group GPIO IRQ chip initialization
  2019-10-24 14:33 [PATCH v1 1/2] pinctrl: baytrail: Allocate IRQ chip dynamic Andy Shevchenko
@ 2019-10-24 14:33 ` Andy Shevchenko
  2019-10-25 10:02   ` Mika Westerberg
  2019-10-25 10:02 ` [PATCH v1 1/2] pinctrl: baytrail: Allocate IRQ chip dynamic Mika Westerberg
  1 sibling, 1 reply; 4+ messages in thread
From: Andy Shevchenko @ 2019-10-24 14:33 UTC (permalink / raw)
  To: Mika Westerberg, linux-gpio, Linus Walleij; +Cc: Andy Shevchenko

After commit aee0f04d5f3b ("pinctrl: intel: baytrail: Pass irqchip
when adding gpiochip") the GPIO IRQ chip structure is being initialized under
conditional when IRQ resource has been discovered. But that commit left aside
the assignment of ->init_valid_mask() callback that is done unconditionally.

For sake of consistency and preventing some garbage in GPIO IRQ chip structure
group initialization together.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/pinctrl/intel/pinctrl-baytrail.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pinctrl/intel/pinctrl-baytrail.c b/drivers/pinctrl/intel/pinctrl-baytrail.c
index 9d0e32dbf970..beb26550c25f 100644
--- a/drivers/pinctrl/intel/pinctrl-baytrail.c
+++ b/drivers/pinctrl/intel/pinctrl-baytrail.c
@@ -1513,7 +1513,6 @@ static int byt_gpio_probe(struct byt_gpio *vg)
 	gc->can_sleep	= false;
 	gc->parent	= &vg->pdev->dev;
 	gc->ngpio	= vg->soc_data->npins;
-	gc->irq.init_valid_mask	= byt_init_irq_valid_mask;
 
 #ifdef CONFIG_PM_SLEEP
 	vg->saved_context = devm_kcalloc(&vg->pdev->dev, gc->ngpio,
@@ -1537,6 +1536,7 @@ static int byt_gpio_probe(struct byt_gpio *vg)
 		girq = &gc->irq;
 		girq->chip = &vg->irqchip;
 		girq->init_hw = byt_gpio_irq_init_hw;
+		girq->init_valid_mask = byt_init_irq_valid_mask;
 		girq->parent_handler = byt_gpio_irq_handler;
 		girq->num_parents = 1;
 		girq->parents = devm_kcalloc(&vg->pdev->dev, 1,
-- 
2.23.0


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

* Re: [PATCH v1 1/2] pinctrl: baytrail: Allocate IRQ chip dynamic
  2019-10-24 14:33 [PATCH v1 1/2] pinctrl: baytrail: Allocate IRQ chip dynamic Andy Shevchenko
  2019-10-24 14:33 ` [PATCH v1 2/2] pinctrl: baytrail: Group GPIO IRQ chip initialization Andy Shevchenko
@ 2019-10-25 10:02 ` Mika Westerberg
  1 sibling, 0 replies; 4+ messages in thread
From: Mika Westerberg @ 2019-10-25 10:02 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: linux-gpio, Linus Walleij

On Thu, Oct 24, 2019 at 05:33:42PM +0300, Andy Shevchenko wrote:
> Keeping the IRQ chip definition static shares it with multiple instances
> of the GPIO chip in the system. This is bad and now we get this warning
> from GPIO library:
> 
> "detected irqchip that is shared with multiple gpiochips: please fix the driver."
> 
> Hence, move the IRQ chip definition from being driver static into the struct
> intel_pinctrl. So a unique IRQ chip is used for each GPIO chip instance.
> 
> Fixes: 9f573b98ca50 ("pinctrl: baytrail: Update irq chip operations")
> Depends-on: aee0f04d5f3b ("pinctrl: intel: baytrail: Pass irqchip when adding gpiochip")
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>

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

* Re: [PATCH v1 2/2] pinctrl: baytrail: Group GPIO IRQ chip initialization
  2019-10-24 14:33 ` [PATCH v1 2/2] pinctrl: baytrail: Group GPIO IRQ chip initialization Andy Shevchenko
@ 2019-10-25 10:02   ` Mika Westerberg
  0 siblings, 0 replies; 4+ messages in thread
From: Mika Westerberg @ 2019-10-25 10:02 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: linux-gpio, Linus Walleij

On Thu, Oct 24, 2019 at 05:33:43PM +0300, Andy Shevchenko wrote:
> After commit aee0f04d5f3b ("pinctrl: intel: baytrail: Pass irqchip
> when adding gpiochip") the GPIO IRQ chip structure is being initialized under
> conditional when IRQ resource has been discovered. But that commit left aside
> the assignment of ->init_valid_mask() callback that is done unconditionally.
> 
> For sake of consistency and preventing some garbage in GPIO IRQ chip structure
> group initialization together.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>

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

end of thread, other threads:[~2019-10-25 10:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-24 14:33 [PATCH v1 1/2] pinctrl: baytrail: Allocate IRQ chip dynamic Andy Shevchenko
2019-10-24 14:33 ` [PATCH v1 2/2] pinctrl: baytrail: Group GPIO IRQ chip initialization Andy Shevchenko
2019-10-25 10:02   ` Mika Westerberg
2019-10-25 10:02 ` [PATCH v1 1/2] pinctrl: baytrail: Allocate IRQ chip dynamic Mika Westerberg

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.