Re: [PATCH 1/2] genirq/irq_sim: add a notifier for irqchip events

From: Thomas Gleixner
Date: Fri Jun 21 2024 - 11:40:21 EST


On Wed, Jun 12 2024 at 13:52, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <bartosz.golaszewski@xxxxxxxxxx>
>
> Currently users of the interrupt simulator don't have any way of being
> notified about interrupts from the simulated domain being requested or
> released. This causes a problem for one of the users - the GPIO
> simulator - which is unable to lock the pins as interrupts.
>
> Add a blocking notifier and provide interfaces to register with it, then
> use it to notify users of the domain about interrupts being requested
> and released while also leaving space for future extensions.

Why a notifier?

There is only one usage site per simulator domain. So there is no reason
to have a notifier with handwaving about future extensions.

The right thing to do is:

typedef void (*irq_sim_cb_t)(irq_hw_number_t hwirq, bool request, void *data)

struct irq_domain *irq_domain_create_sim(struct fwnode_handle *fwnode,
unsigned int num_irqs,
irq_sim_cb_t *cb, void *cb_data);

You get the idea, right?

Thanks,

tglx