Re: [PATCH v1 1/5] i2c: mux: pca954x: Refactor pca954x_irq_handler()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 2020-03-06 11:02, Andy Shevchenko wrote:
> On Thu, Mar 05, 2020 at 09:34:46PM +0000, Peter Rosin wrote:
>> On 2020-03-05 16:53, Andy Shevchenko wrote:
>>> Refactor pca954x_irq_handler() to:
>>>   - use for_each_set_bit() macro
>>>   - use IRQ_RETVAL() macro
>>>
>>> Above change makes code easy to read and understand.
> 
>>> +	pending = ret >> PCA954X_IRQ_OFFSET;
>>> +	for_each_set_bit(i, &pending, data->chip->nchans)
>>> +		handle_nested_irq(irq_linear_revmap(data->irq, i));
>>> +
>>> +	return IRQ_RETVAL(pending);
>>
>> What if ret has some bit set above the bit corresponding to the last channel?
> 
> We will "handle" spurious interrupt.
> 
>> Maybe that's somehow not possible, but if that's the case it's not apparent.
> 
> So, does
> 
> 	pending = (ret >> PCA954X_IRQ_OFFSET) & (BIT(data->chip->nchans) - 1);
> 
> satisfy you?
> 

Yep, that's safer. Thanks!

Cheers,
Peter



[Index of Archives]     [Linux GPIO]     [Linux SPI]     [Linux Hardward Monitoring]     [LM Sensors]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux