[PATCH 18/22] staging: comedi: ni_6527: tidy up the interrupt subdevice

Ian Abbott abbotti at mev.co.uk
Wed Oct 2 11:41:54 UTC 2013


On 2013-10-02 12:17, Ian Abbott wrote:
> On 2013-10-01 23:14, H Hartley Sweeten wrote:
>> Do the request_irq() before setting up the subdevices. Only initialize
>> the interrupt subdevice if the irq is actually available.
>
> Since it's using IRQ_SHARED, you'll need add a test to the start of
> ni6527_interrupt() to check dev->attached before accessing the subdevice:
>
>      if (!dev->attached)
>          return IRQ_NONE;
>

Actually, the first thing the interrupt does is read the status 
register, which should indicate that the device is not asserting a reset 
since the hardware has just been initialized by ni6527_reset() to 
disable and clear interrupts.

So it should be safe.  It may still be worth checking one of 
dev->attached or dev->read_subdev for additional safety.

-- 
-=( Ian Abbott @ MEV Ltd.    E-mail: <abbotti at mev.co.uk>        )=-
-=( Tel: +44 (0)161 477 1898   FAX: +44 (0)161 718 3587         )=-


More information about the devel mailing list