[PATCH 3/4] staging: comedi: ni_pcidio: Add comedi_poll support

Dan Carpenter dan.carpenter at oracle.com
Mon Jan 9 17:14:30 UTC 2012


On Mon, Jan 09, 2012 at 03:47:32PM +0000, Ian Abbott wrote:
> This patch is ported over by me (Ian Abbott) from the out-of-tree Comedi
> git repository at "git://comedi.org/git/comedi/comedi.git".
> 
> The original patch is by Nicholas Nell.
> 
> The patch adds support for the COMEDI_POLL ioctl to the ni_pcidio
> driver.
> 
> Signed-off-by: Ian Abbott <abbotti at mev.co.uk>
> Cc: Nicholas Nell <nicholas.nell at colorado.edu>
> ---
>  drivers/staging/comedi/drivers/ni_pcidio.c |   22 ++++++++++++++++++++++
>  1 files changed, 22 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/staging/comedi/drivers/ni_pcidio.c b/drivers/staging/comedi/drivers/ni_pcidio.c
> index 5145bf1..c258059 100644
> --- a/drivers/staging/comedi/drivers/ni_pcidio.c
> +++ b/drivers/staging/comedi/drivers/ni_pcidio.c
> @@ -483,12 +483,28 @@ void ni_pcidio_event(struct comedi_device *dev, struct comedi_subdevice *s)
>  	comedi_event(dev, s);
>  }
>  
> +static int ni_pcidio_poll(struct comedi_device *dev, struct comedi_subdevice *s)
> +{
> +	unsigned long flags_dev, flags_mite;
> +	int count;
> +
> +	spin_lock_irqsave(&dev->spinlock, flags_dev);
> +	spin_lock_irqsave(&devpriv->mite_channel_lock, flags_mite);

We disabled IRQs on the line before.  No need to disable them a
second time.

regards,
dan carpenter

> +	if (devpriv->di_mite_chan)
> +		mite_sync_input_dma(devpriv->di_mite_chan, s->async);
> +	spin_unlock_irqrestore(&devpriv->mite_channel_lock, flags_mite);
> +	count = s->async->buf_write_count - s->async->buf_read_count;
> +	spin_unlock_irqrestore(&dev->spinlock, flags_dev);
> +	return count;
> +}
> +

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://driverdev.linuxdriverproject.org/pipermail/driverdev-devel/attachments/20120109/35ca6a51/attachment.asc>


More information about the devel mailing list