On Fri, 21 Jun 2024 17:40:00 +0200, Thomas Gleixner <tglx@xxxxxxxxxxxxx> said: > 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? > If you're opposed to the notifier, can we at least make it somewhat future-proof and more elegant with the following? struct irq_sim_ops { int (*irq_sim_irq_requested)(irq_hw_number_t hwirq , void *data); int (*irq_sim_irq_released)(irq_hw_number_t hwirq, void *data); }; struct irq_domain *irq_domain_create_sim_ext(struct fwnode_handle *fwnode, unsigned int num_irqs, const struct irq_sim_ops *ops, void *data); This way we don't have to change the other call-site over at IIO at all nor will need to change the prototype for irq_domain_create_sim_ext() if another callback is needed. Bart