mirror of
https://github.com/riscv-software-src/opensbi.git
synced 2025-08-25 07:41:42 +01:00
lib: sbi_irqchip: Set the IRQ handler when registering a chip
In addition to saving some code size, this moves the decision about setting the top-level external interrupt handler to the irqchip core, not the specific driver, which would be needed to support chained interrupt handlers. Signed-off-by: Samuel Holland <samuel.holland@sifive.com> Reviewed-by: Anup Patel <anup@brainfault.org>
This commit is contained in:

committed by
Anup Patel

parent
678f5909a3
commit
111772353f
@@ -20,12 +20,6 @@ static int default_irqfn(void)
|
||||
|
||||
static int (*ext_irqfn)(void) = default_irqfn;
|
||||
|
||||
void sbi_irqchip_set_irqfn(int (*fn)(void))
|
||||
{
|
||||
if (fn)
|
||||
ext_irqfn = fn;
|
||||
}
|
||||
|
||||
int sbi_irqchip_process(void)
|
||||
{
|
||||
return ext_irqfn();
|
||||
@@ -34,6 +28,9 @@ int sbi_irqchip_process(void)
|
||||
void sbi_irqchip_add_device(struct sbi_irqchip_device *dev)
|
||||
{
|
||||
sbi_list_add_tail(&dev->node, &irqchip_list);
|
||||
|
||||
if (dev->irq_handle)
|
||||
ext_irqfn = dev->irq_handle;
|
||||
}
|
||||
|
||||
int sbi_irqchip_init(struct sbi_scratch *scratch, bool cold_boot)
|
||||
|
Reference in New Issue
Block a user