Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 44e8541c authored by Pekka Enberg's avatar Pekka Enberg Committed by Greg Kroah-Hartman
Browse files

Staging: w35und: remove atomic op wrappers



Use the kernel provided atomic op functions and remove the OS_ATOMIC and
related wrapper macros.

Acked-by: default avatarPavel Machek <pavel@suse.cz>
Signed-off-by: default avatarPekka Enberg <penberg@cs.helsinki.fi>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent deee7c81
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -32,11 +32,10 @@ struct wb35_adapter {
	hw_data_t sHwData;	//For HAL
	MDS Mds;

	spinlock_t AtomicSpinLock;
	spinlock_t SpinLock;
	u32 shutdown;

	OS_ATOMIC ThreadCount;
	atomic_t ThreadCount;

	u32 LinkStatus;		// OS_DISCONNECTED or OS_CONNECTED

+0 −8
Original line number Diff line number Diff line
@@ -73,14 +73,6 @@
#define OS_EVENT_INDICATE( _A, _B, _F )
#define OS_PMKID_STATUS_EVENT( _A )


/* Uff, no, longs are not atomic on all architectures Linux
 * supports. This should really use atomic_t */

#define OS_ATOMIC			u32
#define OS_ATOMIC_READ( _A, _V )	_V
#define OS_ATOMIC_INC( _A, _V )		EncapAtomicInc( _A, (void*)_V )
#define OS_ATOMIC_DEC( _A, _V )		EncapAtomicDec( _A, (void*)_V )
#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

+4 −4
Original line number Diff line number Diff line
@@ -386,11 +386,11 @@ Wb35Reg_EP0VM_start( phw_data_t pHwData )
{
	struct wb35_reg *reg = &pHwData->reg;

	if (OS_ATOMIC_INC( pHwData->adapter, &reg->RegFireCount) == 1) {
	if (atomic_inc_return(&reg->RegFireCount) == 1) {
		reg->EP0vm_state = VM_RUNNING;
		Wb35Reg_EP0VM(pHwData);
	} else
		OS_ATOMIC_DEC( pHwData->adapter, &reg->RegFireCount );
		atomic_dec(&reg->RegFireCount);
}

void
@@ -447,7 +447,7 @@ Wb35Reg_EP0VM(phw_data_t pHwData )

 cleanup:
	reg->EP0vm_state = VM_STOP;
	OS_ATOMIC_DEC( pHwData->adapter, &reg->RegFireCount );
	atomic_dec(&reg->RegFireCount);
}


@@ -465,7 +465,7 @@ Wb35Reg_EP0VM_complete(struct urb *urb)

	if (pHwData->SurpriseRemove) { // Let WbWlanHalt to handle surprise remove
		reg->EP0vm_state = VM_STOP;
		OS_ATOMIC_DEC( pHwData->adapter, &reg->RegFireCount );
		atomic_dec(&reg->RegFireCount);
	} else {
		// Complete to send, remove the URB from the first
		spin_lock_irq( &reg->EP0VM_spin_lock );
+1 −1
Original line number Diff line number Diff line
@@ -142,7 +142,7 @@ struct wb35_reg {
	u32	        EP0VM_status;//$$
	struct wb35_reg_queue *reg_first;
	struct wb35_reg_queue *reg_last;
	OS_ATOMIC       RegFireCount;
	atomic_t       RegFireCount;

	// Hardware status
	u8	EP0vm_state;
+4 −5
Original line number Diff line number Diff line
@@ -10,17 +10,16 @@
//============================================================================
#include "sysdef.h"


void Wb35Rx_start(phw_data_t pHwData)
{
	PWB35RX pWb35Rx = &pHwData->Wb35Rx;

	// Allow only one thread to run into the Wb35Rx() function
	if (OS_ATOMIC_INC(pHwData->adapter, &pWb35Rx->RxFireCounter) == 1) {
	if (atomic_inc_return(&pWb35Rx->RxFireCounter) == 1) {
		pWb35Rx->EP3vm_state = VM_RUNNING;
		Wb35Rx(pHwData);
	} else
		OS_ATOMIC_DEC(pHwData->adapter, &pWb35Rx->RxFireCounter);
		atomic_dec(&pWb35Rx->RxFireCounter);
}

// This function cannot reentrain
@@ -82,7 +81,7 @@ void Wb35Rx( phw_data_t pHwData )
error:
	// VM stop
	pWb35Rx->EP3vm_state = VM_STOP;
	OS_ATOMIC_DEC( pHwData->adapter, &pWb35Rx->RxFireCounter );
	atomic_dec(&pWb35Rx->RxFireCounter);
}

void Wb35Rx_Complete(struct urb *urb)
@@ -157,7 +156,7 @@ void Wb35Rx_Complete(struct urb *urb)

error:
	pWb35Rx->RxOwner[ RxBufferId ] = 1; // Set the owner to hardware
	OS_ATOMIC_DEC( pHwData->adapter, &pWb35Rx->RxFireCounter );
	atomic_dec(&pWb35Rx->RxFireCounter);
	pWb35Rx->EP3vm_state = VM_STOP;
}

Loading