Staging: w35und: remove spinlock wrappers
authorPekka Enberg <penberg@cs.helsinki.fi>
Tue, 21 Oct 2008 08:45:02 +0000 (11:45 +0300)
committerGreg Kroah-Hartman <gregkh@suse.de>
Wed, 22 Oct 2008 16:56:38 +0000 (09:56 -0700)
This patch removes the OS_SPIN_LOCK and related wrappers from the driver code.

Acked-by: Pavel Machek <pavel@suse.cz>
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/staging/winbond/linux/common.h
drivers/staging/winbond/linux/wb35reg.c
drivers/staging/winbond/linux/wb35reg_s.h
drivers/staging/winbond/mlme_s.h
drivers/staging/winbond/wblinux.c
drivers/staging/winbond/wblinux_s.h

index c8f14b7b5b22aade61baf40a91d29133f6c22b4f..712a86cfa68b5650c1c0396f7914e4a31ed8fa0a 100644 (file)
@@ -105,13 +105,6 @@ typedef struct urb * PURB;
 #define OS_MEMORY_CLEAR( _A, _S )      memset( (u8 *)_A,0,_S)
 #define OS_MEMORY_COMPARE( _A, _B, _S )        (memcmp(_A,_B,_S)? 0 : 1) // Definition is reverse with Ndis 1: the same 0: different
 
-
-#define OS_SPIN_LOCK                           spinlock_t
-#define OS_SPIN_LOCK_ALLOCATE( _S )            spin_lock_init( _S );
-#define OS_SPIN_LOCK_FREE( _S )
-#define OS_SPIN_LOCK_ACQUIRED( _S )            spin_lock_irq( _S )
-#define OS_SPIN_LOCK_RELEASED( _S )            spin_unlock_irq( _S );
-
 #define OS_TIMER       struct timer_list
 #define OS_TIMER_INITIAL( _T, _F, _P )                 \
 {                                                      \
index 5c28ec9643de1bf12a9286108bb6ad9fedbd8b56..ebb6db5438a4ed07e21a3a08ec152600bf89ad1c 100644 (file)
@@ -46,14 +46,14 @@ Wb35Reg_BurstWrite(phw_data_t pHwData, u16 RegisterNo, u32 * pRegisterData, u8 N
                pRegQueue->pUsbReq = dr;
                pRegQueue->pUrb = pUrb;
 
-               OS_SPIN_LOCK_ACQUIRED( &pWb35Reg->EP0VM_spin_lock );
+               spin_lock_irq( &pWb35Reg->EP0VM_spin_lock );
                if (pWb35Reg->pRegFirst == NULL)
                        pWb35Reg->pRegFirst = pRegQueue;
                else
                        pWb35Reg->pRegLast->Next = pRegQueue;
                pWb35Reg->pRegLast = pRegQueue;
 
-               OS_SPIN_LOCK_RELEASED( &pWb35Reg->EP0VM_spin_lock );
+               spin_unlock_irq( &pWb35Reg->EP0VM_spin_lock );
 
                // Start EP0VM
                Wb35Reg_EP0VM_start(pHwData);
@@ -193,14 +193,14 @@ Wb35Reg_Write(  phw_data_t pHwData,  u16 RegisterNo,  u32 RegisterValue )
                pRegQueue->pUsbReq = dr;
                pRegQueue->pUrb = pUrb;
 
-               OS_SPIN_LOCK_ACQUIRED(&pWb35Reg->EP0VM_spin_lock );
+               spin_lock_irq(&pWb35Reg->EP0VM_spin_lock );
                if (pWb35Reg->pRegFirst == NULL)
                        pWb35Reg->pRegFirst = pRegQueue;
                else
                        pWb35Reg->pRegLast->Next = pRegQueue;
                pWb35Reg->pRegLast = pRegQueue;
 
-               OS_SPIN_LOCK_RELEASED( &pWb35Reg->EP0VM_spin_lock );
+               spin_unlock_irq( &pWb35Reg->EP0VM_spin_lock );
 
                // Start EP0VM
                Wb35Reg_EP0VM_start(pHwData);
@@ -254,14 +254,14 @@ Wb35Reg_WriteWithCallbackValue( phw_data_t pHwData, u16 RegisterNo, u32 Register
                pRegQueue->Next = NULL;
                pRegQueue->pUsbReq = dr;
                pRegQueue->pUrb = pUrb;
-               OS_SPIN_LOCK_ACQUIRED (&pWb35Reg->EP0VM_spin_lock );
+               spin_lock_irq (&pWb35Reg->EP0VM_spin_lock );
                if( pWb35Reg->pRegFirst == NULL )
                        pWb35Reg->pRegFirst = pRegQueue;
                else
                        pWb35Reg->pRegLast->Next = pRegQueue;
                pWb35Reg->pRegLast = pRegQueue;
 
-               OS_SPIN_LOCK_RELEASED ( &pWb35Reg->EP0VM_spin_lock );
+               spin_unlock_irq ( &pWb35Reg->EP0VM_spin_lock );
 
                // Start EP0VM
                Wb35Reg_EP0VM_start(pHwData);
@@ -359,14 +359,14 @@ Wb35Reg_Read(phw_data_t pHwData, u16 RegisterNo,  u32 * pRegisterValue )
                pRegQueue->Next = NULL;
                pRegQueue->pUsbReq = dr;
                pRegQueue->pUrb = pUrb;
-               OS_SPIN_LOCK_ACQUIRED ( &pWb35Reg->EP0VM_spin_lock );
+               spin_lock_irq ( &pWb35Reg->EP0VM_spin_lock );
                if( pWb35Reg->pRegFirst == NULL )
                        pWb35Reg->pRegFirst = pRegQueue;
                else
                        pWb35Reg->pRegLast->Next = pRegQueue;
                pWb35Reg->pRegLast = pRegQueue;
 
-               OS_SPIN_LOCK_RELEASED( &pWb35Reg->EP0VM_spin_lock );
+               spin_unlock_irq( &pWb35Reg->EP0VM_spin_lock );
 
                // Start EP0VM
                Wb35Reg_EP0VM_start( pHwData );
@@ -411,9 +411,9 @@ Wb35Reg_EP0VM(phw_data_t pHwData )
                goto cleanup;
 
        // Get the register data and send to USB through Irp
-       OS_SPIN_LOCK_ACQUIRED( &pWb35Reg->EP0VM_spin_lock );
+       spin_lock_irq( &pWb35Reg->EP0VM_spin_lock );
        pRegQueue = pWb35Reg->pRegFirst;
-       OS_SPIN_LOCK_RELEASED( &pWb35Reg->EP0VM_spin_lock );
+       spin_unlock_irq( &pWb35Reg->EP0VM_spin_lock );
 
        if (!pRegQueue)
                goto cleanup;
@@ -468,12 +468,12 @@ Wb35Reg_EP0VM_complete(PURB pUrb)
                OS_ATOMIC_DEC( pHwData->Adapter, &pWb35Reg->RegFireCount );
        } else {
                // Complete to send, remove the URB from the first
-               OS_SPIN_LOCK_ACQUIRED( &pWb35Reg->EP0VM_spin_lock );
+               spin_lock_irq( &pWb35Reg->EP0VM_spin_lock );
                pRegQueue = pWb35Reg->pRegFirst;
                if (pRegQueue == pWb35Reg->pRegLast)
                        pWb35Reg->pRegLast = NULL;
                pWb35Reg->pRegFirst = pWb35Reg->pRegFirst->Next;
-               OS_SPIN_LOCK_RELEASED( &pWb35Reg->EP0VM_spin_lock );
+               spin_unlock_irq( &pWb35Reg->EP0VM_spin_lock );
 
                if (pWb35Reg->EP0VM_status) {
 #ifdef _PE_REG_DUMP_
@@ -513,7 +513,7 @@ Wb35Reg_destroy(phw_data_t pHwData)
        OS_SLEEP(10000);  // Delay for waiting function enter 940623.1.b
 
        // Release all the data in RegQueue
-       OS_SPIN_LOCK_ACQUIRED( &pWb35Reg->EP0VM_spin_lock );
+       spin_lock_irq( &pWb35Reg->EP0VM_spin_lock );
        pRegQueue = pWb35Reg->pRegFirst;
        while (pRegQueue) {
                if (pRegQueue == pWb35Reg->pRegLast)
@@ -521,7 +521,7 @@ Wb35Reg_destroy(phw_data_t pHwData)
                pWb35Reg->pRegFirst = pWb35Reg->pRegFirst->Next;
 
                pUrb = pRegQueue->pUrb;
-               OS_SPIN_LOCK_RELEASED( &pWb35Reg->EP0VM_spin_lock );
+               spin_unlock_irq( &pWb35Reg->EP0VM_spin_lock );
                if (pUrb) {
                        usb_free_urb(pUrb);
                        kfree(pRegQueue);
@@ -530,14 +530,11 @@ Wb35Reg_destroy(phw_data_t pHwData)
                        WBDEBUG(("EP0 queue release error\n"));
                        #endif
                }
-               OS_SPIN_LOCK_ACQUIRED( &pWb35Reg->EP0VM_spin_lock );
+               spin_lock_irq( &pWb35Reg->EP0VM_spin_lock );
 
                pRegQueue = pWb35Reg->pRegFirst;
        }
-       OS_SPIN_LOCK_RELEASED( &pWb35Reg->EP0VM_spin_lock );
-
-       // Free resource
-       OS_SPIN_LOCK_FREE(  &pWb35Reg->EP0VM_spin_lock );
+       spin_unlock_irq( &pWb35Reg->EP0VM_spin_lock );
 }
 
 //====================================================================================
@@ -550,7 +547,7 @@ unsigned char Wb35Reg_initial(phw_data_t pHwData)
        u32 SoftwareSet, VCO_trim, TxVga, Region_ScanInterval;
 
        // Spin lock is acquired for read and write IRP command
-       OS_SPIN_LOCK_ALLOCATE( &pWb35Reg->EP0VM_spin_lock );
+       spin_lock_init( &pWb35Reg->EP0VM_spin_lock );
 
        // Getting RF module type from EEPROM ------------------------------------
        Wb35Reg_WriteSync( pHwData, 0x03b4, 0x080d0000 ); // Start EEPROM access + Read + address(0x0d)
index 9b7630126103217478326a79ca73ceffe1c51b01..8b35b93f7f0256f5119fbb37a35ff0aeab25fb40 100644 (file)
@@ -143,7 +143,7 @@ typedef struct _WB35REG
        //-------------------
        // VM
        //-------------------
-       OS_SPIN_LOCK    EP0VM_spin_lock; // 4B
+       spinlock_t      EP0VM_spin_lock; // 4B
        u32             EP0VM_status;//$$
        PREG_QUEUE          pRegFirst;
        PREG_QUEUE          pRegLast;
index 6ec818b3c23100f3e077526af6f70d939e9ab296..039fd408ba62c7ae6680412910d04f5b72aba1d6 100644 (file)
@@ -130,7 +130,7 @@ typedef struct _MLME_FRAME
        u8                      DataType;
        u8                      IsInUsed;
 
-       OS_SPIN_LOCK    MLMESpinLock;
+       spinlock_t      MLMESpinLock;
 
     u8         TxMMPDU[MAX_NUM_TX_MMPDU][MAX_MMPDU_SIZE];
        u8              TxMMPDUInUse[ (MAX_NUM_TX_MMPDU+3) & ~0x03 ];
index 51dad95b48b86231b2d01001cbb3a3b3010df876..186ad6029c7b7090b689458caa29401482d9390a 100644 (file)
@@ -26,10 +26,10 @@ EncapAtomicInc(PADAPTER Adapter, void* pAtomic)
        PWBLINUX pWbLinux = &Adapter->WbLinux;
        u32     ltmp;
        u32 *   pltmp = (u32 *)pAtomic;
-       OS_SPIN_LOCK_ACQUIRED( &pWbLinux->AtomicSpinLock );
+       spin_lock_irq( &pWbLinux->AtomicSpinLock );
        (*pltmp)++;
        ltmp = (*pltmp);
-       OS_SPIN_LOCK_RELEASED( &pWbLinux->AtomicSpinLock );
+       spin_unlock_irq( &pWbLinux->AtomicSpinLock );
        return ltmp;
 }
 
@@ -39,10 +39,10 @@ EncapAtomicDec(PADAPTER Adapter, void* pAtomic)
        PWBLINUX pWbLinux = &Adapter->WbLinux;
        u32     ltmp;
        u32 *   pltmp = (u32 *)pAtomic;
-       OS_SPIN_LOCK_ACQUIRED( &pWbLinux->AtomicSpinLock );
+       spin_lock_irq( &pWbLinux->AtomicSpinLock );
        (*pltmp)--;
        ltmp = (*pltmp);
-       OS_SPIN_LOCK_RELEASED( &pWbLinux->AtomicSpinLock );
+       spin_unlock_irq( &pWbLinux->AtomicSpinLock );
        return ltmp;
 }
 
@@ -51,8 +51,8 @@ WBLINUX_Initial(PADAPTER Adapter)
 {
        PWBLINUX pWbLinux = &Adapter->WbLinux;
 
-       OS_SPIN_LOCK_ALLOCATE( &pWbLinux->SpinLock );
-       OS_SPIN_LOCK_ALLOCATE( &pWbLinux->AtomicSpinLock );
+       spin_lock_init( &pWbLinux->SpinLock );
+       spin_lock_init( &pWbLinux->AtomicSpinLock );
        return TRUE;
 }
 
@@ -79,7 +79,6 @@ void
 WBLINUX_Destroy(PADAPTER Adapter)
 {
        WBLINUX_stop( Adapter );
-       OS_SPIN_LOCK_FREE( &pWbNdis->SpinLock );
 #ifdef _PE_USB_INI_DUMP_
        WBDEBUG(("[w35und] unregister_netdev!\n"));
 #endif
index 97e9167ab839b65cb095d330b015c9ed96d65990..fd2bb43bf3cf75a4bf41f8e9f69a20ed534b408f 100644 (file)
@@ -24,8 +24,8 @@
 
 typedef struct _WBLINUX
 {
-       OS_SPIN_LOCK    AtomicSpinLock;
-       OS_SPIN_LOCK    SpinLock;
+       spinlock_t      AtomicSpinLock;
+       spinlock_t      SpinLock;
        u32     shutdown;
 
        OS_ATOMIC       ThreadCount;