On Mon, Dec 12, 2022 at 9:13 AM Yinbo Zhu <zhuyinbo@xxxxxxxxxxx> wrote: > mask_irq/unmask_irq/irq_ack/ function always be called by > handle_level_irq/handle_edge_irq in current irq domain. and the > handle_level_irq/handle_edge_irq will be called by handle_irq_desc that > ask know which irq is. > > when a peripheral need to use a gpio irq that gpio irq driver need know > irq status and call irq desc->irq_handler. > > so I don't got it about which case it is unnecessary to know which irq. Sorry I don't understand what you are asking, can you elaborate? Do you mean that you don't know which driver will not call ->to_irq() on the gpiochip? That would be any driver that takes an IRQ directly in the device tree: gpio: gpio { interrupt-controller; #interrupt-cells = <2>; .... }; device { interrupts = <&gpio 14 IRQ_TYPE_LEVEL_HIGH>; .... }; This case will only call the irqchip callbacks and will never call the .to_irq() on the gpio_chip. > > You find an example of a hierarchical GPIO irqchip using the > > GPIOLIB_IRQCHIP in drivers/gpio/gpio-ixp4xx.c. > > Loongson-2 gpio irq hardware only a enable register, and when a gpio irq > happen, then will has a such flow: "cpuintc -> liointc -> gpioinc -> > generic_handle_domain_irq -> handle_level_irq -> > peripheral-action(action->handler)" > > generic_handle_domain_irq need rely on specific hwirq that ask gpio irq > hardware has a status register but Loongson-2 gpio irq hardware doesn't > have it. > > so I still think it wasn't appropriate that for loongson-2 gpio driver > add a irq chip. generic_handle_domain_irq() is of no concern, what matters is if your interrupt is hierarchical or not, the callback in the GPIO chip can be a simple remapping of the numberspace followed by a call to the parent callbacks. Yours, Linus Walleij