[PATCH 31/31] genirq: Improve "hwirq" output in /proc and /sys/

Thomas Gleixner tglx at linutronix.de
Thu May 20 22:57:10 AEST 2021


On Thu, May 20 2021 at 14:27, Cédric Le Goater wrote:
> On 5/14/21 10:49 PM, Thomas Gleixner wrote:
>> On Fri, Apr 30 2021 at 10:04, Cédric Le Goater wrote:
>>> The HW IRQ numbers generated by the PCI MSI layer can be quite large
>>> on a pSeries machine when running under the IBM Hypervisor and they
>>> appear as negative. Use '%u' to show them correctly.
>>>
>>> Cc: Thomas Gleixner <tglx at linutronix.de>
>>> Signed-off-by: Cédric Le Goater <clg at kaod.org>
>>> ---
>>>  kernel/irq/irqdesc.c | 2 +-
>>>  kernel/irq/proc.c    | 2 +-
>>>  2 files changed, 2 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/kernel/irq/irqdesc.c b/kernel/irq/irqdesc.c
>>> index cc1a09406c6e..85054eb2ae51 100644
>>> --- a/kernel/irq/irqdesc.c
>>> +++ b/kernel/irq/irqdesc.c
>>> @@ -188,7 +188,7 @@ static ssize_t hwirq_show(struct kobject *kobj,
>>>  
>>>  	raw_spin_lock_irq(&desc->lock);
>>>  	if (desc->irq_data.domain)
>>> -		ret = sprintf(buf, "%d\n", (int)desc->irq_data.hwirq);
>>> +		ret = sprintf(buf, "%u\n", (int)desc->irq_data.hwirq);
>> 
>> Which makes the (int) cast pointless, right?
>
> Well, hwirq is a long.

And that makes '%u' plus an int casted argument any more correct?

Aside of that hwirq is an unsigned long type and not long.

> Would you prefer a "%lu" for both ?

That's the obvious right thing to do, isn't it?

Thanks,

        tglx


More information about the Linuxppc-dev mailing list