[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <878qd6147f.ffs@tglx>
Date: Fri, 06 Feb 2026 12:50:12 +0100
From: Thomas Gleixner <tglx@...nel.org>
To: Biju <biju.das.au@...il.com>
Cc: Biju Das <biju.das.jz@...renesas.com>, linux-kernel@...r.kernel.org,
Geert Uytterhoeven <geert+renesas@...der.be>, Prabhakar Mahadev Lad
<prabhakar.mahadev-lad.rj@...renesas.com>, Biju Das
<biju.das.au@...il.com>, linux-renesas-soc@...r.kernel.org
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?
> +};
> +
> /**
> * 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.
> - 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.
Thanks,
tglx
Powered by blists - more mailing lists