[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMRc=MejZYpY=Nb60LJ63d3L9JK8zBj4154mpeLGsk+_=ZLwVA@mail.gmail.com>
Date: Fri, 21 Jun 2024 11:59:05 -0400
From: Bartosz Golaszewski <brgl@...ev.pl>
To: Thomas Gleixner <tglx@...utronix.de>
Cc: linux-gpio@...r.kernel.org, linux-kernel@...r.kernel.org,
Bartosz Golaszewski <bartosz.golaszewski@...aro.org>, Bartosz Golaszewski <brgl@...ev.pl>,
Linus Walleij <linus.walleij@...aro.org>
Subject: Re: [PATCH 1/2] genirq/irq_sim: add a notifier for irqchip events
On Fri, 21 Jun 2024 17:40:00 +0200, Thomas Gleixner <tglx@...utronix.de> said:
> On Wed, Jun 12 2024 at 13:52, Bartosz Golaszewski wrote:
>> From: Bartosz Golaszewski <bartosz.golaszewski@...aro.org>
>>
>> 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
Powered by blists - more mailing lists