Re: [PATCH 11/24] RISC-V: ACPI: irqchip/riscv-intc: Add ACPI support

Sunil V L
2023-02-13T15:25:26Z

On Wed, Feb 08, 2023 at 09:49:40PM +0000, Conor Dooley wrote:
> Hey Sunil,
>
> On Mon, Jan 30, 2023 at 11:52:12PM +0530, Sunil V L wrote:
> > Add support for initializing the RISC-V INTC driver on ACPI based
> > platforms.
> >
> > Signed-off-by: Sunil V L <sunilvl@ventanamicro.com>
>
> > +static int __init
> > +riscv_intc_acpi_init(union acpi_subtable_headers *header,
> > + const unsigned long end)
> > +{
> > + int rc;
> > + struct fwnode_handle *fn;
> > + struct acpi_madt_rintc *rintc;
> > +
> > + rintc = (struct acpi_madt_rintc *)header;
> > +
> > + /*
> > + * The ACPI MADT will have one INTC for each CPU (or HART)
> > + * so riscv_intc_acpi_init() function will be called once
> > + * for each INTC. We only need to do INTC initialization
> > + * for the INTC belonging to the boot CPU (or boot HART).
> > + */
> > + if (riscv_hartid_to_cpuid(rintc->hart_id) != smp_processor_id())
> > + return 0;
> > +
> > + fn = irq_domain_alloc_named_fwnode("RISCV-INTC");
> > + WARN_ON(fn == NULL);
>
> Is there a reason that you do not just check this as !fn?
>
> > + if (!fn) {
>
> This is a repeated check from the WARN_ON(), no?
>
> > + pr_err("unable to allocate INTC FW node\n");
>
> Why do you need a WARN_ON() & the pr_err() here?
>
You are right. Will remove the WARN_ON.

> > + return -1;
>
> Why not an actual ERRNO?
>
Okay.

Thanks,
Sunil