Re: [PATCH] irqdomain: fix -Wshadow warning

From: Thomas Gleixner
Date: Mon Nov 16 2020 - 12:29:01 EST


On Mon, Nov 16 2020 at 16:26, Arnd Bergmann wrote:
> On Mon, Nov 16, 2020 at 3:03 PM Thomas Gleixner <tglx@xxxxxxxxxxxxx> wrote:
>> So instead of trying to chase all these places we really want to rename
>> the global 'nr_irqs' variable.
>
> Fair enough, yes.
>
>> Something like the uncompiled below which is purely mechanical and does
>> not even try to look at some of the places which use it for the very
>> wrong reasons and purpose * Shudder *.
>
> Looks good to me.
>
> If we rename it, we might want to pick an even longer name to make
> it stand out in code review when it does get used, and easier to
> grep for.

Sure, I just picked it lazily without much thought.

>> + if (msi < max_nr_irqs && irq_get_chip_data(msi) == msic) {
>> generic_handle_irq(msi);
>> msic->fifo_virt[idx] = cpu_to_le32(0xffffffff);
>> } else {
>
> Most of the ones like this seem to have been simply converted from
> old sanity checks using NR_IRQS and would work just as well without
> the checks.

Yeah. As I said I did not look closely, but the peek already told me
that there is cruft.

> Actually removing the checks would have a small regression
> potential.

Right, it shouldn't cause problems.

>> --- a/drivers/pcmcia/at91_cf.c
>> +++ b/drivers/pcmcia/at91_cf.c
>
> potential.
>
>> @@ -312,7 +312,7 @@ static int at91_cf_probe(struct platform
>> goto fail0a;
>> cf->socket.pci_irq = gpio_to_irq(board->irq_pin);
>> } else
>> - cf->socket.pci_irq = nr_irqs + 1;
>> + cf->socket.pci_irq = max_nr_irqs + 1;
>>
>> /*
>> * pcmcia layer only remaps "real" memory not iospace
>
> This one would seem to actually warrant a bugfix, setting
> the field to zero.

Indeed.

Thanks,

tglx