From 96fc8794d6d51d71a493540744a728dbea70ce3e Mon Sep 17 00:00:00 2001 From: Frank Mori Hess Date: Sun, 18 Jul 2004 01:03:23 +0000 Subject: [PATCH] missed some locking that should have been converted to use devpriv->window_lock --- comedi/drivers/ni_atmio.c | 19 +++++++++---------- comedi/drivers/ni_mio_cs.c | 21 ++++++++++----------- comedi/drivers/ni_pcimio.c | 27 ++++++++++++--------------- 3 files changed, 31 insertions(+), 36 deletions(-) diff --git a/comedi/drivers/ni_atmio.c b/comedi/drivers/ni_atmio.c index 94d5f14a..c476e896 100644 --- a/comedi/drivers/ni_atmio.c +++ b/comedi/drivers/ni_atmio.c @@ -255,6 +255,11 @@ static int ni_irqpin[]={-1,-1,-1,0,1,2,-1,3,-1,-1,4,5,6,-1,-1,7}; #define NI_E_IRQ_FLAGS 0 +typedef struct{ + struct pci_dev *isapnp_dev; + NI_PRIVATE_COMMON +}ni_private; +#define devpriv ((ni_private *)dev->private) /* How we access registers */ @@ -276,14 +281,14 @@ static inline void __win_out(comedi_device *dev, unsigned short data, int addr) { unsigned long flags; - comedi_spin_lock_irqsave(&dev->spinlock,flags); + comedi_spin_lock_irqsave(&devpriv->window_lock,flags); if((addr)<8){ ni_writew(data,addr*2); }else{ ni_writew(addr,Window_Address); ni_writew(data,Window_Data); } - comedi_spin_unlock_irqrestore(&dev->spinlock,flags); + comedi_spin_unlock_irqrestore(&devpriv->window_lock,flags); } #define win_in(addr) __win_in(dev,addr) @@ -292,14 +297,14 @@ static inline unsigned short __win_in(comedi_device *dev, int addr) unsigned long flags; int ret; - comedi_spin_lock_irqsave(&dev->spinlock,flags); + comedi_spin_lock_irqsave(&devpriv->window_lock,flags); if(addr<8){ ret = ni_readw(addr*2); }else{ ni_writew(addr,Window_Address); ret = ni_readw(Window_Data); } - comedi_spin_unlock_irqrestore(&dev->spinlock,flags); + comedi_spin_unlock_irqrestore(&devpriv->window_lock,flags); return ret; } @@ -314,12 +319,6 @@ static struct isapnp_device_id device_ids[] = { MODULE_DEVICE_TABLE(isapnp, device_ids); #endif -typedef struct{ - struct pci_dev *isapnp_dev; - NI_PRIVATE_COMMON -}ni_private; -#define devpriv ((ni_private *)dev->private) - static int ni_atmio_attach(comedi_device *dev,comedi_devconfig *it); static int ni_atmio_detach(comedi_device *dev); static comedi_driver driver_atmio={ diff --git a/comedi/drivers/ni_mio_cs.c b/comedi/drivers/ni_mio_cs.c index 2f08d047..ad43d16c 100644 --- a/comedi/drivers/ni_mio_cs.c +++ b/comedi/drivers/ni_mio_cs.c @@ -162,6 +162,12 @@ static ni_board ni_boards[]={ #define NI_E_IRQ_FLAGS SA_SHIRQ +typedef struct{ + dev_link_t *link; + + NI_PRIVATE_COMMON +}ni_private; +#define devpriv ((ni_private *)dev->private) /* How we access registers */ @@ -183,14 +189,14 @@ static inline void __win_out(comedi_device *dev, unsigned short data, int addr) { unsigned long flags; - comedi_spin_lock_irqsave(&dev->spinlock,flags); + comedi_spin_lock_irqsave(&devpriv->window_lock,flags); if(addr<8){ ni_writew(data,addr*2); }else{ ni_writew(addr,Window_Address); ni_writew(data,Window_Data); } - comedi_spin_unlock_irqrestore(&dev->spinlock,flags); + comedi_spin_unlock_irqrestore(&devpriv->window_lock,flags); } #define win_in(addr) __win_in(dev,addr) @@ -199,25 +205,18 @@ static inline unsigned short __win_in(comedi_device *dev, int addr) unsigned long flags; int ret; - comedi_spin_lock_irqsave(&dev->spinlock,flags); + comedi_spin_lock_irqsave(&devpriv->window_lock,flags); if(addr<8){ ret = ni_readw(addr*2); }else{ ni_writew(addr,Window_Address); ret = ni_readw(Window_Data); } - comedi_spin_unlock_irqrestore(&dev->spinlock,flags); + comedi_spin_unlock_irqrestore(&devpriv->window_lock,flags); return ret; } -typedef struct{ - dev_link_t *link; - - NI_PRIVATE_COMMON -}ni_private; -#define devpriv ((ni_private *)dev->private) - static int mio_cs_attach(comedi_device *dev,comedi_devconfig *it); static int mio_cs_detach(comedi_device *dev); static comedi_driver driver_ni_mio_cs={ diff --git a/comedi/drivers/ni_pcimio.c b/comedi/drivers/ni_pcimio.c index 52dbc50a..8673a443 100644 --- a/comedi/drivers/ni_pcimio.c +++ b/comedi/drivers/ni_pcimio.c @@ -666,6 +666,14 @@ static comedi_driver driver_pcimio={ }; COMEDI_INITCLEANUP(driver_pcimio); +typedef struct{ + struct mite_struct *mite; + + NI_PRIVATE_COMMON + + unsigned int last_buf_write_count; +}ni_private; +#define devpriv ((ni_private *)dev->private) /* How we access registers */ @@ -691,10 +699,10 @@ static inline void __win_out(comedi_device *dev, unsigned short data, int addr) { unsigned long flags; - comedi_spin_lock_irqsave(&dev->spinlock,flags); + comedi_spin_lock_irqsave(&devpriv->window_lock,flags); ni_writew(addr,Window_Address); ni_writew(data,Window_Data); - comedi_spin_unlock_irqrestore(&dev->spinlock,flags); + comedi_spin_unlock_irqrestore(&devpriv->window_lock,flags); } #define win_in(addr) __win_in(dev,addr) @@ -703,10 +711,10 @@ static inline unsigned short __win_in(comedi_device *dev, int addr) unsigned long flags; int ret; - comedi_spin_lock_irqsave(&dev->spinlock,flags); + comedi_spin_lock_irqsave(&devpriv->window_lock,flags); ni_writew(addr,Window_Address); ret = ni_readw(Window_Data); - comedi_spin_unlock_irqrestore(&dev->spinlock,flags); + comedi_spin_unlock_irqrestore(&devpriv->window_lock,flags); return ret; } @@ -716,17 +724,6 @@ static inline unsigned short __win_in(comedi_device *dev, int addr) #define NI_E_IRQ_FLAGS SA_SHIRQ - -typedef struct{ - struct mite_struct *mite; - - NI_PRIVATE_COMMON - - unsigned int last_buf_write_count; -}ni_private; -#define devpriv ((ni_private *)dev->private) - - #include "ni_mio_common.c" -- 2.26.2