Commit 7fff1316 authored by Pekka Enberg's avatar Pekka Enberg Committed by Greg Kroah-Hartman

Staging: w35und: remove global struct ieee80211_hw

Remove the my_dev global variable from wbusb.c by passing a pointer to struct
ieee80211_hw around so that packet_came() gets it.
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 1e8a2b60
...@@ -10,24 +10,29 @@ ...@@ -10,24 +10,29 @@
//============================================================================ //============================================================================
#include <linux/usb.h> #include <linux/usb.h>
#include "core.h"
#include "sysdef.h" #include "sysdef.h"
#include "wb35rx_f.h" #include "wb35rx_f.h"
void Wb35Rx_start(phw_data_t pHwData) void Wb35Rx_start(struct ieee80211_hw *hw)
{ {
struct wbsoft_priv *priv = hw->priv;
phw_data_t pHwData = &priv->sHwData;
PWB35RX pWb35Rx = &pHwData->Wb35Rx; PWB35RX pWb35Rx = &pHwData->Wb35Rx;
// Allow only one thread to run into the Wb35Rx() function // Allow only one thread to run into the Wb35Rx() function
if (atomic_inc_return(&pWb35Rx->RxFireCounter) == 1) { if (atomic_inc_return(&pWb35Rx->RxFireCounter) == 1) {
pWb35Rx->EP3vm_state = VM_RUNNING; pWb35Rx->EP3vm_state = VM_RUNNING;
Wb35Rx(pHwData); Wb35Rx(hw);
} else } else
atomic_dec(&pWb35Rx->RxFireCounter); atomic_dec(&pWb35Rx->RxFireCounter);
} }
// This function cannot reentrain // This function cannot reentrain
void Wb35Rx( phw_data_t pHwData ) void Wb35Rx(struct ieee80211_hw *hw)
{ {
struct wbsoft_priv *priv = hw->priv;
phw_data_t pHwData = &priv->sHwData;
PWB35RX pWb35Rx = &pHwData->Wb35Rx; PWB35RX pWb35Rx = &pHwData->Wb35Rx;
u8 * pRxBufferAddress; u8 * pRxBufferAddress;
struct urb *urb = pWb35Rx->RxUrb; struct urb *urb = pWb35Rx->RxUrb;
...@@ -69,7 +74,7 @@ void Wb35Rx( phw_data_t pHwData ) ...@@ -69,7 +74,7 @@ void Wb35Rx( phw_data_t pHwData )
usb_fill_bulk_urb(urb, pHwData->WbUsb.udev, usb_fill_bulk_urb(urb, pHwData->WbUsb.udev,
usb_rcvbulkpipe(pHwData->WbUsb.udev, 3), usb_rcvbulkpipe(pHwData->WbUsb.udev, 3),
pRxBufferAddress, MAX_USB_RX_BUFFER, pRxBufferAddress, MAX_USB_RX_BUFFER,
Wb35Rx_Complete, pHwData); Wb35Rx_Complete, hw);
pWb35Rx->EP3vm_state = VM_RUNNING; pWb35Rx->EP3vm_state = VM_RUNNING;
...@@ -89,7 +94,9 @@ error: ...@@ -89,7 +94,9 @@ error:
void Wb35Rx_Complete(struct urb *urb) void Wb35Rx_Complete(struct urb *urb)
{ {
phw_data_t pHwData = urb->context; struct ieee80211_hw *hw = urb->context;
struct wbsoft_priv *priv = hw->priv;
phw_data_t pHwData = &priv->sHwData;
PWB35RX pWb35Rx = &pHwData->Wb35Rx; PWB35RX pWb35Rx = &pHwData->Wb35Rx;
u8 * pRxBufferAddress; u8 * pRxBufferAddress;
u32 SizeCheck; u32 SizeCheck;
...@@ -150,11 +157,11 @@ void Wb35Rx_Complete(struct urb *urb) ...@@ -150,11 +157,11 @@ void Wb35Rx_Complete(struct urb *urb)
pWb35Rx->RxBufferSize[ RxBufferId ] = BulkLength; pWb35Rx->RxBufferSize[ RxBufferId ] = BulkLength;
if (!pWb35Rx->RxOwner[ RxBufferId ]) if (!pWb35Rx->RxOwner[ RxBufferId ])
Wb35Rx_indicate(pHwData); Wb35Rx_indicate(hw);
kfree(pWb35Rx->pDRx); kfree(pWb35Rx->pDRx);
// Do the next receive // Do the next receive
Wb35Rx(pHwData); Wb35Rx(hw);
return; return;
error: error:
...@@ -257,11 +264,13 @@ void Wb35Rx_adjust(PDESCRIPTOR pRxDes) ...@@ -257,11 +264,13 @@ void Wb35Rx_adjust(PDESCRIPTOR pRxDes)
pRxDes->buffer_size[0] = BufferSize; pRxDes->buffer_size[0] = BufferSize;
} }
extern void packet_came(char *pRxBufferAddress, int PacketSize); extern void packet_came(struct ieee80211_hw *hw, char *pRxBufferAddress, int PacketSize);
u16 Wb35Rx_indicate(phw_data_t pHwData) u16 Wb35Rx_indicate(struct ieee80211_hw *hw)
{ {
struct wbsoft_priv *priv = hw->priv;
phw_data_t pHwData = &priv->sHwData;
DESCRIPTOR RxDes; DESCRIPTOR RxDes;
PWB35RX pWb35Rx = &pHwData->Wb35Rx; PWB35RX pWb35Rx = &pHwData->Wb35Rx;
u8 * pRxBufferAddress; u8 * pRxBufferAddress;
...@@ -317,7 +326,7 @@ u16 Wb35Rx_indicate(phw_data_t pHwData) ...@@ -317,7 +326,7 @@ u16 Wb35Rx_indicate(phw_data_t pHwData)
RxDes.buffer_total_size = RxDes.buffer_size[0]; RxDes.buffer_total_size = RxDes.buffer_size[0];
Wb35Rx_adjust(&RxDes); Wb35Rx_adjust(&RxDes);
packet_came(pRxBufferAddress, PacketSize); packet_came(hw, pRxBufferAddress, PacketSize);
// Move RxBuffer point to the next // Move RxBuffer point to the next
stmp = PacketSize + 3; stmp = PacketSize + 3;
......
#ifndef __WINBOND_WB35RX_F_H #ifndef __WINBOND_WB35RX_F_H
#define __WINBOND_WB35RX_F_H #define __WINBOND_WB35RX_F_H
#include <net/mac80211.h>
#include "wbhal_s.h" #include "wbhal_s.h"
//==================================== //====================================
...@@ -10,11 +11,11 @@ void Wb35Rx_reset_descriptor( phw_data_t pHwData ); ...@@ -10,11 +11,11 @@ void Wb35Rx_reset_descriptor( phw_data_t pHwData );
unsigned char Wb35Rx_initial( phw_data_t pHwData ); unsigned char Wb35Rx_initial( phw_data_t pHwData );
void Wb35Rx_destroy( phw_data_t pHwData ); void Wb35Rx_destroy( phw_data_t pHwData );
void Wb35Rx_stop( phw_data_t pHwData ); void Wb35Rx_stop( phw_data_t pHwData );
u16 Wb35Rx_indicate( phw_data_t pHwData ); u16 Wb35Rx_indicate(struct ieee80211_hw *hw);
void Wb35Rx_adjust( PDESCRIPTOR pRxDes ); void Wb35Rx_adjust( PDESCRIPTOR pRxDes );
void Wb35Rx_start( phw_data_t pHwData ); void Wb35Rx_start(struct ieee80211_hw *hw);
void Wb35Rx( phw_data_t pHwData ); void Wb35Rx(struct ieee80211_hw *hw);
void Wb35Rx_Complete(struct urb *urb); void Wb35Rx_Complete(struct urb *urb);
#endif #endif
...@@ -315,9 +315,10 @@ static void hal_led_control(unsigned long data) ...@@ -315,9 +315,10 @@ static void hal_led_control(unsigned long data)
add_timer(&pHwData->LEDTimer); add_timer(&pHwData->LEDTimer);
} }
u8 hal_init_hardware(struct ieee80211_hw *hw)
u8 hal_init_hardware(phw_data_t pHwData, struct wbsoft_priv * adapter)
{ {
struct wbsoft_priv *priv = hw->priv;
phw_data_t pHwData = &priv->sHwData;
u16 SoftwareSet; u16 SoftwareSet;
// Initial the variable // Initial the variable
...@@ -333,7 +334,7 @@ u8 hal_init_hardware(phw_data_t pHwData, struct wbsoft_priv * adapter) ...@@ -333,7 +334,7 @@ u8 hal_init_hardware(phw_data_t pHwData, struct wbsoft_priv * adapter)
pHwData->InitialResource = 4; pHwData->InitialResource = 4;
init_timer(&pHwData->LEDTimer); init_timer(&pHwData->LEDTimer);
pHwData->LEDTimer.function = hal_led_control; pHwData->LEDTimer.function = hal_led_control;
pHwData->LEDTimer.data = (unsigned long) adapter; pHwData->LEDTimer.data = (unsigned long) priv;
pHwData->LEDTimer.expires = jiffies + msecs_to_jiffies(1000); pHwData->LEDTimer.expires = jiffies + msecs_to_jiffies(1000);
add_timer(&pHwData->LEDTimer); add_timer(&pHwData->LEDTimer);
...@@ -349,8 +350,8 @@ u8 hal_init_hardware(phw_data_t pHwData, struct wbsoft_priv * adapter) ...@@ -349,8 +350,8 @@ u8 hal_init_hardware(phw_data_t pHwData, struct wbsoft_priv * adapter)
return false; return false;
#endif #endif
Wb35Rx_start( pHwData ); Wb35Rx_start(hw);
Wb35Tx_EP2VM_start(adapter); Wb35Tx_EP2VM_start(priv);
return true; return true;
} }
......
...@@ -21,7 +21,7 @@ void hal_clear_all_key( phw_data_t pHwData ); ...@@ -21,7 +21,7 @@ void hal_clear_all_key( phw_data_t pHwData );
void hal_get_ethernet_address( phw_data_t pHwData, u8 *current_address ); void hal_get_ethernet_address( phw_data_t pHwData, u8 *current_address );
void hal_set_ethernet_address( phw_data_t pHwData, u8 *current_address ); void hal_set_ethernet_address( phw_data_t pHwData, u8 *current_address );
void hal_get_permanent_address( phw_data_t pHwData, u8 *pethernet_address ); void hal_get_permanent_address( phw_data_t pHwData, u8 *pethernet_address );
unsigned char hal_init_hardware( phw_data_t pHwData, struct wbsoft_priv * adapter ); u8 hal_init_hardware(struct ieee80211_hw *hw);
void hal_set_power_save_mode( phw_data_t pHwData, unsigned char power_save, unsigned char wakeup, unsigned char dtim ); void hal_set_power_save_mode( phw_data_t pHwData, unsigned char power_save, unsigned char wakeup, unsigned char dtim );
void hal_get_power_save_mode( phw_data_t pHwData, u8 *pin_pwr_save ); void hal_get_power_save_mode( phw_data_t pHwData, u8 *pin_pwr_save );
void hal_set_slot_time( phw_data_t pHwData, u8 type ); void hal_set_slot_time( phw_data_t pHwData, u8 type );
......
...@@ -85,8 +85,9 @@ WbWlanHalt( struct wbsoft_priv * adapter ) ...@@ -85,8 +85,9 @@ WbWlanHalt( struct wbsoft_priv * adapter )
} }
unsigned char unsigned char
WbWLanInitialize(struct wbsoft_priv * adapter) WbWLanInitialize(struct ieee80211_hw *hw)
{ {
struct wbsoft_priv *priv = hw->priv;
phw_data_t pHwData; phw_data_t pHwData;
u8 *pMacAddr; u8 *pMacAddr;
u8 *pMacAddr2; u8 *pMacAddr2;
...@@ -97,22 +98,22 @@ WbWLanInitialize(struct wbsoft_priv * adapter) ...@@ -97,22 +98,22 @@ WbWLanInitialize(struct wbsoft_priv * adapter)
// //
// Setting default value for Linux // Setting default value for Linux
// //
adapter->sLocalPara.region_INF = REGION_AUTO; priv->sLocalPara.region_INF = REGION_AUTO;
adapter->sLocalPara.TxRateMode = RATE_AUTO; priv->sLocalPara.TxRateMode = RATE_AUTO;
psLOCAL->bMacOperationMode = MODE_802_11_BG; // B/G mode priv->sLocalPara.bMacOperationMode = MODE_802_11_BG; // B/G mode
adapter->Mds.TxRTSThreshold = DEFAULT_RTSThreshold; priv->Mds.TxRTSThreshold = DEFAULT_RTSThreshold;
adapter->Mds.TxFragmentThreshold = DEFAULT_FRAGMENT_THRESHOLD; priv->Mds.TxFragmentThreshold = DEFAULT_FRAGMENT_THRESHOLD;
hal_set_phy_type( &adapter->sHwData, RF_WB_242_1 ); hal_set_phy_type( &priv->sHwData, RF_WB_242_1 );
adapter->sLocalPara.MTUsize = MAX_ETHERNET_PACKET_SIZE; priv->sLocalPara.MTUsize = MAX_ETHERNET_PACKET_SIZE;
psLOCAL->bPreambleMode = AUTO_MODE; priv->sLocalPara.bPreambleMode = AUTO_MODE;
adapter->sLocalPara.RadioOffStatus.boSwRadioOff = false; priv->sLocalPara.RadioOffStatus.boSwRadioOff = false;
pHwData = &adapter->sHwData; pHwData = &priv->sHwData;
hal_set_phy_type( pHwData, RF_DECIDE_BY_INF ); hal_set_phy_type( pHwData, RF_DECIDE_BY_INF );
// //
// Initial each module and variable // Initial each module and variable
// //
if (!WBLINUX_Initial(adapter)) { if (!WBLINUX_Initial(priv)) {
#ifdef _PE_USB_INI_DUMP_ #ifdef _PE_USB_INI_DUMP_
WBDEBUG(("[w35und]WBNDIS initialization failed\n")); WBDEBUG(("[w35und]WBNDIS initialization failed\n"));
#endif #endif
...@@ -120,33 +121,33 @@ WbWLanInitialize(struct wbsoft_priv * adapter) ...@@ -120,33 +121,33 @@ WbWLanInitialize(struct wbsoft_priv * adapter)
} }
// Initial Software variable // Initial Software variable
adapter->sLocalPara.ShutDowned = false; priv->sLocalPara.ShutDowned = false;
//added by ws for wep key error detection //added by ws for wep key error detection
adapter->sLocalPara.bWepKeyError= false; priv->sLocalPara.bWepKeyError= false;
adapter->sLocalPara.bToSelfPacketReceived = false; priv->sLocalPara.bToSelfPacketReceived = false;
adapter->sLocalPara.WepKeyDetectTimerCount= 2 * 100; /// 2 seconds priv->sLocalPara.WepKeyDetectTimerCount= 2 * 100; /// 2 seconds
// Initial USB hal // Initial USB hal
InitStep = 1; InitStep = 1;
pHwData = &adapter->sHwData; pHwData = &priv->sHwData;
if (!hal_init_hardware(pHwData, adapter)) if (!hal_init_hardware(hw))
goto error; goto error;
EEPROM_region = hal_get_region_from_EEPROM( pHwData ); EEPROM_region = hal_get_region_from_EEPROM( pHwData );
if (EEPROM_region != REGION_AUTO) if (EEPROM_region != REGION_AUTO)
psLOCAL->region = EEPROM_region; priv->sLocalPara.region = EEPROM_region;
else { else {
if (psLOCAL->region_INF != REGION_AUTO) if (priv->sLocalPara.region_INF != REGION_AUTO)
psLOCAL->region = psLOCAL->region_INF; priv->sLocalPara.region = priv->sLocalPara.region_INF;
else else
psLOCAL->region = REGION_USA; //default setting priv->sLocalPara.region = REGION_USA; //default setting
} }
// Get Software setting flag from hal // Get Software setting flag from hal
adapter->sLocalPara.boAntennaDiversity = false; priv->sLocalPara.boAntennaDiversity = false;
if (hal_software_set(pHwData) & 0x00000001) if (hal_software_set(pHwData) & 0x00000001)
adapter->sLocalPara.boAntennaDiversity = true; priv->sLocalPara.boAntennaDiversity = true;
// //
// For TS module // For TS module
...@@ -155,7 +156,7 @@ WbWLanInitialize(struct wbsoft_priv * adapter) ...@@ -155,7 +156,7 @@ WbWLanInitialize(struct wbsoft_priv * adapter)
// For MDS module // For MDS module
InitStep = 3; InitStep = 3;
Mds_initial(adapter); Mds_initial(priv);
//======================================= //=======================================
// Initialize the SME, SCAN, MLME, ROAM // Initialize the SME, SCAN, MLME, ROAM
...@@ -165,18 +166,18 @@ WbWLanInitialize(struct wbsoft_priv * adapter) ...@@ -165,18 +166,18 @@ WbWLanInitialize(struct wbsoft_priv * adapter)
InitStep = 6; InitStep = 6;
// If no user-defined address in the registry, use the addresss "burned" on the NIC instead. // If no user-defined address in the registry, use the addresss "burned" on the NIC instead.
pMacAddr = adapter->sLocalPara.ThisMacAddress; pMacAddr = priv->sLocalPara.ThisMacAddress;
pMacAddr2 = adapter->sLocalPara.PermanentAddress; pMacAddr2 = priv->sLocalPara.PermanentAddress;
hal_get_permanent_address( pHwData, adapter->sLocalPara.PermanentAddress );// Reading ethernet address from EEPROM hal_get_permanent_address( pHwData, priv->sLocalPara.PermanentAddress );// Reading ethernet address from EEPROM
if (memcmp(pMacAddr, "\x00\x00\x00\x00\x00\x00", MAC_ADDR_LENGTH) == 0) if (memcmp(pMacAddr, "\x00\x00\x00\x00\x00\x00", MAC_ADDR_LENGTH) == 0)
memcpy(pMacAddr, pMacAddr2, MAC_ADDR_LENGTH); memcpy(pMacAddr, pMacAddr2, MAC_ADDR_LENGTH);
else { else {
// Set the user define MAC address // Set the user define MAC address
hal_set_ethernet_address(pHwData, adapter->sLocalPara.ThisMacAddress); hal_set_ethernet_address(pHwData, priv->sLocalPara.ThisMacAddress);
} }
//get current antenna //get current antenna
psLOCAL->bAntennaNo = hal_get_antenna_number(pHwData); priv->sLocalPara.bAntennaNo = hal_get_antenna_number(pHwData);
#ifdef _PE_STATE_DUMP_ #ifdef _PE_STATE_DUMP_
WBDEBUG(("Driver init, antenna no = %d\n", psLOCAL->bAntennaNo)); WBDEBUG(("Driver init, antenna no = %d\n", psLOCAL->bAntennaNo));
#endif #endif
...@@ -186,25 +187,25 @@ WbWLanInitialize(struct wbsoft_priv * adapter) ...@@ -186,25 +187,25 @@ WbWLanInitialize(struct wbsoft_priv * adapter)
while (!hal_idle(pHwData)) while (!hal_idle(pHwData))
msleep(10); msleep(10);
MTO_Init(adapter); MTO_Init(priv);
HwRadioOff = hal_get_hw_radio_off( pHwData ); HwRadioOff = hal_get_hw_radio_off( pHwData );
psLOCAL->RadioOffStatus.boHwRadioOff = !!HwRadioOff; priv->sLocalPara.RadioOffStatus.boHwRadioOff = !!HwRadioOff;
hal_set_radio_mode( pHwData, (unsigned char)(psLOCAL->RadioOffStatus.boSwRadioOff || psLOCAL->RadioOffStatus.boHwRadioOff) ); hal_set_radio_mode( pHwData, (unsigned char)(priv->sLocalPara.RadioOffStatus.boSwRadioOff || priv->sLocalPara.RadioOffStatus.boHwRadioOff) );
hal_driver_init_OK(pHwData) = 1; // Notify hal that the driver is ready now. hal_driver_init_OK(pHwData) = 1; // Notify hal that the driver is ready now.
//set a tx power for reference..... //set a tx power for reference.....
// sme_set_tx_power_level(adapter, 12); FIXME? // sme_set_tx_power_level(priv, 12); FIXME?
return true; return true;
error: error:
switch (InitStep) { switch (InitStep) {
case 5: case 5:
case 4: case 4:
case 3: Mds_Destroy( adapter ); case 3: Mds_Destroy( priv );
case 2: case 2:
case 1: WBLINUX_Destroy( adapter ); case 1: WBLINUX_Destroy( priv );
hal_halt( pHwData, NULL ); hal_halt( pHwData, NULL );
case 0: break; case 0: break;
} }
......
...@@ -17,6 +17,7 @@ void wb35_set_multicast( struct net_device *netdev ); ...@@ -17,6 +17,7 @@ void wb35_set_multicast( struct net_device *netdev );
struct net_device_stats * wb35_netdev_stats( struct net_device *netdev ); struct net_device_stats * wb35_netdev_stats( struct net_device *netdev );
void WBLINUX_stop( struct wbsoft_priv *adapter ); void WBLINUX_stop( struct wbsoft_priv *adapter );
void WbWlanHalt( struct wbsoft_priv *adapter ); void WbWlanHalt( struct wbsoft_priv *adapter );
unsigned char WbWLanInitialize(struct wbsoft_priv *adapter); unsigned char WbWLanInitialize(struct ieee80211_hw *hw);
#endif #endif
...@@ -45,7 +45,6 @@ static struct ieee80211_supported_band wbsoft_band_2GHz = { ...@@ -45,7 +45,6 @@ static struct ieee80211_supported_band wbsoft_band_2GHz = {
}; };
int wbsoft_enabled; int wbsoft_enabled;
struct ieee80211_hw *my_dev;
static int wbsoft_add_interface(struct ieee80211_hw *dev, static int wbsoft_add_interface(struct ieee80211_hw *dev,
struct ieee80211_if_init_conf *conf) struct ieee80211_if_init_conf *conf)
...@@ -225,7 +224,6 @@ static int wb35_probe(struct usb_interface *intf, const struct usb_device_id *id ...@@ -225,7 +224,6 @@ static int wb35_probe(struct usb_interface *intf, const struct usb_device_id *id
goto error; goto error;
priv = dev->priv; priv = dev->priv;
my_dev = dev;
pWbUsb = &priv->sHwData.WbUsb; pWbUsb = &priv->sHwData.WbUsb;
pWbUsb->udev = udev; pWbUsb->udev = udev;
...@@ -238,7 +236,7 @@ static int wb35_probe(struct usb_interface *intf, const struct usb_device_id *id ...@@ -238,7 +236,7 @@ static int wb35_probe(struct usb_interface *intf, const struct usb_device_id *id
pWbUsb->IsUsb20 = 1; pWbUsb->IsUsb20 = 1;
} }
if (!WbWLanInitialize(priv)) { if (!WbWLanInitialize(dev)) {
err = -EINVAL; err = -EINVAL;
goto error_free_hw; goto error_free_hw;
} }
...@@ -274,7 +272,7 @@ error: ...@@ -274,7 +272,7 @@ error:
return err; return err;
} }
void packet_came(char *pRxBufferAddress, int PacketSize) void packet_came(struct ieee80211_hw *hw, char *pRxBufferAddress, int PacketSize)
{ {
struct sk_buff *skb; struct sk_buff *skb;
struct ieee80211_rx_status rx_status = {0}; struct ieee80211_rx_status rx_status = {0};
...@@ -299,7 +297,7 @@ void packet_came(char *pRxBufferAddress, int PacketSize) ...@@ -299,7 +297,7 @@ void packet_came(char *pRxBufferAddress, int PacketSize)
rx_status.phymode = MODE_IEEE80211B; rx_status.phymode = MODE_IEEE80211B;
*/ */
ieee80211_rx_irqsafe(my_dev, skb, &rx_status); ieee80211_rx_irqsafe(hw, skb, &rx_status);
} }
static void wb35_disconnect(struct usb_interface *intf) static void wb35_disconnect(struct usb_interface *intf)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment