Re: [PATCH 1/3] irq/irq_sim: add a simple interrupt simulator framework

From: Bartosz Golaszewski
Date: Mon Jul 24 2017 - 02:54:40 EST


2017-07-22 22:59 GMT+02:00 Jonathan Cameron <jic23@xxxxxxxxxx>:
>> +
>> +/**
>> + * irq_sim_fire - Enqueue an interrupt.
>> + *
>> + * @sim: The interrupt simulator object.
>> + * @offset: Offset of the simulated interrupt which should be fired.
>> + */
>> +void irq_sim_fire(struct irq_sim *sim, unsigned int offset)
>> +{
>> + if (sim->irqs[offset].enabled) {
>> + sim->work_ctx.irq = irq_sim_irqnum(sim, offset);
> Is this safe against more than one firing at a time? Or is it
> the responsibility of the caller to prevent that?
>

Yes, I assumed this should be the responsibility of the caller. Let me
know if there's an important reason to implement separate locking
within this framework. My goal was to keep it simple, hence no
generalized UAPI too - callers should use their own interfaces to
expose this to the user space if needed.

Thanks,
Bartosz