mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-26 10:49:33 +00:00
genirq/irq_sim: Return the base of the irq range from irq_sim_init()
Returning the base of the allocated interrupt range from irq_sim_init() and devm_irq_sim_init() allows users to handle the logic of associating irq numbers with any other driver-specific resources without having to use irq_sim_irqnum(). Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Cc: Marc Zyngier <marc.zyngier@arm.com> Link: https://lkml.kernel.org/r/20180304121018.640-4-brgl@bgdev.pl
This commit is contained in:
parent
28b6afa7d4
commit
f09777fa89
1 changed files with 6 additions and 4 deletions
|
@ -50,7 +50,8 @@ static void irq_sim_handle_irq(struct irq_work *work)
|
||||||
* @sim: The interrupt simulator object to initialize.
|
* @sim: The interrupt simulator object to initialize.
|
||||||
* @num_irqs: Number of interrupts to allocate
|
* @num_irqs: Number of interrupts to allocate
|
||||||
*
|
*
|
||||||
* Returns 0 on success and a negative error number on failure.
|
* On success: return the base of the allocated interrupt range.
|
||||||
|
* On failure: a negative errno.
|
||||||
*/
|
*/
|
||||||
int irq_sim_init(struct irq_sim *sim, unsigned int num_irqs)
|
int irq_sim_init(struct irq_sim *sim, unsigned int num_irqs)
|
||||||
{
|
{
|
||||||
|
@ -79,7 +80,7 @@ int irq_sim_init(struct irq_sim *sim, unsigned int num_irqs)
|
||||||
init_irq_work(&sim->work_ctx.work, irq_sim_handle_irq);
|
init_irq_work(&sim->work_ctx.work, irq_sim_handle_irq);
|
||||||
sim->irq_count = num_irqs;
|
sim->irq_count = num_irqs;
|
||||||
|
|
||||||
return 0;
|
return sim->irq_base;
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(irq_sim_init);
|
EXPORT_SYMBOL_GPL(irq_sim_init);
|
||||||
|
|
||||||
|
@ -111,7 +112,8 @@ static void devm_irq_sim_release(struct device *dev, void *res)
|
||||||
* @sim: The interrupt simulator object to initialize.
|
* @sim: The interrupt simulator object to initialize.
|
||||||
* @num_irqs: Number of interrupts to allocate
|
* @num_irqs: Number of interrupts to allocate
|
||||||
*
|
*
|
||||||
* Returns 0 on success and a negative error number on failure.
|
* On success: return the base of the allocated interrupt range.
|
||||||
|
* On failure: a negative errno.
|
||||||
*/
|
*/
|
||||||
int devm_irq_sim_init(struct device *dev, struct irq_sim *sim,
|
int devm_irq_sim_init(struct device *dev, struct irq_sim *sim,
|
||||||
unsigned int num_irqs)
|
unsigned int num_irqs)
|
||||||
|
@ -132,7 +134,7 @@ int devm_irq_sim_init(struct device *dev, struct irq_sim *sim,
|
||||||
dr->sim = sim;
|
dr->sim = sim;
|
||||||
devres_add(dev, dr);
|
devres_add(dev, dr);
|
||||||
|
|
||||||
return 0;
|
return rv;
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(devm_irq_sim_init);
|
EXPORT_SYMBOL_GPL(devm_irq_sim_init);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue