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

From: Benjamin Herrenschmidt <[email-masked]>
Date: Fri, 27 Jan 2012 08:25:37 +1100

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.

Cheers,
Ben.