linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* gpio ->to_irq
@ 2022-05-11  8:53 Dvorkin Dmitry
  2022-05-11 10:25 ` Andy Shevchenko
  0 siblings, 1 reply; 2+ messages in thread
From: Dvorkin Dmitry @ 2022-05-11  8:53 UTC (permalink / raw)
  To: linux-gpio

[-- Attachment #1: Type: text/plain, Size: 914 bytes --]

Hello!

I have a question about gpiochip ->to_irq().

Kernel call gpio_to_irq() requests IRQ for the pin, previously taken by 
*gpio_request().

But for sysfs when user does echo "pin#" > /sys/class/gpio/export  
gpio_to_irq() is also called at the time of export there:

https://elixir.bootlin.com/linux/v5.4.100/source/drivers/gpio/gpiolib-sysfs.c#L171

and there

https://elixir.bootlin.com/linux/v5.4.100/source/drivers/gpio/gpiolib-sysfs.c#L378

It is a problem for my driver. I have 120 pins and only 7 dynamically 
muxed GPIO irqs.

So when somebody requests gpio_to_irq() I am creating the mux to the 
first free gpio IRQ. But When user just exports GPIO pin using "old" 
sysfs kernel interface in the filesystem, it should not be done.

How can I see if gpio_to_irq() has been called by sysfs to prevent 
unnecessary dynamic muxing? Or there another way to get rid of this 
wrong behavior in my driver?


[-- Attachment #2: dvorkin.vcf --]
[-- Type: text/x-vcard, Size: 391 bytes --]

BEGIN:VCARD
VERSION:4.0
EMAIL;PREF=1:dvorkin@tibbo.com
EMAIL:dvorkindmitry@gmail.com
FN:Dmitry Dvorkin
NICKNAME:dv
ORG:Tibbo Technology Inc.;
TITLE:Embedded Linux Architect
N:Dvorkin;Dmitry;;;
ADR:;;9F-3\, No.31, Lane 169, Kang-Ning St., Hsi-Chih;New Taipei City;;2218
 0;Taiwan
TEL;VALUE=TEXT:+79190546388
URL;VALUE=URL:https://tibbo.com/
UID:1c58210f-ac8c-4337-b391-0bde146d2d83
END:VCARD

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

end of thread, other threads:[~2022-05-11 10:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-05-11  8:53 gpio ->to_irq Dvorkin Dmitry
2022-05-11 10:25 ` 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).