Re: [PATCH v2] staging: mt7621-gpio: avoid custom irq_domain for gpio

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

 



On Mon, Jun 11, 2018 at 06:26:09PM +1000, NeilBrown wrote:
> On Mon, Jun 11 2018, Sergio Paracuellos wrote:
> 
> > Instead of create a custom irq_domain for this chip, use
> > 'gpiochip_set_chained_irqchip' from GPIOLIB_IRQCHIP. It
> > is ok to call this function several times. You only have to
> > mark the line with 'IRQF_SHARED' and then loop over the
> > three banks until you find a hit. There were some problems
> > with removing an irqchip like that but this driver is a bool
> > so it might work just fine. After this changes the functions
> > 'mediatek_gpio_to_irq' is not needed anymore and also the
> > 'gpio_irq_domain' field from the state container. Instead of
> > use the custom irq domain in the irq handler use the associated
> > domain from the gpio_chip in 'irq_find_mapping' function.
> > Function 'mediatek_gpio_bank_probe' has been moved a it to the
> > botton to have all the irq related functions together and avoid
> > some forward declarations to resolve some symbols along the code.
> >
> > Signed-off-by: Sergio Paracuellos <sergio.paracuellos@xxxxxxxxx>
> 
> Thanks for this.
> The patch has two problems.
> 1/ it doesn't compile unless CONFIG_GPIOLIB_IRQCHIP is selected.
>   So we need "select GPIOLIB_IRQCHIP" in Kconfig
> 
> 2/ The interrupt line has not been marked IRQF_SHARED.
>  I cannot figure out how to mark it as IRQF_SHARED.
>  If I hack the code so that mediatek_gpio_bank_probe()
>  is only called for the first bank, then interrupt from
>  that bank work fine.
>  If I let it be called for all three banks, then on the first interrupt,
>  the system starts to hang.

The way to do this seems to mark IRQF_SHARED using devm_request_irq and then
passing out NULL as irq handler in gpiochip_set_chained_irqchip. The prototype
for the irq handler change also from the normal irqreturn_t stuff. I have just sent
a new PATCH (included in the v3 of 'last cleanups' series) following this approach. 

Hope this helps and works :-),

> 
> Thanks,
> NeilBrown

Best regards,
    Sergio Paracuellos


_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux