linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] [input]: hid-cp2112: fix multiple gpiochips
@ 2021-01-09 22:36 Douglas Gilbert
  2021-03-08 13:56 ` Jiri Kosina
  0 siblings, 1 reply; 2+ messages in thread
From: Douglas Gilbert @ 2021-01-09 22:36 UTC (permalink / raw)
  To: linux-input, linux-usb; +Cc: jikos, benjamin.tissoires

In lk 5.11.0-rc2 connecting a USB based Silicon Labs HID to I2C
bridge evaluation board (CP2112EK) causes this warning:
  gpio gpiochip0: (cp2112_gpio): detected irqchip that is shared
       with multiple gpiochips: please fix the driver

Simply copy what other gpio related drivers do to fix this
particular warning: replicate the struct irq_chip object in each
device instance rather than have a static object which makes that
object (incorrectly) shared by each device.

Signed-off-by: Douglas Gilbert <dgilbert@interlog.com>
---
 drivers/hid/hid-cp2112.c | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/hid/hid-cp2112.c b/drivers/hid/hid-cp2112.c
index 21e15627a461..477baa30889c 100644
--- a/drivers/hid/hid-cp2112.c
+++ b/drivers/hid/hid-cp2112.c
@@ -161,6 +161,7 @@ struct cp2112_device {
 	atomic_t read_avail;
 	atomic_t xfer_avail;
 	struct gpio_chip gc;
+	struct irq_chip irq;
 	u8 *in_out_buffer;
 	struct mutex lock;
 
@@ -1175,16 +1176,6 @@ static int cp2112_gpio_irq_type(struct irq_data *d, unsigned int type)
 	return 0;
 }
 
-static struct irq_chip cp2112_gpio_irqchip = {
-	.name = "cp2112-gpio",
-	.irq_startup = cp2112_gpio_irq_startup,
-	.irq_shutdown = cp2112_gpio_irq_shutdown,
-	.irq_ack = cp2112_gpio_irq_ack,
-	.irq_mask = cp2112_gpio_irq_mask,
-	.irq_unmask = cp2112_gpio_irq_unmask,
-	.irq_set_type = cp2112_gpio_irq_type,
-};
-
 static int __maybe_unused cp2112_allocate_irq(struct cp2112_device *dev,
 					      int pin)
 {
@@ -1339,8 +1330,17 @@ static int cp2112_probe(struct hid_device *hdev, const struct hid_device_id *id)
 	dev->gc.can_sleep		= 1;
 	dev->gc.parent			= &hdev->dev;
 
+	dev->irq.name = "cp2112-gpio";
+	dev->irq.irq_startup = cp2112_gpio_irq_startup;
+	dev->irq.irq_shutdown = cp2112_gpio_irq_shutdown;
+	dev->irq.irq_ack = cp2112_gpio_irq_ack;
+	dev->irq.irq_mask = cp2112_gpio_irq_mask;
+	dev->irq.irq_unmask = cp2112_gpio_irq_unmask;
+	dev->irq.irq_set_type = cp2112_gpio_irq_type;
+	dev->irq.flags = IRQCHIP_MASK_ON_SUSPEND;
+
 	girq = &dev->gc.irq;
-	girq->chip = &cp2112_gpio_irqchip;
+	girq->chip = &dev->irq;
 	/* The event comes from the outside so no parent handler */
 	girq->parent_handler = NULL;
 	girq->num_parents = 0;
-- 
2.25.1


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

* Re: [PATCH] [input]: hid-cp2112: fix multiple gpiochips
  2021-01-09 22:36 [PATCH] [input]: hid-cp2112: fix multiple gpiochips Douglas Gilbert
@ 2021-03-08 13:56 ` Jiri Kosina
  0 siblings, 0 replies; 2+ messages in thread
From: Jiri Kosina @ 2021-03-08 13:56 UTC (permalink / raw)
  To: Douglas Gilbert; +Cc: linux-input, linux-usb, benjamin.tissoires

On Sat, 9 Jan 2021, Douglas Gilbert wrote:

> In lk 5.11.0-rc2 connecting a USB based Silicon Labs HID to I2C
> bridge evaluation board (CP2112EK) causes this warning:
>   gpio gpiochip0: (cp2112_gpio): detected irqchip that is shared
>        with multiple gpiochips: please fix the driver
> 
> Simply copy what other gpio related drivers do to fix this
> particular warning: replicate the struct irq_chip object in each
> device instance rather than have a static object which makes that
> object (incorrectly) shared by each device.
> 
> Signed-off-by: Douglas Gilbert <dgilbert@interlog.com>

Applied, thanks for the fix, and sorry for the delay.

-- 
Jiri Kosina
SUSE Labs


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

end of thread, other threads:[~2021-03-08 13:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-09 22:36 [PATCH] [input]: hid-cp2112: fix multiple gpiochips Douglas Gilbert
2021-03-08 13:56 ` Jiri Kosina

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).