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

NeilBrown neil at brown.name
Mon Jun 11 08:26:09 UTC 2018


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 at gmail.com>

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.

Thanks,
NeilBrown
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <http://driverdev.linuxdriverproject.org/pipermail/driverdev-devel/attachments/20180611/1d03e3b6/attachment.asc>


More information about the devel mailing list