Re: gpio ->to_irq

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, May 11, 2022 at 12:03 PM Dvorkin Dmitry <dvorkin@xxxxxxxxx> wrote:
>
> 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.

It's much easier to answer if you may share the source code of your
driver. Ideally if there is a publicly available datasheet on the
hardware in question.

> 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?

Generally speaking nobody should call gpio_to_irq() in the new code.
This is a legacy interface that mustn't be used.

-- 
With Best Regards,
Andy Shevchenko



[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux