linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] gpio-cdev: Release IRQ used by gpio-cdev on gpio chip removal
@ 2024-02-20 11:10 Herve Codina
  2024-02-20 11:10 ` [PATCH 1/2] gpiolib: call gcdev_unregister() sooner in the removal operations Herve Codina
                   ` (2 more replies)
  0 siblings, 3 replies; 17+ messages in thread
From: Herve Codina @ 2024-02-20 11:10 UTC (permalink / raw)
  To: Bartosz Golaszewski, Kent Gibson, Linus Walleij
  Cc: linux-gpio, linux-kernel, Luca Ceresoli, Thomas Petazzoni,
	Herve Codina

Hi,

When a gpio chip device is removed while some related gpio are used by
the user-space (gpiomon for instance), the following warning can appear:
  remove_proc_entry: removing non-empty directory 'irq/233', leaking at least 'gpiomon'
  WARNING: CPU: 2 PID: 72 at fs/proc/generic.c:717 remove_proc_entry+0x190/0x19c
  ...
  Call trace:
    remove_proc_entry+0x190/0x19c
    unregister_irq_proc+0xd0/0x104
    free_desc+0x4c/0xc4
    irq_free_descs+0x6c/0x90
    irq_dispose_mapping+0x104/0x14c
    gpiochip_irqchip_remove+0xcc/0x1a4
    gpiochip_remove+0x48/0x100
  ...

Indeed, even if the gpio removal is notified to the gpio-cdev, the
IRQ used is not released when it should be.

This series calls the gpio removal notifier sooner in the removal
process in order to give a chance to a notifier function to release
the IRQ before releasing the IRQ mapping and adds the needed
operations to release the IRQ in the gpio cdev notifier function.

Best regards,
Hervé Codina

Herve Codina (2):
  gpiolib: call gcdev_unregister() sooner in the removal operations
  gpiolib: cdev: release IRQs when the gpio chip device is removed

 drivers/gpio/gpiolib-cdev.c | 33 ++++++++++++++++++++++-----------
 drivers/gpio/gpiolib.c      |  8 +++++++-
 2 files changed, 29 insertions(+), 12 deletions(-)

-- 
2.43.0


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

end of thread, other threads:[~2024-02-27 19:27 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-20 11:10 [PATCH 0/2] gpio-cdev: Release IRQ used by gpio-cdev on gpio chip removal Herve Codina
2024-02-20 11:10 ` [PATCH 1/2] gpiolib: call gcdev_unregister() sooner in the removal operations Herve Codina
2024-02-20 13:47   ` Bartosz Golaszewski
2024-02-20 11:10 ` [PATCH 2/2] gpiolib: cdev: release IRQs when the gpio chip device is removed Herve Codina
2024-02-20 14:29   ` Kent Gibson
2024-02-20 18:26     ` Herve Codina
2024-02-21  0:25       ` Kent Gibson
2024-02-21  0:55         ` Kent Gibson
2024-02-22  0:57     ` Kent Gibson
2024-02-22  1:05       ` Kent Gibson
2024-02-22  8:31         ` Bartosz Golaszewski
2024-02-22 11:36           ` Herve Codina
2024-02-22 12:21             ` Bartosz Golaszewski
2024-02-22 23:51               ` Saravana Kannan
2024-02-27  8:26                 ` Herve Codina
2024-02-27 19:27                 ` Bartosz Golaszewski
2024-02-20 13:41 ` [PATCH 0/2] gpio-cdev: Release IRQ used by gpio-cdev on gpio chip removal Bartosz Golaszewski

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