Re: [PATCH 1/7] irqchip/loongarch-avec: Adjust irqchip driver for 32BIT/64BIT
From: Huacai Chen
Date: Mon Jan 12 2026 - 23:42:09 EST
On Sat, Jan 10, 2026 at 4:37 AM Thomas Gleixner <tglx@xxxxxxxxxx> wrote:
>
> On Fri, Jan 09 2026 at 12:23, Jiaxun Yang wrote:
> > On Fri, 9 Jan 2026, at 12:09 PM, Thomas Gleixner wrote:
> >>> static inline void avecintc_enable(void)
> >>> {
> >>> +#ifdef CONFIG_MACH_LOONGSON64
> >>> u64 value;
> >>>
> >>> value = iocsr_read64(LOONGARCH_IOCSR_MISC_FUNC);
> >>> value |= IOCSR_MISC_FUNC_AVEC_EN;
> >>> iocsr_write64(value, LOONGARCH_IOCSR_MISC_FUNC);
> >>> +#endif
> >>
> >> Can't this be:
> >>
> >> if (IS_ENABLED(CONFIG_MACH_LOONGSON64))
> >>
> >> which is preferred over ifdeffery?
> >
> > Sadly, iocsr_read64 symbol is only available on 64 bit systems,
> > so it must be guarded somehow.
>
> It's unconditionally defined so using IS_ENABLED() is fine because the
> compiler optimizes everything out before the resolv stage.
I'm sorry but IS_ENABLED() doesn't work in this case. Because
iocsr_read64() is not a regular function but a compiler intrinsic, it
is handled in the pre-process stage, so still causes build errors.
Please ignore my V2 and I will re-send V3, thanks.
Huacai
>
> Thanks,
>
> tglx