* [PATCH 1/7] w35und: inline DRIVER_AUTHOR and DRIVER_DESC macros @ 2008-10-30 16:12 Pekka Enberg 2008-10-30 16:12 ` [PATCH 2/7] w35und: clean up wblinux.c a bit Pekka Enberg 2008-10-30 19:16 ` [PATCH 1/7] w35und: inline DRIVER_AUTHOR and DRIVER_DESC macros Pavel Machek 0 siblings, 2 replies; 14+ messages in thread From: Pekka Enberg @ 2008-10-30 16:12 UTC (permalink / raw) To: greg; +Cc: linux-kernel, Pekka Enberg, Pavel Machek They're used in one place so we can inline them. Cc: Pavel Machek <pavel@suse.cz> Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi> --- drivers/staging/winbond/wbusb.c | 4 ++-- drivers/staging/winbond/wbusb_s.h | 3 --- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/staging/winbond/wbusb.c b/drivers/staging/winbond/wbusb.c index 40bb77c..67847c8 100644 --- a/drivers/staging/winbond/wbusb.c +++ b/drivers/staging/winbond/wbusb.c @@ -11,8 +11,8 @@ #include "wbhal_f.h" #include "wblinux_f.h" -MODULE_AUTHOR(DRIVER_AUTHOR); -MODULE_DESCRIPTION(DRIVER_DESC); +MODULE_AUTHOR("Original by: Jeff Lee<YY_Lee@issc.com.tw> Adapted to 2.6.x by Costantino Leandro (Rxart Desktop) <le_costantino@pixartargentina.com.ar>"); +MODULE_DESCRIPTION("IS89C35 802.11bg WLAN USB Driver"); MODULE_LICENSE("GPL"); MODULE_VERSION("0.1"); diff --git a/drivers/staging/winbond/wbusb_s.h b/drivers/staging/winbond/wbusb_s.h index 1aa8ab1..1de9360 100644 --- a/drivers/staging/winbond/wbusb_s.h +++ b/drivers/staging/winbond/wbusb_s.h @@ -28,9 +28,6 @@ typedef struct _RW_CONTEXT void* pCallBackFunctionParameter; } RW_CONTEXT, *PRW_CONTEXT; -#define DRIVER_AUTHOR "Original by: Jeff Lee<YY_Lee@issc.com.tw> Adapted to 2.6.x by Costantino Leandro (Rxart Desktop) <le_costantino@pixartargentina.com.ar>" -#define DRIVER_DESC "IS89C35 802.11bg WLAN USB Driver" - typedef struct _WBUSB { u32 IsUsb20; struct usb_device *udev; -- 1.5.3.7 ^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 2/7] w35und: clean up wblinux.c a bit 2008-10-30 16:12 [PATCH 1/7] w35und: inline DRIVER_AUTHOR and DRIVER_DESC macros Pekka Enberg @ 2008-10-30 16:12 ` Pekka Enberg 2008-10-30 16:12 ` [PATCH 3/7] w35und: remove unused ->ShutDowned member from struct LOCAL_PARA Pekka Enberg 2008-10-30 19:17 ` [PATCH 2/7] w35und: clean up wblinux.c a bit Pavel Machek 2008-10-30 19:16 ` [PATCH 1/7] w35und: inline DRIVER_AUTHOR and DRIVER_DESC macros Pavel Machek 1 sibling, 2 replies; 14+ messages in thread From: Pekka Enberg @ 2008-10-30 16:12 UTC (permalink / raw) To: greg; +Cc: linux-kernel, Pekka Enberg, Pavel Machek This patch removes wrapper functions from wblinux.c and moves the hardware init and halt functions to wbusb.c which has the only callers of them. Cc: Pavel Machek <pavel@suse.cz> Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi> --- drivers/staging/winbond/wblinux.c | 167 ----------------------------------- drivers/staging/winbond/wblinux_f.h | 5 - drivers/staging/winbond/wbusb.c | 150 ++++++++++++++++++++++++++++++- 3 files changed, 147 insertions(+), 175 deletions(-) diff --git a/drivers/staging/winbond/wblinux.c b/drivers/staging/winbond/wblinux.c index 31f2d20..433aa0d 100644 --- a/drivers/staging/winbond/wblinux.c +++ b/drivers/staging/winbond/wblinux.c @@ -16,22 +16,6 @@ #include "wbhal_f.h" #include "wblinux_f.h" -unsigned char -WBLINUX_Initial(struct wbsoft_priv * adapter) -{ - spin_lock_init( &adapter->SpinLock ); - return true; -} - -void -WBLINUX_Destroy(struct wbsoft_priv * adapter) -{ - WBLINUX_stop( adapter ); -#ifdef _PE_USB_INI_DUMP_ - WBDEBUG(("[w35und] unregister_netdev!\n")); -#endif -} - void WBLINUX_stop( struct wbsoft_priv * adapter ) { @@ -61,154 +45,3 @@ WBLINUX_stop( struct wbsoft_priv * adapter ) atomic_dec(&adapter->ThreadCount); } - -void -WbWlanHalt( struct wbsoft_priv * adapter ) -{ - //--------------------- - adapter->sLocalPara.ShutDowned = true; - - Mds_Destroy( adapter ); - - // Turn off Rx and Tx hardware ability - hal_stop( &adapter->sHwData ); -#ifdef _PE_USB_INI_DUMP_ - WBDEBUG(("[w35und] Hal_stop O.K.\n")); -#endif - msleep(100);// Waiting Irp completed - - // Destroy the NDIS module - WBLINUX_Destroy( adapter ); - - // Halt the HAL - hal_halt(&adapter->sHwData, NULL); -} - -unsigned char -WbWLanInitialize(struct ieee80211_hw *hw) -{ - struct wbsoft_priv *priv = hw->priv; - phw_data_t pHwData; - u8 *pMacAddr; - u8 *pMacAddr2; - u32 InitStep = 0; - u8 EEPROM_region; - u8 HwRadioOff; - - // - // Setting default value for Linux - // - priv->sLocalPara.region_INF = REGION_AUTO; - priv->sLocalPara.TxRateMode = RATE_AUTO; - priv->sLocalPara.bMacOperationMode = MODE_802_11_BG; // B/G mode - priv->Mds.TxRTSThreshold = DEFAULT_RTSThreshold; - priv->Mds.TxFragmentThreshold = DEFAULT_FRAGMENT_THRESHOLD; - hal_set_phy_type( &priv->sHwData, RF_WB_242_1 ); - priv->sLocalPara.MTUsize = MAX_ETHERNET_PACKET_SIZE; - priv->sLocalPara.bPreambleMode = AUTO_MODE; - priv->sLocalPara.RadioOffStatus.boSwRadioOff = false; - pHwData = &priv->sHwData; - hal_set_phy_type( pHwData, RF_DECIDE_BY_INF ); - - // - // Initial each module and variable - // - if (!WBLINUX_Initial(priv)) { -#ifdef _PE_USB_INI_DUMP_ - WBDEBUG(("[w35und]WBNDIS initialization failed\n")); -#endif - goto error; - } - - // Initial Software variable - priv->sLocalPara.ShutDowned = false; - - //added by ws for wep key error detection - priv->sLocalPara.bWepKeyError= false; - priv->sLocalPara.bToSelfPacketReceived = false; - priv->sLocalPara.WepKeyDetectTimerCount= 2 * 100; /// 2 seconds - - // Initial USB hal - InitStep = 1; - pHwData = &priv->sHwData; - if (!hal_init_hardware(hw)) - goto error; - - EEPROM_region = hal_get_region_from_EEPROM( pHwData ); - if (EEPROM_region != REGION_AUTO) - priv->sLocalPara.region = EEPROM_region; - else { - if (priv->sLocalPara.region_INF != REGION_AUTO) - priv->sLocalPara.region = priv->sLocalPara.region_INF; - else - priv->sLocalPara.region = REGION_USA; //default setting - } - - // Get Software setting flag from hal - priv->sLocalPara.boAntennaDiversity = false; - if (hal_software_set(pHwData) & 0x00000001) - priv->sLocalPara.boAntennaDiversity = true; - - // - // For TS module - // - InitStep = 2; - - // For MDS module - InitStep = 3; - Mds_initial(priv); - - //======================================= - // Initialize the SME, SCAN, MLME, ROAM - //======================================= - InitStep = 4; - InitStep = 5; - InitStep = 6; - - // If no user-defined address in the registry, use the addresss "burned" on the NIC instead. - pMacAddr = priv->sLocalPara.ThisMacAddress; - pMacAddr2 = priv->sLocalPara.PermanentAddress; - 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) - memcpy(pMacAddr, pMacAddr2, MAC_ADDR_LENGTH); - else { - // Set the user define MAC address - hal_set_ethernet_address(pHwData, priv->sLocalPara.ThisMacAddress); - } - - //get current antenna - priv->sLocalPara.bAntennaNo = hal_get_antenna_number(pHwData); -#ifdef _PE_STATE_DUMP_ - WBDEBUG(("Driver init, antenna no = %d\n", psLOCAL->bAntennaNo)); -#endif - hal_get_hw_radio_off( pHwData ); - - // Waiting for HAL setting OK - while (!hal_idle(pHwData)) - msleep(10); - - MTO_Init(priv); - - HwRadioOff = hal_get_hw_radio_off( pHwData ); - priv->sLocalPara.RadioOffStatus.boHwRadioOff = !!HwRadioOff; - - 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. - //set a tx power for reference..... -// sme_set_tx_power_level(priv, 12); FIXME? - return true; - -error: - switch (InitStep) { - case 5: - case 4: - case 3: Mds_Destroy( priv ); - case 2: - case 1: WBLINUX_Destroy( priv ); - hal_halt( pHwData, NULL ); - case 0: break; - } - - return false; -} diff --git a/drivers/staging/winbond/wblinux_f.h b/drivers/staging/winbond/wblinux_f.h index 15e6a65..f531a01 100644 --- a/drivers/staging/winbond/wblinux_f.h +++ b/drivers/staging/winbond/wblinux_f.h @@ -9,15 +9,10 @@ // // wblinux_f.h // -unsigned char WBLINUX_Initial( struct wbsoft_priv *adapter ); int wb35_start_xmit(struct sk_buff *skb, struct net_device *netdev ); void WBLINUX_stop( struct wbsoft_priv *adapter ); -void WBLINUX_Destroy( struct wbsoft_priv *adapter ); void wb35_set_multicast( struct net_device *netdev ); struct net_device_stats * wb35_netdev_stats( struct net_device *netdev ); void WBLINUX_stop( struct wbsoft_priv *adapter ); -void WbWlanHalt( struct wbsoft_priv *adapter ); -unsigned char WbWLanInitialize(struct ieee80211_hw *hw); - #endif diff --git a/drivers/staging/winbond/wbusb.c b/drivers/staging/winbond/wbusb.c index 67847c8..673875d 100644 --- a/drivers/staging/winbond/wbusb.c +++ b/drivers/staging/winbond/wbusb.c @@ -7,7 +7,9 @@ #include <linux/usb.h> #include "core.h" +#include "mds_f.h" #include "mlmetxrx_f.h" +#include "mto_f.h" #include "wbhal_f.h" #include "wblinux_f.h" @@ -180,7 +182,7 @@ static u64 wbsoft_get_tsf(struct ieee80211_hw *dev) static const struct ieee80211_ops wbsoft_ops = { .tx = wbsoft_tx, - .start = wbsoft_start, /* Start can be pretty much empty as we do WbWLanInitialize() during probe? */ + .start = wbsoft_start, /* Start can be pretty much empty as we do wb35_hw_init() during probe? */ .stop = wbsoft_stop, .add_interface = wbsoft_add_interface, .remove_interface = wbsoft_remove_interface, @@ -193,6 +195,124 @@ static const struct ieee80211_ops wbsoft_ops = { // conf_tx: hal_set_cwmin()/hal_set_cwmax; }; +static unsigned char wb35_hw_init(struct ieee80211_hw *hw) +{ + struct wbsoft_priv *priv = hw->priv; + phw_data_t pHwData; + u8 *pMacAddr; + u8 *pMacAddr2; + u32 InitStep = 0; + u8 EEPROM_region; + u8 HwRadioOff; + + // + // Setting default value for Linux + // + priv->sLocalPara.region_INF = REGION_AUTO; + priv->sLocalPara.TxRateMode = RATE_AUTO; + priv->sLocalPara.bMacOperationMode = MODE_802_11_BG; // B/G mode + priv->Mds.TxRTSThreshold = DEFAULT_RTSThreshold; + priv->Mds.TxFragmentThreshold = DEFAULT_FRAGMENT_THRESHOLD; + hal_set_phy_type( &priv->sHwData, RF_WB_242_1 ); + priv->sLocalPara.MTUsize = MAX_ETHERNET_PACKET_SIZE; + priv->sLocalPara.bPreambleMode = AUTO_MODE; + priv->sLocalPara.RadioOffStatus.boSwRadioOff = false; + pHwData = &priv->sHwData; + hal_set_phy_type( pHwData, RF_DECIDE_BY_INF ); + + // Initial Software variable + priv->sLocalPara.ShutDowned = false; + + //added by ws for wep key error detection + priv->sLocalPara.bWepKeyError= false; + priv->sLocalPara.bToSelfPacketReceived = false; + priv->sLocalPara.WepKeyDetectTimerCount= 2 * 100; /// 2 seconds + + // Initial USB hal + InitStep = 1; + pHwData = &priv->sHwData; + if (!hal_init_hardware(hw)) + goto error; + + EEPROM_region = hal_get_region_from_EEPROM( pHwData ); + if (EEPROM_region != REGION_AUTO) + priv->sLocalPara.region = EEPROM_region; + else { + if (priv->sLocalPara.region_INF != REGION_AUTO) + priv->sLocalPara.region = priv->sLocalPara.region_INF; + else + priv->sLocalPara.region = REGION_USA; //default setting + } + + // Get Software setting flag from hal + priv->sLocalPara.boAntennaDiversity = false; + if (hal_software_set(pHwData) & 0x00000001) + priv->sLocalPara.boAntennaDiversity = true; + + // + // For TS module + // + InitStep = 2; + + // For MDS module + InitStep = 3; + Mds_initial(priv); + + //======================================= + // Initialize the SME, SCAN, MLME, ROAM + //======================================= + InitStep = 4; + InitStep = 5; + InitStep = 6; + + // If no user-defined address in the registry, use the addresss "burned" on the NIC instead. + pMacAddr = priv->sLocalPara.ThisMacAddress; + pMacAddr2 = priv->sLocalPara.PermanentAddress; + 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) + memcpy(pMacAddr, pMacAddr2, MAC_ADDR_LENGTH); + else { + // Set the user define MAC address + hal_set_ethernet_address(pHwData, priv->sLocalPara.ThisMacAddress); + } + + //get current antenna + priv->sLocalPara.bAntennaNo = hal_get_antenna_number(pHwData); +#ifdef _PE_STATE_DUMP_ + WBDEBUG(("Driver init, antenna no = %d\n", psLOCAL->bAntennaNo)); +#endif + hal_get_hw_radio_off( pHwData ); + + // Waiting for HAL setting OK + while (!hal_idle(pHwData)) + msleep(10); + + MTO_Init(priv); + + HwRadioOff = hal_get_hw_radio_off( pHwData ); + priv->sLocalPara.RadioOffStatus.boHwRadioOff = !!HwRadioOff; + + 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. + //set a tx power for reference..... +// sme_set_tx_power_level(priv, 12); FIXME? + return true; + +error: + switch (InitStep) { + case 5: + case 4: + case 3: Mds_Destroy( priv ); + case 2: + case 1: WBLINUX_stop(priv); + hal_halt( pHwData, NULL ); + case 0: break; + } + + return false; +} + static int wb35_probe(struct usb_interface *intf, const struct usb_device_id *id_table) { PWBUSB pWbUsb; @@ -225,6 +345,8 @@ static int wb35_probe(struct usb_interface *intf, const struct usb_device_id *id priv = dev->priv; + spin_lock_init(&priv->SpinLock); + pWbUsb = &priv->sHwData.WbUsb; pWbUsb->udev = udev; @@ -236,7 +358,7 @@ static int wb35_probe(struct usb_interface *intf, const struct usb_device_id *id pWbUsb->IsUsb20 = 1; } - if (!WbWLanInitialize(dev)) { + if (!wb35_hw_init(dev)) { err = -EINVAL; goto error_free_hw; } @@ -300,11 +422,33 @@ void packet_came(struct ieee80211_hw *hw, char *pRxBufferAddress, int PacketSize ieee80211_rx_irqsafe(hw, skb, &rx_status); } +static void wb35_hw_halt(struct wbsoft_priv *adapter) +{ + //--------------------- + adapter->sLocalPara.ShutDowned = true; + + Mds_Destroy( adapter ); + + // Turn off Rx and Tx hardware ability + hal_stop( &adapter->sHwData ); +#ifdef _PE_USB_INI_DUMP_ + WBDEBUG(("[w35und] Hal_stop O.K.\n")); +#endif + msleep(100);// Waiting Irp completed + + // Destroy the NDIS module + WBLINUX_stop(adapter); + + // Halt the HAL + hal_halt(&adapter->sHwData, NULL); +} + + static void wb35_disconnect(struct usb_interface *intf) { struct wbsoft_priv *priv = usb_get_intfdata(intf); - WbWlanHalt(priv); + wb35_hw_halt(priv); usb_set_intfdata(intf, NULL); usb_put_dev(interface_to_usbdev(intf)); -- 1.5.3.7 ^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 3/7] w35und: remove unused ->ShutDowned member from struct LOCAL_PARA 2008-10-30 16:12 ` [PATCH 2/7] w35und: clean up wblinux.c a bit Pekka Enberg @ 2008-10-30 16:12 ` Pekka Enberg 2008-10-30 16:12 ` [PATCH 4/7] w35und: move global wbsoft_enabled to struct wbsoft_priv Pekka Enberg 2008-10-30 19:17 ` [PATCH 3/7] w35und: remove unused ->ShutDowned member from struct LOCAL_PARA Pavel Machek 2008-10-30 19:17 ` [PATCH 2/7] w35und: clean up wblinux.c a bit Pavel Machek 1 sibling, 2 replies; 14+ messages in thread From: Pekka Enberg @ 2008-10-30 16:12 UTC (permalink / raw) To: greg; +Cc: linux-kernel, Pekka Enberg, Pavel Machek It's not actually read by anyone so we might as well remove it. Cc: Pavel Machek <pavel@suse.cz> Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi> --- drivers/staging/winbond/localpara.h | 1 - drivers/staging/winbond/wbusb.c | 6 ------ 2 files changed, 0 insertions(+), 7 deletions(-) diff --git a/drivers/staging/winbond/localpara.h b/drivers/staging/winbond/localpara.h index a308ac2..607bb05 100644 --- a/drivers/staging/winbond/localpara.h +++ b/drivers/staging/winbond/localpara.h @@ -149,7 +149,6 @@ typedef struct LOCAL_PARA //// power-save variables u8 iPowerSaveMode; // 0 indicates it is on, 1 indicates it is off - u8 ShutDowned; u8 ATIMmode; u8 ExcludeUnencrypted; diff --git a/drivers/staging/winbond/wbusb.c b/drivers/staging/winbond/wbusb.c index 673875d..0f70101 100644 --- a/drivers/staging/winbond/wbusb.c +++ b/drivers/staging/winbond/wbusb.c @@ -220,9 +220,6 @@ static unsigned char wb35_hw_init(struct ieee80211_hw *hw) pHwData = &priv->sHwData; hal_set_phy_type( pHwData, RF_DECIDE_BY_INF ); - // Initial Software variable - priv->sLocalPara.ShutDowned = false; - //added by ws for wep key error detection priv->sLocalPara.bWepKeyError= false; priv->sLocalPara.bToSelfPacketReceived = false; @@ -424,9 +421,6 @@ void packet_came(struct ieee80211_hw *hw, char *pRxBufferAddress, int PacketSize static void wb35_hw_halt(struct wbsoft_priv *adapter) { - //--------------------- - adapter->sLocalPara.ShutDowned = true; - Mds_Destroy( adapter ); // Turn off Rx and Tx hardware ability -- 1.5.3.7 ^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 4/7] w35und: move global wbsoft_enabled to struct wbsoft_priv 2008-10-30 16:12 ` [PATCH 3/7] w35und: remove unused ->ShutDowned member from struct LOCAL_PARA Pekka Enberg @ 2008-10-30 16:12 ` Pekka Enberg 2008-10-30 16:12 ` [PATCH 5/7] w35und: move packet_came() to wb35rx.c Pekka Enberg 2008-10-30 19:18 ` [PATCH 4/7] w35und: move global wbsoft_enabled to struct wbsoft_priv Pavel Machek 2008-10-30 19:17 ` [PATCH 3/7] w35und: remove unused ->ShutDowned member from struct LOCAL_PARA Pavel Machek 1 sibling, 2 replies; 14+ messages in thread From: Pekka Enberg @ 2008-10-30 16:12 UTC (permalink / raw) To: greg; +Cc: linux-kernel, Pekka Enberg, Pavel Machek This is a preparational step for moving packet_came() to wb35rx.c(). Cc: Pavel Machek <pavel@suse.cz> Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi> --- drivers/staging/winbond/core.h | 2 ++ drivers/staging/winbond/wbusb.c | 11 ++++++----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/drivers/staging/winbond/core.h b/drivers/staging/winbond/core.h index 64b73bb..c6dd223 100644 --- a/drivers/staging/winbond/core.h +++ b/drivers/staging/winbond/core.h @@ -39,6 +39,8 @@ struct wbsoft_priv { struct iw_statistics iw_stats; u8 LinkName[WB_MAX_LINK_NAME_LEN]; + + bool enabled; }; #endif /* __WINBOND_CORE_H */ diff --git a/drivers/staging/winbond/wbusb.c b/drivers/staging/winbond/wbusb.c index 0f70101..246f20b 100644 --- a/drivers/staging/winbond/wbusb.c +++ b/drivers/staging/winbond/wbusb.c @@ -46,8 +46,6 @@ static struct ieee80211_supported_band wbsoft_band_2GHz = { .n_bitrates = ARRAY_SIZE(wbsoft_rates), }; -int wbsoft_enabled; - static int wbsoft_add_interface(struct ieee80211_hw *dev, struct ieee80211_if_init_conf *conf) { @@ -129,8 +127,10 @@ static int wbsoft_tx(struct ieee80211_hw *dev, struct sk_buff *skb) static int wbsoft_start(struct ieee80211_hw *dev) { - wbsoft_enabled = 1; - printk("wbsoft_start called\n"); + struct wbsoft_priv *priv = dev->priv; + + priv->enabled = true; + return 0; } @@ -393,10 +393,11 @@ error: void packet_came(struct ieee80211_hw *hw, char *pRxBufferAddress, int PacketSize) { + struct wbsoft_priv *priv = hw->priv; struct sk_buff *skb; struct ieee80211_rx_status rx_status = {0}; - if (!wbsoft_enabled) + if (!priv->enabled) return; skb = dev_alloc_skb(PacketSize); -- 1.5.3.7 ^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 5/7] w35und: move packet_came() to wb35rx.c 2008-10-30 16:12 ` [PATCH 4/7] w35und: move global wbsoft_enabled to struct wbsoft_priv Pekka Enberg @ 2008-10-30 16:12 ` Pekka Enberg 2008-10-30 16:12 ` [PATCH 6/7] w35und: remove ->skb_array from struct wbsoft_priv Pekka Enberg 2008-10-30 19:19 ` [PATCH 5/7] w35und: move packet_came() to wb35rx.c Pavel Machek 2008-10-30 19:18 ` [PATCH 4/7] w35und: move global wbsoft_enabled to struct wbsoft_priv Pavel Machek 1 sibling, 2 replies; 14+ messages in thread From: Pekka Enberg @ 2008-10-30 16:12 UTC (permalink / raw) To: greg; +Cc: linux-kernel, Pekka Enberg, Pavel Machek The function no longer has dependencies to wbusb.c so we can move it to wb35rx.c and make it static now. Cc: Pavel Machek <pavel@suse.cz> Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi> --- drivers/staging/winbond/wb35rx.c | 28 +++++++++++++++++++++++++++- drivers/staging/winbond/wbusb.c | 29 ----------------------------- 2 files changed, 27 insertions(+), 30 deletions(-) diff --git a/drivers/staging/winbond/wb35rx.c b/drivers/staging/winbond/wb35rx.c index cd5a8e1..85b861c 100644 --- a/drivers/staging/winbond/wb35rx.c +++ b/drivers/staging/winbond/wb35rx.c @@ -264,8 +264,34 @@ void Wb35Rx_adjust(PDESCRIPTOR pRxDes) pRxDes->buffer_size[0] = BufferSize; } -extern void packet_came(struct ieee80211_hw *hw, char *pRxBufferAddress, int PacketSize); +static void packet_came(struct ieee80211_hw *hw, char *pRxBufferAddress, int PacketSize) +{ + struct wbsoft_priv *priv = hw->priv; + struct sk_buff *skb; + struct ieee80211_rx_status rx_status = {0}; + + if (!priv->enabled) + return; + + skb = dev_alloc_skb(PacketSize); + if (!skb) { + printk("Not enough memory for packet, FIXME\n"); + return; + } + + memcpy(skb_put(skb, PacketSize), + pRxBufferAddress, + PacketSize); +/* + rx_status.rate = 10; + rx_status.channel = 1; + rx_status.freq = 12345; + rx_status.phymode = MODE_IEEE80211B; +*/ + + ieee80211_rx_irqsafe(hw, skb, &rx_status); +} u16 Wb35Rx_indicate(struct ieee80211_hw *hw) { diff --git a/drivers/staging/winbond/wbusb.c b/drivers/staging/winbond/wbusb.c index 246f20b..b981662 100644 --- a/drivers/staging/winbond/wbusb.c +++ b/drivers/staging/winbond/wbusb.c @@ -391,35 +391,6 @@ error: return err; } -void packet_came(struct ieee80211_hw *hw, char *pRxBufferAddress, int PacketSize) -{ - struct wbsoft_priv *priv = hw->priv; - struct sk_buff *skb; - struct ieee80211_rx_status rx_status = {0}; - - if (!priv->enabled) - return; - - skb = dev_alloc_skb(PacketSize); - if (!skb) { - printk("Not enough memory for packet, FIXME\n"); - return; - } - - memcpy(skb_put(skb, PacketSize), - pRxBufferAddress, - PacketSize); - -/* - rx_status.rate = 10; - rx_status.channel = 1; - rx_status.freq = 12345; - rx_status.phymode = MODE_IEEE80211B; -*/ - - ieee80211_rx_irqsafe(hw, skb, &rx_status); -} - static void wb35_hw_halt(struct wbsoft_priv *adapter) { Mds_Destroy( adapter ); -- 1.5.3.7 ^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 6/7] w35und: remove ->skb_array from struct wbsoft_priv 2008-10-30 16:12 ` [PATCH 5/7] w35und: move packet_came() to wb35rx.c Pekka Enberg @ 2008-10-30 16:12 ` Pekka Enberg 2008-10-30 16:12 ` [PATCH 7/7] w35und: remove ->shutdown " Pekka Enberg 2008-10-30 19:19 ` [PATCH 6/7] w35und: remove ->skb_array " Pavel Machek 2008-10-30 19:19 ` [PATCH 5/7] w35und: move packet_came() to wb35rx.c Pavel Machek 1 sibling, 2 replies; 14+ messages in thread From: Pekka Enberg @ 2008-10-30 16:12 UTC (permalink / raw) To: greg; +Cc: linux-kernel, Pekka Enberg, Pavel Machek It's not actually used for anything, so remove it. Cc: Pavel Machek <pavel@suse.cz> Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi> --- drivers/staging/winbond/core.h | 3 --- drivers/staging/winbond/wblinux.c | 16 ---------------- 2 files changed, 0 insertions(+), 19 deletions(-) diff --git a/drivers/staging/winbond/core.h b/drivers/staging/winbond/core.h index c6dd223..9c9d5d2 100644 --- a/drivers/staging/winbond/core.h +++ b/drivers/staging/winbond/core.h @@ -31,10 +31,7 @@ struct wbsoft_priv { 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; diff --git a/drivers/staging/winbond/wblinux.c b/drivers/staging/winbond/wblinux.c index 433aa0d..0461516 100644 --- a/drivers/staging/winbond/wblinux.c +++ b/drivers/staging/winbond/wblinux.c @@ -19,25 +19,9 @@ void WBLINUX_stop( struct wbsoft_priv * adapter ) { - struct sk_buff *pSkb; - if (atomic_inc_return(&adapter->ThreadCount) == 1) { // Shutdown module immediately adapter->shutdown = 1; - - while (adapter->skb_array[ adapter->skb_GetIndex ]) { - // Trying to free the un-sending packet - 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 ); - - adapter->skb_GetIndex++; - adapter->skb_GetIndex %= WBLINUX_PACKET_ARRAY_SIZE; - } - #ifdef _PE_STATE_DUMP_ WBDEBUG(( "[w35und] SKB_RELEASE OK\n" )); #endif -- 1.5.3.7 ^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 7/7] w35und: remove ->shutdown from struct wbsoft_priv 2008-10-30 16:12 ` [PATCH 6/7] w35und: remove ->skb_array from struct wbsoft_priv Pekka Enberg @ 2008-10-30 16:12 ` Pekka Enberg 2008-10-30 19:20 ` Pavel Machek 2008-10-30 19:19 ` [PATCH 6/7] w35und: remove ->skb_array " Pavel Machek 1 sibling, 1 reply; 14+ messages in thread From: Pekka Enberg @ 2008-10-30 16:12 UTC (permalink / raw) To: greg; +Cc: linux-kernel, Pekka Enberg, Pavel Machek It's not actually used for anything, so remove it. Cc: Pavel Machek <pavel@suse.cz> Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi> --- drivers/staging/winbond/Makefile | 1 - drivers/staging/winbond/core.h | 1 - drivers/staging/winbond/wbhal.c | 1 - drivers/staging/winbond/wblinux.c | 31 ------------------------------- drivers/staging/winbond/wblinux_f.h | 2 -- drivers/staging/winbond/wbusb.c | 6 +----- 6 files changed, 1 insertions(+), 41 deletions(-) delete mode 100644 drivers/staging/winbond/wblinux.c delete mode 100644 drivers/staging/winbond/wblinux_s.h diff --git a/drivers/staging/winbond/Makefile b/drivers/staging/winbond/Makefile index a93732e..d337571 100644 --- a/drivers/staging/winbond/Makefile +++ b/drivers/staging/winbond/Makefile @@ -9,7 +9,6 @@ w35und-objs := \ wb35rx.o \ wb35tx.o \ wbhal.o \ - wblinux.o \ wbusb.o \ diff --git a/drivers/staging/winbond/core.h b/drivers/staging/winbond/core.h index 9c9d5d2..fe142a1 100644 --- a/drivers/staging/winbond/core.h +++ b/drivers/staging/winbond/core.h @@ -24,7 +24,6 @@ struct wbsoft_priv { MDS Mds; spinlock_t SpinLock; - u32 shutdown; atomic_t ThreadCount; diff --git a/drivers/staging/winbond/wbhal.c b/drivers/staging/winbond/wbhal.c index d2be5fb..7ab5300 100644 --- a/drivers/staging/winbond/wbhal.c +++ b/drivers/staging/winbond/wbhal.c @@ -850,7 +850,6 @@ void hal_surprise_remove(struct wbsoft_priv *adapter) #ifdef _PE_STATE_DUMP_ WBDEBUG(("Calling hal_surprise_remove\n")); #endif - WBLINUX_stop( adapter ); } } diff --git a/drivers/staging/winbond/wblinux.c b/drivers/staging/winbond/wblinux.c deleted file mode 100644 index 0461516..0000000 --- a/drivers/staging/winbond/wblinux.c +++ /dev/null @@ -1,31 +0,0 @@ -//============================================================================ -// Copyright (c) 1996-2005 Winbond Electronic Corporation -// -// Module Name: -// wblinux.c -// -// Abstract: -// Linux releated routines -// -//============================================================================ -#include <linux/netdevice.h> - -#include "mds_f.h" -#include "mto_f.h" -#include "sysdef.h" -#include "wbhal_f.h" -#include "wblinux_f.h" - -void -WBLINUX_stop( struct wbsoft_priv * adapter ) -{ - if (atomic_inc_return(&adapter->ThreadCount) == 1) { - // Shutdown module immediately - adapter->shutdown = 1; -#ifdef _PE_STATE_DUMP_ - WBDEBUG(( "[w35und] SKB_RELEASE OK\n" )); -#endif - } - - atomic_dec(&adapter->ThreadCount); -} diff --git a/drivers/staging/winbond/wblinux_f.h b/drivers/staging/winbond/wblinux_f.h index f531a01..868e877 100644 --- a/drivers/staging/winbond/wblinux_f.h +++ b/drivers/staging/winbond/wblinux_f.h @@ -10,9 +10,7 @@ // wblinux_f.h // int wb35_start_xmit(struct sk_buff *skb, struct net_device *netdev ); -void WBLINUX_stop( struct wbsoft_priv *adapter ); void wb35_set_multicast( struct net_device *netdev ); struct net_device_stats * wb35_netdev_stats( struct net_device *netdev ); -void WBLINUX_stop( struct wbsoft_priv *adapter ); #endif diff --git a/drivers/staging/winbond/wblinux_s.h b/drivers/staging/winbond/wblinux_s.h deleted file mode 100644 index e69de29..0000000 diff --git a/drivers/staging/winbond/wbusb.c b/drivers/staging/winbond/wbusb.c index b981662..cb4dee5 100644 --- a/drivers/staging/winbond/wbusb.c +++ b/drivers/staging/winbond/wbusb.c @@ -302,8 +302,7 @@ error: case 4: case 3: Mds_Destroy( priv ); case 2: - case 1: WBLINUX_stop(priv); - hal_halt( pHwData, NULL ); + case 1: hal_halt( pHwData, NULL ); case 0: break; } @@ -402,9 +401,6 @@ static void wb35_hw_halt(struct wbsoft_priv *adapter) #endif msleep(100);// Waiting Irp completed - // Destroy the NDIS module - WBLINUX_stop(adapter); - // Halt the HAL hal_halt(&adapter->sHwData, NULL); } -- 1.5.3.7 ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 7/7] w35und: remove ->shutdown from struct wbsoft_priv 2008-10-30 16:12 ` [PATCH 7/7] w35und: remove ->shutdown " Pekka Enberg @ 2008-10-30 19:20 ` Pavel Machek 0 siblings, 0 replies; 14+ messages in thread From: Pavel Machek @ 2008-10-30 19:20 UTC (permalink / raw) To: Pekka Enberg; +Cc: greg, linux-kernel On Thu 2008-10-30 18:12:07, Pekka Enberg wrote: > It's not actually used for anything, so remove it. Acked-by: Pavel Machek <pavel@suse.cz> > Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi> > --- > drivers/staging/winbond/Makefile | 1 - > drivers/staging/winbond/core.h | 1 - > drivers/staging/winbond/wbhal.c | 1 - > drivers/staging/winbond/wblinux.c | 31 ------------------------------- > drivers/staging/winbond/wblinux_f.h | 2 -- > drivers/staging/winbond/wbusb.c | 6 +----- > 6 files changed, 1 insertions(+), 41 deletions(-) > delete mode 100644 drivers/staging/winbond/wblinux.c > delete mode 100644 drivers/staging/winbond/wblinux_s.h > > diff --git a/drivers/staging/winbond/Makefile b/drivers/staging/winbond/Makefile > index a93732e..d337571 100644 > --- a/drivers/staging/winbond/Makefile > +++ b/drivers/staging/winbond/Makefile > @@ -9,7 +9,6 @@ w35und-objs := \ > wb35rx.o \ > wb35tx.o \ > wbhal.o \ > - wblinux.o \ > wbusb.o \ > > > diff --git a/drivers/staging/winbond/core.h b/drivers/staging/winbond/core.h > index 9c9d5d2..fe142a1 100644 > --- a/drivers/staging/winbond/core.h > +++ b/drivers/staging/winbond/core.h > @@ -24,7 +24,6 @@ struct wbsoft_priv { > MDS Mds; > > spinlock_t SpinLock; > - u32 shutdown; > > atomic_t ThreadCount; > > diff --git a/drivers/staging/winbond/wbhal.c b/drivers/staging/winbond/wbhal.c > index d2be5fb..7ab5300 100644 > --- a/drivers/staging/winbond/wbhal.c > +++ b/drivers/staging/winbond/wbhal.c > @@ -850,7 +850,6 @@ void hal_surprise_remove(struct wbsoft_priv *adapter) > #ifdef _PE_STATE_DUMP_ > WBDEBUG(("Calling hal_surprise_remove\n")); > #endif > - WBLINUX_stop( adapter ); > } > } > > diff --git a/drivers/staging/winbond/wblinux.c b/drivers/staging/winbond/wblinux.c > deleted file mode 100644 > index 0461516..0000000 > --- a/drivers/staging/winbond/wblinux.c > +++ /dev/null > @@ -1,31 +0,0 @@ > -//============================================================================ > -// Copyright (c) 1996-2005 Winbond Electronic Corporation > -// > -// Module Name: > -// wblinux.c > -// > -// Abstract: > -// Linux releated routines > -// > -//============================================================================ > -#include <linux/netdevice.h> > - > -#include "mds_f.h" > -#include "mto_f.h" > -#include "sysdef.h" > -#include "wbhal_f.h" > -#include "wblinux_f.h" > - > -void > -WBLINUX_stop( struct wbsoft_priv * adapter ) > -{ > - if (atomic_inc_return(&adapter->ThreadCount) == 1) { > - // Shutdown module immediately > - adapter->shutdown = 1; > -#ifdef _PE_STATE_DUMP_ > - WBDEBUG(( "[w35und] SKB_RELEASE OK\n" )); > -#endif > - } > - > - atomic_dec(&adapter->ThreadCount); > -} > diff --git a/drivers/staging/winbond/wblinux_f.h b/drivers/staging/winbond/wblinux_f.h > index f531a01..868e877 100644 > --- a/drivers/staging/winbond/wblinux_f.h > +++ b/drivers/staging/winbond/wblinux_f.h > @@ -10,9 +10,7 @@ > // wblinux_f.h > // > int wb35_start_xmit(struct sk_buff *skb, struct net_device *netdev ); > -void WBLINUX_stop( struct wbsoft_priv *adapter ); > void wb35_set_multicast( struct net_device *netdev ); > struct net_device_stats * wb35_netdev_stats( struct net_device *netdev ); > -void WBLINUX_stop( struct wbsoft_priv *adapter ); > > #endif > diff --git a/drivers/staging/winbond/wblinux_s.h b/drivers/staging/winbond/wblinux_s.h > deleted file mode 100644 > index e69de29..0000000 > diff --git a/drivers/staging/winbond/wbusb.c b/drivers/staging/winbond/wbusb.c > index b981662..cb4dee5 100644 > --- a/drivers/staging/winbond/wbusb.c > +++ b/drivers/staging/winbond/wbusb.c > @@ -302,8 +302,7 @@ error: > case 4: > case 3: Mds_Destroy( priv ); > case 2: > - case 1: WBLINUX_stop(priv); > - hal_halt( pHwData, NULL ); > + case 1: hal_halt( pHwData, NULL ); > case 0: break; > } > > @@ -402,9 +401,6 @@ static void wb35_hw_halt(struct wbsoft_priv *adapter) > #endif > msleep(100);// Waiting Irp completed > > - // Destroy the NDIS module > - WBLINUX_stop(adapter); > - > // Halt the HAL > hal_halt(&adapter->sHwData, NULL); > } -- (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 6/7] w35und: remove ->skb_array from struct wbsoft_priv 2008-10-30 16:12 ` [PATCH 6/7] w35und: remove ->skb_array from struct wbsoft_priv Pekka Enberg 2008-10-30 16:12 ` [PATCH 7/7] w35und: remove ->shutdown " Pekka Enberg @ 2008-10-30 19:19 ` Pavel Machek 1 sibling, 0 replies; 14+ messages in thread From: Pavel Machek @ 2008-10-30 19:19 UTC (permalink / raw) To: Pekka Enberg; +Cc: greg, linux-kernel On Thu 2008-10-30 18:12:06, Pekka Enberg wrote: > It's not actually used for anything, so remove it. Acked-by: Pavel Machek <pavel@suse.cz> -- (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 5/7] w35und: move packet_came() to wb35rx.c 2008-10-30 16:12 ` [PATCH 5/7] w35und: move packet_came() to wb35rx.c Pekka Enberg 2008-10-30 16:12 ` [PATCH 6/7] w35und: remove ->skb_array from struct wbsoft_priv Pekka Enberg @ 2008-10-30 19:19 ` Pavel Machek 1 sibling, 0 replies; 14+ messages in thread From: Pavel Machek @ 2008-10-30 19:19 UTC (permalink / raw) To: Pekka Enberg; +Cc: greg, linux-kernel On Thu 2008-10-30 18:12:05, Pekka Enberg wrote: > The function no longer has dependencies to wbusb.c so we can move it to > wb35rx.c and make it static now. Acked-by: Pavel Machek <pavel@suse.cz> -- (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 4/7] w35und: move global wbsoft_enabled to struct wbsoft_priv 2008-10-30 16:12 ` [PATCH 4/7] w35und: move global wbsoft_enabled to struct wbsoft_priv Pekka Enberg 2008-10-30 16:12 ` [PATCH 5/7] w35und: move packet_came() to wb35rx.c Pekka Enberg @ 2008-10-30 19:18 ` Pavel Machek 1 sibling, 0 replies; 14+ messages in thread From: Pavel Machek @ 2008-10-30 19:18 UTC (permalink / raw) To: Pekka Enberg; +Cc: greg, linux-kernel On Thu 2008-10-30 18:12:04, Pekka Enberg wrote: > This is a preparational step for moving packet_came() to wb35rx.c(). Acked-by: Pavel Machek <pavel@suse.cz> > Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi> > --- > drivers/staging/winbond/core.h | 2 ++ > drivers/staging/winbond/wbusb.c | 11 ++++++----- > 2 files changed, 8 insertions(+), 5 deletions(-) > > diff --git a/drivers/staging/winbond/core.h b/drivers/staging/winbond/core.h > index 64b73bb..c6dd223 100644 > --- a/drivers/staging/winbond/core.h > +++ b/drivers/staging/winbond/core.h > @@ -39,6 +39,8 @@ struct wbsoft_priv { > struct iw_statistics iw_stats; > > u8 LinkName[WB_MAX_LINK_NAME_LEN]; > + > + bool enabled; > }; > > #endif /* __WINBOND_CORE_H */ > diff --git a/drivers/staging/winbond/wbusb.c b/drivers/staging/winbond/wbusb.c > index 0f70101..246f20b 100644 > --- a/drivers/staging/winbond/wbusb.c > +++ b/drivers/staging/winbond/wbusb.c > @@ -46,8 +46,6 @@ static struct ieee80211_supported_band wbsoft_band_2GHz = { > .n_bitrates = ARRAY_SIZE(wbsoft_rates), > }; > > -int wbsoft_enabled; > - > static int wbsoft_add_interface(struct ieee80211_hw *dev, > struct ieee80211_if_init_conf *conf) > { > @@ -129,8 +127,10 @@ static int wbsoft_tx(struct ieee80211_hw *dev, struct sk_buff *skb) > > static int wbsoft_start(struct ieee80211_hw *dev) > { > - wbsoft_enabled = 1; > - printk("wbsoft_start called\n"); > + struct wbsoft_priv *priv = dev->priv; > + > + priv->enabled = true; > + > return 0; > } > > @@ -393,10 +393,11 @@ error: > > void packet_came(struct ieee80211_hw *hw, char *pRxBufferAddress, int PacketSize) > { > + struct wbsoft_priv *priv = hw->priv; > struct sk_buff *skb; > struct ieee80211_rx_status rx_status = {0}; > > - if (!wbsoft_enabled) > + if (!priv->enabled) > return; > > skb = dev_alloc_skb(PacketSize); -- (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 3/7] w35und: remove unused ->ShutDowned member from struct LOCAL_PARA 2008-10-30 16:12 ` [PATCH 3/7] w35und: remove unused ->ShutDowned member from struct LOCAL_PARA Pekka Enberg 2008-10-30 16:12 ` [PATCH 4/7] w35und: move global wbsoft_enabled to struct wbsoft_priv Pekka Enberg @ 2008-10-30 19:17 ` Pavel Machek 1 sibling, 0 replies; 14+ messages in thread From: Pavel Machek @ 2008-10-30 19:17 UTC (permalink / raw) To: Pekka Enberg; +Cc: greg, linux-kernel On Thu 2008-10-30 18:12:03, Pekka Enberg wrote: > It's not actually read by anyone so we might as well remove it. Acked-by: Pavel Machek <pavel@suse.cz> > Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi> > --- > drivers/staging/winbond/localpara.h | 1 - > drivers/staging/winbond/wbusb.c | 6 ------ > 2 files changed, 0 insertions(+), 7 deletions(-) > > diff --git a/drivers/staging/winbond/localpara.h b/drivers/staging/winbond/localpara.h > index a308ac2..607bb05 100644 > --- a/drivers/staging/winbond/localpara.h > +++ b/drivers/staging/winbond/localpara.h > @@ -149,7 +149,6 @@ typedef struct LOCAL_PARA > > //// power-save variables > u8 iPowerSaveMode; // 0 indicates it is on, 1 indicates it is off > - u8 ShutDowned; > u8 ATIMmode; > u8 ExcludeUnencrypted; > > diff --git a/drivers/staging/winbond/wbusb.c b/drivers/staging/winbond/wbusb.c > index 673875d..0f70101 100644 > --- a/drivers/staging/winbond/wbusb.c > +++ b/drivers/staging/winbond/wbusb.c > @@ -220,9 +220,6 @@ static unsigned char wb35_hw_init(struct ieee80211_hw *hw) > pHwData = &priv->sHwData; > hal_set_phy_type( pHwData, RF_DECIDE_BY_INF ); > > - // Initial Software variable > - priv->sLocalPara.ShutDowned = false; > - > //added by ws for wep key error detection > priv->sLocalPara.bWepKeyError= false; > priv->sLocalPara.bToSelfPacketReceived = false; > @@ -424,9 +421,6 @@ void packet_came(struct ieee80211_hw *hw, char *pRxBufferAddress, int PacketSize > > static void wb35_hw_halt(struct wbsoft_priv *adapter) > { > - //--------------------- > - adapter->sLocalPara.ShutDowned = true; > - > Mds_Destroy( adapter ); > > // Turn off Rx and Tx hardware ability -- (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 2/7] w35und: clean up wblinux.c a bit 2008-10-30 16:12 ` [PATCH 2/7] w35und: clean up wblinux.c a bit Pekka Enberg 2008-10-30 16:12 ` [PATCH 3/7] w35und: remove unused ->ShutDowned member from struct LOCAL_PARA Pekka Enberg @ 2008-10-30 19:17 ` Pavel Machek 1 sibling, 0 replies; 14+ messages in thread From: Pavel Machek @ 2008-10-30 19:17 UTC (permalink / raw) To: Pekka Enberg; +Cc: greg, linux-kernel On Thu 2008-10-30 18:12:02, Pekka Enberg wrote: > This patch removes wrapper functions from wblinux.c and moves the hardware init > and halt functions to wbusb.c which has the only callers of them. Acked-by: Pavel Machek <pavel@suse.cz> > Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi> > --- > drivers/staging/winbond/wblinux.c | 167 ----------------------------------- > drivers/staging/winbond/wblinux_f.h | 5 - > drivers/staging/winbond/wbusb.c | 150 ++++++++++++++++++++++++++++++- > 3 files changed, 147 insertions(+), 175 deletions(-) > > diff --git a/drivers/staging/winbond/wblinux.c b/drivers/staging/winbond/wblinux.c > index 31f2d20..433aa0d 100644 > --- a/drivers/staging/winbond/wblinux.c > +++ b/drivers/staging/winbond/wblinux.c > @@ -16,22 +16,6 @@ > #include "wbhal_f.h" > #include "wblinux_f.h" > > -unsigned char > -WBLINUX_Initial(struct wbsoft_priv * adapter) > -{ > - spin_lock_init( &adapter->SpinLock ); > - return true; > -} > - > -void > -WBLINUX_Destroy(struct wbsoft_priv * adapter) > -{ > - WBLINUX_stop( adapter ); > -#ifdef _PE_USB_INI_DUMP_ > - WBDEBUG(("[w35und] unregister_netdev!\n")); > -#endif > -} > - > void > WBLINUX_stop( struct wbsoft_priv * adapter ) > { > @@ -61,154 +45,3 @@ WBLINUX_stop( struct wbsoft_priv * adapter ) > > atomic_dec(&adapter->ThreadCount); > } > - > -void > -WbWlanHalt( struct wbsoft_priv * adapter ) > -{ > - //--------------------- > - adapter->sLocalPara.ShutDowned = true; > - > - Mds_Destroy( adapter ); > - > - // Turn off Rx and Tx hardware ability > - hal_stop( &adapter->sHwData ); > -#ifdef _PE_USB_INI_DUMP_ > - WBDEBUG(("[w35und] Hal_stop O.K.\n")); > -#endif > - msleep(100);// Waiting Irp completed > - > - // Destroy the NDIS module > - WBLINUX_Destroy( adapter ); > - > - // Halt the HAL > - hal_halt(&adapter->sHwData, NULL); > -} > - > -unsigned char > -WbWLanInitialize(struct ieee80211_hw *hw) > -{ > - struct wbsoft_priv *priv = hw->priv; > - phw_data_t pHwData; > - u8 *pMacAddr; > - u8 *pMacAddr2; > - u32 InitStep = 0; > - u8 EEPROM_region; > - u8 HwRadioOff; > - > - // > - // Setting default value for Linux > - // > - priv->sLocalPara.region_INF = REGION_AUTO; > - priv->sLocalPara.TxRateMode = RATE_AUTO; > - priv->sLocalPara.bMacOperationMode = MODE_802_11_BG; // B/G mode > - priv->Mds.TxRTSThreshold = DEFAULT_RTSThreshold; > - priv->Mds.TxFragmentThreshold = DEFAULT_FRAGMENT_THRESHOLD; > - hal_set_phy_type( &priv->sHwData, RF_WB_242_1 ); > - priv->sLocalPara.MTUsize = MAX_ETHERNET_PACKET_SIZE; > - priv->sLocalPara.bPreambleMode = AUTO_MODE; > - priv->sLocalPara.RadioOffStatus.boSwRadioOff = false; > - pHwData = &priv->sHwData; > - hal_set_phy_type( pHwData, RF_DECIDE_BY_INF ); > - > - // > - // Initial each module and variable > - // > - if (!WBLINUX_Initial(priv)) { > -#ifdef _PE_USB_INI_DUMP_ > - WBDEBUG(("[w35und]WBNDIS initialization failed\n")); > -#endif > - goto error; > - } > - > - // Initial Software variable > - priv->sLocalPara.ShutDowned = false; > - > - //added by ws for wep key error detection > - priv->sLocalPara.bWepKeyError= false; > - priv->sLocalPara.bToSelfPacketReceived = false; > - priv->sLocalPara.WepKeyDetectTimerCount= 2 * 100; /// 2 seconds > - > - // Initial USB hal > - InitStep = 1; > - pHwData = &priv->sHwData; > - if (!hal_init_hardware(hw)) > - goto error; > - > - EEPROM_region = hal_get_region_from_EEPROM( pHwData ); > - if (EEPROM_region != REGION_AUTO) > - priv->sLocalPara.region = EEPROM_region; > - else { > - if (priv->sLocalPara.region_INF != REGION_AUTO) > - priv->sLocalPara.region = priv->sLocalPara.region_INF; > - else > - priv->sLocalPara.region = REGION_USA; //default setting > - } > - > - // Get Software setting flag from hal > - priv->sLocalPara.boAntennaDiversity = false; > - if (hal_software_set(pHwData) & 0x00000001) > - priv->sLocalPara.boAntennaDiversity = true; > - > - // > - // For TS module > - // > - InitStep = 2; > - > - // For MDS module > - InitStep = 3; > - Mds_initial(priv); > - > - //======================================= > - // Initialize the SME, SCAN, MLME, ROAM > - //======================================= > - InitStep = 4; > - InitStep = 5; > - InitStep = 6; > - > - // If no user-defined address in the registry, use the addresss "burned" on the NIC instead. > - pMacAddr = priv->sLocalPara.ThisMacAddress; > - pMacAddr2 = priv->sLocalPara.PermanentAddress; > - 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) > - memcpy(pMacAddr, pMacAddr2, MAC_ADDR_LENGTH); > - else { > - // Set the user define MAC address > - hal_set_ethernet_address(pHwData, priv->sLocalPara.ThisMacAddress); > - } > - > - //get current antenna > - priv->sLocalPara.bAntennaNo = hal_get_antenna_number(pHwData); > -#ifdef _PE_STATE_DUMP_ > - WBDEBUG(("Driver init, antenna no = %d\n", psLOCAL->bAntennaNo)); > -#endif > - hal_get_hw_radio_off( pHwData ); > - > - // Waiting for HAL setting OK > - while (!hal_idle(pHwData)) > - msleep(10); > - > - MTO_Init(priv); > - > - HwRadioOff = hal_get_hw_radio_off( pHwData ); > - priv->sLocalPara.RadioOffStatus.boHwRadioOff = !!HwRadioOff; > - > - 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. > - //set a tx power for reference..... > -// sme_set_tx_power_level(priv, 12); FIXME? > - return true; > - > -error: > - switch (InitStep) { > - case 5: > - case 4: > - case 3: Mds_Destroy( priv ); > - case 2: > - case 1: WBLINUX_Destroy( priv ); > - hal_halt( pHwData, NULL ); > - case 0: break; > - } > - > - return false; > -} > diff --git a/drivers/staging/winbond/wblinux_f.h b/drivers/staging/winbond/wblinux_f.h > index 15e6a65..f531a01 100644 > --- a/drivers/staging/winbond/wblinux_f.h > +++ b/drivers/staging/winbond/wblinux_f.h > @@ -9,15 +9,10 @@ > // > // wblinux_f.h > // > -unsigned char WBLINUX_Initial( struct wbsoft_priv *adapter ); > int wb35_start_xmit(struct sk_buff *skb, struct net_device *netdev ); > void WBLINUX_stop( struct wbsoft_priv *adapter ); > -void WBLINUX_Destroy( struct wbsoft_priv *adapter ); > void wb35_set_multicast( struct net_device *netdev ); > struct net_device_stats * wb35_netdev_stats( struct net_device *netdev ); > void WBLINUX_stop( struct wbsoft_priv *adapter ); > -void WbWlanHalt( struct wbsoft_priv *adapter ); > -unsigned char WbWLanInitialize(struct ieee80211_hw *hw); > - > > #endif > diff --git a/drivers/staging/winbond/wbusb.c b/drivers/staging/winbond/wbusb.c > index 67847c8..673875d 100644 > --- a/drivers/staging/winbond/wbusb.c > +++ b/drivers/staging/winbond/wbusb.c > @@ -7,7 +7,9 @@ > #include <linux/usb.h> > > #include "core.h" > +#include "mds_f.h" > #include "mlmetxrx_f.h" > +#include "mto_f.h" > #include "wbhal_f.h" > #include "wblinux_f.h" > > @@ -180,7 +182,7 @@ static u64 wbsoft_get_tsf(struct ieee80211_hw *dev) > > static const struct ieee80211_ops wbsoft_ops = { > .tx = wbsoft_tx, > - .start = wbsoft_start, /* Start can be pretty much empty as we do WbWLanInitialize() during probe? */ > + .start = wbsoft_start, /* Start can be pretty much empty as we do wb35_hw_init() during probe? */ > .stop = wbsoft_stop, > .add_interface = wbsoft_add_interface, > .remove_interface = wbsoft_remove_interface, > @@ -193,6 +195,124 @@ static const struct ieee80211_ops wbsoft_ops = { > // conf_tx: hal_set_cwmin()/hal_set_cwmax; > }; > > +static unsigned char wb35_hw_init(struct ieee80211_hw *hw) > +{ > + struct wbsoft_priv *priv = hw->priv; > + phw_data_t pHwData; > + u8 *pMacAddr; > + u8 *pMacAddr2; > + u32 InitStep = 0; > + u8 EEPROM_region; > + u8 HwRadioOff; > + > + // > + // Setting default value for Linux > + // > + priv->sLocalPara.region_INF = REGION_AUTO; > + priv->sLocalPara.TxRateMode = RATE_AUTO; > + priv->sLocalPara.bMacOperationMode = MODE_802_11_BG; // B/G mode > + priv->Mds.TxRTSThreshold = DEFAULT_RTSThreshold; > + priv->Mds.TxFragmentThreshold = DEFAULT_FRAGMENT_THRESHOLD; > + hal_set_phy_type( &priv->sHwData, RF_WB_242_1 ); > + priv->sLocalPara.MTUsize = MAX_ETHERNET_PACKET_SIZE; > + priv->sLocalPara.bPreambleMode = AUTO_MODE; > + priv->sLocalPara.RadioOffStatus.boSwRadioOff = false; > + pHwData = &priv->sHwData; > + hal_set_phy_type( pHwData, RF_DECIDE_BY_INF ); > + > + // Initial Software variable > + priv->sLocalPara.ShutDowned = false; > + > + //added by ws for wep key error detection > + priv->sLocalPara.bWepKeyError= false; > + priv->sLocalPara.bToSelfPacketReceived = false; > + priv->sLocalPara.WepKeyDetectTimerCount= 2 * 100; /// 2 seconds > + > + // Initial USB hal > + InitStep = 1; > + pHwData = &priv->sHwData; > + if (!hal_init_hardware(hw)) > + goto error; > + > + EEPROM_region = hal_get_region_from_EEPROM( pHwData ); > + if (EEPROM_region != REGION_AUTO) > + priv->sLocalPara.region = EEPROM_region; > + else { > + if (priv->sLocalPara.region_INF != REGION_AUTO) > + priv->sLocalPara.region = priv->sLocalPara.region_INF; > + else > + priv->sLocalPara.region = REGION_USA; //default setting > + } > + > + // Get Software setting flag from hal > + priv->sLocalPara.boAntennaDiversity = false; > + if (hal_software_set(pHwData) & 0x00000001) > + priv->sLocalPara.boAntennaDiversity = true; > + > + // > + // For TS module > + // > + InitStep = 2; > + > + // For MDS module > + InitStep = 3; > + Mds_initial(priv); > + > + //======================================= > + // Initialize the SME, SCAN, MLME, ROAM > + //======================================= > + InitStep = 4; > + InitStep = 5; > + InitStep = 6; > + > + // If no user-defined address in the registry, use the addresss "burned" on the NIC instead. > + pMacAddr = priv->sLocalPara.ThisMacAddress; > + pMacAddr2 = priv->sLocalPara.PermanentAddress; > + 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) > + memcpy(pMacAddr, pMacAddr2, MAC_ADDR_LENGTH); > + else { > + // Set the user define MAC address > + hal_set_ethernet_address(pHwData, priv->sLocalPara.ThisMacAddress); > + } > + > + //get current antenna > + priv->sLocalPara.bAntennaNo = hal_get_antenna_number(pHwData); > +#ifdef _PE_STATE_DUMP_ > + WBDEBUG(("Driver init, antenna no = %d\n", psLOCAL->bAntennaNo)); > +#endif > + hal_get_hw_radio_off( pHwData ); > + > + // Waiting for HAL setting OK > + while (!hal_idle(pHwData)) > + msleep(10); > + > + MTO_Init(priv); > + > + HwRadioOff = hal_get_hw_radio_off( pHwData ); > + priv->sLocalPara.RadioOffStatus.boHwRadioOff = !!HwRadioOff; > + > + 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. > + //set a tx power for reference..... > +// sme_set_tx_power_level(priv, 12); FIXME? > + return true; > + > +error: > + switch (InitStep) { > + case 5: > + case 4: > + case 3: Mds_Destroy( priv ); > + case 2: > + case 1: WBLINUX_stop(priv); > + hal_halt( pHwData, NULL ); > + case 0: break; > + } > + > + return false; > +} > + > static int wb35_probe(struct usb_interface *intf, const struct usb_device_id *id_table) > { > PWBUSB pWbUsb; > @@ -225,6 +345,8 @@ static int wb35_probe(struct usb_interface *intf, const struct usb_device_id *id > > priv = dev->priv; > > + spin_lock_init(&priv->SpinLock); > + > pWbUsb = &priv->sHwData.WbUsb; > pWbUsb->udev = udev; > > @@ -236,7 +358,7 @@ static int wb35_probe(struct usb_interface *intf, const struct usb_device_id *id > pWbUsb->IsUsb20 = 1; > } > > - if (!WbWLanInitialize(dev)) { > + if (!wb35_hw_init(dev)) { > err = -EINVAL; > goto error_free_hw; > } > @@ -300,11 +422,33 @@ void packet_came(struct ieee80211_hw *hw, char *pRxBufferAddress, int PacketSize > ieee80211_rx_irqsafe(hw, skb, &rx_status); > } > > +static void wb35_hw_halt(struct wbsoft_priv *adapter) > +{ > + //--------------------- > + adapter->sLocalPara.ShutDowned = true; > + > + Mds_Destroy( adapter ); > + > + // Turn off Rx and Tx hardware ability > + hal_stop( &adapter->sHwData ); > +#ifdef _PE_USB_INI_DUMP_ > + WBDEBUG(("[w35und] Hal_stop O.K.\n")); > +#endif > + msleep(100);// Waiting Irp completed > + > + // Destroy the NDIS module > + WBLINUX_stop(adapter); > + > + // Halt the HAL > + hal_halt(&adapter->sHwData, NULL); > +} > + > + > static void wb35_disconnect(struct usb_interface *intf) > { > struct wbsoft_priv *priv = usb_get_intfdata(intf); > > - WbWlanHalt(priv); > + wb35_hw_halt(priv); > > usb_set_intfdata(intf, NULL); > usb_put_dev(interface_to_usbdev(intf)); -- (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 1/7] w35und: inline DRIVER_AUTHOR and DRIVER_DESC macros 2008-10-30 16:12 [PATCH 1/7] w35und: inline DRIVER_AUTHOR and DRIVER_DESC macros Pekka Enberg 2008-10-30 16:12 ` [PATCH 2/7] w35und: clean up wblinux.c a bit Pekka Enberg @ 2008-10-30 19:16 ` Pavel Machek 1 sibling, 0 replies; 14+ messages in thread From: Pavel Machek @ 2008-10-30 19:16 UTC (permalink / raw) To: Pekka Enberg; +Cc: greg, linux-kernel On Thu 2008-10-30 18:12:01, Pekka Enberg wrote: > They're used in one place so we can inline them. Acked-by: Pavel Machek <pavel@suse.cz> Ok, perhaps I should add myself to the list ;-)... Pavel > Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi> > --- > drivers/staging/winbond/wbusb.c | 4 ++-- > drivers/staging/winbond/wbusb_s.h | 3 --- > 2 files changed, 2 insertions(+), 5 deletions(-) > > diff --git a/drivers/staging/winbond/wbusb.c b/drivers/staging/winbond/wbusb.c > index 40bb77c..67847c8 100644 > --- a/drivers/staging/winbond/wbusb.c > +++ b/drivers/staging/winbond/wbusb.c > @@ -11,8 +11,8 @@ > #include "wbhal_f.h" > #include "wblinux_f.h" > > -MODULE_AUTHOR(DRIVER_AUTHOR); > -MODULE_DESCRIPTION(DRIVER_DESC); > +MODULE_AUTHOR("Original by: Jeff Lee<YY_Lee@issc.com.tw> Adapted to 2.6.x by Costantino Leandro (Rxart Desktop) <le_costantino@pixartargentina.com.ar>"); > +MODULE_DESCRIPTION("IS89C35 802.11bg WLAN USB Driver"); > MODULE_LICENSE("GPL"); > MODULE_VERSION("0.1"); > > diff --git a/drivers/staging/winbond/wbusb_s.h b/drivers/staging/winbond/wbusb_s.h > index 1aa8ab1..1de9360 100644 > --- a/drivers/staging/winbond/wbusb_s.h > +++ b/drivers/staging/winbond/wbusb_s.h > @@ -28,9 +28,6 @@ typedef struct _RW_CONTEXT > void* pCallBackFunctionParameter; > } RW_CONTEXT, *PRW_CONTEXT; > > -#define DRIVER_AUTHOR "Original by: Jeff Lee<YY_Lee@issc.com.tw> Adapted to 2.6.x by Costantino Leandro (Rxart Desktop) <le_costantino@pixartargentina.com.ar>" > -#define DRIVER_DESC "IS89C35 802.11bg WLAN USB Driver" > - > typedef struct _WBUSB { > u32 IsUsb20; > struct usb_device *udev; -- (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html ^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2008-10-30 19:19 UTC | newest] Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2008-10-30 16:12 [PATCH 1/7] w35und: inline DRIVER_AUTHOR and DRIVER_DESC macros Pekka Enberg 2008-10-30 16:12 ` [PATCH 2/7] w35und: clean up wblinux.c a bit Pekka Enberg 2008-10-30 16:12 ` [PATCH 3/7] w35und: remove unused ->ShutDowned member from struct LOCAL_PARA Pekka Enberg 2008-10-30 16:12 ` [PATCH 4/7] w35und: move global wbsoft_enabled to struct wbsoft_priv Pekka Enberg 2008-10-30 16:12 ` [PATCH 5/7] w35und: move packet_came() to wb35rx.c Pekka Enberg 2008-10-30 16:12 ` [PATCH 6/7] w35und: remove ->skb_array from struct wbsoft_priv Pekka Enberg 2008-10-30 16:12 ` [PATCH 7/7] w35und: remove ->shutdown " Pekka Enberg 2008-10-30 19:20 ` Pavel Machek 2008-10-30 19:19 ` [PATCH 6/7] w35und: remove ->skb_array " Pavel Machek 2008-10-30 19:19 ` [PATCH 5/7] w35und: move packet_came() to wb35rx.c Pavel Machek 2008-10-30 19:18 ` [PATCH 4/7] w35und: move global wbsoft_enabled to struct wbsoft_priv Pavel Machek 2008-10-30 19:17 ` [PATCH 3/7] w35und: remove unused ->ShutDowned member from struct LOCAL_PARA Pavel Machek 2008-10-30 19:17 ` [PATCH 2/7] w35und: clean up wblinux.c a bit Pavel Machek 2008-10-30 19:16 ` [PATCH 1/7] w35und: inline DRIVER_AUTHOR and DRIVER_DESC macros Pavel Machek
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox
Powered by JetHome