Subject: Re: [PATCH 1/1] carma-fpga: fix race between data dumping and DMA callback

From: "Ira W. Snyder" <[email-masked]>
Date: Fri, 27 Jan 2012 08:07:58 -0800

On Fri, Jan 27, 2012 at 08:25:37AM +1100, Benjamin Herrenschmidt wrote:
> On Thu, 2012-01-26 at 13:00 -0800, Ira W. Snyder wrote:
> > 
> > @@ -970,7 +984,13 @@ static ssize_t data_en_show(struct device *dev, struct device_attribute *attr,
> >                             char *buf)
> >  {
> >         struct fpga_device *priv = dev_get_drvdata(dev);
> > -       return snprintf(buf, PAGE_SIZE, "%u\n", priv->enabled);
> > +       int ret;
> > +
> > +       spin_lock_irq(&priv->lock);
> > +       ret = snprintf(buf, PAGE_SIZE, "%u\n", priv->enabled);
> > +       spin_unlock_irq(&priv->lock);
> > +
> > +       return ret;
> >  } 
> 
> I don't think the lock buys you anything here.
> 

You're right. Feel free to drop the hunk.

Ira

> Cheers,
> Ben.