diff options
author | Ira Snyder <iws@ovro.caltech.edu> | 2012-01-26 05:59:54 -0500 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2012-02-26 19:33:59 -0500 |
commit | 75ff85a81680e5779383aa6210a4f89ed76e40ec (patch) | |
tree | c327f25f2a51fc32382f0fcff4fee7c0532b6f15 /drivers/misc/carma/carma-fpga.c | |
parent | 6d45584fdc202fd30da655120412210153429104 (diff) |
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>
Diffstat (limited to 'drivers/misc/carma/carma-fpga.c')
-rw-r--r-- | drivers/misc/carma/carma-fpga.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/drivers/misc/carma/carma-fpga.c b/drivers/misc/carma/carma-fpga.c index 14e974b2a781..4fd896deda0d 100644 --- a/drivers/misc/carma/carma-fpga.c +++ b/drivers/misc/carma/carma-fpga.c | |||
@@ -1079,6 +1079,7 @@ static ssize_t data_read(struct file *filp, char __user *ubuf, size_t count, | |||
1079 | struct fpga_reader *reader = filp->private_data; | 1079 | struct fpga_reader *reader = filp->private_data; |
1080 | struct fpga_device *priv = reader->priv; | 1080 | struct fpga_device *priv = reader->priv; |
1081 | struct list_head *used = &priv->used; | 1081 | struct list_head *used = &priv->used; |
1082 | bool drop_buffer = false; | ||
1082 | struct data_buf *dbuf; | 1083 | struct data_buf *dbuf; |
1083 | size_t avail; | 1084 | size_t avail; |
1084 | void *data; | 1085 | void *data; |
@@ -1166,10 +1167,12 @@ have_buffer: | |||
1166 | * One of two things has happened, the device is disabled, or the | 1167 | * One of two things has happened, the device is disabled, or the |
1167 | * device has been reconfigured underneath us. In either case, we | 1168 | * device has been reconfigured underneath us. In either case, we |
1168 | * should just throw away the buffer. | 1169 | * should just throw away the buffer. |
1170 | * | ||
1171 | * Lockdep complains if this is done under the spinlock, so we | ||
1172 | * handle it during the unlock path. | ||
1169 | */ | 1173 | */ |
1170 | if (!priv->enabled || dbuf->size != priv->bufsize) { | 1174 | if (!priv->enabled || dbuf->size != priv->bufsize) { |
1171 | videobuf_dma_unmap(priv->dev, &dbuf->vb); | 1175 | drop_buffer = true; |
1172 | data_free_buffer(dbuf); | ||
1173 | goto out_unlock; | 1176 | goto out_unlock; |
1174 | } | 1177 | } |
1175 | 1178 | ||
@@ -1178,6 +1181,12 @@ have_buffer: | |||
1178 | 1181 | ||
1179 | out_unlock: | 1182 | out_unlock: |
1180 | spin_unlock_irq(&priv->lock); | 1183 | spin_unlock_irq(&priv->lock); |
1184 | |||
1185 | if (drop_buffer) { | ||
1186 | videobuf_dma_unmap(priv->dev, &dbuf->vb); | ||
1187 | data_free_buffer(dbuf); | ||
1188 | } | ||
1189 | |||
1181 | return count; | 1190 | return count; |
1182 | } | 1191 | } |
1183 | 1192 | ||