Re: [PATCH 5/8] irqchip/loongson-pch-lpc: add OF init code

From: Icenowy Zheng

Date: Mon Feb 02 2026 - 00:50:53 EST


在 2026-02-01星期日的 17:19 +0100,Thomas Gleixner写道:
> On Sat, Jan 31 2026 at 17:45, Icenowy Zheng wrote:
>
> > As the (kernel-internally) OF-based MIPS Loongson-3 systems can
> > also
>
> What are kernel-internally systems?

I mean kernel-internally-OF-based. These devices' firmware does not
ship DT, but Linux kernel ships some DTs and pick one by arch code.

Do you have any suggestions for rewording to make this more clear? Or
should I just stop to mention this implementaion detail?

>
> > have PCH LPC interrupt controller, add OF-based initialization code
> > for
>
> have a ... controller.
>
> Add OF ....
>
> > +#ifdef CONFIG_OF
> > +static int pch_lpc_of_init(struct device_node *node,
> > +                               struct device_node *parent)
>
> No line break required.
>
> > +{
> > +       int parent_irq;
> > +       struct fwnode_handle *irq_handle;
> > +       struct resource res;
>
> Variable ordering.

Is there any rule for the ordering?

>
> > +       if (of_address_to_resource(node, 0, &res))
> > +               return -EINVAL;
> > +
> > +       parent_irq = irq_of_parse_and_map(node, 0);
> > +       if (!parent_irq) {
> > +               pr_err("Failed to get the parent IRQ for LPC
> > IRQs\n");
> > +               return -EINVAL;
> > +       }
> > +
> > +       irq_handle = of_fwnode_handle(node);
> > +
> > +       return pch_lpc_init(res.start, resource_size(&res),
> > irq_handle,
> > +                           parent_irq);
>
> If pch_lpc_init() fails the parent interrupt mapping is leaked, no?

I don't know any reverse operation for irq_of_parse_and_map(), and most
implementations I see has no cleanup codepath for this parent IRQ.

Thanks,
Icenowy

>
> Thanks,
>
>         tglx