[PATCH 1/1] carma-fpga: fix race between data dumping and DMA callback
Benjamin Herrenschmidt
benh at kernel.crashing.org
Fri Jan 27 08:25:37 EST 2012
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.
More information about the Linuxppc-dev
mailing list