carma-fpga: fix lockdep warning
Lockdep occasionally complains with the message: INFO: HARDIRQ-safe -> HARDIRQ-unsafe lock order detected This is caused by calling videobuf_dma_unmap() under spin_lock_irq(). To fix the warning, we drop the lock before unmapping and freeing the buffer. Signed-off-by: Ira W. Snyder <iws@ovro.caltech.edu> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
This commit is contained in:
committed by
Benjamin Herrenschmidt
parent
6d45584fdc
commit
75ff85a816
@@ -1079,6 +1079,7 @@ static ssize_t data_read(struct file *filp, char __user *ubuf, size_t count,
|
|||||||
struct fpga_reader *reader = filp->private_data;
|
struct fpga_reader *reader = filp->private_data;
|
||||||
struct fpga_device *priv = reader->priv;
|
struct fpga_device *priv = reader->priv;
|
||||||
struct list_head *used = &priv->used;
|
struct list_head *used = &priv->used;
|
||||||
|
bool drop_buffer = false;
|
||||||
struct data_buf *dbuf;
|
struct data_buf *dbuf;
|
||||||
size_t avail;
|
size_t avail;
|
||||||
void *data;
|
void *data;
|
||||||
@@ -1166,10 +1167,12 @@ have_buffer:
|
|||||||
* One of two things has happened, the device is disabled, or the
|
* One of two things has happened, the device is disabled, or the
|
||||||
* device has been reconfigured underneath us. In either case, we
|
* device has been reconfigured underneath us. In either case, we
|
||||||
* should just throw away the buffer.
|
* should just throw away the buffer.
|
||||||
|
*
|
||||||
|
* Lockdep complains if this is done under the spinlock, so we
|
||||||
|
* handle it during the unlock path.
|
||||||
*/
|
*/
|
||||||
if (!priv->enabled || dbuf->size != priv->bufsize) {
|
if (!priv->enabled || dbuf->size != priv->bufsize) {
|
||||||
videobuf_dma_unmap(priv->dev, &dbuf->vb);
|
drop_buffer = true;
|
||||||
data_free_buffer(dbuf);
|
|
||||||
goto out_unlock;
|
goto out_unlock;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1178,6 +1181,12 @@ have_buffer:
|
|||||||
|
|
||||||
out_unlock:
|
out_unlock:
|
||||||
spin_unlock_irq(&priv->lock);
|
spin_unlock_irq(&priv->lock);
|
||||||
|
|
||||||
|
if (drop_buffer) {
|
||||||
|
videobuf_dma_unmap(priv->dev, &dbuf->vb);
|
||||||
|
data_free_buffer(dbuf);
|
||||||
|
}
|
||||||
|
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user