[PATCH v2 41/43] staging: comedi: ni_660x: remove spinlock 'dma_cfg_lock'

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This spinlock is only used to protect changes to the private data 'dma_cfg'.

Before calling any function that would change the 'dma_cfg' the spinlock
'mite_channel_lock' is also locked. That spinlock is not unlocked until
after the 'dma_cfg' change.

Remove the redundant spinlock.

Signed-off-by: H Hartley Sweeten <hsweeten@xxxxxxxxxxxxxxxxxxx>
Cc: Ian Abbott <abbotti@xxxxxxxxx>
Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
 drivers/staging/comedi/drivers/ni_660x.c | 9 ---------
 1 file changed, 9 deletions(-)

diff --git a/drivers/staging/comedi/drivers/ni_660x.c b/drivers/staging/comedi/drivers/ni_660x.c
index 85c793a..3b57ce5 100644
--- a/drivers/staging/comedi/drivers/ni_660x.c
+++ b/drivers/staging/comedi/drivers/ni_660x.c
@@ -263,8 +263,6 @@ struct ni_660x_private {
 	spinlock_t mite_channel_lock;
 	/* prevents races between interrupt and comedi_poll */
 	spinlock_t interrupt_lock;
-	/* protects dma_cfg changes */
-	spinlock_t dma_cfg_lock;
 	unsigned int dma_cfg[NI660X_MAX_CHIPS];
 	unsigned int io_cfg[NI660X_NUM_PFI_CHANNELS];
 	u64 io_dir;
@@ -313,9 +311,7 @@ static inline void ni_660x_set_dma_channel(struct comedi_device *dev,
 {
 	struct ni_660x_private *devpriv = dev->private;
 	unsigned int chip = counter->chip_index;
-	unsigned long flags;
 
-	spin_lock_irqsave(&devpriv->dma_cfg_lock, flags);
 	devpriv->dma_cfg[chip] &= ~NI660X_DMA_CFG_SEL_MASK(mite_channel);
 	devpriv->dma_cfg[chip] |= NI660X_DMA_CFG_SEL(mite_channel,
 						     counter->counter_index);
@@ -323,7 +319,6 @@ static inline void ni_660x_set_dma_channel(struct comedi_device *dev,
 		      NI660X_DMA_CFG_RESET(mite_channel),
 		      NI660X_DMA_CFG);
 	mmiowb();
-	spin_unlock_irqrestore(&devpriv->dma_cfg_lock, flags);
 }
 
 static inline void ni_660x_unset_dma_channel(struct comedi_device *dev,
@@ -332,14 +327,11 @@ static inline void ni_660x_unset_dma_channel(struct comedi_device *dev,
 {
 	struct ni_660x_private *devpriv = dev->private;
 	unsigned int chip = counter->chip_index;
-	unsigned long flags;
 
-	spin_lock_irqsave(&devpriv->dma_cfg_lock, flags);
 	devpriv->dma_cfg[chip] &= ~NI660X_DMA_CFG_SEL_MASK(mite_channel);
 	devpriv->dma_cfg[chip] |= NI660X_DMA_CFG_SEL_NONE(mite_channel);
 	ni_660x_write(dev, chip, devpriv->dma_cfg[chip], NI660X_DMA_CFG);
 	mmiowb();
-	spin_unlock_irqrestore(&devpriv->dma_cfg_lock, flags);
 }
 
 static int ni_660x_request_mite_channel(struct comedi_device *dev,
@@ -500,7 +492,6 @@ static int ni_660x_allocate_private(struct comedi_device *dev)
 
 	spin_lock_init(&devpriv->mite_channel_lock);
 	spin_lock_init(&devpriv->interrupt_lock);
-	spin_lock_init(&devpriv->dma_cfg_lock);
 	for (i = 0; i < NI660X_NUM_PFI_CHANNELS; ++i)
 		devpriv->io_cfg[i] = NI_660X_PFI_OUTPUT_COUNTER;
 
-- 
2.6.3

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux