RE: [PATCH v3 4/9] irqchip/renesas-rzg2l: Drop IRQC_NUM_IRQ macro
From: Biju Das
Date: Tue Feb 24 2026 - 08:50:13 EST
Hi Thomas,
Thanks for the feedback.
> -----Original Message-----
> From: Thomas Gleixner <tglx@xxxxxxxxxx>
> Sent: 06 February 2026 11:50
> Subject: Re: [PATCH v3 4/9] irqchip/renesas-rzg2l: Drop IRQC_NUM_IRQ macro
>
> On Fri, Feb 06 2026 at 11:16, Biju wrote:
> > +/**
> > + * struct rzg2l_hw_info - Interrupt Control Unit controller hardware info structure.
> > + * @num_irq: Total Number of interrupts
> > + */
> > +struct rzg2l_hw_info {
> > + u8 num_irq;
>
> Odd data type. Whats wrong with a good old unsigned int?
Ok will use unsigned int
>
> > +};
> > +
> > /**
> > * struct rzg2l_irqc_priv - IRQ controller private data structure
> > * @base: Controller's base address
> > * @irqchip: Pointer to struct irq_chip
> > * @fwspec: IRQ firmware specific data
> > * @lock: Lock to serialize access to hardware registers
> > + * @info: Pointer to struct rzg2l_hw_info
>
> Why a pointer?
>
> > * @cache: Registers cache for suspend/resume
> > */
> > static struct rzg2l_irqc_priv {
> > @@ -81,6 +89,7 @@ static struct rzg2l_irqc_priv {
> > const struct irq_chip *irqchip;
> > struct irq_fwspec *fwspec;
> > raw_spinlock_t lock;
> > + const struct rzg2l_hw_info *info;
> > struct rzg2l_irqc_reg_cache cache;
> > } *rzg2l_irqc_data;
> >
> > @@ -136,7 +145,7 @@ static void rzg2l_irqc_eoi(struct irq_data *d)
> > raw_spin_lock(&priv->lock);
> > if (hw_irq >= IRQC_IRQ_START && hw_irq <= IRQC_IRQ_COUNT)
> > rzg2l_clear_irq_int(priv, hw_irq);
> > - else if (hw_irq >= IRQC_TINT_START && hw_irq < IRQC_NUM_IRQ)
> > + else if (hw_irq >= IRQC_TINT_START && hw_irq < priv->info->num_irq)
>
> Ah I see. To make this more expensive by accessing yet another cache line. Simply embed a struct
> hwinfo into irqc_priv and copy the data into it at probe time.
Ok, will simply embed a struct hwinfo into irqc_priv and
copy the data into it at probe time.
>
>
> > - if (hwirq > (IRQC_NUM_IRQ - 1))
> > + if (hwirq > (priv->info->num_irq - 1))
>
> hwirq >= priv->info.num_irq
>
> This -1 logic is horrible and error prone.
OK will fix this in next version.
Cheers,
Biju