diff --git a/drivers/staging/winbond/adapter.h b/drivers/staging/winbond/adapter.h index 8925dad8d5d3..fc4205de988f 100644 --- a/drivers/staging/winbond/adapter.h +++ b/drivers/staging/winbond/adapter.h @@ -1,23 +1,55 @@ -// -// ADAPTER.H - -// Windows NDIS global variable 'adapter' typedef -// +#define OS_MEMORY_ALLOC( _V, _S ) WBLINUX_MemoryAlloc( _V, _S ) +#define OS_LINK_STATUS (adapter->LinkStatus == OS_CONNECTED) +#define OS_SET_SHUTDOWN( _A ) _A->shutdown=1 +#define OS_SET_RESUME( _A ) _A->shutdown=0 +#define OS_CONNECT_STATUS_INDICATE( _A, _F ) WBLINUX_ConnectStatus( _A, _F ) +#define OS_DISCONNECTED 0 +#define OS_CONNECTED 1 +#define OS_STOP( _A ) WBLINUX_stop( _A ) + +#define OS_CURRENT_RX_BYTE( _A ) _A->RxByteCount +#define OS_CURRENT_TX_BYTE( _A ) _A->TxByteCount +#define OS_EVENT_INDICATE( _A, _B, _F ) +#define OS_PMKID_STATUS_EVENT( _A ) +#define OS_RECEIVE_PACKET_INDICATE( _A, _D ) WBLinux_ReceivePacket( _A, _D ) +#define OS_RECEIVE_802_1X_PACKET_INDICATE( _A, _D ) EAP_ReceivePacket( _A, _D ) +#define OS_GET_PACKET( _A, _D ) WBLINUX_GetNextPacket( _A, _D ) +#define OS_GET_PACKET_COMPLETE( _A, _D ) WBLINUX_GetNextPacketCompleted( _A, _D ) +#define OS_SEND_RESULT( _A, _ID, _R ) + +#define WBLINUX_PACKET_ARRAY_SIZE (ETHERNET_TX_DESCRIPTORS*4) + #define MAX_ANSI_STRING 40 struct wb35_adapter { - u32 adapterIndex; // 20060703.4 Add for using padapterContext global adapter point + u32 adapterIndex; // 20060703.4 Add for using padapterContext global adapter point - WB_LOCALDESCRIPT sLocalPara; // Myself connected parameters - PWB_BSSDESCRIPTION asBSSDescriptElement; + WB_LOCALDESCRIPT sLocalPara; // Myself connected parameters + PWB_BSSDESCRIPTION asBSSDescriptElement; - MLME_FRAME sMlmeFrame; // connect to peerSTA parameters + MLME_FRAME sMlmeFrame; // connect to peerSTA parameters - MTO_PARAMETERS sMtoPara; // MTO_struct ... - hw_data_t sHwData; //For HAL - MDS Mds; + MTO_PARAMETERS sMtoPara; // MTO_struct ... + hw_data_t sHwData; //For HAL + MDS Mds; - WBLINUX WbLinux; - struct iw_statistics iw_stats; + spinlock_t AtomicSpinLock; + spinlock_t SpinLock; + u32 shutdown; - u8 LinkName[MAX_ANSI_STRING]; + OS_ATOMIC ThreadCount; + + u32 LinkStatus; // OS_DISCONNECTED or OS_CONNECTED + + u32 RxByteCount; + u32 TxByteCount; + + struct sk_buff *skb_array[WBLINUX_PACKET_ARRAY_SIZE]; + struct sk_buff *packet_return; + s32 skb_SetIndex; + s32 skb_GetIndex; + s32 netif_state_stop; // 1: stop 0: normal + struct iw_statistics iw_stats; + + u8 LinkName[MAX_ANSI_STRING]; }; diff --git a/drivers/staging/winbond/linux/sysdef.h b/drivers/staging/winbond/linux/sysdef.h index d46d63e5c673..4b35a972165d 100644 --- a/drivers/staging/winbond/linux/sysdef.h +++ b/drivers/staging/winbond/linux/sysdef.h @@ -53,7 +53,6 @@ #include "../sme_api.h" #include "../gl_80211.h" #include "../mto.h" -#include "../wblinux_s.h" #include "../wbhal_s.h" diff --git a/drivers/staging/winbond/linux/wbusb.c b/drivers/staging/winbond/linux/wbusb.c index 1e43232d0fd4..5f09fd49f52b 100644 --- a/drivers/staging/winbond/linux/wbusb.c +++ b/drivers/staging/winbond/linux/wbusb.c @@ -188,7 +188,6 @@ struct wbsoft_priv { static int wb35_probe(struct usb_interface *intf, const struct usb_device_id *id_table) { struct wb35_adapter *adapter; - PWBLINUX pWbLinux; PWBUSB pWbUsb; struct usb_host_interface *interface; struct usb_endpoint_descriptor *endpoint; @@ -214,7 +213,6 @@ static int wb35_probe(struct usb_interface *intf, const struct usb_device_id *id adapter = kzalloc(sizeof(*adapter), GFP_KERNEL); my_adapter = adapter; - pWbLinux = &adapter->WbLinux; pWbUsb = &adapter->sHwData.WbUsb; pWbUsb->udev = udev; @@ -334,12 +332,9 @@ WbUsb_destroy(phw_data_t pHwData) static void wb35_disconnect(struct usb_interface *intf) { - PWBLINUX pWbLinux; struct wb35_adapter * adapter = usb_get_intfdata(intf); usb_set_intfdata(intf, NULL); - pWbLinux = &adapter->WbLinux; - // Card remove WbWlanHalt(adapter); diff --git a/drivers/staging/winbond/wblinux.c b/drivers/staging/winbond/wblinux.c index 6259dd0dcd18..89f9f7c9376e 100644 --- a/drivers/staging/winbond/wblinux.c +++ b/drivers/staging/winbond/wblinux.c @@ -23,36 +23,32 @@ WBLINUX_MemoryAlloc(void* *VirtualAddress, u32 Length) s32 EncapAtomicInc(struct wb35_adapter * adapter, void* pAtomic) { - PWBLINUX pWbLinux = &adapter->WbLinux; u32 ltmp; u32 * pltmp = (u32 *)pAtomic; - spin_lock_irq( &pWbLinux->AtomicSpinLock ); + spin_lock_irq( &adapter->AtomicSpinLock ); (*pltmp)++; ltmp = (*pltmp); - spin_unlock_irq( &pWbLinux->AtomicSpinLock ); + spin_unlock_irq( &adapter->AtomicSpinLock ); return ltmp; } s32 EncapAtomicDec(struct wb35_adapter * adapter, void* pAtomic) { - PWBLINUX pWbLinux = &adapter->WbLinux; u32 ltmp; u32 * pltmp = (u32 *)pAtomic; - spin_lock_irq( &pWbLinux->AtomicSpinLock ); + spin_lock_irq( &adapter->AtomicSpinLock ); (*pltmp)--; ltmp = (*pltmp); - spin_unlock_irq( &pWbLinux->AtomicSpinLock ); + spin_unlock_irq( &adapter->AtomicSpinLock ); return ltmp; } unsigned char WBLINUX_Initial(struct wb35_adapter * adapter) { - PWBLINUX pWbLinux = &adapter->WbLinux; - - spin_lock_init( &pWbLinux->SpinLock ); - spin_lock_init( &pWbLinux->AtomicSpinLock ); + spin_lock_init( &adapter->SpinLock ); + spin_lock_init( &adapter->AtomicSpinLock ); return TRUE; } @@ -87,24 +83,23 @@ WBLINUX_Destroy(struct wb35_adapter * adapter) void WBLINUX_stop( struct wb35_adapter * adapter ) { - PWBLINUX pWbLinux = &adapter->WbLinux; struct sk_buff *pSkb; - if (OS_ATOMIC_INC( adapter, &pWbLinux->ThreadCount ) == 1) { + if (OS_ATOMIC_INC( adapter, &adapter->ThreadCount ) == 1) { // Shutdown module immediately - pWbLinux->shutdown = 1; + adapter->shutdown = 1; - while (pWbLinux->skb_array[ pWbLinux->skb_GetIndex ]) { + while (adapter->skb_array[ adapter->skb_GetIndex ]) { // Trying to free the un-sending packet - pSkb = pWbLinux->skb_array[ pWbLinux->skb_GetIndex ]; - pWbLinux->skb_array[ pWbLinux->skb_GetIndex ] = NULL; + pSkb = adapter->skb_array[ adapter->skb_GetIndex ]; + adapter->skb_array[ adapter->skb_GetIndex ] = NULL; if( in_irq() ) dev_kfree_skb_irq( pSkb ); else dev_kfree_skb( pSkb ); - pWbLinux->skb_GetIndex++; - pWbLinux->skb_GetIndex %= WBLINUX_PACKET_ARRAY_SIZE; + adapter->skb_GetIndex++; + adapter->skb_GetIndex %= WBLINUX_PACKET_ARRAY_SIZE; } #ifdef _PE_STATE_DUMP_ @@ -112,7 +107,7 @@ WBLINUX_stop( struct wb35_adapter * adapter ) #endif } - OS_ATOMIC_DEC(adapter, &pWbLinux->ThreadCount); + OS_ATOMIC_DEC(adapter, &adapter->ThreadCount); } void @@ -268,8 +263,6 @@ error: void WBLINUX_ConnectStatus(struct wb35_adapter * adapter, u32 flag) { - PWBLINUX pWbLinux = &adapter->WbLinux; - - pWbLinux->LinkStatus = flag; // OS_DISCONNECTED or OS_CONNECTED + adapter->LinkStatus = flag; // OS_DISCONNECTED or OS_CONNECTED } diff --git a/drivers/staging/winbond/wblinux_s.h b/drivers/staging/winbond/wblinux_s.h deleted file mode 100644 index 619843f26336..000000000000 --- a/drivers/staging/winbond/wblinux_s.h +++ /dev/null @@ -1,45 +0,0 @@ -//============================================================ -// wblinux_s.h -// -#define OS_MEMORY_ALLOC( _V, _S ) WBLINUX_MemoryAlloc( _V, _S ) -#define OS_LINK_STATUS (adapter->WbLinux.LinkStatus == OS_CONNECTED) -#define OS_SET_SHUTDOWN( _A ) _A->WbLinux.shutdown=1 -#define OS_SET_RESUME( _A ) _A->WbLinux.shutdown=0 -#define OS_CONNECT_STATUS_INDICATE( _A, _F ) WBLINUX_ConnectStatus( _A, _F ) -#define OS_DISCONNECTED 0 -#define OS_CONNECTED 1 -#define OS_STOP( _A ) WBLINUX_stop( _A ) - -#define OS_CURRENT_RX_BYTE( _A ) _A->WbLinux.RxByteCount -#define OS_CURRENT_TX_BYTE( _A ) _A->WbLinux.TxByteCount -#define OS_EVENT_INDICATE( _A, _B, _F ) -#define OS_PMKID_STATUS_EVENT( _A ) -#define OS_RECEIVE_PACKET_INDICATE( _A, _D ) WBLinux_ReceivePacket( _A, _D ) -#define OS_RECEIVE_802_1X_PACKET_INDICATE( _A, _D ) EAP_ReceivePacket( _A, _D ) -#define OS_GET_PACKET( _A, _D ) WBLINUX_GetNextPacket( _A, _D ) -#define OS_GET_PACKET_COMPLETE( _A, _D ) WBLINUX_GetNextPacketCompleted( _A, _D ) -#define OS_SEND_RESULT( _A, _ID, _R ) - -#define WBLINUX_PACKET_ARRAY_SIZE (ETHERNET_TX_DESCRIPTORS*4) - -typedef struct _WBLINUX -{ - spinlock_t AtomicSpinLock; - spinlock_t SpinLock; - u32 shutdown; - - OS_ATOMIC ThreadCount; - - u32 LinkStatus; // OS_DISCONNECTED or OS_CONNECTED - - u32 RxByteCount; - u32 TxByteCount; - - struct sk_buff *skb_array[ WBLINUX_PACKET_ARRAY_SIZE ]; - struct sk_buff *packet_return; - s32 skb_SetIndex; - s32 skb_GetIndex; - s32 netif_state_stop; // 1: stop 0: normal -} WBLINUX, *PWBLINUX; - -