From 3fccd74cddcfff86ddcaaed831676cb42c435822 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Wed, 15 Nov 2023 15:32:24 -0500 Subject: [PATCH] drop immutable gpio patches for 5.10 and 5.15 Too many follow-on patches are needed, AND it's really not needed for the real bugfix that was needed here. The original fix is still preserved. --- ...-to-ease-the-transition-towards-immu.patch | 54 --------- ...le-with-irqchips-marked-as-immutable.patch | 89 -------------- ...e-the-gpiochip_irq_re-ql-res-helpers.patch | 70 ----------- ...rq-shutdown-stopping-polling-for-all.patch | 17 +-- .../hid-cp2112-make-irq_chip-immutable.patch | 109 ------------------ queue-5.10/series | 4 - ...-to-ease-the-transition-towards-immu.patch | 54 --------- ...le-with-irqchips-marked-as-immutable.patch | 89 -------------- ...e-the-gpiochip_irq_re-ql-res-helpers.patch | 70 ----------- ...rq-shutdown-stopping-polling-for-all.patch | 15 +-- .../hid-cp2112-make-irq_chip-immutable.patch | 109 ------------------ queue-5.15/series | 4 - 12 files changed, 11 insertions(+), 673 deletions(-) delete mode 100644 queue-5.10/gpio-add-helpers-to-ease-the-transition-towards-immu.patch delete mode 100644 queue-5.10/gpio-don-t-fiddle-with-irqchips-marked-as-immutable.patch delete mode 100644 queue-5.10/gpio-expose-the-gpiochip_irq_re-ql-res-helpers.patch delete mode 100644 queue-5.10/hid-cp2112-make-irq_chip-immutable.patch delete mode 100644 queue-5.15/gpio-add-helpers-to-ease-the-transition-towards-immu.patch delete mode 100644 queue-5.15/gpio-don-t-fiddle-with-irqchips-marked-as-immutable.patch delete mode 100644 queue-5.15/gpio-expose-the-gpiochip_irq_re-ql-res-helpers.patch delete mode 100644 queue-5.15/hid-cp2112-make-irq_chip-immutable.patch diff --git a/queue-5.10/gpio-add-helpers-to-ease-the-transition-towards-immu.patch b/queue-5.10/gpio-add-helpers-to-ease-the-transition-towards-immu.patch deleted file mode 100644 index eb55cd859e3..00000000000 --- a/queue-5.10/gpio-add-helpers-to-ease-the-transition-towards-immu.patch +++ /dev/null @@ -1,54 +0,0 @@ -From df4b1e899b420b2ee4661e9a42e9455f46c39c4e Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Tue, 19 Apr 2022 15:18:39 +0100 -Subject: gpio: Add helpers to ease the transition towards immutable irq_chip - -From: Marc Zyngier - -[ Upstream commit 36b78aae4bfee749bbde73be570796bfd0f56bec ] - -Add a couple of new helpers to make it slightly simpler to convert -drivers to immutable irq_chip structures: - -- GPIOCHIP_IRQ_RESOURCE_HELPERS populates the irq_chip structure - with the resource management callbacks - -- gpio_irq_chip_set_chip() populates the gpio_irq_chip.chip - structure, avoiding the proliferation of ugly casts - -Reviewed-by: Andy Shevchenko -Reviewed-by: Bartosz Golaszewski -Signed-off-by: Marc Zyngier -Link: https://lore.kernel.org/r/20220419141846.598305-4-maz@kernel.org -Stable-dep-of: dc3115e6c5d9 ("hid: cp2112: Fix IRQ shutdown stopping polling for all IRQs on chip") -Signed-off-by: Sasha Levin ---- - include/linux/gpio/driver.h | 12 ++++++++++++ - 1 file changed, 12 insertions(+) - -diff --git a/include/linux/gpio/driver.h b/include/linux/gpio/driver.h -index 38df53b541d53..897fc150552a2 100644 ---- a/include/linux/gpio/driver.h -+++ b/include/linux/gpio/driver.h -@@ -595,6 +595,18 @@ void gpiochip_enable_irq(struct gpio_chip *gc, unsigned int offset); - int gpiochip_irq_reqres(struct irq_data *data); - void gpiochip_irq_relres(struct irq_data *data); - -+/* Paste this in your irq_chip structure */ -+#define GPIOCHIP_IRQ_RESOURCE_HELPERS \ -+ .irq_request_resources = gpiochip_irq_reqres, \ -+ .irq_release_resources = gpiochip_irq_relres -+ -+static inline void gpio_irq_chip_set_chip(struct gpio_irq_chip *girq, -+ const struct irq_chip *chip) -+{ -+ /* Yes, dropping const is ugly, but it isn't like we have a choice */ -+ girq->chip = (struct irq_chip *)chip; -+} -+ - /* Line status inquiry for drivers */ - bool gpiochip_line_is_open_drain(struct gpio_chip *gc, unsigned int offset); - bool gpiochip_line_is_open_source(struct gpio_chip *gc, unsigned int offset); --- -2.42.0 - diff --git a/queue-5.10/gpio-don-t-fiddle-with-irqchips-marked-as-immutable.patch b/queue-5.10/gpio-don-t-fiddle-with-irqchips-marked-as-immutable.patch deleted file mode 100644 index 415b3589a88..00000000000 --- a/queue-5.10/gpio-don-t-fiddle-with-irqchips-marked-as-immutable.patch +++ /dev/null @@ -1,89 +0,0 @@ -From 7d68361f77afb1ca0865bca7d160f730b71dd16e Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Tue, 19 Apr 2022 15:18:37 +0100 -Subject: gpio: Don't fiddle with irqchips marked as immutable - -From: Marc Zyngier - -[ Upstream commit 6c846d026d490b2383d395bc8e7b06336219667b ] - -In order to move away from gpiolib messing with the internals of -unsuspecting irqchips, add a flag by which irqchips advertise -that they are not to be messed with, and do solemnly swear that -they correctly call into the gpiolib helpers when required. - -Also nudge the users into converting their drivers to the -new model. - -Reviewed-by: Andy Shevchenko -Reviewed-by: Bartosz Golaszewski -Signed-off-by: Marc Zyngier -Link: https://lore.kernel.org/r/20220419141846.598305-2-maz@kernel.org -Stable-dep-of: dc3115e6c5d9 ("hid: cp2112: Fix IRQ shutdown stopping polling for all IRQs on chip") -Signed-off-by: Sasha Levin ---- - drivers/gpio/gpiolib.c | 7 ++++++- - include/linux/irq.h | 2 ++ - kernel/irq/debugfs.c | 1 + - 3 files changed, 9 insertions(+), 1 deletion(-) - -diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c -index d10f621085e2e..8a6510d0fe5fc 100644 ---- a/drivers/gpio/gpiolib.c -+++ b/drivers/gpio/gpiolib.c -@@ -1491,6 +1491,11 @@ static void gpiochip_set_irq_hooks(struct gpio_chip *gc) - { - struct irq_chip *irqchip = gc->irq.chip; - -+ if (irqchip->flags & IRQCHIP_IMMUTABLE) -+ return; -+ -+ chip_warn(gc, "not an immutable chip, please consider fixing it!\n"); -+ - if (!irqchip->irq_request_resources && - !irqchip->irq_release_resources) { - irqchip->irq_request_resources = gpiochip_irq_reqres; -@@ -1667,7 +1672,7 @@ static void gpiochip_irqchip_remove(struct gpio_chip *gc) - irq_domain_remove(gc->irq.domain); - } - -- if (irqchip) { -+ if (irqchip && !(irqchip->flags & IRQCHIP_IMMUTABLE)) { - if (irqchip->irq_request_resources == gpiochip_irq_reqres) { - irqchip->irq_request_resources = NULL; - irqchip->irq_release_resources = NULL; -diff --git a/include/linux/irq.h b/include/linux/irq.h -index b89a8ac83d1bc..da4cd9fb3e5f3 100644 ---- a/include/linux/irq.h -+++ b/include/linux/irq.h -@@ -568,6 +568,7 @@ struct irq_chip { - * IRQCHIP_ENABLE_WAKEUP_ON_SUSPEND: Invokes __enable_irq()/__disable_irq() for wake irqs - * in the suspend path if they are in disabled state - * IRQCHIP_AFFINITY_PRE_STARTUP: Default affinity update before startup -+ * IRQCHIP_IMMUTABLE: Don't ever change anything in this chip - */ - enum { - IRQCHIP_SET_TYPE_MASKED = (1 << 0), -@@ -581,6 +582,7 @@ enum { - IRQCHIP_SUPPORTS_NMI = (1 << 8), - IRQCHIP_ENABLE_WAKEUP_ON_SUSPEND = (1 << 9), - IRQCHIP_AFFINITY_PRE_STARTUP = (1 << 10), -+ IRQCHIP_IMMUTABLE = (1 << 11), - }; - - #include -diff --git a/kernel/irq/debugfs.c b/kernel/irq/debugfs.c -index e4cff358b437e..7ff52d94b42c0 100644 ---- a/kernel/irq/debugfs.c -+++ b/kernel/irq/debugfs.c -@@ -58,6 +58,7 @@ static const struct irq_bit_descr irqchip_flags[] = { - BIT_MASK_DESCR(IRQCHIP_SUPPORTS_LEVEL_MSI), - BIT_MASK_DESCR(IRQCHIP_SUPPORTS_NMI), - BIT_MASK_DESCR(IRQCHIP_ENABLE_WAKEUP_ON_SUSPEND), -+ BIT_MASK_DESCR(IRQCHIP_IMMUTABLE), - }; - - static void --- -2.42.0 - diff --git a/queue-5.10/gpio-expose-the-gpiochip_irq_re-ql-res-helpers.patch b/queue-5.10/gpio-expose-the-gpiochip_irq_re-ql-res-helpers.patch deleted file mode 100644 index 2696b2b435d..00000000000 --- a/queue-5.10/gpio-expose-the-gpiochip_irq_re-ql-res-helpers.patch +++ /dev/null @@ -1,70 +0,0 @@ -From 9ab3c9635641c836c2b9ae874d945c10f978b0e6 Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Tue, 19 Apr 2022 15:18:38 +0100 -Subject: gpio: Expose the gpiochip_irq_re[ql]res helpers - -From: Marc Zyngier - -[ Upstream commit 704f08753b6dcd0e08c1953af0b2c7f3fac87111 ] - -The GPIO subsystem has a couple of internal helpers to manage -resources on behalf of the irqchip. Expose them so that GPIO -drivers can use them directly. - -Reviewed-by: Andy Shevchenko -Reviewed-by: Bartosz Golaszewski -Signed-off-by: Marc Zyngier -Link: https://lore.kernel.org/r/20220419141846.598305-3-maz@kernel.org -Stable-dep-of: dc3115e6c5d9 ("hid: cp2112: Fix IRQ shutdown stopping polling for all IRQs on chip") -Signed-off-by: Sasha Levin ---- - drivers/gpio/gpiolib.c | 6 ++++-- - include/linux/gpio/driver.h | 4 ++++ - 2 files changed, 8 insertions(+), 2 deletions(-) - -diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c -index 8a6510d0fe5fc..69ef51a05709a 100644 ---- a/drivers/gpio/gpiolib.c -+++ b/drivers/gpio/gpiolib.c -@@ -1439,19 +1439,21 @@ static int gpiochip_to_irq(struct gpio_chip *gc, unsigned offset) - return irq_create_mapping(domain, offset); - } - --static int gpiochip_irq_reqres(struct irq_data *d) -+int gpiochip_irq_reqres(struct irq_data *d) - { - struct gpio_chip *gc = irq_data_get_irq_chip_data(d); - - return gpiochip_reqres_irq(gc, d->hwirq); - } -+EXPORT_SYMBOL(gpiochip_irq_reqres); - --static void gpiochip_irq_relres(struct irq_data *d) -+void gpiochip_irq_relres(struct irq_data *d) - { - struct gpio_chip *gc = irq_data_get_irq_chip_data(d); - - gpiochip_relres_irq(gc, d->hwirq); - } -+EXPORT_SYMBOL(gpiochip_irq_relres); - - static void gpiochip_irq_mask(struct irq_data *d) - { -diff --git a/include/linux/gpio/driver.h b/include/linux/gpio/driver.h -index 64c93a36a3a92..38df53b541d53 100644 ---- a/include/linux/gpio/driver.h -+++ b/include/linux/gpio/driver.h -@@ -591,6 +591,10 @@ void gpiochip_relres_irq(struct gpio_chip *gc, unsigned int offset); - void gpiochip_disable_irq(struct gpio_chip *gc, unsigned int offset); - void gpiochip_enable_irq(struct gpio_chip *gc, unsigned int offset); - -+/* irq_data versions of the above */ -+int gpiochip_irq_reqres(struct irq_data *data); -+void gpiochip_irq_relres(struct irq_data *data); -+ - /* Line status inquiry for drivers */ - bool gpiochip_line_is_open_drain(struct gpio_chip *gc, unsigned int offset); - bool gpiochip_line_is_open_source(struct gpio_chip *gc, unsigned int offset); --- -2.42.0 - diff --git a/queue-5.10/hid-cp2112-fix-irq-shutdown-stopping-polling-for-all.patch b/queue-5.10/hid-cp2112-fix-irq-shutdown-stopping-polling-for-all.patch index e3061fdecdc..43b43d40f98 100644 --- a/queue-5.10/hid-cp2112-fix-irq-shutdown-stopping-polling-for-all.patch +++ b/queue-5.10/hid-cp2112-fix-irq-shutdown-stopping-polling-for-all.patch @@ -1,4 +1,4 @@ -From 15ec08258775e23372c5894b2b69d0b702129f97 Mon Sep 17 00:00:00 2001 +From 71e783cfea753e5f37131882afbd29500d1d365e Mon Sep 17 00:00:00 2001 From: Sasha Levin Date: Wed, 11 Oct 2023 13:23:17 -0500 Subject: hid: cp2112: Fix IRQ shutdown stopping polling for all IRQs on chip @@ -22,20 +22,18 @@ Fixes: 13de9cca514e ("HID: cp2112: add IRQ chip handling") Link: https://lore.kernel.org/r/20231011182317.1053344-1-danny.kaehn@plexus.com Signed-off-by: Benjamin Tissoires Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman --- - drivers/hid/hid-cp2112.c | 6 +++++- - 1 file changed, 5 insertions(+), 1 deletion(-) + drivers/hid/hid-cp2112.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) -diff --git a/drivers/hid/hid-cp2112.c b/drivers/hid/hid-cp2112.c -index 704aebb1a588f..ee983ddc7fd03 100644 --- a/drivers/hid/hid-cp2112.c +++ b/drivers/hid/hid-cp2112.c -@@ -1175,7 +1175,11 @@ static void cp2112_gpio_irq_shutdown(struct irq_data *d) +@@ -1171,7 +1171,10 @@ static void cp2112_gpio_irq_shutdown(str + struct gpio_chip *gc = irq_data_get_irq_chip_data(d); struct cp2112_device *dev = gpiochip_get_data(gc); - cp2112_gpio_irq_mask(d); - cancel_delayed_work_sync(&dev->gpio_poll_worker); -+ + if (!dev->irq_mask) { + dev->gpio_poll = false; + cancel_delayed_work_sync(&dev->gpio_poll_worker); @@ -43,6 +41,3 @@ index 704aebb1a588f..ee983ddc7fd03 100644 } static int cp2112_gpio_irq_type(struct irq_data *d, unsigned int type) --- -2.42.0 - diff --git a/queue-5.10/hid-cp2112-make-irq_chip-immutable.patch b/queue-5.10/hid-cp2112-make-irq_chip-immutable.patch deleted file mode 100644 index 165bd4109dd..00000000000 --- a/queue-5.10/hid-cp2112-make-irq_chip-immutable.patch +++ /dev/null @@ -1,109 +0,0 @@ -From 16bfa9251b2616c98ccaa9ded3d79e74e6bfb935 Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Mon, 3 Jul 2023 21:52:13 +0300 -Subject: HID: cp2112: Make irq_chip immutable - -From: Andy Shevchenko - -[ Upstream commit 3e2977c425ad2789ca18084fff913cceacae75a2 ] - -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 -Link: https://lore.kernel.org/r/20230703185222.50554-4-andriy.shevchenko@linux.intel.com -Signed-off-by: Benjamin Tissoires -Stable-dep-of: dc3115e6c5d9 ("hid: cp2112: Fix IRQ shutdown stopping polling for all IRQs on chip") -Signed-off-by: Sasha Levin ---- - drivers/hid/hid-cp2112.c | 33 ++++++++++++++++++++------------- - 1 file changed, 20 insertions(+), 13 deletions(-) - -diff --git a/drivers/hid/hid-cp2112.c b/drivers/hid/hid-cp2112.c -index a683d38200267..704aebb1a588f 100644 ---- a/drivers/hid/hid-cp2112.c -+++ b/drivers/hid/hid-cp2112.c -@@ -161,7 +161,6 @@ 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; - -@@ -1078,16 +1077,20 @@ static void cp2112_gpio_irq_mask(struct irq_data *d) - { - struct gpio_chip *gc = irq_data_get_irq_chip_data(d); - struct cp2112_device *dev = gpiochip_get_data(gc); -+ irq_hw_number_t hwirq = irqd_to_hwirq(d); - -- __clear_bit(d->hwirq, &dev->irq_mask); -+ __clear_bit(hwirq, &dev->irq_mask); -+ gpiochip_disable_irq(gc, hwirq); - } - - static void cp2112_gpio_irq_unmask(struct irq_data *d) - { - struct gpio_chip *gc = irq_data_get_irq_chip_data(d); - struct cp2112_device *dev = gpiochip_get_data(gc); -+ irq_hw_number_t hwirq = irqd_to_hwirq(d); - -- __set_bit(d->hwirq, &dev->irq_mask); -+ gpiochip_enable_irq(gc, hwirq); -+ __set_bit(hwirq, &dev->irq_mask); - } - - static void cp2112_gpio_poll_callback(struct work_struct *work) -@@ -1171,6 +1174,7 @@ static void cp2112_gpio_irq_shutdown(struct irq_data *d) - struct gpio_chip *gc = irq_data_get_irq_chip_data(d); - struct cp2112_device *dev = gpiochip_get_data(gc); - -+ cp2112_gpio_irq_mask(d); - cancel_delayed_work_sync(&dev->gpio_poll_worker); - } - -@@ -1224,6 +1228,18 @@ static int __maybe_unused cp2112_allocate_irq(struct cp2112_device *dev, - return ret; - } - -+static const 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, -+ .flags = IRQCHIP_MASK_ON_SUSPEND | IRQCHIP_IMMUTABLE, -+ GPIOCHIP_IRQ_RESOURCE_HELPERS, -+}; -+ - static int cp2112_probe(struct hid_device *hdev, const struct hid_device_id *id) - { - struct cp2112_device *dev; -@@ -1333,17 +1349,8 @@ 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 = &dev->irq; -+ gpio_irq_chip_set_chip(girq, &cp2112_gpio_irqchip); - /* The event comes from the outside so no parent handler */ - girq->parent_handler = NULL; - girq->num_parents = 0; --- -2.42.0 - diff --git a/queue-5.10/series b/queue-5.10/series index 3138c9a82e3..3f76da4e9b3 100644 --- a/queue-5.10/series +++ b/queue-5.10/series @@ -103,10 +103,6 @@ rdma-hns-fix-signed-unsigned-mixed-comparisons.patch asoc-fsl-fix-pm-disable-depth-imbalance-in-fsl_easrc.patch scsi-ufs-core-leave-space-for-0-in-utf8-desc-string.patch rdma-hfi1-workaround-truncation-compilation-error.patch -gpio-don-t-fiddle-with-irqchips-marked-as-immutable.patch -gpio-expose-the-gpiochip_irq_re-ql-res-helpers.patch -gpio-add-helpers-to-ease-the-transition-towards-immu.patch -hid-cp2112-make-irq_chip-immutable.patch hid-cp2112-fix-irq-shutdown-stopping-polling-for-all.patch sh-bios-revive-earlyprintk-support.patch revert-hid-logitech-hidpp-add-a-module-parameter-to-.patch diff --git a/queue-5.15/gpio-add-helpers-to-ease-the-transition-towards-immu.patch b/queue-5.15/gpio-add-helpers-to-ease-the-transition-towards-immu.patch deleted file mode 100644 index 8e2045f02c6..00000000000 --- a/queue-5.15/gpio-add-helpers-to-ease-the-transition-towards-immu.patch +++ /dev/null @@ -1,54 +0,0 @@ -From 0043afef0d43ad2bc0e3da4bc8d4b7abc4f87a19 Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Tue, 19 Apr 2022 15:18:39 +0100 -Subject: gpio: Add helpers to ease the transition towards immutable irq_chip - -From: Marc Zyngier - -[ Upstream commit 36b78aae4bfee749bbde73be570796bfd0f56bec ] - -Add a couple of new helpers to make it slightly simpler to convert -drivers to immutable irq_chip structures: - -- GPIOCHIP_IRQ_RESOURCE_HELPERS populates the irq_chip structure - with the resource management callbacks - -- gpio_irq_chip_set_chip() populates the gpio_irq_chip.chip - structure, avoiding the proliferation of ugly casts - -Reviewed-by: Andy Shevchenko -Reviewed-by: Bartosz Golaszewski -Signed-off-by: Marc Zyngier -Link: https://lore.kernel.org/r/20220419141846.598305-4-maz@kernel.org -Stable-dep-of: dc3115e6c5d9 ("hid: cp2112: Fix IRQ shutdown stopping polling for all IRQs on chip") -Signed-off-by: Sasha Levin ---- - include/linux/gpio/driver.h | 12 ++++++++++++ - 1 file changed, 12 insertions(+) - -diff --git a/include/linux/gpio/driver.h b/include/linux/gpio/driver.h -index b241fc23ff3a2..91f60d1e3eb31 100644 ---- a/include/linux/gpio/driver.h -+++ b/include/linux/gpio/driver.h -@@ -599,6 +599,18 @@ void gpiochip_enable_irq(struct gpio_chip *gc, unsigned int offset); - int gpiochip_irq_reqres(struct irq_data *data); - void gpiochip_irq_relres(struct irq_data *data); - -+/* Paste this in your irq_chip structure */ -+#define GPIOCHIP_IRQ_RESOURCE_HELPERS \ -+ .irq_request_resources = gpiochip_irq_reqres, \ -+ .irq_release_resources = gpiochip_irq_relres -+ -+static inline void gpio_irq_chip_set_chip(struct gpio_irq_chip *girq, -+ const struct irq_chip *chip) -+{ -+ /* Yes, dropping const is ugly, but it isn't like we have a choice */ -+ girq->chip = (struct irq_chip *)chip; -+} -+ - /* Line status inquiry for drivers */ - bool gpiochip_line_is_open_drain(struct gpio_chip *gc, unsigned int offset); - bool gpiochip_line_is_open_source(struct gpio_chip *gc, unsigned int offset); --- -2.42.0 - diff --git a/queue-5.15/gpio-don-t-fiddle-with-irqchips-marked-as-immutable.patch b/queue-5.15/gpio-don-t-fiddle-with-irqchips-marked-as-immutable.patch deleted file mode 100644 index 5f254b43fd3..00000000000 --- a/queue-5.15/gpio-don-t-fiddle-with-irqchips-marked-as-immutable.patch +++ /dev/null @@ -1,89 +0,0 @@ -From 67223eb1b98579c9464871d1938a5924fe06e220 Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Tue, 19 Apr 2022 15:18:37 +0100 -Subject: gpio: Don't fiddle with irqchips marked as immutable - -From: Marc Zyngier - -[ Upstream commit 6c846d026d490b2383d395bc8e7b06336219667b ] - -In order to move away from gpiolib messing with the internals of -unsuspecting irqchips, add a flag by which irqchips advertise -that they are not to be messed with, and do solemnly swear that -they correctly call into the gpiolib helpers when required. - -Also nudge the users into converting their drivers to the -new model. - -Reviewed-by: Andy Shevchenko -Reviewed-by: Bartosz Golaszewski -Signed-off-by: Marc Zyngier -Link: https://lore.kernel.org/r/20220419141846.598305-2-maz@kernel.org -Stable-dep-of: dc3115e6c5d9 ("hid: cp2112: Fix IRQ shutdown stopping polling for all IRQs on chip") -Signed-off-by: Sasha Levin ---- - drivers/gpio/gpiolib.c | 7 ++++++- - include/linux/irq.h | 2 ++ - kernel/irq/debugfs.c | 1 + - 3 files changed, 9 insertions(+), 1 deletion(-) - -diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c -index f9fdd117c654c..e572c30a202ad 100644 ---- a/drivers/gpio/gpiolib.c -+++ b/drivers/gpio/gpiolib.c -@@ -1483,6 +1483,11 @@ static void gpiochip_set_irq_hooks(struct gpio_chip *gc) - { - struct irq_chip *irqchip = gc->irq.chip; - -+ if (irqchip->flags & IRQCHIP_IMMUTABLE) -+ return; -+ -+ chip_warn(gc, "not an immutable chip, please consider fixing it!\n"); -+ - if (!irqchip->irq_request_resources && - !irqchip->irq_release_resources) { - irqchip->irq_request_resources = gpiochip_irq_reqres; -@@ -1650,7 +1655,7 @@ static void gpiochip_irqchip_remove(struct gpio_chip *gc) - irq_domain_remove(gc->irq.domain); - } - -- if (irqchip) { -+ if (irqchip && !(irqchip->flags & IRQCHIP_IMMUTABLE)) { - if (irqchip->irq_request_resources == gpiochip_irq_reqres) { - irqchip->irq_request_resources = NULL; - irqchip->irq_release_resources = NULL; -diff --git a/include/linux/irq.h b/include/linux/irq.h -index f9e6449fbbbae..296ef3b7d7afa 100644 ---- a/include/linux/irq.h -+++ b/include/linux/irq.h -@@ -570,6 +570,7 @@ struct irq_chip { - * IRQCHIP_ENABLE_WAKEUP_ON_SUSPEND: Invokes __enable_irq()/__disable_irq() for wake irqs - * in the suspend path if they are in disabled state - * IRQCHIP_AFFINITY_PRE_STARTUP: Default affinity update before startup -+ * IRQCHIP_IMMUTABLE: Don't ever change anything in this chip - */ - enum { - IRQCHIP_SET_TYPE_MASKED = (1 << 0), -@@ -583,6 +584,7 @@ enum { - IRQCHIP_SUPPORTS_NMI = (1 << 8), - IRQCHIP_ENABLE_WAKEUP_ON_SUSPEND = (1 << 9), - IRQCHIP_AFFINITY_PRE_STARTUP = (1 << 10), -+ IRQCHIP_IMMUTABLE = (1 << 11), - }; - - #include -diff --git a/kernel/irq/debugfs.c b/kernel/irq/debugfs.c -index e4cff358b437e..7ff52d94b42c0 100644 ---- a/kernel/irq/debugfs.c -+++ b/kernel/irq/debugfs.c -@@ -58,6 +58,7 @@ static const struct irq_bit_descr irqchip_flags[] = { - BIT_MASK_DESCR(IRQCHIP_SUPPORTS_LEVEL_MSI), - BIT_MASK_DESCR(IRQCHIP_SUPPORTS_NMI), - BIT_MASK_DESCR(IRQCHIP_ENABLE_WAKEUP_ON_SUSPEND), -+ BIT_MASK_DESCR(IRQCHIP_IMMUTABLE), - }; - - static void --- -2.42.0 - diff --git a/queue-5.15/gpio-expose-the-gpiochip_irq_re-ql-res-helpers.patch b/queue-5.15/gpio-expose-the-gpiochip_irq_re-ql-res-helpers.patch deleted file mode 100644 index 2e10a543996..00000000000 --- a/queue-5.15/gpio-expose-the-gpiochip_irq_re-ql-res-helpers.patch +++ /dev/null @@ -1,70 +0,0 @@ -From bf522c0ca975b2c9887f891c4124f72f6e7c7b27 Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Tue, 19 Apr 2022 15:18:38 +0100 -Subject: gpio: Expose the gpiochip_irq_re[ql]res helpers - -From: Marc Zyngier - -[ Upstream commit 704f08753b6dcd0e08c1953af0b2c7f3fac87111 ] - -The GPIO subsystem has a couple of internal helpers to manage -resources on behalf of the irqchip. Expose them so that GPIO -drivers can use them directly. - -Reviewed-by: Andy Shevchenko -Reviewed-by: Bartosz Golaszewski -Signed-off-by: Marc Zyngier -Link: https://lore.kernel.org/r/20220419141846.598305-3-maz@kernel.org -Stable-dep-of: dc3115e6c5d9 ("hid: cp2112: Fix IRQ shutdown stopping polling for all IRQs on chip") -Signed-off-by: Sasha Levin ---- - drivers/gpio/gpiolib.c | 6 ++++-- - include/linux/gpio/driver.h | 4 ++++ - 2 files changed, 8 insertions(+), 2 deletions(-) - -diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c -index e572c30a202ad..57e726d65904b 100644 ---- a/drivers/gpio/gpiolib.c -+++ b/drivers/gpio/gpiolib.c -@@ -1431,19 +1431,21 @@ static int gpiochip_to_irq(struct gpio_chip *gc, unsigned int offset) - return irq_create_mapping(domain, offset); - } - --static int gpiochip_irq_reqres(struct irq_data *d) -+int gpiochip_irq_reqres(struct irq_data *d) - { - struct gpio_chip *gc = irq_data_get_irq_chip_data(d); - - return gpiochip_reqres_irq(gc, d->hwirq); - } -+EXPORT_SYMBOL(gpiochip_irq_reqres); - --static void gpiochip_irq_relres(struct irq_data *d) -+void gpiochip_irq_relres(struct irq_data *d) - { - struct gpio_chip *gc = irq_data_get_irq_chip_data(d); - - gpiochip_relres_irq(gc, d->hwirq); - } -+EXPORT_SYMBOL(gpiochip_irq_relres); - - static void gpiochip_irq_mask(struct irq_data *d) - { -diff --git a/include/linux/gpio/driver.h b/include/linux/gpio/driver.h -index 65df2ce96f0b1..b241fc23ff3a2 100644 ---- a/include/linux/gpio/driver.h -+++ b/include/linux/gpio/driver.h -@@ -595,6 +595,10 @@ void gpiochip_relres_irq(struct gpio_chip *gc, unsigned int offset); - void gpiochip_disable_irq(struct gpio_chip *gc, unsigned int offset); - void gpiochip_enable_irq(struct gpio_chip *gc, unsigned int offset); - -+/* irq_data versions of the above */ -+int gpiochip_irq_reqres(struct irq_data *data); -+void gpiochip_irq_relres(struct irq_data *data); -+ - /* Line status inquiry for drivers */ - bool gpiochip_line_is_open_drain(struct gpio_chip *gc, unsigned int offset); - bool gpiochip_line_is_open_source(struct gpio_chip *gc, unsigned int offset); --- -2.42.0 - diff --git a/queue-5.15/hid-cp2112-fix-irq-shutdown-stopping-polling-for-all.patch b/queue-5.15/hid-cp2112-fix-irq-shutdown-stopping-polling-for-all.patch index bb3b1405e80..43b43d40f98 100644 --- a/queue-5.15/hid-cp2112-fix-irq-shutdown-stopping-polling-for-all.patch +++ b/queue-5.15/hid-cp2112-fix-irq-shutdown-stopping-polling-for-all.patch @@ -22,20 +22,18 @@ Fixes: 13de9cca514e ("HID: cp2112: add IRQ chip handling") Link: https://lore.kernel.org/r/20231011182317.1053344-1-danny.kaehn@plexus.com Signed-off-by: Benjamin Tissoires Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman --- - drivers/hid/hid-cp2112.c | 6 +++++- - 1 file changed, 5 insertions(+), 1 deletion(-) + drivers/hid/hid-cp2112.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) -diff --git a/drivers/hid/hid-cp2112.c b/drivers/hid/hid-cp2112.c -index 704aebb1a588f..ee983ddc7fd03 100644 --- a/drivers/hid/hid-cp2112.c +++ b/drivers/hid/hid-cp2112.c -@@ -1175,7 +1175,11 @@ static void cp2112_gpio_irq_shutdown(struct irq_data *d) +@@ -1171,7 +1171,10 @@ static void cp2112_gpio_irq_shutdown(str + struct gpio_chip *gc = irq_data_get_irq_chip_data(d); struct cp2112_device *dev = gpiochip_get_data(gc); - cp2112_gpio_irq_mask(d); - cancel_delayed_work_sync(&dev->gpio_poll_worker); -+ + if (!dev->irq_mask) { + dev->gpio_poll = false; + cancel_delayed_work_sync(&dev->gpio_poll_worker); @@ -43,6 +41,3 @@ index 704aebb1a588f..ee983ddc7fd03 100644 } static int cp2112_gpio_irq_type(struct irq_data *d, unsigned int type) --- -2.42.0 - diff --git a/queue-5.15/hid-cp2112-make-irq_chip-immutable.patch b/queue-5.15/hid-cp2112-make-irq_chip-immutable.patch deleted file mode 100644 index 8da7c538bd9..00000000000 --- a/queue-5.15/hid-cp2112-make-irq_chip-immutable.patch +++ /dev/null @@ -1,109 +0,0 @@ -From 197afd0c04462b3f50de1aa00415135c7dc26f77 Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Mon, 3 Jul 2023 21:52:13 +0300 -Subject: HID: cp2112: Make irq_chip immutable - -From: Andy Shevchenko - -[ Upstream commit 3e2977c425ad2789ca18084fff913cceacae75a2 ] - -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 -Link: https://lore.kernel.org/r/20230703185222.50554-4-andriy.shevchenko@linux.intel.com -Signed-off-by: Benjamin Tissoires -Stable-dep-of: dc3115e6c5d9 ("hid: cp2112: Fix IRQ shutdown stopping polling for all IRQs on chip") -Signed-off-by: Sasha Levin ---- - drivers/hid/hid-cp2112.c | 33 ++++++++++++++++++++------------- - 1 file changed, 20 insertions(+), 13 deletions(-) - -diff --git a/drivers/hid/hid-cp2112.c b/drivers/hid/hid-cp2112.c -index a683d38200267..704aebb1a588f 100644 ---- a/drivers/hid/hid-cp2112.c -+++ b/drivers/hid/hid-cp2112.c -@@ -161,7 +161,6 @@ 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; - -@@ -1078,16 +1077,20 @@ static void cp2112_gpio_irq_mask(struct irq_data *d) - { - struct gpio_chip *gc = irq_data_get_irq_chip_data(d); - struct cp2112_device *dev = gpiochip_get_data(gc); -+ irq_hw_number_t hwirq = irqd_to_hwirq(d); - -- __clear_bit(d->hwirq, &dev->irq_mask); -+ __clear_bit(hwirq, &dev->irq_mask); -+ gpiochip_disable_irq(gc, hwirq); - } - - static void cp2112_gpio_irq_unmask(struct irq_data *d) - { - struct gpio_chip *gc = irq_data_get_irq_chip_data(d); - struct cp2112_device *dev = gpiochip_get_data(gc); -+ irq_hw_number_t hwirq = irqd_to_hwirq(d); - -- __set_bit(d->hwirq, &dev->irq_mask); -+ gpiochip_enable_irq(gc, hwirq); -+ __set_bit(hwirq, &dev->irq_mask); - } - - static void cp2112_gpio_poll_callback(struct work_struct *work) -@@ -1171,6 +1174,7 @@ static void cp2112_gpio_irq_shutdown(struct irq_data *d) - struct gpio_chip *gc = irq_data_get_irq_chip_data(d); - struct cp2112_device *dev = gpiochip_get_data(gc); - -+ cp2112_gpio_irq_mask(d); - cancel_delayed_work_sync(&dev->gpio_poll_worker); - } - -@@ -1224,6 +1228,18 @@ static int __maybe_unused cp2112_allocate_irq(struct cp2112_device *dev, - return ret; - } - -+static const 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, -+ .flags = IRQCHIP_MASK_ON_SUSPEND | IRQCHIP_IMMUTABLE, -+ GPIOCHIP_IRQ_RESOURCE_HELPERS, -+}; -+ - static int cp2112_probe(struct hid_device *hdev, const struct hid_device_id *id) - { - struct cp2112_device *dev; -@@ -1333,17 +1349,8 @@ 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 = &dev->irq; -+ gpio_irq_chip_set_chip(girq, &cp2112_gpio_irqchip); - /* The event comes from the outside so no parent handler */ - girq->parent_handler = NULL; - girq->num_parents = 0; --- -2.42.0 - diff --git a/queue-5.15/series b/queue-5.15/series index f15de030d68..f2053f87c4f 100644 --- a/queue-5.15/series +++ b/queue-5.15/series @@ -145,10 +145,6 @@ rdma-hns-the-ud-mode-can-only-be-configured-with-dcq.patch asoc-fsl-fix-pm-disable-depth-imbalance-in-fsl_easrc.patch scsi-ufs-core-leave-space-for-0-in-utf8-desc-string.patch rdma-hfi1-workaround-truncation-compilation-error.patch -gpio-don-t-fiddle-with-irqchips-marked-as-immutable.patch -gpio-expose-the-gpiochip_irq_re-ql-res-helpers.patch -gpio-add-helpers-to-ease-the-transition-towards-immu.patch -hid-cp2112-make-irq_chip-immutable.patch hid-cp2112-fix-irq-shutdown-stopping-polling-for-all.patch sh-bios-revive-earlyprintk-support.patch revert-hid-logitech-hidpp-add-a-module-parameter-to-.patch -- 2.47.3