media: ddbridge: use spin_lock_irqsave() in output_work()
authorDaniel Scheller <d.scheller@gmx.net>
Mon, 9 Apr 2018 16:47:43 +0000 (12:47 -0400)
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Fri, 4 May 2018 14:39:30 +0000 (10:39 -0400)
Make sure to save IRQ states before taking the dma lock, as already done
in it's input_work() counterpart.

Picked up from the upstream dddvb-0.9.33 release.

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
drivers/media/pci/ddbridge/ddbridge-core.c

index cb2d9d811580a101ae2bc51972a9c0072e413e1c..7e57f5864df3c61e61567fc34fbbc1a06ba16469 100644 (file)
@@ -2117,18 +2117,18 @@ static void output_work(struct work_struct *work)
        struct ddb_dma *dma = container_of(work, struct ddb_dma, work);
        struct ddb_output *output = (struct ddb_output *)dma->io;
        struct ddb *dev = output->port->dev;
+       unsigned long flags;
 
-       spin_lock(&dma->lock);
-       if (!dma->running) {
-               spin_unlock(&dma->lock);
-               return;
-       }
+       spin_lock_irqsave(&dma->lock, flags);
+       if (!dma->running)
+               goto unlock_exit;
        dma->stat = ddbreadl(dev, DMA_BUFFER_CURRENT(dma));
        dma->ctrl = ddbreadl(dev, DMA_BUFFER_CONTROL(dma));
        if (output->redi)
                output_ack_input(output, output->redi);
        wake_up(&dma->wq);
-       spin_unlock(&dma->lock);
+unlock_exit:
+       spin_unlock_irqrestore(&dma->lock, flags);
 }
 
 static void output_handler(void *data)