LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] w35und: move struct wbsoft_priv to core.h and use it
@ 2008-10-30 14:14 Pekka Enberg
  2008-10-30 14:14 ` [PATCH] w35und: remove ->adapter from struct _HW_DATA_T Pekka Enberg
  0 siblings, 1 reply; 9+ messages in thread
From: Pekka Enberg @ 2008-10-30 14:14 UTC (permalink / raw)
  To: greg; +Cc: linux-kernel, Pekka Enberg, Pavel Machek

This patch removes my_adapter global variable from wbusb.c by adding a
->adapter member to struct wbsoft_priv.

Cc: Pavel Machek <pavel@suse.cz>
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
---
 drivers/staging/winbond/core.h  |   10 ++++++++++
 drivers/staging/winbond/wbusb.c |   33 ++++++++++++++++++---------------
 2 files changed, 28 insertions(+), 15 deletions(-)
 create mode 100644 drivers/staging/winbond/core.h

diff --git a/drivers/staging/winbond/core.h b/drivers/staging/winbond/core.h
new file mode 100644
index 0000000..62ad954
--- /dev/null
+++ b/drivers/staging/winbond/core.h
@@ -0,0 +1,10 @@
+#ifndef __WINBOND_CORE_H
+#define __WINBOND_CORE_H
+
+#include "adapter.h"
+
+struct wbsoft_priv {
+	struct wb35_adapter *adapter;
+};
+
+#endif /* __WINBOND_CORE_H */
diff --git a/drivers/staging/winbond/wbusb.c b/drivers/staging/winbond/wbusb.c
index 4af13a0..d8fa9e5 100644
--- a/drivers/staging/winbond/wbusb.c
+++ b/drivers/staging/winbond/wbusb.c
@@ -6,6 +6,7 @@
 #include <net/mac80211.h>
 #include <linux/usb.h>
 
+#include "core.h"
 #include "mlmetxrx_f.h"
 #include "wbhal_f.h"
 #include "wblinux_f.h"
@@ -45,7 +46,6 @@ static struct ieee80211_supported_band wbsoft_band_2GHz = {
 
 int wbsoft_enabled;
 struct ieee80211_hw *my_dev;
-struct wb35_adapter * my_adapter;
 
 static int wbsoft_add_interface(struct ieee80211_hw *dev,
 				 struct ieee80211_if_init_conf *conf)
@@ -118,7 +118,9 @@ static void wbsoft_configure_filter(struct ieee80211_hw *dev,
 
 static int wbsoft_tx(struct ieee80211_hw *dev, struct sk_buff *skb)
 {
-	MLMESendFrame(my_adapter, skb->data, skb->len, FRAME_TYPE_802_11_MANAGEMENT);
+	struct wbsoft_priv *priv = dev->priv;
+
+	MLMESendFrame(priv->adapter, skb->data, skb->len, FRAME_TYPE_802_11_MANAGEMENT);
 
 	return NETDEV_TX_OK;
 }
@@ -133,6 +135,8 @@ static int wbsoft_start(struct ieee80211_hw *dev)
 
 static int wbsoft_config(struct ieee80211_hw *dev, struct ieee80211_conf *conf)
 {
+	struct wbsoft_priv *priv = dev->priv;
+
 	ChanInfo ch;
 	printk("wbsoft_config called\n");
 
@@ -140,20 +144,20 @@ static int wbsoft_config(struct ieee80211_hw *dev, struct ieee80211_conf *conf)
 	ch.ChanNo = 1;	/* Should use channel_num, or something, as that is already pre-translated */
 
 
-	hal_set_current_channel(&my_adapter->sHwData, ch);
-	hal_set_beacon_period(&my_adapter->sHwData, conf->beacon_int);
-//	hal_set_cap_info(&my_adapter->sHwData, ?? );
+	hal_set_current_channel(&priv->adapter->sHwData, ch);
+	hal_set_beacon_period(&priv->adapter->sHwData, conf->beacon_int);
+//	hal_set_cap_info(&priv->adapter->sHwData, ?? );
 // hal_set_ssid(phw_data_t pHwData,  u8 * pssid,  u8 ssid_len); ??
-	hal_set_accept_broadcast(&my_adapter->sHwData, 1);
-	hal_set_accept_promiscuous(&my_adapter->sHwData,  1);
-	hal_set_accept_multicast(&my_adapter->sHwData,  1);
-	hal_set_accept_beacon(&my_adapter->sHwData,  1);
-	hal_set_radio_mode(&my_adapter->sHwData,  0);
+	hal_set_accept_broadcast(&priv->adapter->sHwData, 1);
+	hal_set_accept_promiscuous(&priv->adapter->sHwData,  1);
+	hal_set_accept_multicast(&priv->adapter->sHwData,  1);
+	hal_set_accept_beacon(&priv->adapter->sHwData,  1);
+	hal_set_radio_mode(&priv->adapter->sHwData,  0);
 	//hal_set_antenna_number(  phw_data_t pHwData, u8 number )
 	//hal_set_rf_power(phw_data_t pHwData, u8 PowerIndex)
 
 
-//	hal_start_bss(&my_adapter->sHwData, WLAN_BSSTYPE_INFRASTRUCTURE);	??
+//	hal_start_bss(&priv->adapter->sHwData, WLAN_BSSTYPE_INFRASTRUCTURE);	??
 
 //void hal_set_rates(phw_data_t pHwData, u8 * pbss_rates,
 //		   u8 length, unsigned char basic_rate_set)
@@ -190,9 +194,6 @@ static const struct ieee80211_ops wbsoft_ops = {
 // conf_tx: hal_set_cwmin()/hal_set_cwmax;
 };
 
-struct wbsoft_priv {
-};
-
 static int wb35_probe(struct usb_interface *intf, const struct usb_device_id *id_table)
 {
 	struct wb35_adapter *adapter;
@@ -226,7 +227,6 @@ static int wb35_probe(struct usb_interface *intf, const struct usb_device_id *id
 		goto error;
 	}
 
-	my_adapter = adapter;
 	pWbUsb = &adapter->sHwData.WbUsb;
 	pWbUsb->udev = udev;
 
@@ -247,6 +247,9 @@ static int wb35_probe(struct usb_interface *intf, const struct usb_device_id *id
 	if (!dev)
 		goto error_free_adapter;
 
+	priv = dev->priv;
+	priv->adapter = adapter;
+
 	my_dev = dev;
 
 	SET_IEEE80211_DEV(dev, &udev->dev);
-- 
1.5.3.7


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH] w35und: remove ->adapter from struct _HW_DATA_T
  2008-10-30 14:14 [PATCH] w35und: move struct wbsoft_priv to core.h and use it Pekka Enberg
@ 2008-10-30 14:14 ` Pekka Enberg
  2008-10-30 14:14   ` [PATCH] w35und: clean up adapter.h a bit Pekka Enberg
  2008-10-30 19:09   ` [PATCH] w35und: remove ->adapter from struct _HW_DATA_T Pavel Machek
  0 siblings, 2 replies; 9+ messages in thread
From: Pekka Enberg @ 2008-10-30 14:14 UTC (permalink / raw)
  To: greg; +Cc: linux-kernel, Pekka Enberg, Pavel Machek

Eventually we want to pass a pointer to struct ieee80211_hw around in the
driver, so remove the bidirectional link between struct wb35_adapter and struct
_HW_DATA_T to simplify the code.

Cc: Pavel Machek <pavel@suse.cz>
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
---
 drivers/staging/winbond/mds.c      |    2 +-
 drivers/staging/winbond/wb35tx.c   |   38 +++++++++++++++++++----------------
 drivers/staging/winbond/wb35tx_f.h |   11 +++++----
 drivers/staging/winbond/wbhal.c    |   24 +++++++++++-----------
 drivers/staging/winbond/wbhal_f.h  |    6 ++--
 drivers/staging/winbond/wbhal_s.h  |   10 ---------
 6 files changed, 43 insertions(+), 48 deletions(-)

diff --git a/drivers/staging/winbond/mds.c b/drivers/staging/winbond/mds.c
index a23b74e..af4fdf1 100644
--- a/drivers/staging/winbond/mds.c
+++ b/drivers/staging/winbond/mds.c
@@ -176,7 +176,7 @@ Mds_Tx(struct wb35_adapter * adapter)
 	// Start to send by lower module
 	//
 	if (!pHwData->IsKeyPreSet)
-		Wb35Tx_start(pHwData);
+		Wb35Tx_start(adapter);
 
  cleanup:
 	atomic_dec(&pMds->TxThreadCount);
diff --git a/drivers/staging/winbond/wb35tx.c b/drivers/staging/winbond/wb35tx.c
index af4a61f..ce7e981 100644
--- a/drivers/staging/winbond/wb35tx.c
+++ b/drivers/staging/winbond/wb35tx.c
@@ -23,23 +23,24 @@ Wb35Tx_get_tx_buffer(phw_data_t pHwData, u8 **pBuffer)
 	return true;
 }
 
-void Wb35Tx_start(phw_data_t pHwData)
+void Wb35Tx_start(struct wb35_adapter *adapter)
 {
+	phw_data_t pHwData = &adapter->sHwData;
 	PWB35TX pWb35Tx = &pHwData->Wb35Tx;
 
 	// Allow only one thread to run into function
 	if (atomic_inc_return(&pWb35Tx->TxFireCounter) == 1) {
 		pWb35Tx->EP4vm_state = VM_RUNNING;
-		Wb35Tx(pHwData);
+		Wb35Tx(adapter);
 	} else
 		atomic_dec(&pWb35Tx->TxFireCounter);
 }
 
 
-void Wb35Tx(phw_data_t pHwData)
+void Wb35Tx(struct wb35_adapter *adapter)
 {
+	phw_data_t	pHwData = &adapter->sHwData;
 	PWB35TX		pWb35Tx = &pHwData->Wb35Tx;
-	struct wb35_adapter *adapter = pHwData->adapter;
 	u8		*pTxBufferAddress;
 	PMDS		pMds = &adapter->Mds;
 	struct urb *	pUrb = (struct urb *)pWb35Tx->Tx4Urb;
@@ -65,7 +66,7 @@ void Wb35Tx(phw_data_t pHwData)
 	usb_fill_bulk_urb(pUrb, pHwData->WbUsb.udev,
 			  usb_sndbulkpipe(pHwData->WbUsb.udev, 4),
 			  pTxBufferAddress, pMds->TxBufferSize[ SendIndex ],
-			  Wb35Tx_complete, pHwData);
+			  Wb35Tx_complete, adapter);
 
 	pWb35Tx->EP4vm_state = VM_RUNNING;
 	retv = usb_submit_urb(pUrb, GFP_ATOMIC);
@@ -77,7 +78,7 @@ void Wb35Tx(phw_data_t pHwData)
 	// Check if driver needs issue Irp for EP2
 	pWb35Tx->TxFillCount += pMds->TxCountInBuffer[SendIndex];
 	if (pWb35Tx->TxFillCount > 12)
-		Wb35Tx_EP2VM_start( pHwData );
+		Wb35Tx_EP2VM_start(adapter);
 
 	pWb35Tx->ByteTransfer += pMds->TxBufferSize[SendIndex];
 	return;
@@ -90,8 +91,8 @@ void Wb35Tx(phw_data_t pHwData)
 
 void Wb35Tx_complete(struct urb * pUrb)
 {
-	phw_data_t	pHwData = pUrb->context;
-	struct wb35_adapter *adapter = pHwData->adapter;
+	struct wb35_adapter *adapter = pUrb->context;
+	phw_data_t	pHwData = &adapter->sHwData;
 	PWB35TX		pWb35Tx = &pHwData->Wb35Tx;
 	PMDS		pMds = &adapter->Mds;
 
@@ -117,7 +118,7 @@ void Wb35Tx_complete(struct urb * pUrb)
 	}
 
 	Mds_Tx(adapter);
-	Wb35Tx(pHwData);
+	Wb35Tx(adapter);
 	return;
 
 error:
@@ -193,8 +194,9 @@ void Wb35Tx_destroy(phw_data_t pHwData)
 	#endif
 }
 
-void Wb35Tx_CurrentTime(phw_data_t pHwData, u32 TimeCount)
+void Wb35Tx_CurrentTime(struct wb35_adapter *adapter, u32 TimeCount)
 {
+	phw_data_t pHwData = &adapter->sHwData;
 	PWB35TX pWb35Tx = &pHwData->Wb35Tx;
 	unsigned char Trigger = false;
 
@@ -205,26 +207,28 @@ void Wb35Tx_CurrentTime(phw_data_t pHwData, u32 TimeCount)
 
 	if (Trigger) {
 		pWb35Tx->TxTimer = TimeCount;
-		Wb35Tx_EP2VM_start( pHwData );
+		Wb35Tx_EP2VM_start(adapter);
 	}
 }
 
-void Wb35Tx_EP2VM_start(phw_data_t pHwData)
+void Wb35Tx_EP2VM_start(struct wb35_adapter *adapter)
 {
+	phw_data_t pHwData = &adapter->sHwData;
 	PWB35TX pWb35Tx = &pHwData->Wb35Tx;
 
 	// Allow only one thread to run into function
 	if (atomic_inc_return(&pWb35Tx->TxResultCount) == 1) {
 		pWb35Tx->EP2vm_state = VM_RUNNING;
-		Wb35Tx_EP2VM( pHwData );
+		Wb35Tx_EP2VM(adapter);
 	}
 	else
 		atomic_dec(&pWb35Tx->TxResultCount);
 }
 
 
-void Wb35Tx_EP2VM(phw_data_t pHwData)
+void Wb35Tx_EP2VM(struct wb35_adapter *adapter)
 {
+	phw_data_t	pHwData = &adapter->sHwData;
 	PWB35TX pWb35Tx = &pHwData->Wb35Tx;
 	struct urb *	pUrb = (struct urb *)pWb35Tx->Tx2Urb;
 	u32 *	pltmp = (u32 *)pWb35Tx->EP2_buf;
@@ -240,7 +244,7 @@ void Wb35Tx_EP2VM(phw_data_t pHwData)
 	// Issuing URB
 	//
 	usb_fill_int_urb( pUrb, pHwData->WbUsb.udev, usb_rcvintpipe(pHwData->WbUsb.udev,2),
-			  pltmp, MAX_INTERRUPT_LENGTH, Wb35Tx_EP2VM_complete, pHwData, 32);
+			  pltmp, MAX_INTERRUPT_LENGTH, Wb35Tx_EP2VM_complete, adapter, 32);
 
 	pWb35Tx->EP2vm_state = VM_RUNNING;
 	retv = usb_submit_urb(pUrb, GFP_ATOMIC);
@@ -261,9 +265,9 @@ error:
 
 void Wb35Tx_EP2VM_complete(struct urb * pUrb)
 {
-	phw_data_t	pHwData = pUrb->context;
+	struct wb35_adapter *adapter = pUrb->context;
+	phw_data_t	pHwData = &adapter->sHwData;
 	T02_DESCRIPTOR	T02, TSTATUS;
-	struct wb35_adapter *adapter = pHwData->adapter;
 	PWB35TX		pWb35Tx = &pHwData->Wb35Tx;
 	u32 *		pltmp = (u32 *)pWb35Tx->EP2_buf;
 	u32		i;
diff --git a/drivers/staging/winbond/wb35tx_f.h b/drivers/staging/winbond/wb35tx_f.h
index 6aca4e9..466eb6f 100644
--- a/drivers/staging/winbond/wb35tx_f.h
+++ b/drivers/staging/winbond/wb35tx_f.h
@@ -1,6 +1,7 @@
 #ifndef __WINBOND_WB35TX_F_H
 #define __WINBOND_WB35TX_F_H
 
+#include "adapter.h"
 #include "wbhal_f.h"
 
 //====================================
@@ -10,16 +11,16 @@ unsigned char Wb35Tx_initial(	 phw_data_t pHwData );
 void Wb35Tx_destroy(  phw_data_t pHwData );
 unsigned char Wb35Tx_get_tx_buffer(  phw_data_t pHwData,  u8 **pBuffer );
 
-void Wb35Tx_EP2VM(  phw_data_t pHwData );
-void Wb35Tx_EP2VM_start(  phw_data_t pHwData );
+void Wb35Tx_EP2VM(struct wb35_adapter *adapter);
+void Wb35Tx_EP2VM_start(struct wb35_adapter *adapter);
 void Wb35Tx_EP2VM_complete(struct urb *urb);
 
-void Wb35Tx_start(  phw_data_t pHwData );
+void Wb35Tx_start(struct wb35_adapter *adapter);
 void Wb35Tx_stop(  phw_data_t pHwData );
-void Wb35Tx(  phw_data_t pHwData );
+void Wb35Tx(struct wb35_adapter *adapter);
 void Wb35Tx_complete(struct urb *urb);
 void Wb35Tx_reset_descriptor(  phw_data_t pHwData );
 
-void Wb35Tx_CurrentTime(  phw_data_t pHwData,  u32 TimeCount );
+void Wb35Tx_CurrentTime(struct wb35_adapter *adapter,  u32 TimeCount);
 
 #endif
diff --git a/drivers/staging/winbond/wbhal.c b/drivers/staging/winbond/wbhal.c
index 752ce59..3b7e90b 100644
--- a/drivers/staging/winbond/wbhal.c
+++ b/drivers/staging/winbond/wbhal.c
@@ -32,8 +32,8 @@ void hal_get_permanent_address( phw_data_t pHwData, u8 *pethernet_address )
 
 static void hal_led_control(unsigned long data)
 {
-	phw_data_t pHwData = (phw_data_t) data;
-	struct wb35_adapter *	adapter = pHwData->adapter;
+	struct wb35_adapter *adapter = (struct wb35_adapter *) data;
+	phw_data_t pHwData = &adapter->sHwData;
 	struct wb35_reg *reg = &pHwData->reg;
 	u32	LEDSet = (pHwData->SoftwareSet & HAL_LED_SET_MASK) >> HAL_LED_SET_SHIFT;
 	u8	LEDgray[20] = { 0,3,4,6,8,10,11,12,13,14,15,14,13,12,11,10,8,6,4,2 };
@@ -310,7 +310,7 @@ static void hal_led_control(unsigned long data)
 	}
 
 	pHwData->time_count += TimeInterval;
-	Wb35Tx_CurrentTime( pHwData, pHwData->time_count ); // 20060928 add
+	Wb35Tx_CurrentTime(adapter, pHwData->time_count); // 20060928 add
 	pHwData->LEDTimer.expires = jiffies + msecs_to_jiffies(TimeInterval);
 	add_timer(&pHwData->LEDTimer);
 }
@@ -319,7 +319,6 @@ static void hal_led_control(unsigned long data)
 u8 hal_init_hardware(phw_data_t pHwData, struct wb35_adapter * adapter)
 {
 	u16 SoftwareSet;
-	pHwData->adapter = adapter;
 
 	// Initial the variable
 	pHwData->MaxReceiveLifeTime = DEFAULT_MSDU_LIFE_TIME; // Setting Rx maximum MSDU life time
@@ -334,7 +333,7 @@ u8 hal_init_hardware(phw_data_t pHwData, struct wb35_adapter * adapter)
 				pHwData->InitialResource = 4;
 				init_timer(&pHwData->LEDTimer);
 				pHwData->LEDTimer.function = hal_led_control;
-				pHwData->LEDTimer.data = (unsigned long) pHwData;
+				pHwData->LEDTimer.data = (unsigned long) adapter;
 				pHwData->LEDTimer.expires = jiffies + msecs_to_jiffies(1000);
 				add_timer(&pHwData->LEDTimer);
 
@@ -351,7 +350,7 @@ u8 hal_init_hardware(phw_data_t pHwData, struct wb35_adapter * adapter)
 				#endif
 
 				Wb35Rx_start( pHwData );
-				Wb35Tx_EP2VM_start( pHwData );
+				Wb35Tx_EP2VM_start(adapter);
 
 				return true;
 			}
@@ -672,13 +671,13 @@ s32 hal_get_rssi(  phw_data_t pHwData,  u32 *HalRssiArry,  u8 Count )
 	return ltmp;
 }
 //----------------------------------------------------------------------------------------------------
-s32 hal_get_rssi_bss(  phw_data_t pHwData,  u16 idx,  u8 Count )
+s32 hal_get_rssi_bss(struct wb35_adapter *adapter,  u16 idx,  u8 Count)
 {
+	phw_data_t pHwData = &adapter->sHwData;
 	struct wb35_reg *reg = &pHwData->reg;
 	R01_DESCRIPTOR	r01;
 	s32 ltmp = 0, tmp;
 	u8	i, j;
-	struct wb35_adapter *	adapter = pHwData->adapter;
 //	u32 *HalRssiArry = psBSS(idx)->HalRssi;
 
 	if( pHwData->SurpriseRemove ) return -200;
@@ -842,9 +841,10 @@ void hal_system_power_change(phw_data_t pHwData, u32 PowerState)
 	}
 }
 
-void hal_surprise_remove(  phw_data_t pHwData )
+void hal_surprise_remove(struct wb35_adapter *adapter)
 {
-	struct wb35_adapter * adapter = pHwData->adapter;
+	phw_data_t pHwData = &adapter->sHwData;
+
 	if (atomic_inc_return( &pHwData->SurpriseRemoveCount ) == 1) {
 		#ifdef _PE_STATE_DUMP_
 		WBDEBUG(("Calling hal_surprise_remove\n"));
@@ -853,9 +853,9 @@ void hal_surprise_remove(  phw_data_t pHwData )
 	}
 }
 
-void hal_rate_change(  phw_data_t pHwData ) // Notify the HAL rate is changing 20060613.1
+void hal_rate_change(struct wb35_adapter *adapter) // Notify the HAL rate is changing 20060613.1
 {
-	struct wb35_adapter *	adapter = pHwData->adapter;
+	phw_data_t pHwData = &adapter->sHwData;
 	u8		rate = CURRENT_TX_RATE;
 
 	BBProcessor_RateChanging( pHwData, rate );
diff --git a/drivers/staging/winbond/wbhal_f.h b/drivers/staging/winbond/wbhal_f.h
index d64fd17..4cb4da0 100644
--- a/drivers/staging/winbond/wbhal_f.h
+++ b/drivers/staging/winbond/wbhal_f.h
@@ -61,7 +61,7 @@ void hal_set_cwmax(  phw_data_t pHwData,  u16 cwin_max );
 void hal_set_rsn_wpa(  phw_data_t pHwData,  u32 * RSN_IE_Bitmap , u32 * RSN_OUI_type , unsigned char bDesiredAuthMode);
 //s32 hal_get_rssi(  phw_data_t pHwData,  u32 HalRssi );
 s32 hal_get_rssi(  phw_data_t pHwData,  u32 *HalRssiArry,  u8 Count );
-s32 hal_get_rssi_bss(  phw_data_t pHwData,  u16 idx,  u8 Count );
+s32 hal_get_rssi_bss(struct wb35_adapter *adapter,  u16 idx,  u8 Count);
 void hal_set_connect_info(  phw_data_t pHwData,  unsigned char boConnect );
 u8 hal_get_est_sq3(  phw_data_t pHwData,  u8 Count );
 void hal_set_rf_power(  phw_data_t pHwData,  u8 PowerIndex ); // 20060621 Modify
@@ -82,13 +82,13 @@ u8 hal_get_hw_radio_off			(  phw_data_t pHwData );
 #define hal_scan_interval( _A )		(_A->Scan_Interval)
 void hal_scan_status_indicate(  phw_data_t pHwData, u8 status);	// 0: complete, 1: in progress
 void hal_system_power_change(  phw_data_t pHwData, u32 PowerState ); // 20051230 -=D0 1=D1 ..
-void hal_surprise_remove(  phw_data_t pHwData );
+void hal_surprise_remove(struct wb35_adapter *adapter);
 
 #define PHY_DEBUG( msg, args... )
 
 
 
-void hal_rate_change(  phw_data_t pHwData ); // Notify the HAL rate is changing 20060613.1
+void hal_rate_change(struct wb35_adapter *adapter); // Notify the HAL rate is changing 20060613.1
 unsigned char hal_get_dxx_reg(  phw_data_t pHwData,  u16 number,  u32 * pValue );
 unsigned char hal_set_dxx_reg(  phw_data_t pHwData,  u16 number,  u32 value );
 #define hal_get_time_count( _P )	(_P->time_count/10)	// return 100ms count
diff --git a/drivers/staging/winbond/wbhal_s.h b/drivers/staging/winbond/wbhal_s.h
index 995976a..276d2b1 100644
--- a/drivers/staging/winbond/wbhal_s.h
+++ b/drivers/staging/winbond/wbhal_s.h
@@ -449,16 +449,6 @@ typedef struct _HW_DATA_T
 	u32	FragCount;
 	u32	DMAFix; //V1_DMA_FIX The variable can be removed if driver want to save mem space for V2.
 
-	//=======================================================================================
-	// For USB driver, hal need more variables. Due to
-	//	1. NDIS-WDM operation
-	//	2. The SME, MLME and OLD MDS need adapter structure, but the driver under HAL doesn't
-	//		have that parameter when receiving and indicating packet.
-	//		The MDS must input the adapter pointer as the second parameter of hal_init_hardware.
-	//		The function usage is different than PCI driver.
-	//=======================================================================================
-	void* adapter;
-
 	//===============================================
 	// Definition for MAC address
 	//===============================================
-- 
1.5.3.7


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH] w35und: clean up adapter.h a bit
  2008-10-30 14:14 ` [PATCH] w35und: remove ->adapter from struct _HW_DATA_T Pekka Enberg
@ 2008-10-30 14:14   ` Pekka Enberg
  2008-10-30 14:14     ` [PATCH] w35und: merge struct wb35_adapter to struct wbsoft_priv Pekka Enberg
  2008-10-30 19:10     ` [PATCH] w35und: clean up adapter.h a bit Pavel Machek
  2008-10-30 19:09   ` [PATCH] w35und: remove ->adapter from struct _HW_DATA_T Pavel Machek
  1 sibling, 2 replies; 9+ messages in thread
From: Pekka Enberg @ 2008-10-30 14:14 UTC (permalink / raw)
  To: greg; +Cc: linux-kernel, Pekka Enberg, Pavel Machek

This patch cleans up adapter.h a bit in preparation for merging struct
wb35_adapter to struct wbsoft_priv.

Cc: Pavel Machek <pavel@suse.cz>
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
---
 drivers/staging/winbond/adapter.h |   17 +++--------------
 drivers/staging/winbond/common.h  |    3 ---
 drivers/staging/winbond/mds_s.h   |    1 -
 drivers/staging/winbond/wbhal.c   |   10 +++++-----
 4 files changed, 8 insertions(+), 23 deletions(-)

diff --git a/drivers/staging/winbond/adapter.h b/drivers/staging/winbond/adapter.h
index 11df483..239cc3a 100644
--- a/drivers/staging/winbond/adapter.h
+++ b/drivers/staging/winbond/adapter.h
@@ -7,20 +7,9 @@
 #include "mto.h"
 #include "wbhal_s.h"
 
-#define OS_SET_SHUTDOWN( _A )		_A->shutdown=1
-#define OS_SET_RESUME( _A )		_A->shutdown=0
-#define OS_STOP( _A )	WBLINUX_stop( _A )
+#define WBLINUX_PACKET_ARRAY_SIZE (ETHERNET_TX_DESCRIPTORS*4)
 
-#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_802_1X_PACKET_INDICATE( _A, _D )	EAP_ReceivePacket( _A, _D )
-#define OS_SEND_RESULT( _A, _ID, _R )
-
-#define WBLINUX_PACKET_ARRAY_SIZE	(ETHERNET_TX_DESCRIPTORS*4)
-
-#define MAX_ANSI_STRING		40
+#define WB_MAX_LINK_NAME_LEN 40
 
 struct wb35_adapter {
 	u32 adapterIndex;	// 20060703.4 Add for using padapterContext global adapter point
@@ -49,7 +38,7 @@ struct wb35_adapter {
 	s32 netif_state_stop;	// 1: stop  0: normal
 	struct iw_statistics iw_stats;
 
-	u8 LinkName[MAX_ANSI_STRING];
+	u8 LinkName[WB_MAX_LINK_NAME_LEN];
 };
 
 #endif
diff --git a/drivers/staging/winbond/common.h b/drivers/staging/winbond/common.h
index 2badc29..c4d9604 100644
--- a/drivers/staging/winbond/common.h
+++ b/drivers/staging/winbond/common.h
@@ -23,8 +23,5 @@
 #define WBDEBUG( _M )	0
 #endif
 
-#define OS_EVENT_INDICATE( _A, _B, _F )
-#define OS_PMKID_STATUS_EVENT( _A )
-
 #endif // COMMON_DEF
 
diff --git a/drivers/staging/winbond/mds_s.h b/drivers/staging/winbond/mds_s.h
index 02b1182..29f1568 100644
--- a/drivers/staging/winbond/mds_s.h
+++ b/drivers/staging/winbond/mds_s.h
@@ -14,7 +14,6 @@
 #define MAX_USB_TX_BUFFER_NUMBER	4		// Virtual pre-buffer number of MAX_USB_TX_BUFFER
 #define MAX_USB_TX_BUFFER			4096	// IS89C35 ability 4n alignment is required for hardware
 
-#define MDS_EVENT_INDICATE( _A, _B, _F )	OS_EVENT_INDICATE( _A, _B, _F )
 #define AUTH_REQUEST_PAIRWISE_ERROR			0		// _F flag setting
 #define AUTH_REQUEST_GROUP_ERROR			1		// _F flag setting
 
diff --git a/drivers/staging/winbond/wbhal.c b/drivers/staging/winbond/wbhal.c
index 3b7e90b..a7d25a6 100644
--- a/drivers/staging/winbond/wbhal.c
+++ b/drivers/staging/winbond/wbhal.c
@@ -223,8 +223,8 @@ static void hal_led_control(unsigned long data)
 				else
 				{
 					// Is transmitting/receiving ??
-					if( (OS_CURRENT_RX_BYTE( adapter ) != pHwData->RxByteCountLast ) ||
-						(OS_CURRENT_TX_BYTE( adapter ) != pHwData->TxByteCountLast ) )
+					if( (adapter->RxByteCount != pHwData->RxByteCountLast ) ||
+						(adapter->TxByteCount != pHwData->TxByteCountLast ) )
 					{
 						if( (reg->U1BC_LEDConfigure & 0x3000) != 0x3000 )
 						{
@@ -233,8 +233,8 @@ static void hal_led_control(unsigned long data)
 						}
 
 						// Update variable
-						pHwData->RxByteCountLast = OS_CURRENT_RX_BYTE( adapter );
-						pHwData->TxByteCountLast = OS_CURRENT_TX_BYTE( adapter );
+						pHwData->RxByteCountLast = adapter->RxByteCount;
+						pHwData->TxByteCountLast = adapter->TxByteCount;
 						TimeInterval = 200;
 					}
 					else
@@ -849,7 +849,7 @@ void hal_surprise_remove(struct wb35_adapter *adapter)
 		#ifdef _PE_STATE_DUMP_
 		WBDEBUG(("Calling hal_surprise_remove\n"));
 		#endif
-		OS_STOP( adapter );
+		WBLINUX_stop( adapter );
 	}
 }
 
-- 
1.5.3.7


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH] w35und: merge struct wb35_adapter to struct wbsoft_priv
  2008-10-30 14:14   ` [PATCH] w35und: clean up adapter.h a bit Pekka Enberg
@ 2008-10-30 14:14     ` Pekka Enberg
  2008-10-30 14:14       ` [PATCH] w35und: remove global struct ieee80211_hw Pekka Enberg
  2008-10-30 19:11       ` [PATCH] w35und: merge struct wb35_adapter to struct wbsoft_priv Pavel Machek
  2008-10-30 19:10     ` [PATCH] w35und: clean up adapter.h a bit Pavel Machek
  1 sibling, 2 replies; 9+ messages in thread
From: Pekka Enberg @ 2008-10-30 14:14 UTC (permalink / raw)
  To: greg; +Cc: linux-kernel, Pekka Enberg, Pavel Machek

This patch merges struct wb35_adapter to struct wbsoft_priv. Now we can finally
start passing a pointer to struct ieee80211_hw around where necessary.

Cc: Pavel Machek <pavel@suse.cz>
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
---
 drivers/staging/winbond/adapter.h    |   44 ---------------------
 drivers/staging/winbond/bss_f.h      |   70 +++++++++++++++++-----------------
 drivers/staging/winbond/core.h       |   38 +++++++++++++++++-
 drivers/staging/winbond/mds.c        |   16 ++++----
 drivers/staging/winbond/mds_f.h      |   36 +++++++++---------
 drivers/staging/winbond/mlmetxrx.c   |   12 +++---
 drivers/staging/winbond/mlmetxrx_f.h |   22 +++++-----
 drivers/staging/winbond/mto.h        |    2 +-
 drivers/staging/winbond/mto_f.h      |    8 ++--
 drivers/staging/winbond/rxisr.c      |    8 ++--
 drivers/staging/winbond/scan_s.h     |    6 +-
 drivers/staging/winbond/wb35tx.c     |   14 +++---
 drivers/staging/winbond/wb35tx_f.h   |   12 +++---
 drivers/staging/winbond/wbhal.c      |   10 ++--
 drivers/staging/winbond/wbhal_f.h    |   10 ++--
 drivers/staging/winbond/wblinux.c    |   10 ++--
 drivers/staging/winbond/wblinux_f.h  |   14 +++---
 drivers/staging/winbond/wbusb.c      |   55 +++++++++++----------------
 18 files changed, 183 insertions(+), 204 deletions(-)
 delete mode 100644 drivers/staging/winbond/adapter.h

diff --git a/drivers/staging/winbond/adapter.h b/drivers/staging/winbond/adapter.h
deleted file mode 100644
index 239cc3a..0000000
--- a/drivers/staging/winbond/adapter.h
+++ /dev/null
@@ -1,44 +0,0 @@
-#ifndef __WINBOND_ADAPTER_H
-#define __WINBOND_ADAPTER_H
-
-#include <linux/wireless.h>
-
-#include "bssdscpt.h"
-#include "mto.h"
-#include "wbhal_s.h"
-
-#define WBLINUX_PACKET_ARRAY_SIZE (ETHERNET_TX_DESCRIPTORS*4)
-
-#define WB_MAX_LINK_NAME_LEN 40
-
-struct wb35_adapter {
-	u32 adapterIndex;	// 20060703.4 Add for using padapterContext global adapter point
-
-	WB_LOCALDESCRIPT sLocalPara;	// Myself connected parameters
-	PWB_BSSDESCRIPTION asBSSDescriptElement;
-
-	MLME_FRAME sMlmeFrame;	// connect to peerSTA parameters
-
-	MTO_PARAMETERS sMtoPara;	// MTO_struct ...
-	hw_data_t sHwData;	//For HAL
-	MDS Mds;
-
-	spinlock_t SpinLock;
-	u32 shutdown;
-
-	atomic_t ThreadCount;
-
-	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[WB_MAX_LINK_NAME_LEN];
-};
-
-#endif
diff --git a/drivers/staging/winbond/bss_f.h b/drivers/staging/winbond/bss_f.h
index feffe5f..a433b5a 100644
--- a/drivers/staging/winbond/bss_f.h
+++ b/drivers/staging/winbond/bss_f.h
@@ -1,7 +1,7 @@
 #ifndef __WINBOND_BSS_F_H
 #define __WINBOND_BSS_F_H
 
-#include "adapter.h"
+#include "core.h"
 
 struct PMKID_Information_Element;
 
@@ -9,54 +9,54 @@ struct PMKID_Information_Element;
 // BSS descriptor DataBase management global function
 //
 
-void vBSSdescriptionInit(struct wb35_adapter * adapter);
-void vBSSfoundList(struct wb35_adapter * adapter);
-u8 boChanFilter(struct wb35_adapter * adapter, u8 ChanNo);
-u16 wBSSallocateEntry(struct wb35_adapter * adapter);
-u16 wBSSGetEntry(struct wb35_adapter * adapter);
-void vSimpleHouseKeeping(struct wb35_adapter * adapter);
-u16 wBSShouseKeeping(struct wb35_adapter * adapter);
-void ClearBSSdescpt(struct wb35_adapter * adapter, u16 i);
-u16 wBSSfindBssID(struct wb35_adapter * adapter, u8 *pbBssid);
-u16 wBSSfindDedicateCandidate(struct wb35_adapter * adapter, struct SSID_Element *psSsid, u8 *pbBssid);
-u16 wBSSfindMACaddr(struct wb35_adapter * adapter, u8 *pbMacAddr);
-u16 wBSSsearchMACaddr(struct wb35_adapter * adapter, u8 *pbMacAddr, u8 band);
-u16 wBSSaddScanData(struct wb35_adapter *, u16, psRXDATA);
-u16 wBSSUpdateScanData(struct wb35_adapter * adapter, u16 wBssIdx, psRXDATA psRcvData);
-u16 wBSScreateIBSSdata(struct wb35_adapter * adapter, PWB_BSSDESCRIPTION psDesData);
-void DesiredRate2BSSdescriptor(struct wb35_adapter * adapter, PWB_BSSDESCRIPTION psDesData,
+void vBSSdescriptionInit(struct wbsoft_priv * adapter);
+void vBSSfoundList(struct wbsoft_priv * adapter);
+u8 boChanFilter(struct wbsoft_priv * adapter, u8 ChanNo);
+u16 wBSSallocateEntry(struct wbsoft_priv * adapter);
+u16 wBSSGetEntry(struct wbsoft_priv * adapter);
+void vSimpleHouseKeeping(struct wbsoft_priv * adapter);
+u16 wBSShouseKeeping(struct wbsoft_priv * adapter);
+void ClearBSSdescpt(struct wbsoft_priv * adapter, u16 i);
+u16 wBSSfindBssID(struct wbsoft_priv * adapter, u8 *pbBssid);
+u16 wBSSfindDedicateCandidate(struct wbsoft_priv * adapter, struct SSID_Element *psSsid, u8 *pbBssid);
+u16 wBSSfindMACaddr(struct wbsoft_priv * adapter, u8 *pbMacAddr);
+u16 wBSSsearchMACaddr(struct wbsoft_priv * adapter, u8 *pbMacAddr, u8 band);
+u16 wBSSaddScanData(struct wbsoft_priv *, u16, psRXDATA);
+u16 wBSSUpdateScanData(struct wbsoft_priv * adapter, u16 wBssIdx, psRXDATA psRcvData);
+u16 wBSScreateIBSSdata(struct wbsoft_priv * adapter, PWB_BSSDESCRIPTION psDesData);
+void DesiredRate2BSSdescriptor(struct wbsoft_priv * adapter, PWB_BSSDESCRIPTION psDesData,
 							 u8 *pBasicRateSet, u8 BasicRateCount,
 							 u8 *pOperationRateSet, u8 OperationRateCount);
-void DesiredRate2InfoElement(struct wb35_adapter * adapter, u8	*addr, u16 *iFildOffset,
+void DesiredRate2InfoElement(struct wbsoft_priv * adapter, u8	*addr, u16 *iFildOffset,
 							 u8 *pBasicRateSet, u8 BasicRateCount,
 							 u8 *pOperationRateSet, u8 OperationRateCount);
-void BSSAddIBSSdata(struct wb35_adapter * adapter, PWB_BSSDESCRIPTION psDesData);
+void BSSAddIBSSdata(struct wbsoft_priv * adapter, PWB_BSSDESCRIPTION psDesData);
 unsigned char boCmpMacAddr( u8 *, u8 *);
 unsigned char boCmpSSID(struct SSID_Element *psSSID1, struct SSID_Element *psSSID2);
-u16 wBSSfindSSID(struct wb35_adapter * adapter, struct SSID_Element *psSsid);
-u16 wRoamingQuery(struct wb35_adapter * adapter);
-void vRateToBitmap(struct wb35_adapter * adapter, u16 index);
-u8 bRateToBitmapIndex(struct wb35_adapter * adapter, u8 bRate);
+u16 wBSSfindSSID(struct wbsoft_priv * adapter, struct SSID_Element *psSsid);
+u16 wRoamingQuery(struct wbsoft_priv * adapter);
+void vRateToBitmap(struct wbsoft_priv * adapter, u16 index);
+u8 bRateToBitmapIndex(struct wbsoft_priv * adapter, u8 bRate);
 u8 bBitmapToRate(u8 i);
-unsigned char boIsERPsta(struct wb35_adapter * adapter, u16 i);
-unsigned char boCheckConnect(struct wb35_adapter * adapter);
-unsigned char boCheckSignal(struct wb35_adapter * adapter);
-void AddIBSSIe(struct wb35_adapter * adapter,PWB_BSSDESCRIPTION psDesData );//added by ws for WPA_None06/01/04
-void BssScanUpToDate(struct wb35_adapter * adapter);
-void BssUpToDate(struct wb35_adapter * adapter);
+unsigned char boIsERPsta(struct wbsoft_priv * adapter, u16 i);
+unsigned char boCheckConnect(struct wbsoft_priv * adapter);
+unsigned char boCheckSignal(struct wbsoft_priv * adapter);
+void AddIBSSIe(struct wbsoft_priv * adapter,PWB_BSSDESCRIPTION psDesData );//added by ws for WPA_None06/01/04
+void BssScanUpToDate(struct wbsoft_priv * adapter);
+void BssUpToDate(struct wbsoft_priv * adapter);
 void RateSort(u8 *RateArray, u8 num, u8 mode);
-void RateReSortForSRate(struct wb35_adapter * adapter, u8 *RateArray, u8 num);
-void Assemble_IE(struct wb35_adapter * adapter, u16 wBssIdx);
-void SetMaxTxRate(struct wb35_adapter * adapter);
+void RateReSortForSRate(struct wbsoft_priv * adapter, u8 *RateArray, u8 num);
+void Assemble_IE(struct wbsoft_priv * adapter, u16 wBssIdx);
+void SetMaxTxRate(struct wbsoft_priv * adapter);
 
-void CreateWpaIE(struct wb35_adapter * adapter, u16* iFildOffset, u8 *msg, struct  Management_Frame* msgHeader,
+void CreateWpaIE(struct wbsoft_priv * adapter, u16* iFildOffset, u8 *msg, struct  Management_Frame* msgHeader,
 				 struct Association_Request_Frame_Body* msgBody, u16 iMSindex); //added by WS 05/14/05
 
 #ifdef _WPA2_
-void CreateRsnIE(struct wb35_adapter * adapter, u16* iFildOffset, u8 *msg, struct  Management_Frame* msgHeader,
+void CreateRsnIE(struct wbsoft_priv * adapter, u16* iFildOffset, u8 *msg, struct  Management_Frame* msgHeader,
 				 struct Association_Request_Frame_Body* msgBody, u16 iMSindex);//added by WS 05/14/05
 
-u16 SearchPmkid(struct wb35_adapter * adapter, struct  Management_Frame* msgHeader,
+u16 SearchPmkid(struct wbsoft_priv * adapter, struct  Management_Frame* msgHeader,
 				   struct PMKID_Information_Element * AssoReq_PMKID );
 #endif
 
diff --git a/drivers/staging/winbond/core.h b/drivers/staging/winbond/core.h
index 62ad954..64b73bb 100644
--- a/drivers/staging/winbond/core.h
+++ b/drivers/staging/winbond/core.h
@@ -1,10 +1,44 @@
 #ifndef __WINBOND_CORE_H
 #define __WINBOND_CORE_H
 
-#include "adapter.h"
+#include <linux/wireless.h>
+
+#include "bssdscpt.h"
+#include "mto.h"
+#include "wbhal_s.h"
+
+#define WBLINUX_PACKET_ARRAY_SIZE (ETHERNET_TX_DESCRIPTORS*4)
+
+#define WB_MAX_LINK_NAME_LEN 40
 
 struct wbsoft_priv {
-	struct wb35_adapter *adapter;
+	u32 adapterIndex;	// 20060703.4 Add for using padapterContext global adapter point
+
+	WB_LOCALDESCRIPT sLocalPara;	// Myself connected parameters
+	PWB_BSSDESCRIPTION asBSSDescriptElement;
+
+	MLME_FRAME sMlmeFrame;	// connect to peerSTA parameters
+
+	MTO_PARAMETERS sMtoPara;	// MTO_struct ...
+	hw_data_t sHwData;	//For HAL
+	MDS Mds;
+
+	spinlock_t SpinLock;
+	u32 shutdown;
+
+	atomic_t ThreadCount;
+
+	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[WB_MAX_LINK_NAME_LEN];
 };
 
 #endif /* __WINBOND_CORE_H */
diff --git a/drivers/staging/winbond/mds.c b/drivers/staging/winbond/mds.c
index af4fdf1..a4e7300 100644
--- a/drivers/staging/winbond/mds.c
+++ b/drivers/staging/winbond/mds.c
@@ -8,7 +8,7 @@
 #include "wblinux_f.h"
 
 void
-Mds_reset_descriptor(struct wb35_adapter * adapter)
+Mds_reset_descriptor(struct wbsoft_priv * adapter)
 {
 	PMDS pMds = &adapter->Mds;
 
@@ -21,7 +21,7 @@ Mds_reset_descriptor(struct wb35_adapter * adapter)
 }
 
 unsigned char
-Mds_initial(struct wb35_adapter * adapter)
+Mds_initial(struct wbsoft_priv * adapter)
 {
 	PMDS pMds = &adapter->Mds;
 
@@ -35,13 +35,13 @@ Mds_initial(struct wb35_adapter * adapter)
 }
 
 void
-Mds_Destroy(struct wb35_adapter * adapter)
+Mds_Destroy(struct wbsoft_priv * adapter)
 {
 	vRxTimerStop(adapter);
 }
 
 void
-Mds_Tx(struct wb35_adapter * adapter)
+Mds_Tx(struct wbsoft_priv * adapter)
 {
 	phw_data_t	pHwData = &adapter->sHwData;
 	PMDS		pMds = &adapter->Mds;
@@ -183,7 +183,7 @@ Mds_Tx(struct wb35_adapter * adapter)
 }
 
 void
-Mds_SendComplete(struct wb35_adapter * adapter, PT02_DESCRIPTOR pT02)
+Mds_SendComplete(struct wbsoft_priv * adapter, PT02_DESCRIPTOR pT02)
 {
 	PMDS	pMds = &adapter->Mds;
 	phw_data_t	pHwData = &adapter->sHwData;
@@ -236,7 +236,7 @@ Mds_SendComplete(struct wb35_adapter * adapter, PT02_DESCRIPTOR pT02)
 }
 
 void
-Mds_HeaderCopy(struct wb35_adapter * adapter, PDESCRIPTOR pDes, u8 *TargetBuffer)
+Mds_HeaderCopy(struct wbsoft_priv * adapter, PDESCRIPTOR pDes, u8 *TargetBuffer)
 {
 	PMDS	pMds = &adapter->Mds;
 	u8	*src_buffer = pDes->buffer_address[0];//931130.5.g
@@ -333,7 +333,7 @@ Mds_HeaderCopy(struct wb35_adapter * adapter, PDESCRIPTOR pDes, u8 *TargetBuffer
 
 // The function return the 4n size of usb pk
 u16
-Mds_BodyCopy(struct wb35_adapter * adapter, PDESCRIPTOR pDes, u8 *TargetBuffer)
+Mds_BodyCopy(struct wbsoft_priv * adapter, PDESCRIPTOR pDes, u8 *TargetBuffer)
 {
 	PT00_DESCRIPTOR	pT00;
 	PMDS	pMds = &adapter->Mds;
@@ -436,7 +436,7 @@ Mds_BodyCopy(struct wb35_adapter * adapter, PDESCRIPTOR pDes, u8 *TargetBuffer)
 
 
 void
-Mds_DurationSet(  struct wb35_adapter * adapter,  PDESCRIPTOR pDes,  u8 *buffer )
+Mds_DurationSet(  struct wbsoft_priv * adapter,  PDESCRIPTOR pDes,  u8 *buffer )
 {
 	PT00_DESCRIPTOR	pT00;
 	PT01_DESCRIPTOR	pT01;
diff --git a/drivers/staging/winbond/mds_f.h b/drivers/staging/winbond/mds_f.h
index 2e0f7a8..a3724ac 100644
--- a/drivers/staging/winbond/mds_f.h
+++ b/drivers/staging/winbond/mds_f.h
@@ -2,31 +2,31 @@
 #define __WINBOND_MDS_F_H
 
 #include "wbhal_s.h"
-#include "adapter.h"
+#include "core.h"
 
-unsigned char Mds_initial(  struct wb35_adapter *adapter );
-void Mds_Destroy(  struct wb35_adapter *adapter );
-void Mds_Tx(  struct wb35_adapter *adapter );
-void Mds_HeaderCopy(  struct wb35_adapter *adapter,  PDESCRIPTOR pDes,  u8 *TargetBuffer );
-u16 Mds_BodyCopy(  struct wb35_adapter *adapter,  PDESCRIPTOR pDes,  u8 *TargetBuffer );
-void Mds_DurationSet(  struct wb35_adapter *adapter,  PDESCRIPTOR pDes,  u8 *TargetBuffer );
-void Mds_SendComplete(  struct wb35_adapter *adapter,  PT02_DESCRIPTOR pT02 );
-void Mds_MpduProcess(  struct wb35_adapter *adapter,  PDESCRIPTOR pRxDes );
-void Mds_reset_descriptor(  struct wb35_adapter *adapter );
+unsigned char Mds_initial(  struct wbsoft_priv *adapter );
+void Mds_Destroy(  struct wbsoft_priv *adapter );
+void Mds_Tx(  struct wbsoft_priv *adapter );
+void Mds_HeaderCopy(  struct wbsoft_priv *adapter,  PDESCRIPTOR pDes,  u8 *TargetBuffer );
+u16 Mds_BodyCopy(  struct wbsoft_priv *adapter,  PDESCRIPTOR pDes,  u8 *TargetBuffer );
+void Mds_DurationSet(  struct wbsoft_priv *adapter,  PDESCRIPTOR pDes,  u8 *TargetBuffer );
+void Mds_SendComplete(  struct wbsoft_priv *adapter,  PT02_DESCRIPTOR pT02 );
+void Mds_MpduProcess(  struct wbsoft_priv *adapter,  PDESCRIPTOR pRxDes );
+void Mds_reset_descriptor(  struct wbsoft_priv *adapter );
 extern void DataDmp(u8 *pdata, u32 len, u32 offset);
 
 
-void vRxTimerInit(struct wb35_adapter *adapter);
-void vRxTimerStart(struct wb35_adapter *adapter, int timeout_value);
-void vRxTimerStop(struct wb35_adapter *adapter);
+void vRxTimerInit(struct wbsoft_priv *adapter);
+void vRxTimerStart(struct wbsoft_priv *adapter, int timeout_value);
+void vRxTimerStop(struct wbsoft_priv *adapter);
 
 // For Asynchronous indicating. The routine collocates with USB.
-void Mds_MsduProcess(  struct wb35_adapter *adapter,  PRXLAYER1 pRxLayer1,  u8 SlotIndex);
+void Mds_MsduProcess(  struct wbsoft_priv *adapter,  PRXLAYER1 pRxLayer1,  u8 SlotIndex);
 
 // For data frame sending 20060802
-u16 MDS_GetPacketSize(  struct wb35_adapter *adapter );
-void MDS_GetNextPacket(  struct wb35_adapter *adapter,  PDESCRIPTOR pDes );
-void MDS_GetNextPacketComplete(  struct wb35_adapter *adapter,  PDESCRIPTOR pDes );
-void MDS_SendResult(  struct wb35_adapter *adapter,  u8 PacketId,  unsigned char SendOK );
+u16 MDS_GetPacketSize(  struct wbsoft_priv *adapter );
+void MDS_GetNextPacket(  struct wbsoft_priv *adapter,  PDESCRIPTOR pDes );
+void MDS_GetNextPacketComplete(  struct wbsoft_priv *adapter,  PDESCRIPTOR pDes );
+void MDS_SendResult(  struct wbsoft_priv *adapter,  u8 PacketId,  unsigned char SendOK );
 
 #endif
diff --git a/drivers/staging/winbond/mlmetxrx.c b/drivers/staging/winbond/mlmetxrx.c
index 308309b..d83795f 100644
--- a/drivers/staging/winbond/mlmetxrx.c
+++ b/drivers/staging/winbond/mlmetxrx.c
@@ -19,7 +19,7 @@
 
 #include "mds_f.h"
 
-void MLMEResetTxRx(struct wb35_adapter * adapter)
+void MLMEResetTxRx(struct wbsoft_priv * adapter)
 {
 	s32     i;
 
@@ -55,7 +55,7 @@ void MLMEResetTxRx(struct wb35_adapter * adapter)
 //=============================================================================
 
 /* FIXME: Should this just be replaced with kmalloc() and kfree()? */
-u8 *MLMEGetMMPDUBuffer(struct wb35_adapter * adapter)
+u8 *MLMEGetMMPDUBuffer(struct wbsoft_priv * adapter)
 {
 	s32 i;
 	u8 *returnVal;
@@ -73,7 +73,7 @@ u8 *MLMEGetMMPDUBuffer(struct wb35_adapter * adapter)
 }
 
 //=============================================================================
-u8 MLMESendFrame(struct wb35_adapter * adapter, u8 *pMMPDU, u16 len, u8 DataType)
+u8 MLMESendFrame(struct wbsoft_priv * adapter, u8 *pMMPDU, u16 len, u8 DataType)
 /*	DataType : FRAME_TYPE_802_11_MANAGEMENT, FRAME_TYPE_802_11_MANAGEMENT_CHALLENGE,
 				FRAME_TYPE_802_11_DATA */
 {
@@ -98,7 +98,7 @@ u8 MLMESendFrame(struct wb35_adapter * adapter, u8 *pMMPDU, u16 len, u8 DataType
 	return true;
 }
 
-void MLME_GetNextPacket(struct wb35_adapter *adapter, PDESCRIPTOR desc)
+void MLME_GetNextPacket(struct wbsoft_priv *adapter, PDESCRIPTOR desc)
 {
 	desc->InternalUsed = desc->buffer_start_index + desc->buffer_number;
 	desc->InternalUsed %= MAX_DESCRIPTOR_BUFFER_INDEX;
@@ -109,7 +109,7 @@ void MLME_GetNextPacket(struct wb35_adapter *adapter, PDESCRIPTOR desc)
 	desc->Type = adapter->sMlmeFrame.DataType;
 }
 
-void MLMEfreeMMPDUBuffer(struct wb35_adapter * adapter, s8 *pData)
+void MLMEfreeMMPDUBuffer(struct wbsoft_priv * adapter, s8 *pData)
 {
 	int i;
 
@@ -127,7 +127,7 @@ void MLMEfreeMMPDUBuffer(struct wb35_adapter * adapter, s8 *pData)
 }
 
 void
-MLME_SendComplete(struct wb35_adapter * adapter, u8 PacketID, unsigned char SendOK)
+MLME_SendComplete(struct wbsoft_priv * adapter, u8 PacketID, unsigned char SendOK)
 {
 	MLME_TXCALLBACK	TxCallback;
 
diff --git a/drivers/staging/winbond/mlmetxrx_f.h b/drivers/staging/winbond/mlmetxrx_f.h
index 0f264ed..905c301 100644
--- a/drivers/staging/winbond/mlmetxrx_f.h
+++ b/drivers/staging/winbond/mlmetxrx_f.h
@@ -8,34 +8,34 @@
 #ifndef _MLMETXRX_H
 #define _MLMETXRX_H
 
-#include "adapter.h"
+#include "core.h"
 
 void
 MLMEProcThread(
-     struct wb35_adapter *    adapter
+     struct wbsoft_priv *    adapter
 	);
 
-void MLMEResetTxRx( struct wb35_adapter * adapter);
+void MLMEResetTxRx( struct wbsoft_priv * adapter);
 
 u8 *
 MLMEGetMMPDUBuffer(
-     struct wb35_adapter *    adapter
+     struct wbsoft_priv *    adapter
    );
 
-void MLMEfreeMMPDUBuffer( struct wb35_adapter * adapter,  s8 * pData);
+void MLMEfreeMMPDUBuffer( struct wbsoft_priv * adapter,  s8 * pData);
 
-void MLME_GetNextPacket(  struct wb35_adapter * adapter,  PDESCRIPTOR pDes );
-u8 MLMESendFrame( struct wb35_adapter * adapter,
+void MLME_GetNextPacket(  struct wbsoft_priv * adapter,  PDESCRIPTOR pDes );
+u8 MLMESendFrame( struct wbsoft_priv * adapter,
 					u8	*pMMPDU,
 					u16	len,
 					 u8	DataType);
 
 void
-MLME_SendComplete(  struct wb35_adapter * adapter,  u8 PacketID,  unsigned char SendOK );
+MLME_SendComplete(  struct wbsoft_priv * adapter,  u8 PacketID,  unsigned char SendOK );
 
 void
 MLMERcvFrame(
-     struct wb35_adapter *    adapter,
+     struct wbsoft_priv *    adapter,
      PRXBUFFER        pRxBufferArray,
      u8            NumOfBuffer,
      u8            ReturnSlotIndex
@@ -43,11 +43,11 @@ MLMERcvFrame(
 
 void
 MLMEReturnPacket(
-     struct wb35_adapter *    adapter,
+     struct wbsoft_priv *    adapter,
      u8 *          pRxBufer
    );
 #ifdef _IBSS_BEACON_SEQ_STICK_
-s8 SendBCNullData(struct wb35_adapter * adapter, u16 wIdx);
+s8 SendBCNullData(struct wbsoft_priv * adapter, u16 wIdx);
 #endif
 
 #endif
diff --git a/drivers/staging/winbond/mto.h b/drivers/staging/winbond/mto.h
index 9a17544..536c4f1 100644
--- a/drivers/staging/winbond/mto.h
+++ b/drivers/staging/winbond/mto.h
@@ -131,7 +131,7 @@ typedef struct _MTO_PARAMETERS
 } MTO_PARAMETERS, *PMTO_PARAMETERS;
 
 
-#define MTO_FUNC_INPUT              struct wb35_adapter *	adapter
+#define MTO_FUNC_INPUT              struct wbsoft_priv *	adapter
 #define MTO_FUNC_INPUT_DATA         adapter
 #define MTO_DATA()                  (adapter->sMtoPara)
 #define MTO_HAL()                   (&adapter->sHwData)
diff --git a/drivers/staging/winbond/mto_f.h b/drivers/staging/winbond/mto_f.h
index ce4319d..81f5913 100644
--- a/drivers/staging/winbond/mto_f.h
+++ b/drivers/staging/winbond/mto_f.h
@@ -1,11 +1,11 @@
 #ifndef __WINBOND_MTO_F_H
 #define __WINBOND_MTO_F_H
 
-#include "adapter.h"
+#include "core.h"
 
-extern void MTO_Init(struct wb35_adapter *);
-extern void MTO_PeriodicTimerExpired(struct wb35_adapter *);
-extern void MTO_SetDTORateRange(struct wb35_adapter *, u8 *, u8);
+extern void MTO_Init(struct wbsoft_priv *);
+extern void MTO_PeriodicTimerExpired(struct wbsoft_priv *);
+extern void MTO_SetDTORateRange(struct wbsoft_priv *, u8 *, u8);
 extern u8 MTO_GetTxRate(MTO_FUNC_INPUT, u32 fpdu_len);
 extern u8 MTO_GetTxFallbackRate(MTO_FUNC_INPUT);
 extern void MTO_SetTxCount(MTO_FUNC_INPUT, u8 t0, u8 index);
diff --git a/drivers/staging/winbond/rxisr.c b/drivers/staging/winbond/rxisr.c
index d48fed7..f4619d9 100644
--- a/drivers/staging/winbond/rxisr.c
+++ b/drivers/staging/winbond/rxisr.c
@@ -1,19 +1,19 @@
 #include "sysdef.h"
-#include "adapter.h"
+#include "core.h"
 
 static void RxTimerHandler(unsigned long data)
 {
 	WARN_ON(1);
 }
 
-void vRxTimerInit(struct wb35_adapter *adapter)
+void vRxTimerInit(struct wbsoft_priv *adapter)
 {
 	init_timer(&adapter->Mds.timer);
 	adapter->Mds.timer.function = RxTimerHandler;
 	adapter->Mds.timer.data = (unsigned long) adapter;
 }
 
-void vRxTimerStart(struct wb35_adapter *adapter, int timeout_value)
+void vRxTimerStart(struct wbsoft_priv *adapter, int timeout_value)
 {
 	if (timeout_value < MIN_TIMEOUT_VAL)
 		timeout_value = MIN_TIMEOUT_VAL;
@@ -22,7 +22,7 @@ void vRxTimerStart(struct wb35_adapter *adapter, int timeout_value)
 	add_timer(&adapter->Mds.timer);
 }
 
-void vRxTimerStop(struct wb35_adapter *adapter)
+void vRxTimerStop(struct wbsoft_priv *adapter)
 {
 	del_timer_sync(&adapter->Mds.timer);
 }
diff --git a/drivers/staging/winbond/scan_s.h b/drivers/staging/winbond/scan_s.h
index 7269546..775bb81 100644
--- a/drivers/staging/winbond/scan_s.h
+++ b/drivers/staging/winbond/scan_s.h
@@ -114,8 +114,8 @@ typedef struct _SCAN_PARAMETERS
 
 // static functions
 
-//static void ScanTimerHandler(struct wb35_adapter * adapter);
-//static void vScanTimerStart(struct wb35_adapter *	adapter, int timeout_value);
-//static void vScanTimerStop(struct wb35_adapter * adapter);
+//static void ScanTimerHandler(struct wbsoft_priv * adapter);
+//static void vScanTimerStart(struct wbsoft_priv *	adapter, int timeout_value);
+//static void vScanTimerStop(struct wbsoft_priv * adapter);
 
 #endif
diff --git a/drivers/staging/winbond/wb35tx.c b/drivers/staging/winbond/wb35tx.c
index ce7e981..32ee391 100644
--- a/drivers/staging/winbond/wb35tx.c
+++ b/drivers/staging/winbond/wb35tx.c
@@ -23,7 +23,7 @@ Wb35Tx_get_tx_buffer(phw_data_t pHwData, u8 **pBuffer)
 	return true;
 }
 
-void Wb35Tx_start(struct wb35_adapter *adapter)
+void Wb35Tx_start(struct wbsoft_priv *adapter)
 {
 	phw_data_t pHwData = &adapter->sHwData;
 	PWB35TX pWb35Tx = &pHwData->Wb35Tx;
@@ -37,7 +37,7 @@ void Wb35Tx_start(struct wb35_adapter *adapter)
 }
 
 
-void Wb35Tx(struct wb35_adapter *adapter)
+void Wb35Tx(struct wbsoft_priv *adapter)
 {
 	phw_data_t	pHwData = &adapter->sHwData;
 	PWB35TX		pWb35Tx = &pHwData->Wb35Tx;
@@ -91,7 +91,7 @@ void Wb35Tx(struct wb35_adapter *adapter)
 
 void Wb35Tx_complete(struct urb * pUrb)
 {
-	struct wb35_adapter *adapter = pUrb->context;
+	struct wbsoft_priv *adapter = pUrb->context;
 	phw_data_t	pHwData = &adapter->sHwData;
 	PWB35TX		pWb35Tx = &pHwData->Wb35Tx;
 	PMDS		pMds = &adapter->Mds;
@@ -194,7 +194,7 @@ void Wb35Tx_destroy(phw_data_t pHwData)
 	#endif
 }
 
-void Wb35Tx_CurrentTime(struct wb35_adapter *adapter, u32 TimeCount)
+void Wb35Tx_CurrentTime(struct wbsoft_priv *adapter, u32 TimeCount)
 {
 	phw_data_t pHwData = &adapter->sHwData;
 	PWB35TX pWb35Tx = &pHwData->Wb35Tx;
@@ -211,7 +211,7 @@ void Wb35Tx_CurrentTime(struct wb35_adapter *adapter, u32 TimeCount)
 	}
 }
 
-void Wb35Tx_EP2VM_start(struct wb35_adapter *adapter)
+void Wb35Tx_EP2VM_start(struct wbsoft_priv *adapter)
 {
 	phw_data_t pHwData = &adapter->sHwData;
 	PWB35TX pWb35Tx = &pHwData->Wb35Tx;
@@ -226,7 +226,7 @@ void Wb35Tx_EP2VM_start(struct wb35_adapter *adapter)
 }
 
 
-void Wb35Tx_EP2VM(struct wb35_adapter *adapter)
+void Wb35Tx_EP2VM(struct wbsoft_priv *adapter)
 {
 	phw_data_t	pHwData = &adapter->sHwData;
 	PWB35TX pWb35Tx = &pHwData->Wb35Tx;
@@ -265,7 +265,7 @@ error:
 
 void Wb35Tx_EP2VM_complete(struct urb * pUrb)
 {
-	struct wb35_adapter *adapter = pUrb->context;
+	struct wbsoft_priv *adapter = pUrb->context;
 	phw_data_t	pHwData = &adapter->sHwData;
 	T02_DESCRIPTOR	T02, TSTATUS;
 	PWB35TX		pWb35Tx = &pHwData->Wb35Tx;
diff --git a/drivers/staging/winbond/wb35tx_f.h b/drivers/staging/winbond/wb35tx_f.h
index 466eb6f..277faa7 100644
--- a/drivers/staging/winbond/wb35tx_f.h
+++ b/drivers/staging/winbond/wb35tx_f.h
@@ -1,7 +1,7 @@
 #ifndef __WINBOND_WB35TX_F_H
 #define __WINBOND_WB35TX_F_H
 
-#include "adapter.h"
+#include "core.h"
 #include "wbhal_f.h"
 
 //====================================
@@ -11,16 +11,16 @@ unsigned char Wb35Tx_initial(	 phw_data_t pHwData );
 void Wb35Tx_destroy(  phw_data_t pHwData );
 unsigned char Wb35Tx_get_tx_buffer(  phw_data_t pHwData,  u8 **pBuffer );
 
-void Wb35Tx_EP2VM(struct wb35_adapter *adapter);
-void Wb35Tx_EP2VM_start(struct wb35_adapter *adapter);
+void Wb35Tx_EP2VM(struct wbsoft_priv *adapter);
+void Wb35Tx_EP2VM_start(struct wbsoft_priv *adapter);
 void Wb35Tx_EP2VM_complete(struct urb *urb);
 
-void Wb35Tx_start(struct wb35_adapter *adapter);
+void Wb35Tx_start(struct wbsoft_priv *adapter);
 void Wb35Tx_stop(  phw_data_t pHwData );
-void Wb35Tx(struct wb35_adapter *adapter);
+void Wb35Tx(struct wbsoft_priv *adapter);
 void Wb35Tx_complete(struct urb *urb);
 void Wb35Tx_reset_descriptor(  phw_data_t pHwData );
 
-void Wb35Tx_CurrentTime(struct wb35_adapter *adapter,  u32 TimeCount);
+void Wb35Tx_CurrentTime(struct wbsoft_priv *adapter,  u32 TimeCount);
 
 #endif
diff --git a/drivers/staging/winbond/wbhal.c b/drivers/staging/winbond/wbhal.c
index a7d25a6..289ca7e 100644
--- a/drivers/staging/winbond/wbhal.c
+++ b/drivers/staging/winbond/wbhal.c
@@ -32,7 +32,7 @@ void hal_get_permanent_address( phw_data_t pHwData, u8 *pethernet_address )
 
 static void hal_led_control(unsigned long data)
 {
-	struct wb35_adapter *adapter = (struct wb35_adapter *) data;
+	struct wbsoft_priv *adapter = (struct wbsoft_priv *) data;
 	phw_data_t pHwData = &adapter->sHwData;
 	struct wb35_reg *reg = &pHwData->reg;
 	u32	LEDSet = (pHwData->SoftwareSet & HAL_LED_SET_MASK) >> HAL_LED_SET_SHIFT;
@@ -316,7 +316,7 @@ static void hal_led_control(unsigned long data)
 }
 
 
-u8 hal_init_hardware(phw_data_t pHwData, struct wb35_adapter * adapter)
+u8 hal_init_hardware(phw_data_t pHwData, struct wbsoft_priv * adapter)
 {
 	u16 SoftwareSet;
 
@@ -671,7 +671,7 @@ s32 hal_get_rssi(  phw_data_t pHwData,  u32 *HalRssiArry,  u8 Count )
 	return ltmp;
 }
 //----------------------------------------------------------------------------------------------------
-s32 hal_get_rssi_bss(struct wb35_adapter *adapter,  u16 idx,  u8 Count)
+s32 hal_get_rssi_bss(struct wbsoft_priv *adapter,  u16 idx,  u8 Count)
 {
 	phw_data_t pHwData = &adapter->sHwData;
 	struct wb35_reg *reg = &pHwData->reg;
@@ -841,7 +841,7 @@ void hal_system_power_change(phw_data_t pHwData, u32 PowerState)
 	}
 }
 
-void hal_surprise_remove(struct wb35_adapter *adapter)
+void hal_surprise_remove(struct wbsoft_priv *adapter)
 {
 	phw_data_t pHwData = &adapter->sHwData;
 
@@ -853,7 +853,7 @@ void hal_surprise_remove(struct wb35_adapter *adapter)
 	}
 }
 
-void hal_rate_change(struct wb35_adapter *adapter) // Notify the HAL rate is changing 20060613.1
+void hal_rate_change(struct wbsoft_priv *adapter) // Notify the HAL rate is changing 20060613.1
 {
 	phw_data_t pHwData = &adapter->sHwData;
 	u8		rate = CURRENT_TX_RATE;
diff --git a/drivers/staging/winbond/wbhal_f.h b/drivers/staging/winbond/wbhal_f.h
index 4cb4da0..e7a1d61 100644
--- a/drivers/staging/winbond/wbhal_f.h
+++ b/drivers/staging/winbond/wbhal_f.h
@@ -5,7 +5,7 @@
 #include "wb35tx_f.h"
 #include "wb35rx_f.h"
 
-#include "adapter.h"
+#include "core.h"
 
 //====================================================================================
 // Function declaration
@@ -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_set_ethernet_address(  phw_data_t pHwData,  u8 *current_address );
 void hal_get_permanent_address(  phw_data_t pHwData,  u8 *pethernet_address );
-unsigned char hal_init_hardware(  phw_data_t pHwData,  struct wb35_adapter * adapter );
+unsigned char hal_init_hardware(  phw_data_t pHwData,  struct wbsoft_priv * adapter );
 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_set_slot_time(  phw_data_t pHwData,  u8 type );
@@ -61,7 +61,7 @@ void hal_set_cwmax(  phw_data_t pHwData,  u16 cwin_max );
 void hal_set_rsn_wpa(  phw_data_t pHwData,  u32 * RSN_IE_Bitmap , u32 * RSN_OUI_type , unsigned char bDesiredAuthMode);
 //s32 hal_get_rssi(  phw_data_t pHwData,  u32 HalRssi );
 s32 hal_get_rssi(  phw_data_t pHwData,  u32 *HalRssiArry,  u8 Count );
-s32 hal_get_rssi_bss(struct wb35_adapter *adapter,  u16 idx,  u8 Count);
+s32 hal_get_rssi_bss(struct wbsoft_priv *adapter,  u16 idx,  u8 Count);
 void hal_set_connect_info(  phw_data_t pHwData,  unsigned char boConnect );
 u8 hal_get_est_sq3(  phw_data_t pHwData,  u8 Count );
 void hal_set_rf_power(  phw_data_t pHwData,  u8 PowerIndex ); // 20060621 Modify
@@ -82,13 +82,13 @@ u8 hal_get_hw_radio_off			(  phw_data_t pHwData );
 #define hal_scan_interval( _A )		(_A->Scan_Interval)
 void hal_scan_status_indicate(  phw_data_t pHwData, u8 status);	// 0: complete, 1: in progress
 void hal_system_power_change(  phw_data_t pHwData, u32 PowerState ); // 20051230 -=D0 1=D1 ..
-void hal_surprise_remove(struct wb35_adapter *adapter);
+void hal_surprise_remove(struct wbsoft_priv *adapter);
 
 #define PHY_DEBUG( msg, args... )
 
 
 
-void hal_rate_change(struct wb35_adapter *adapter); // Notify the HAL rate is changing 20060613.1
+void hal_rate_change(struct wbsoft_priv *adapter); // Notify the HAL rate is changing 20060613.1
 unsigned char hal_get_dxx_reg(  phw_data_t pHwData,  u16 number,  u32 * pValue );
 unsigned char hal_set_dxx_reg(  phw_data_t pHwData,  u16 number,  u32 value );
 #define hal_get_time_count( _P )	(_P->time_count/10)	// return 100ms count
diff --git a/drivers/staging/winbond/wblinux.c b/drivers/staging/winbond/wblinux.c
index 5d3acc8..3b02aae 100644
--- a/drivers/staging/winbond/wblinux.c
+++ b/drivers/staging/winbond/wblinux.c
@@ -17,14 +17,14 @@
 #include "wblinux_f.h"
 
 unsigned char
-WBLINUX_Initial(struct wb35_adapter * adapter)
+WBLINUX_Initial(struct wbsoft_priv * adapter)
 {
 	spin_lock_init( &adapter->SpinLock );
 	return true;
 }
 
 void
-WBLINUX_Destroy(struct wb35_adapter * adapter)
+WBLINUX_Destroy(struct wbsoft_priv * adapter)
 {
 	WBLINUX_stop( adapter );
 #ifdef _PE_USB_INI_DUMP_
@@ -33,7 +33,7 @@ WBLINUX_Destroy(struct wb35_adapter * adapter)
 }
 
 void
-WBLINUX_stop(  struct wb35_adapter * adapter )
+WBLINUX_stop(  struct wbsoft_priv * adapter )
 {
 	struct sk_buff *pSkb;
 
@@ -63,7 +63,7 @@ WBLINUX_stop(  struct wb35_adapter * adapter )
 }
 
 void
-WbWlanHalt(  struct wb35_adapter * adapter )
+WbWlanHalt(  struct wbsoft_priv * adapter )
 {
 	//---------------------
 	adapter->sLocalPara.ShutDowned = true;
@@ -85,7 +85,7 @@ WbWlanHalt(  struct wb35_adapter * adapter )
 }
 
 unsigned char
-WbWLanInitialize(struct wb35_adapter * adapter)
+WbWLanInitialize(struct wbsoft_priv * adapter)
 {
 	phw_data_t	pHwData;
 	u8		*pMacAddr;
diff --git a/drivers/staging/winbond/wblinux_f.h b/drivers/staging/winbond/wblinux_f.h
index ed2676b..4b786fc 100644
--- a/drivers/staging/winbond/wblinux_f.h
+++ b/drivers/staging/winbond/wblinux_f.h
@@ -1,7 +1,7 @@
 #ifndef __WBLINUX_F_H
 #define __WBLINUX_F_H
 
-#include "adapter.h"
+#include "core.h"
 #include "mds_s.h"
 
 //=========================================================================
@@ -9,14 +9,14 @@
 //
 // wblinux_f.h
 //
-unsigned char WBLINUX_Initial(  struct wb35_adapter *adapter );
+unsigned char WBLINUX_Initial(  struct wbsoft_priv *adapter );
 int wb35_start_xmit(struct sk_buff *skb, struct net_device *netdev );
-void WBLINUX_stop(  struct wb35_adapter *adapter );
-void WBLINUX_Destroy(  struct wb35_adapter *adapter );
+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 wb35_adapter *adapter );
-void WbWlanHalt(  struct wb35_adapter *adapter );
-unsigned char WbWLanInitialize(struct wb35_adapter *adapter);
+void WBLINUX_stop(  struct wbsoft_priv *adapter );
+void WbWlanHalt(  struct wbsoft_priv *adapter );
+unsigned char WbWLanInitialize(struct wbsoft_priv *adapter);
 
 #endif
diff --git a/drivers/staging/winbond/wbusb.c b/drivers/staging/winbond/wbusb.c
index d8fa9e5..a6bc78e 100644
--- a/drivers/staging/winbond/wbusb.c
+++ b/drivers/staging/winbond/wbusb.c
@@ -120,7 +120,7 @@ static int wbsoft_tx(struct ieee80211_hw *dev, struct sk_buff *skb)
 {
 	struct wbsoft_priv *priv = dev->priv;
 
-	MLMESendFrame(priv->adapter, skb->data, skb->len, FRAME_TYPE_802_11_MANAGEMENT);
+	MLMESendFrame(priv, skb->data, skb->len, FRAME_TYPE_802_11_MANAGEMENT);
 
 	return NETDEV_TX_OK;
 }
@@ -144,20 +144,20 @@ static int wbsoft_config(struct ieee80211_hw *dev, struct ieee80211_conf *conf)
 	ch.ChanNo = 1;	/* Should use channel_num, or something, as that is already pre-translated */
 
 
-	hal_set_current_channel(&priv->adapter->sHwData, ch);
-	hal_set_beacon_period(&priv->adapter->sHwData, conf->beacon_int);
-//	hal_set_cap_info(&priv->adapter->sHwData, ?? );
+	hal_set_current_channel(&priv->sHwData, ch);
+	hal_set_beacon_period(&priv->sHwData, conf->beacon_int);
+//	hal_set_cap_info(&priv->sHwData, ?? );
 // hal_set_ssid(phw_data_t pHwData,  u8 * pssid,  u8 ssid_len); ??
-	hal_set_accept_broadcast(&priv->adapter->sHwData, 1);
-	hal_set_accept_promiscuous(&priv->adapter->sHwData,  1);
-	hal_set_accept_multicast(&priv->adapter->sHwData,  1);
-	hal_set_accept_beacon(&priv->adapter->sHwData,  1);
-	hal_set_radio_mode(&priv->adapter->sHwData,  0);
+	hal_set_accept_broadcast(&priv->sHwData, 1);
+	hal_set_accept_promiscuous(&priv->sHwData,  1);
+	hal_set_accept_multicast(&priv->sHwData,  1);
+	hal_set_accept_beacon(&priv->sHwData,  1);
+	hal_set_radio_mode(&priv->sHwData,  0);
 	//hal_set_antenna_number(  phw_data_t pHwData, u8 number )
 	//hal_set_rf_power(phw_data_t pHwData, u8 PowerIndex)
 
 
-//	hal_start_bss(&priv->adapter->sHwData, WLAN_BSSTYPE_INFRASTRUCTURE);	??
+//	hal_start_bss(&priv->sHwData, WLAN_BSSTYPE_INFRASTRUCTURE);	??
 
 //void hal_set_rates(phw_data_t pHwData, u8 * pbss_rates,
 //		   u8 length, unsigned char basic_rate_set)
@@ -196,7 +196,6 @@ static const struct ieee80211_ops wbsoft_ops = {
 
 static int wb35_probe(struct usb_interface *intf, const struct usb_device_id *id_table)
 {
-	struct wb35_adapter *adapter;
 	PWBUSB		pWbUsb;
         struct usb_host_interface *interface;
 	struct usb_endpoint_descriptor *endpoint;
@@ -221,13 +220,14 @@ static int wb35_probe(struct usb_interface *intf, const struct usb_device_id *id
 		goto error;
 	}
 
-	adapter = kzalloc(sizeof(*adapter), GFP_KERNEL);
-	if (!adapter) {
-		err = -ENOMEM;
+	dev = ieee80211_alloc_hw(sizeof(*priv), &wbsoft_ops);
+	if (!dev)
 		goto error;
-	}
 
-	pWbUsb = &adapter->sHwData.WbUsb;
+	priv = dev->priv;
+	my_dev = dev;
+
+	pWbUsb = &priv->sHwData.WbUsb;
 	pWbUsb->udev = udev;
 
         interface = intf->cur_altsetting;
@@ -238,23 +238,14 @@ static int wb35_probe(struct usb_interface *intf, const struct usb_device_id *id
 		pWbUsb->IsUsb20 = 1;
 	}
 
-	if (!WbWLanInitialize(adapter)) {
+	if (!WbWLanInitialize(priv)) {
 		err = -EINVAL;
-		goto error_free_adapter;
+		goto error_free_hw;
 	}
 
-	dev = ieee80211_alloc_hw(sizeof(*priv), &wbsoft_ops);
-	if (!dev)
-		goto error_free_adapter;
-
-	priv = dev->priv;
-	priv->adapter = adapter;
-
-	my_dev = dev;
-
 	SET_IEEE80211_DEV(dev, &udev->dev);
 	{
-		phw_data_t pHwData = &adapter->sHwData;
+		phw_data_t pHwData = &priv->sHwData;
 		unsigned char		dev_addr[MAX_ADDR_LEN];
 		hal_get_permanent_address(pHwData, dev_addr);
 		SET_IEEE80211_PERM_ADDR(dev, dev_addr);
@@ -272,14 +263,12 @@ static int wb35_probe(struct usb_interface *intf, const struct usb_device_id *id
 	if (err)
 		goto error_free_hw;
 
-	usb_set_intfdata(intf, adapter);
+	usb_set_intfdata(intf, priv);
 
 	return 0;
 
 error_free_hw:
 	ieee80211_free_hw(dev);
-error_free_adapter:
-	kfree(adapter);
 error:
 	usb_put_dev(udev);
 	return err;
@@ -315,9 +304,9 @@ void packet_came(char *pRxBufferAddress, int PacketSize)
 
 static void wb35_disconnect(struct usb_interface *intf)
 {
-	struct wb35_adapter *adapter = usb_get_intfdata(intf);
+	struct wbsoft_priv *priv = usb_get_intfdata(intf);
 
-	WbWlanHalt(adapter);
+	WbWlanHalt(priv);
 
 	usb_set_intfdata(intf, NULL);
 	usb_put_dev(interface_to_usbdev(intf));
-- 
1.5.3.7


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH] w35und: remove global struct ieee80211_hw
  2008-10-30 14:14     ` [PATCH] w35und: merge struct wb35_adapter to struct wbsoft_priv Pekka Enberg
@ 2008-10-30 14:14       ` Pekka Enberg
  2008-10-30 19:12         ` Pavel Machek
  2008-10-30 19:11       ` [PATCH] w35und: merge struct wb35_adapter to struct wbsoft_priv Pavel Machek
  1 sibling, 1 reply; 9+ messages in thread
From: Pekka Enberg @ 2008-10-30 14:14 UTC (permalink / raw)
  To: greg; +Cc: linux-kernel, Pekka Enberg, Pavel Machek

Remove the my_dev global variable from wbusb.c by passing a pointer to struct
ieee80211_hw around so that packet_came() gets it.

Cc: Pavel Machek <pavel@suse.cz>
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
---
 drivers/staging/winbond/wb35rx.c    |   29 +++++++++-----
 drivers/staging/winbond/wb35rx_f.h  |    7 ++-
 drivers/staging/winbond/wbhal.c     |   11 +++--
 drivers/staging/winbond/wbhal_f.h   |    2 +-
 drivers/staging/winbond/wblinux.c   |   73 ++++++++++++++++++-----------------
 drivers/staging/winbond/wblinux_f.h |    3 +-
 drivers/staging/winbond/wbusb.c     |    8 +--
 7 files changed, 72 insertions(+), 61 deletions(-)

diff --git a/drivers/staging/winbond/wb35rx.c b/drivers/staging/winbond/wb35rx.c
index 15a0650..cd5a8e1 100644
--- a/drivers/staging/winbond/wb35rx.c
+++ b/drivers/staging/winbond/wb35rx.c
@@ -10,24 +10,29 @@
 //============================================================================
 #include <linux/usb.h>
 
+#include "core.h"
 #include "sysdef.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;
 
 	// Allow only one thread to run into the Wb35Rx() function
 	if (atomic_inc_return(&pWb35Rx->RxFireCounter) == 1) {
 		pWb35Rx->EP3vm_state = VM_RUNNING;
-		Wb35Rx(pHwData);
+		Wb35Rx(hw);
 	} else
 		atomic_dec(&pWb35Rx->RxFireCounter);
 }
 
 // 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;
 	u8 *	pRxBufferAddress;
 	struct urb *urb = pWb35Rx->RxUrb;
@@ -69,7 +74,7 @@ void Wb35Rx(  phw_data_t pHwData )
 	usb_fill_bulk_urb(urb, pHwData->WbUsb.udev,
 			  usb_rcvbulkpipe(pHwData->WbUsb.udev, 3),
 			  pRxBufferAddress, MAX_USB_RX_BUFFER,
-			  Wb35Rx_Complete, pHwData);
+			  Wb35Rx_Complete, hw);
 
 	pWb35Rx->EP3vm_state = VM_RUNNING;
 
@@ -89,7 +94,9 @@ error:
 
 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;
 	u8 *		pRxBufferAddress;
 	u32		SizeCheck;
@@ -150,11 +157,11 @@ void Wb35Rx_Complete(struct urb *urb)
 	pWb35Rx->RxBufferSize[ RxBufferId ] = BulkLength;
 
 	if (!pWb35Rx->RxOwner[ RxBufferId ])
-		Wb35Rx_indicate(pHwData);
+		Wb35Rx_indicate(hw);
 
 	kfree(pWb35Rx->pDRx);
 	// Do the next receive
-	Wb35Rx(pHwData);
+	Wb35Rx(hw);
 	return;
 
 error:
@@ -257,11 +264,13 @@ void Wb35Rx_adjust(PDESCRIPTOR pRxDes)
 	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;
 	PWB35RX	pWb35Rx = &pHwData->Wb35Rx;
 	u8 *		pRxBufferAddress;
@@ -317,7 +326,7 @@ u16 Wb35Rx_indicate(phw_data_t pHwData)
 			RxDes.buffer_total_size = RxDes.buffer_size[0];
 			Wb35Rx_adjust(&RxDes);
 
-			packet_came(pRxBufferAddress, PacketSize);
+			packet_came(hw, pRxBufferAddress, PacketSize);
 
 			// Move RxBuffer point to the next
 			stmp = PacketSize + 3;
diff --git a/drivers/staging/winbond/wb35rx_f.h b/drivers/staging/winbond/wb35rx_f.h
index 9fb2e2a..5585b55 100644
--- a/drivers/staging/winbond/wb35rx_f.h
+++ b/drivers/staging/winbond/wb35rx_f.h
@@ -1,6 +1,7 @@
 #ifndef __WINBOND_WB35RX_F_H
 #define __WINBOND_WB35RX_F_H
 
+#include <net/mac80211.h>
 #include "wbhal_s.h"
 
 //====================================
@@ -10,11 +11,11 @@ void		Wb35Rx_reset_descriptor(  phw_data_t pHwData );
 unsigned char		Wb35Rx_initial(  phw_data_t pHwData );
 void		Wb35Rx_destroy(  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_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);
 
 #endif
diff --git a/drivers/staging/winbond/wbhal.c b/drivers/staging/winbond/wbhal.c
index 289ca7e..d2be5fb 100644
--- a/drivers/staging/winbond/wbhal.c
+++ b/drivers/staging/winbond/wbhal.c
@@ -315,9 +315,10 @@ static void hal_led_control(unsigned long data)
 	add_timer(&pHwData->LEDTimer);
 }
 
-
-u8 hal_init_hardware(phw_data_t pHwData, struct wbsoft_priv * adapter)
+u8 hal_init_hardware(struct ieee80211_hw *hw)
 {
+	struct wbsoft_priv *priv = hw->priv;
+	phw_data_t pHwData = &priv->sHwData;
 	u16 SoftwareSet;
 
 	// Initial the variable
@@ -333,7 +334,7 @@ u8 hal_init_hardware(phw_data_t pHwData, struct wbsoft_priv * adapter)
 				pHwData->InitialResource = 4;
 				init_timer(&pHwData->LEDTimer);
 				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);
 				add_timer(&pHwData->LEDTimer);
 
@@ -349,8 +350,8 @@ u8 hal_init_hardware(phw_data_t pHwData, struct wbsoft_priv * adapter)
 					return false;
 				#endif
 
-				Wb35Rx_start( pHwData );
-				Wb35Tx_EP2VM_start(adapter);
+				Wb35Rx_start(hw);
+				Wb35Tx_EP2VM_start(priv);
 
 				return true;
 			}
diff --git a/drivers/staging/winbond/wbhal_f.h b/drivers/staging/winbond/wbhal_f.h
index e7a1d61..dc5709f 100644
--- a/drivers/staging/winbond/wbhal_f.h
+++ b/drivers/staging/winbond/wbhal_f.h
@@ -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_set_ethernet_address(  phw_data_t pHwData,  u8 *current_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_get_power_save_mode(  phw_data_t pHwData,   u8 *pin_pwr_save );
 void hal_set_slot_time(  phw_data_t pHwData,  u8 type );
diff --git a/drivers/staging/winbond/wblinux.c b/drivers/staging/winbond/wblinux.c
index 3b02aae..31f2d20 100644
--- a/drivers/staging/winbond/wblinux.c
+++ b/drivers/staging/winbond/wblinux.c
@@ -85,8 +85,9 @@ WbWlanHalt(  struct wbsoft_priv * adapter )
 }
 
 unsigned char
-WbWLanInitialize(struct wbsoft_priv * adapter)
+WbWLanInitialize(struct ieee80211_hw *hw)
 {
+	struct wbsoft_priv *priv = hw->priv;
 	phw_data_t	pHwData;
 	u8		*pMacAddr;
 	u8		*pMacAddr2;
@@ -97,22 +98,22 @@ WbWLanInitialize(struct wbsoft_priv * adapter)
 	//
 	// Setting default value for Linux
 	//
-	adapter->sLocalPara.region_INF = REGION_AUTO;
-	adapter->sLocalPara.TxRateMode = RATE_AUTO;
-	psLOCAL->bMacOperationMode = MODE_802_11_BG;	// B/G mode
-	adapter->Mds.TxRTSThreshold = DEFAULT_RTSThreshold;
-	adapter->Mds.TxFragmentThreshold = DEFAULT_FRAGMENT_THRESHOLD;
-	hal_set_phy_type( &adapter->sHwData, RF_WB_242_1 );
-	adapter->sLocalPara.MTUsize = MAX_ETHERNET_PACKET_SIZE;
-	psLOCAL->bPreambleMode = AUTO_MODE;
-	adapter->sLocalPara.RadioOffStatus.boSwRadioOff = false;
-	pHwData = &adapter->sHwData;
+	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(adapter)) {
+	if (!WBLINUX_Initial(priv)) {
 #ifdef _PE_USB_INI_DUMP_
 		WBDEBUG(("[w35und]WBNDIS initialization failed\n"));
 #endif
@@ -120,33 +121,33 @@ WbWLanInitialize(struct wbsoft_priv * adapter)
 	}
 
 	// Initial Software variable
-	adapter->sLocalPara.ShutDowned = false;
+	priv->sLocalPara.ShutDowned = false;
 
 	//added by ws for wep key error detection
-	adapter->sLocalPara.bWepKeyError= false;
-	adapter->sLocalPara.bToSelfPacketReceived = false;
-	adapter->sLocalPara.WepKeyDetectTimerCount= 2 * 100; /// 2 seconds
+	priv->sLocalPara.bWepKeyError= false;
+	priv->sLocalPara.bToSelfPacketReceived = false;
+	priv->sLocalPara.WepKeyDetectTimerCount= 2 * 100; /// 2 seconds
 
 	// Initial USB hal
 	InitStep = 1;
-	pHwData = &adapter->sHwData;
-	if (!hal_init_hardware(pHwData, adapter))
+	pHwData = &priv->sHwData;
+	if (!hal_init_hardware(hw))
 		goto error;
 
 	EEPROM_region = hal_get_region_from_EEPROM( pHwData );
 	if (EEPROM_region != REGION_AUTO)
-		psLOCAL->region = EEPROM_region;
+		priv->sLocalPara.region = EEPROM_region;
 	else {
-		if (psLOCAL->region_INF != REGION_AUTO)
-			psLOCAL->region = psLOCAL->region_INF;
+		if (priv->sLocalPara.region_INF != REGION_AUTO)
+			priv->sLocalPara.region = priv->sLocalPara.region_INF;
 		else
-			psLOCAL->region = REGION_USA;	//default setting
+			priv->sLocalPara.region = REGION_USA;	//default setting
 	}
 
 	// Get Software setting flag from hal
-	adapter->sLocalPara.boAntennaDiversity = false;
+	priv->sLocalPara.boAntennaDiversity = false;
 	if (hal_software_set(pHwData) & 0x00000001)
-		adapter->sLocalPara.boAntennaDiversity = true;
+		priv->sLocalPara.boAntennaDiversity = true;
 
 	//
 	// For TS module
@@ -155,7 +156,7 @@ WbWLanInitialize(struct wbsoft_priv * adapter)
 
 	// For MDS module
 	InitStep = 3;
-	Mds_initial(adapter);
+	Mds_initial(priv);
 
 	//=======================================
 	// Initialize the SME, SCAN, MLME, ROAM
@@ -165,18 +166,18 @@ WbWLanInitialize(struct wbsoft_priv * adapter)
 	InitStep = 6;
 
 	// If no user-defined address in the registry, use the addresss "burned" on the NIC instead.
-	pMacAddr = adapter->sLocalPara.ThisMacAddress;
-	pMacAddr2 = adapter->sLocalPara.PermanentAddress;
-	hal_get_permanent_address( pHwData, adapter->sLocalPara.PermanentAddress );// Reading ethernet address from EEPROM
+	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, adapter->sLocalPara.ThisMacAddress);
+		hal_set_ethernet_address(pHwData, priv->sLocalPara.ThisMacAddress);
 	}
 
 	//get current antenna
-	psLOCAL->bAntennaNo = hal_get_antenna_number(pHwData);
+	priv->sLocalPara.bAntennaNo = hal_get_antenna_number(pHwData);
 #ifdef _PE_STATE_DUMP_
 	WBDEBUG(("Driver init, antenna no = %d\n", psLOCAL->bAntennaNo));
 #endif
@@ -186,25 +187,25 @@ WbWLanInitialize(struct wbsoft_priv * adapter)
 	while (!hal_idle(pHwData))
 		msleep(10);
 
-	MTO_Init(adapter);
+	MTO_Init(priv);
 
 	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.
 	//set a tx power for reference.....
-//	sme_set_tx_power_level(adapter, 12);	FIXME?
+//	sme_set_tx_power_level(priv, 12);	FIXME?
 	return true;
 
 error:
 	switch (InitStep) {
 	case 5:
 	case 4:
-	case 3: Mds_Destroy( adapter );
+	case 3: Mds_Destroy( priv );
 	case 2:
-	case 1: WBLINUX_Destroy( adapter );
+	case 1: WBLINUX_Destroy( priv );
 		hal_halt( pHwData, NULL );
 	case 0: break;
 	}
diff --git a/drivers/staging/winbond/wblinux_f.h b/drivers/staging/winbond/wblinux_f.h
index 4b786fc..15e6a65 100644
--- a/drivers/staging/winbond/wblinux_f.h
+++ b/drivers/staging/winbond/wblinux_f.h
@@ -17,6 +17,7 @@ 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 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 a6bc78e..40bb77c 100644
--- a/drivers/staging/winbond/wbusb.c
+++ b/drivers/staging/winbond/wbusb.c
@@ -45,7 +45,6 @@ static struct ieee80211_supported_band wbsoft_band_2GHz = {
 };
 
 int wbsoft_enabled;
-struct ieee80211_hw *my_dev;
 
 static int wbsoft_add_interface(struct ieee80211_hw *dev,
 				 struct ieee80211_if_init_conf *conf)
@@ -225,7 +224,6 @@ static int wb35_probe(struct usb_interface *intf, const struct usb_device_id *id
 		goto error;
 
 	priv = dev->priv;
-	my_dev = dev;
 
 	pWbUsb = &priv->sHwData.WbUsb;
 	pWbUsb->udev = udev;
@@ -238,7 +236,7 @@ static int wb35_probe(struct usb_interface *intf, const struct usb_device_id *id
 		pWbUsb->IsUsb20 = 1;
 	}
 
-	if (!WbWLanInitialize(priv)) {
+	if (!WbWLanInitialize(dev)) {
 		err = -EINVAL;
 		goto error_free_hw;
 	}
@@ -274,7 +272,7 @@ error:
 	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 ieee80211_rx_status rx_status = {0};
@@ -299,7 +297,7 @@ void packet_came(char *pRxBufferAddress, int PacketSize)
 	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)
-- 
1.5.3.7


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] w35und: remove ->adapter from struct _HW_DATA_T
  2008-10-30 14:14 ` [PATCH] w35und: remove ->adapter from struct _HW_DATA_T Pekka Enberg
  2008-10-30 14:14   ` [PATCH] w35und: clean up adapter.h a bit Pekka Enberg
@ 2008-10-30 19:09   ` Pavel Machek
  1 sibling, 0 replies; 9+ messages in thread
From: Pavel Machek @ 2008-10-30 19:09 UTC (permalink / raw)
  To: Pekka Enberg; +Cc: greg, linux-kernel

On Thu 2008-10-30 16:14:36, Pekka Enberg wrote:
> Eventually we want to pass a pointer to struct ieee80211_hw around in the
> driver, so remove the bidirectional link between struct wb35_adapter and struct
> _HW_DATA_T to simplify the code.

Acked-by: Pavel Machek <pavel@suse.cz>

> Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
> ---
>  drivers/staging/winbond/mds.c      |    2 +-
>  drivers/staging/winbond/wb35tx.c   |   38 +++++++++++++++++++----------------
>  drivers/staging/winbond/wb35tx_f.h |   11 +++++----
>  drivers/staging/winbond/wbhal.c    |   24 +++++++++++-----------
>  drivers/staging/winbond/wbhal_f.h  |    6 ++--
>  drivers/staging/winbond/wbhal_s.h  |   10 ---------
>  6 files changed, 43 insertions(+), 48 deletions(-)
> 
> diff --git a/drivers/staging/winbond/mds.c b/drivers/staging/winbond/mds.c
> index a23b74e..af4fdf1 100644
> --- a/drivers/staging/winbond/mds.c
> +++ b/drivers/staging/winbond/mds.c
> @@ -176,7 +176,7 @@ Mds_Tx(struct wb35_adapter * adapter)
>  	// Start to send by lower module
>  	//
>  	if (!pHwData->IsKeyPreSet)
> -		Wb35Tx_start(pHwData);
> +		Wb35Tx_start(adapter);
>  
>   cleanup:
>  	atomic_dec(&pMds->TxThreadCount);
> diff --git a/drivers/staging/winbond/wb35tx.c b/drivers/staging/winbond/wb35tx.c
> index af4a61f..ce7e981 100644
> --- a/drivers/staging/winbond/wb35tx.c
> +++ b/drivers/staging/winbond/wb35tx.c
> @@ -23,23 +23,24 @@ Wb35Tx_get_tx_buffer(phw_data_t pHwData, u8 **pBuffer)
>  	return true;
>  }
>  
> -void Wb35Tx_start(phw_data_t pHwData)
> +void Wb35Tx_start(struct wb35_adapter *adapter)
>  {
> +	phw_data_t pHwData = &adapter->sHwData;
>  	PWB35TX pWb35Tx = &pHwData->Wb35Tx;
>  
>  	// Allow only one thread to run into function
>  	if (atomic_inc_return(&pWb35Tx->TxFireCounter) == 1) {
>  		pWb35Tx->EP4vm_state = VM_RUNNING;
> -		Wb35Tx(pHwData);
> +		Wb35Tx(adapter);
>  	} else
>  		atomic_dec(&pWb35Tx->TxFireCounter);
>  }
>  
>  
> -void Wb35Tx(phw_data_t pHwData)
> +void Wb35Tx(struct wb35_adapter *adapter)
>  {
> +	phw_data_t	pHwData = &adapter->sHwData;
>  	PWB35TX		pWb35Tx = &pHwData->Wb35Tx;
> -	struct wb35_adapter *adapter = pHwData->adapter;
>  	u8		*pTxBufferAddress;
>  	PMDS		pMds = &adapter->Mds;
>  	struct urb *	pUrb = (struct urb *)pWb35Tx->Tx4Urb;
> @@ -65,7 +66,7 @@ void Wb35Tx(phw_data_t pHwData)
>  	usb_fill_bulk_urb(pUrb, pHwData->WbUsb.udev,
>  			  usb_sndbulkpipe(pHwData->WbUsb.udev, 4),
>  			  pTxBufferAddress, pMds->TxBufferSize[ SendIndex ],
> -			  Wb35Tx_complete, pHwData);
> +			  Wb35Tx_complete, adapter);
>  
>  	pWb35Tx->EP4vm_state = VM_RUNNING;
>  	retv = usb_submit_urb(pUrb, GFP_ATOMIC);
> @@ -77,7 +78,7 @@ void Wb35Tx(phw_data_t pHwData)
>  	// Check if driver needs issue Irp for EP2
>  	pWb35Tx->TxFillCount += pMds->TxCountInBuffer[SendIndex];
>  	if (pWb35Tx->TxFillCount > 12)
> -		Wb35Tx_EP2VM_start( pHwData );
> +		Wb35Tx_EP2VM_start(adapter);
>  
>  	pWb35Tx->ByteTransfer += pMds->TxBufferSize[SendIndex];
>  	return;
> @@ -90,8 +91,8 @@ void Wb35Tx(phw_data_t pHwData)
>  
>  void Wb35Tx_complete(struct urb * pUrb)
>  {
> -	phw_data_t	pHwData = pUrb->context;
> -	struct wb35_adapter *adapter = pHwData->adapter;
> +	struct wb35_adapter *adapter = pUrb->context;
> +	phw_data_t	pHwData = &adapter->sHwData;
>  	PWB35TX		pWb35Tx = &pHwData->Wb35Tx;
>  	PMDS		pMds = &adapter->Mds;
>  
> @@ -117,7 +118,7 @@ void Wb35Tx_complete(struct urb * pUrb)
>  	}
>  
>  	Mds_Tx(adapter);
> -	Wb35Tx(pHwData);
> +	Wb35Tx(adapter);
>  	return;
>  
>  error:
> @@ -193,8 +194,9 @@ void Wb35Tx_destroy(phw_data_t pHwData)
>  	#endif
>  }
>  
> -void Wb35Tx_CurrentTime(phw_data_t pHwData, u32 TimeCount)
> +void Wb35Tx_CurrentTime(struct wb35_adapter *adapter, u32 TimeCount)
>  {
> +	phw_data_t pHwData = &adapter->sHwData;
>  	PWB35TX pWb35Tx = &pHwData->Wb35Tx;
>  	unsigned char Trigger = false;
>  
> @@ -205,26 +207,28 @@ void Wb35Tx_CurrentTime(phw_data_t pHwData, u32 TimeCount)
>  
>  	if (Trigger) {
>  		pWb35Tx->TxTimer = TimeCount;
> -		Wb35Tx_EP2VM_start( pHwData );
> +		Wb35Tx_EP2VM_start(adapter);
>  	}
>  }
>  
> -void Wb35Tx_EP2VM_start(phw_data_t pHwData)
> +void Wb35Tx_EP2VM_start(struct wb35_adapter *adapter)
>  {
> +	phw_data_t pHwData = &adapter->sHwData;
>  	PWB35TX pWb35Tx = &pHwData->Wb35Tx;
>  
>  	// Allow only one thread to run into function
>  	if (atomic_inc_return(&pWb35Tx->TxResultCount) == 1) {
>  		pWb35Tx->EP2vm_state = VM_RUNNING;
> -		Wb35Tx_EP2VM( pHwData );
> +		Wb35Tx_EP2VM(adapter);
>  	}
>  	else
>  		atomic_dec(&pWb35Tx->TxResultCount);
>  }
>  
>  
> -void Wb35Tx_EP2VM(phw_data_t pHwData)
> +void Wb35Tx_EP2VM(struct wb35_adapter *adapter)
>  {
> +	phw_data_t	pHwData = &adapter->sHwData;
>  	PWB35TX pWb35Tx = &pHwData->Wb35Tx;
>  	struct urb *	pUrb = (struct urb *)pWb35Tx->Tx2Urb;
>  	u32 *	pltmp = (u32 *)pWb35Tx->EP2_buf;
> @@ -240,7 +244,7 @@ void Wb35Tx_EP2VM(phw_data_t pHwData)
>  	// Issuing URB
>  	//
>  	usb_fill_int_urb( pUrb, pHwData->WbUsb.udev, usb_rcvintpipe(pHwData->WbUsb.udev,2),
> -			  pltmp, MAX_INTERRUPT_LENGTH, Wb35Tx_EP2VM_complete, pHwData, 32);
> +			  pltmp, MAX_INTERRUPT_LENGTH, Wb35Tx_EP2VM_complete, adapter, 32);
>  
>  	pWb35Tx->EP2vm_state = VM_RUNNING;
>  	retv = usb_submit_urb(pUrb, GFP_ATOMIC);
> @@ -261,9 +265,9 @@ error:
>  
>  void Wb35Tx_EP2VM_complete(struct urb * pUrb)
>  {
> -	phw_data_t	pHwData = pUrb->context;
> +	struct wb35_adapter *adapter = pUrb->context;
> +	phw_data_t	pHwData = &adapter->sHwData;
>  	T02_DESCRIPTOR	T02, TSTATUS;
> -	struct wb35_adapter *adapter = pHwData->adapter;
>  	PWB35TX		pWb35Tx = &pHwData->Wb35Tx;
>  	u32 *		pltmp = (u32 *)pWb35Tx->EP2_buf;
>  	u32		i;
> diff --git a/drivers/staging/winbond/wb35tx_f.h b/drivers/staging/winbond/wb35tx_f.h
> index 6aca4e9..466eb6f 100644
> --- a/drivers/staging/winbond/wb35tx_f.h
> +++ b/drivers/staging/winbond/wb35tx_f.h
> @@ -1,6 +1,7 @@
>  #ifndef __WINBOND_WB35TX_F_H
>  #define __WINBOND_WB35TX_F_H
>  
> +#include "adapter.h"
>  #include "wbhal_f.h"
>  
>  //====================================
> @@ -10,16 +11,16 @@ unsigned char Wb35Tx_initial(	 phw_data_t pHwData );
>  void Wb35Tx_destroy(  phw_data_t pHwData );
>  unsigned char Wb35Tx_get_tx_buffer(  phw_data_t pHwData,  u8 **pBuffer );
>  
> -void Wb35Tx_EP2VM(  phw_data_t pHwData );
> -void Wb35Tx_EP2VM_start(  phw_data_t pHwData );
> +void Wb35Tx_EP2VM(struct wb35_adapter *adapter);
> +void Wb35Tx_EP2VM_start(struct wb35_adapter *adapter);
>  void Wb35Tx_EP2VM_complete(struct urb *urb);
>  
> -void Wb35Tx_start(  phw_data_t pHwData );
> +void Wb35Tx_start(struct wb35_adapter *adapter);
>  void Wb35Tx_stop(  phw_data_t pHwData );
> -void Wb35Tx(  phw_data_t pHwData );
> +void Wb35Tx(struct wb35_adapter *adapter);
>  void Wb35Tx_complete(struct urb *urb);
>  void Wb35Tx_reset_descriptor(  phw_data_t pHwData );
>  
> -void Wb35Tx_CurrentTime(  phw_data_t pHwData,  u32 TimeCount );
> +void Wb35Tx_CurrentTime(struct wb35_adapter *adapter,  u32 TimeCount);
>  
>  #endif
> diff --git a/drivers/staging/winbond/wbhal.c b/drivers/staging/winbond/wbhal.c
> index 752ce59..3b7e90b 100644
> --- a/drivers/staging/winbond/wbhal.c
> +++ b/drivers/staging/winbond/wbhal.c
> @@ -32,8 +32,8 @@ void hal_get_permanent_address( phw_data_t pHwData, u8 *pethernet_address )
>  
>  static void hal_led_control(unsigned long data)
>  {
> -	phw_data_t pHwData = (phw_data_t) data;
> -	struct wb35_adapter *	adapter = pHwData->adapter;
> +	struct wb35_adapter *adapter = (struct wb35_adapter *) data;
> +	phw_data_t pHwData = &adapter->sHwData;
>  	struct wb35_reg *reg = &pHwData->reg;
>  	u32	LEDSet = (pHwData->SoftwareSet & HAL_LED_SET_MASK) >> HAL_LED_SET_SHIFT;
>  	u8	LEDgray[20] = { 0,3,4,6,8,10,11,12,13,14,15,14,13,12,11,10,8,6,4,2 };
> @@ -310,7 +310,7 @@ static void hal_led_control(unsigned long data)
>  	}
>  
>  	pHwData->time_count += TimeInterval;
> -	Wb35Tx_CurrentTime( pHwData, pHwData->time_count ); // 20060928 add
> +	Wb35Tx_CurrentTime(adapter, pHwData->time_count); // 20060928 add
>  	pHwData->LEDTimer.expires = jiffies + msecs_to_jiffies(TimeInterval);
>  	add_timer(&pHwData->LEDTimer);
>  }
> @@ -319,7 +319,6 @@ static void hal_led_control(unsigned long data)
>  u8 hal_init_hardware(phw_data_t pHwData, struct wb35_adapter * adapter)
>  {
>  	u16 SoftwareSet;
> -	pHwData->adapter = adapter;
>  
>  	// Initial the variable
>  	pHwData->MaxReceiveLifeTime = DEFAULT_MSDU_LIFE_TIME; // Setting Rx maximum MSDU life time
> @@ -334,7 +333,7 @@ u8 hal_init_hardware(phw_data_t pHwData, struct wb35_adapter * adapter)
>  				pHwData->InitialResource = 4;
>  				init_timer(&pHwData->LEDTimer);
>  				pHwData->LEDTimer.function = hal_led_control;
> -				pHwData->LEDTimer.data = (unsigned long) pHwData;
> +				pHwData->LEDTimer.data = (unsigned long) adapter;
>  				pHwData->LEDTimer.expires = jiffies + msecs_to_jiffies(1000);
>  				add_timer(&pHwData->LEDTimer);
>  
> @@ -351,7 +350,7 @@ u8 hal_init_hardware(phw_data_t pHwData, struct wb35_adapter * adapter)
>  				#endif
>  
>  				Wb35Rx_start( pHwData );
> -				Wb35Tx_EP2VM_start( pHwData );
> +				Wb35Tx_EP2VM_start(adapter);
>  
>  				return true;
>  			}
> @@ -672,13 +671,13 @@ s32 hal_get_rssi(  phw_data_t pHwData,  u32 *HalRssiArry,  u8 Count )
>  	return ltmp;
>  }
>  //----------------------------------------------------------------------------------------------------
> -s32 hal_get_rssi_bss(  phw_data_t pHwData,  u16 idx,  u8 Count )
> +s32 hal_get_rssi_bss(struct wb35_adapter *adapter,  u16 idx,  u8 Count)
>  {
> +	phw_data_t pHwData = &adapter->sHwData;
>  	struct wb35_reg *reg = &pHwData->reg;
>  	R01_DESCRIPTOR	r01;
>  	s32 ltmp = 0, tmp;
>  	u8	i, j;
> -	struct wb35_adapter *	adapter = pHwData->adapter;
>  //	u32 *HalRssiArry = psBSS(idx)->HalRssi;
>  
>  	if( pHwData->SurpriseRemove ) return -200;
> @@ -842,9 +841,10 @@ void hal_system_power_change(phw_data_t pHwData, u32 PowerState)
>  	}
>  }
>  
> -void hal_surprise_remove(  phw_data_t pHwData )
> +void hal_surprise_remove(struct wb35_adapter *adapter)
>  {
> -	struct wb35_adapter * adapter = pHwData->adapter;
> +	phw_data_t pHwData = &adapter->sHwData;
> +
>  	if (atomic_inc_return( &pHwData->SurpriseRemoveCount ) == 1) {
>  		#ifdef _PE_STATE_DUMP_
>  		WBDEBUG(("Calling hal_surprise_remove\n"));
> @@ -853,9 +853,9 @@ void hal_surprise_remove(  phw_data_t pHwData )
>  	}
>  }
>  
> -void hal_rate_change(  phw_data_t pHwData ) // Notify the HAL rate is changing 20060613.1
> +void hal_rate_change(struct wb35_adapter *adapter) // Notify the HAL rate is changing 20060613.1
>  {
> -	struct wb35_adapter *	adapter = pHwData->adapter;
> +	phw_data_t pHwData = &adapter->sHwData;
>  	u8		rate = CURRENT_TX_RATE;
>  
>  	BBProcessor_RateChanging( pHwData, rate );
> diff --git a/drivers/staging/winbond/wbhal_f.h b/drivers/staging/winbond/wbhal_f.h
> index d64fd17..4cb4da0 100644
> --- a/drivers/staging/winbond/wbhal_f.h
> +++ b/drivers/staging/winbond/wbhal_f.h
> @@ -61,7 +61,7 @@ void hal_set_cwmax(  phw_data_t pHwData,  u16 cwin_max );
>  void hal_set_rsn_wpa(  phw_data_t pHwData,  u32 * RSN_IE_Bitmap , u32 * RSN_OUI_type , unsigned char bDesiredAuthMode);
>  //s32 hal_get_rssi(  phw_data_t pHwData,  u32 HalRssi );
>  s32 hal_get_rssi(  phw_data_t pHwData,  u32 *HalRssiArry,  u8 Count );
> -s32 hal_get_rssi_bss(  phw_data_t pHwData,  u16 idx,  u8 Count );
> +s32 hal_get_rssi_bss(struct wb35_adapter *adapter,  u16 idx,  u8 Count);
>  void hal_set_connect_info(  phw_data_t pHwData,  unsigned char boConnect );
>  u8 hal_get_est_sq3(  phw_data_t pHwData,  u8 Count );
>  void hal_set_rf_power(  phw_data_t pHwData,  u8 PowerIndex ); // 20060621 Modify
> @@ -82,13 +82,13 @@ u8 hal_get_hw_radio_off			(  phw_data_t pHwData );
>  #define hal_scan_interval( _A )		(_A->Scan_Interval)
>  void hal_scan_status_indicate(  phw_data_t pHwData, u8 status);	// 0: complete, 1: in progress
>  void hal_system_power_change(  phw_data_t pHwData, u32 PowerState ); // 20051230 -=D0 1=D1 ..
> -void hal_surprise_remove(  phw_data_t pHwData );
> +void hal_surprise_remove(struct wb35_adapter *adapter);
>  
>  #define PHY_DEBUG( msg, args... )
>  
>  
>  
> -void hal_rate_change(  phw_data_t pHwData ); // Notify the HAL rate is changing 20060613.1
> +void hal_rate_change(struct wb35_adapter *adapter); // Notify the HAL rate is changing 20060613.1
>  unsigned char hal_get_dxx_reg(  phw_data_t pHwData,  u16 number,  u32 * pValue );
>  unsigned char hal_set_dxx_reg(  phw_data_t pHwData,  u16 number,  u32 value );
>  #define hal_get_time_count( _P )	(_P->time_count/10)	// return 100ms count
> diff --git a/drivers/staging/winbond/wbhal_s.h b/drivers/staging/winbond/wbhal_s.h
> index 995976a..276d2b1 100644
> --- a/drivers/staging/winbond/wbhal_s.h
> +++ b/drivers/staging/winbond/wbhal_s.h
> @@ -449,16 +449,6 @@ typedef struct _HW_DATA_T
>  	u32	FragCount;
>  	u32	DMAFix; //V1_DMA_FIX The variable can be removed if driver want to save mem space for V2.
>  
> -	//=======================================================================================
> -	// For USB driver, hal need more variables. Due to
> -	//	1. NDIS-WDM operation
> -	//	2. The SME, MLME and OLD MDS need adapter structure, but the driver under HAL doesn't
> -	//		have that parameter when receiving and indicating packet.
> -	//		The MDS must input the adapter pointer as the second parameter of hal_init_hardware.
> -	//		The function usage is different than PCI driver.
> -	//=======================================================================================
> -	void* adapter;
> -
>  	//===============================================
>  	// Definition for MAC address
>  	//===============================================

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] w35und: clean up adapter.h a bit
  2008-10-30 14:14   ` [PATCH] w35und: clean up adapter.h a bit Pekka Enberg
  2008-10-30 14:14     ` [PATCH] w35und: merge struct wb35_adapter to struct wbsoft_priv Pekka Enberg
@ 2008-10-30 19:10     ` Pavel Machek
  1 sibling, 0 replies; 9+ messages in thread
From: Pavel Machek @ 2008-10-30 19:10 UTC (permalink / raw)
  To: Pekka Enberg; +Cc: greg, linux-kernel

On Thu 2008-10-30 16:14:37, Pekka Enberg wrote:
> This patch cleans up adapter.h a bit in preparation for merging struct
> wb35_adapter to struct wbsoft_priv.

Acked-by: Pavel Machek <pavel@suse.cz>

> Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
> ---
>  drivers/staging/winbond/adapter.h |   17 +++--------------
>  drivers/staging/winbond/common.h  |    3 ---
>  drivers/staging/winbond/mds_s.h   |    1 -
>  drivers/staging/winbond/wbhal.c   |   10 +++++-----
>  4 files changed, 8 insertions(+), 23 deletions(-)
> 
> diff --git a/drivers/staging/winbond/adapter.h b/drivers/staging/winbond/adapter.h
> index 11df483..239cc3a 100644
> --- a/drivers/staging/winbond/adapter.h
> +++ b/drivers/staging/winbond/adapter.h
> @@ -7,20 +7,9 @@
>  #include "mto.h"
>  #include "wbhal_s.h"
>  
> -#define OS_SET_SHUTDOWN( _A )		_A->shutdown=1
> -#define OS_SET_RESUME( _A )		_A->shutdown=0
> -#define OS_STOP( _A )	WBLINUX_stop( _A )
> +#define WBLINUX_PACKET_ARRAY_SIZE (ETHERNET_TX_DESCRIPTORS*4)
>  
> -#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_802_1X_PACKET_INDICATE( _A, _D )	EAP_ReceivePacket( _A, _D )
> -#define OS_SEND_RESULT( _A, _ID, _R )
> -
> -#define WBLINUX_PACKET_ARRAY_SIZE	(ETHERNET_TX_DESCRIPTORS*4)
> -
> -#define MAX_ANSI_STRING		40
> +#define WB_MAX_LINK_NAME_LEN 40
>  
>  struct wb35_adapter {
>  	u32 adapterIndex;	// 20060703.4 Add for using padapterContext global adapter point
> @@ -49,7 +38,7 @@ struct wb35_adapter {
>  	s32 netif_state_stop;	// 1: stop  0: normal
>  	struct iw_statistics iw_stats;
>  
> -	u8 LinkName[MAX_ANSI_STRING];
> +	u8 LinkName[WB_MAX_LINK_NAME_LEN];
>  };
>  
>  #endif
> diff --git a/drivers/staging/winbond/common.h b/drivers/staging/winbond/common.h
> index 2badc29..c4d9604 100644
> --- a/drivers/staging/winbond/common.h
> +++ b/drivers/staging/winbond/common.h
> @@ -23,8 +23,5 @@
>  #define WBDEBUG( _M )	0
>  #endif
>  
> -#define OS_EVENT_INDICATE( _A, _B, _F )
> -#define OS_PMKID_STATUS_EVENT( _A )
> -
>  #endif // COMMON_DEF
>  
> diff --git a/drivers/staging/winbond/mds_s.h b/drivers/staging/winbond/mds_s.h
> index 02b1182..29f1568 100644
> --- a/drivers/staging/winbond/mds_s.h
> +++ b/drivers/staging/winbond/mds_s.h
> @@ -14,7 +14,6 @@
>  #define MAX_USB_TX_BUFFER_NUMBER	4		// Virtual pre-buffer number of MAX_USB_TX_BUFFER
>  #define MAX_USB_TX_BUFFER			4096	// IS89C35 ability 4n alignment is required for hardware
>  
> -#define MDS_EVENT_INDICATE( _A, _B, _F )	OS_EVENT_INDICATE( _A, _B, _F )
>  #define AUTH_REQUEST_PAIRWISE_ERROR			0		// _F flag setting
>  #define AUTH_REQUEST_GROUP_ERROR			1		// _F flag setting
>  
> diff --git a/drivers/staging/winbond/wbhal.c b/drivers/staging/winbond/wbhal.c
> index 3b7e90b..a7d25a6 100644
> --- a/drivers/staging/winbond/wbhal.c
> +++ b/drivers/staging/winbond/wbhal.c
> @@ -223,8 +223,8 @@ static void hal_led_control(unsigned long data)
>  				else
>  				{
>  					// Is transmitting/receiving ??
> -					if( (OS_CURRENT_RX_BYTE( adapter ) != pHwData->RxByteCountLast ) ||
> -						(OS_CURRENT_TX_BYTE( adapter ) != pHwData->TxByteCountLast ) )
> +					if( (adapter->RxByteCount != pHwData->RxByteCountLast ) ||
> +						(adapter->TxByteCount != pHwData->TxByteCountLast ) )
>  					{
>  						if( (reg->U1BC_LEDConfigure & 0x3000) != 0x3000 )
>  						{
> @@ -233,8 +233,8 @@ static void hal_led_control(unsigned long data)
>  						}
>  
>  						// Update variable
> -						pHwData->RxByteCountLast = OS_CURRENT_RX_BYTE( adapter );
> -						pHwData->TxByteCountLast = OS_CURRENT_TX_BYTE( adapter );
> +						pHwData->RxByteCountLast = adapter->RxByteCount;
> +						pHwData->TxByteCountLast = adapter->TxByteCount;
>  						TimeInterval = 200;
>  					}
>  					else
> @@ -849,7 +849,7 @@ void hal_surprise_remove(struct wb35_adapter *adapter)
>  		#ifdef _PE_STATE_DUMP_
>  		WBDEBUG(("Calling hal_surprise_remove\n"));
>  		#endif
> -		OS_STOP( adapter );
> +		WBLINUX_stop( adapter );
>  	}
>  }
>  

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] w35und: merge struct wb35_adapter to struct wbsoft_priv
  2008-10-30 14:14     ` [PATCH] w35und: merge struct wb35_adapter to struct wbsoft_priv Pekka Enberg
  2008-10-30 14:14       ` [PATCH] w35und: remove global struct ieee80211_hw Pekka Enberg
@ 2008-10-30 19:11       ` Pavel Machek
  1 sibling, 0 replies; 9+ messages in thread
From: Pavel Machek @ 2008-10-30 19:11 UTC (permalink / raw)
  To: Pekka Enberg; +Cc: greg, linux-kernel

On Thu 2008-10-30 16:14:38, Pekka Enberg wrote:
> This patch merges struct wb35_adapter to struct wbsoft_priv. Now we can finally
> start passing a pointer to struct ieee80211_hw around where necessary.

Acked-by: Pavel Machek <pavel@suse.cz>

> Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
> ---
>  drivers/staging/winbond/adapter.h    |   44 ---------------------
>  drivers/staging/winbond/bss_f.h      |   70 +++++++++++++++++-----------------
>  drivers/staging/winbond/core.h       |   38 +++++++++++++++++-
>  drivers/staging/winbond/mds.c        |   16 ++++----
>  drivers/staging/winbond/mds_f.h      |   36 +++++++++---------
>  drivers/staging/winbond/mlmetxrx.c   |   12 +++---
>  drivers/staging/winbond/mlmetxrx_f.h |   22 +++++-----
>  drivers/staging/winbond/mto.h        |    2 +-
>  drivers/staging/winbond/mto_f.h      |    8 ++--
>  drivers/staging/winbond/rxisr.c      |    8 ++--
>  drivers/staging/winbond/scan_s.h     |    6 +-
>  drivers/staging/winbond/wb35tx.c     |   14 +++---
>  drivers/staging/winbond/wb35tx_f.h   |   12 +++---
>  drivers/staging/winbond/wbhal.c      |   10 ++--
>  drivers/staging/winbond/wbhal_f.h    |   10 ++--
>  drivers/staging/winbond/wblinux.c    |   10 ++--
>  drivers/staging/winbond/wblinux_f.h  |   14 +++---
>  drivers/staging/winbond/wbusb.c      |   55 +++++++++++----------------
>  18 files changed, 183 insertions(+), 204 deletions(-)
>  delete mode 100644 drivers/staging/winbond/adapter.h
> 
> diff --git a/drivers/staging/winbond/adapter.h b/drivers/staging/winbond/adapter.h
> deleted file mode 100644
> index 239cc3a..0000000
> --- a/drivers/staging/winbond/adapter.h
> +++ /dev/null
> @@ -1,44 +0,0 @@
> -#ifndef __WINBOND_ADAPTER_H
> -#define __WINBOND_ADAPTER_H
> -
> -#include <linux/wireless.h>
> -
> -#include "bssdscpt.h"
> -#include "mto.h"
> -#include "wbhal_s.h"
> -
> -#define WBLINUX_PACKET_ARRAY_SIZE (ETHERNET_TX_DESCRIPTORS*4)
> -
> -#define WB_MAX_LINK_NAME_LEN 40
> -
> -struct wb35_adapter {
> -	u32 adapterIndex;	// 20060703.4 Add for using padapterContext global adapter point
> -
> -	WB_LOCALDESCRIPT sLocalPara;	// Myself connected parameters
> -	PWB_BSSDESCRIPTION asBSSDescriptElement;
> -
> -	MLME_FRAME sMlmeFrame;	// connect to peerSTA parameters
> -
> -	MTO_PARAMETERS sMtoPara;	// MTO_struct ...
> -	hw_data_t sHwData;	//For HAL
> -	MDS Mds;
> -
> -	spinlock_t SpinLock;
> -	u32 shutdown;
> -
> -	atomic_t ThreadCount;
> -
> -	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[WB_MAX_LINK_NAME_LEN];
> -};
> -
> -#endif
> diff --git a/drivers/staging/winbond/bss_f.h b/drivers/staging/winbond/bss_f.h
> index feffe5f..a433b5a 100644
> --- a/drivers/staging/winbond/bss_f.h
> +++ b/drivers/staging/winbond/bss_f.h
> @@ -1,7 +1,7 @@
>  #ifndef __WINBOND_BSS_F_H
>  #define __WINBOND_BSS_F_H
>  
> -#include "adapter.h"
> +#include "core.h"
>  
>  struct PMKID_Information_Element;
>  
> @@ -9,54 +9,54 @@ struct PMKID_Information_Element;
>  // BSS descriptor DataBase management global function
>  //
>  
> -void vBSSdescriptionInit(struct wb35_adapter * adapter);
> -void vBSSfoundList(struct wb35_adapter * adapter);
> -u8 boChanFilter(struct wb35_adapter * adapter, u8 ChanNo);
> -u16 wBSSallocateEntry(struct wb35_adapter * adapter);
> -u16 wBSSGetEntry(struct wb35_adapter * adapter);
> -void vSimpleHouseKeeping(struct wb35_adapter * adapter);
> -u16 wBSShouseKeeping(struct wb35_adapter * adapter);
> -void ClearBSSdescpt(struct wb35_adapter * adapter, u16 i);
> -u16 wBSSfindBssID(struct wb35_adapter * adapter, u8 *pbBssid);
> -u16 wBSSfindDedicateCandidate(struct wb35_adapter * adapter, struct SSID_Element *psSsid, u8 *pbBssid);
> -u16 wBSSfindMACaddr(struct wb35_adapter * adapter, u8 *pbMacAddr);
> -u16 wBSSsearchMACaddr(struct wb35_adapter * adapter, u8 *pbMacAddr, u8 band);
> -u16 wBSSaddScanData(struct wb35_adapter *, u16, psRXDATA);
> -u16 wBSSUpdateScanData(struct wb35_adapter * adapter, u16 wBssIdx, psRXDATA psRcvData);
> -u16 wBSScreateIBSSdata(struct wb35_adapter * adapter, PWB_BSSDESCRIPTION psDesData);
> -void DesiredRate2BSSdescriptor(struct wb35_adapter * adapter, PWB_BSSDESCRIPTION psDesData,
> +void vBSSdescriptionInit(struct wbsoft_priv * adapter);
> +void vBSSfoundList(struct wbsoft_priv * adapter);
> +u8 boChanFilter(struct wbsoft_priv * adapter, u8 ChanNo);
> +u16 wBSSallocateEntry(struct wbsoft_priv * adapter);
> +u16 wBSSGetEntry(struct wbsoft_priv * adapter);
> +void vSimpleHouseKeeping(struct wbsoft_priv * adapter);
> +u16 wBSShouseKeeping(struct wbsoft_priv * adapter);
> +void ClearBSSdescpt(struct wbsoft_priv * adapter, u16 i);
> +u16 wBSSfindBssID(struct wbsoft_priv * adapter, u8 *pbBssid);
> +u16 wBSSfindDedicateCandidate(struct wbsoft_priv * adapter, struct SSID_Element *psSsid, u8 *pbBssid);
> +u16 wBSSfindMACaddr(struct wbsoft_priv * adapter, u8 *pbMacAddr);
> +u16 wBSSsearchMACaddr(struct wbsoft_priv * adapter, u8 *pbMacAddr, u8 band);
> +u16 wBSSaddScanData(struct wbsoft_priv *, u16, psRXDATA);
> +u16 wBSSUpdateScanData(struct wbsoft_priv * adapter, u16 wBssIdx, psRXDATA psRcvData);
> +u16 wBSScreateIBSSdata(struct wbsoft_priv * adapter, PWB_BSSDESCRIPTION psDesData);
> +void DesiredRate2BSSdescriptor(struct wbsoft_priv * adapter, PWB_BSSDESCRIPTION psDesData,
>  							 u8 *pBasicRateSet, u8 BasicRateCount,
>  							 u8 *pOperationRateSet, u8 OperationRateCount);
> -void DesiredRate2InfoElement(struct wb35_adapter * adapter, u8	*addr, u16 *iFildOffset,
> +void DesiredRate2InfoElement(struct wbsoft_priv * adapter, u8	*addr, u16 *iFildOffset,
>  							 u8 *pBasicRateSet, u8 BasicRateCount,
>  							 u8 *pOperationRateSet, u8 OperationRateCount);
> -void BSSAddIBSSdata(struct wb35_adapter * adapter, PWB_BSSDESCRIPTION psDesData);
> +void BSSAddIBSSdata(struct wbsoft_priv * adapter, PWB_BSSDESCRIPTION psDesData);
>  unsigned char boCmpMacAddr( u8 *, u8 *);
>  unsigned char boCmpSSID(struct SSID_Element *psSSID1, struct SSID_Element *psSSID2);
> -u16 wBSSfindSSID(struct wb35_adapter * adapter, struct SSID_Element *psSsid);
> -u16 wRoamingQuery(struct wb35_adapter * adapter);
> -void vRateToBitmap(struct wb35_adapter * adapter, u16 index);
> -u8 bRateToBitmapIndex(struct wb35_adapter * adapter, u8 bRate);
> +u16 wBSSfindSSID(struct wbsoft_priv * adapter, struct SSID_Element *psSsid);
> +u16 wRoamingQuery(struct wbsoft_priv * adapter);
> +void vRateToBitmap(struct wbsoft_priv * adapter, u16 index);
> +u8 bRateToBitmapIndex(struct wbsoft_priv * adapter, u8 bRate);
>  u8 bBitmapToRate(u8 i);
> -unsigned char boIsERPsta(struct wb35_adapter * adapter, u16 i);
> -unsigned char boCheckConnect(struct wb35_adapter * adapter);
> -unsigned char boCheckSignal(struct wb35_adapter * adapter);
> -void AddIBSSIe(struct wb35_adapter * adapter,PWB_BSSDESCRIPTION psDesData );//added by ws for WPA_None06/01/04
> -void BssScanUpToDate(struct wb35_adapter * adapter);
> -void BssUpToDate(struct wb35_adapter * adapter);
> +unsigned char boIsERPsta(struct wbsoft_priv * adapter, u16 i);
> +unsigned char boCheckConnect(struct wbsoft_priv * adapter);
> +unsigned char boCheckSignal(struct wbsoft_priv * adapter);
> +void AddIBSSIe(struct wbsoft_priv * adapter,PWB_BSSDESCRIPTION psDesData );//added by ws for WPA_None06/01/04
> +void BssScanUpToDate(struct wbsoft_priv * adapter);
> +void BssUpToDate(struct wbsoft_priv * adapter);
>  void RateSort(u8 *RateArray, u8 num, u8 mode);
> -void RateReSortForSRate(struct wb35_adapter * adapter, u8 *RateArray, u8 num);
> -void Assemble_IE(struct wb35_adapter * adapter, u16 wBssIdx);
> -void SetMaxTxRate(struct wb35_adapter * adapter);
> +void RateReSortForSRate(struct wbsoft_priv * adapter, u8 *RateArray, u8 num);
> +void Assemble_IE(struct wbsoft_priv * adapter, u16 wBssIdx);
> +void SetMaxTxRate(struct wbsoft_priv * adapter);
>  
> -void CreateWpaIE(struct wb35_adapter * adapter, u16* iFildOffset, u8 *msg, struct  Management_Frame* msgHeader,
> +void CreateWpaIE(struct wbsoft_priv * adapter, u16* iFildOffset, u8 *msg, struct  Management_Frame* msgHeader,
>  				 struct Association_Request_Frame_Body* msgBody, u16 iMSindex); //added by WS 05/14/05
>  
>  #ifdef _WPA2_
> -void CreateRsnIE(struct wb35_adapter * adapter, u16* iFildOffset, u8 *msg, struct  Management_Frame* msgHeader,
> +void CreateRsnIE(struct wbsoft_priv * adapter, u16* iFildOffset, u8 *msg, struct  Management_Frame* msgHeader,
>  				 struct Association_Request_Frame_Body* msgBody, u16 iMSindex);//added by WS 05/14/05
>  
> -u16 SearchPmkid(struct wb35_adapter * adapter, struct  Management_Frame* msgHeader,
> +u16 SearchPmkid(struct wbsoft_priv * adapter, struct  Management_Frame* msgHeader,
>  				   struct PMKID_Information_Element * AssoReq_PMKID );
>  #endif
>  
> diff --git a/drivers/staging/winbond/core.h b/drivers/staging/winbond/core.h
> index 62ad954..64b73bb 100644
> --- a/drivers/staging/winbond/core.h
> +++ b/drivers/staging/winbond/core.h
> @@ -1,10 +1,44 @@
>  #ifndef __WINBOND_CORE_H
>  #define __WINBOND_CORE_H
>  
> -#include "adapter.h"
> +#include <linux/wireless.h>
> +
> +#include "bssdscpt.h"
> +#include "mto.h"
> +#include "wbhal_s.h"
> +
> +#define WBLINUX_PACKET_ARRAY_SIZE (ETHERNET_TX_DESCRIPTORS*4)
> +
> +#define WB_MAX_LINK_NAME_LEN 40
>  
>  struct wbsoft_priv {
> -	struct wb35_adapter *adapter;
> +	u32 adapterIndex;	// 20060703.4 Add for using padapterContext global adapter point
> +
> +	WB_LOCALDESCRIPT sLocalPara;	// Myself connected parameters
> +	PWB_BSSDESCRIPTION asBSSDescriptElement;
> +
> +	MLME_FRAME sMlmeFrame;	// connect to peerSTA parameters
> +
> +	MTO_PARAMETERS sMtoPara;	// MTO_struct ...
> +	hw_data_t sHwData;	//For HAL
> +	MDS Mds;
> +
> +	spinlock_t SpinLock;
> +	u32 shutdown;
> +
> +	atomic_t ThreadCount;
> +
> +	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[WB_MAX_LINK_NAME_LEN];
>  };
>  
>  #endif /* __WINBOND_CORE_H */
> diff --git a/drivers/staging/winbond/mds.c b/drivers/staging/winbond/mds.c
> index af4fdf1..a4e7300 100644
> --- a/drivers/staging/winbond/mds.c
> +++ b/drivers/staging/winbond/mds.c
> @@ -8,7 +8,7 @@
>  #include "wblinux_f.h"
>  
>  void
> -Mds_reset_descriptor(struct wb35_adapter * adapter)
> +Mds_reset_descriptor(struct wbsoft_priv * adapter)
>  {
>  	PMDS pMds = &adapter->Mds;
>  
> @@ -21,7 +21,7 @@ Mds_reset_descriptor(struct wb35_adapter * adapter)
>  }
>  
>  unsigned char
> -Mds_initial(struct wb35_adapter * adapter)
> +Mds_initial(struct wbsoft_priv * adapter)
>  {
>  	PMDS pMds = &adapter->Mds;
>  
> @@ -35,13 +35,13 @@ Mds_initial(struct wb35_adapter * adapter)
>  }
>  
>  void
> -Mds_Destroy(struct wb35_adapter * adapter)
> +Mds_Destroy(struct wbsoft_priv * adapter)
>  {
>  	vRxTimerStop(adapter);
>  }
>  
>  void
> -Mds_Tx(struct wb35_adapter * adapter)
> +Mds_Tx(struct wbsoft_priv * adapter)
>  {
>  	phw_data_t	pHwData = &adapter->sHwData;
>  	PMDS		pMds = &adapter->Mds;
> @@ -183,7 +183,7 @@ Mds_Tx(struct wb35_adapter * adapter)
>  }
>  
>  void
> -Mds_SendComplete(struct wb35_adapter * adapter, PT02_DESCRIPTOR pT02)
> +Mds_SendComplete(struct wbsoft_priv * adapter, PT02_DESCRIPTOR pT02)
>  {
>  	PMDS	pMds = &adapter->Mds;
>  	phw_data_t	pHwData = &adapter->sHwData;
> @@ -236,7 +236,7 @@ Mds_SendComplete(struct wb35_adapter * adapter, PT02_DESCRIPTOR pT02)
>  }
>  
>  void
> -Mds_HeaderCopy(struct wb35_adapter * adapter, PDESCRIPTOR pDes, u8 *TargetBuffer)
> +Mds_HeaderCopy(struct wbsoft_priv * adapter, PDESCRIPTOR pDes, u8 *TargetBuffer)
>  {
>  	PMDS	pMds = &adapter->Mds;
>  	u8	*src_buffer = pDes->buffer_address[0];//931130.5.g
> @@ -333,7 +333,7 @@ Mds_HeaderCopy(struct wb35_adapter * adapter, PDESCRIPTOR pDes, u8 *TargetBuffer
>  
>  // The function return the 4n size of usb pk
>  u16
> -Mds_BodyCopy(struct wb35_adapter * adapter, PDESCRIPTOR pDes, u8 *TargetBuffer)
> +Mds_BodyCopy(struct wbsoft_priv * adapter, PDESCRIPTOR pDes, u8 *TargetBuffer)
>  {
>  	PT00_DESCRIPTOR	pT00;
>  	PMDS	pMds = &adapter->Mds;
> @@ -436,7 +436,7 @@ Mds_BodyCopy(struct wb35_adapter * adapter, PDESCRIPTOR pDes, u8 *TargetBuffer)
>  
>  
>  void
> -Mds_DurationSet(  struct wb35_adapter * adapter,  PDESCRIPTOR pDes,  u8 *buffer )
> +Mds_DurationSet(  struct wbsoft_priv * adapter,  PDESCRIPTOR pDes,  u8 *buffer )
>  {
>  	PT00_DESCRIPTOR	pT00;
>  	PT01_DESCRIPTOR	pT01;
> diff --git a/drivers/staging/winbond/mds_f.h b/drivers/staging/winbond/mds_f.h
> index 2e0f7a8..a3724ac 100644
> --- a/drivers/staging/winbond/mds_f.h
> +++ b/drivers/staging/winbond/mds_f.h
> @@ -2,31 +2,31 @@
>  #define __WINBOND_MDS_F_H
>  
>  #include "wbhal_s.h"
> -#include "adapter.h"
> +#include "core.h"
>  
> -unsigned char Mds_initial(  struct wb35_adapter *adapter );
> -void Mds_Destroy(  struct wb35_adapter *adapter );
> -void Mds_Tx(  struct wb35_adapter *adapter );
> -void Mds_HeaderCopy(  struct wb35_adapter *adapter,  PDESCRIPTOR pDes,  u8 *TargetBuffer );
> -u16 Mds_BodyCopy(  struct wb35_adapter *adapter,  PDESCRIPTOR pDes,  u8 *TargetBuffer );
> -void Mds_DurationSet(  struct wb35_adapter *adapter,  PDESCRIPTOR pDes,  u8 *TargetBuffer );
> -void Mds_SendComplete(  struct wb35_adapter *adapter,  PT02_DESCRIPTOR pT02 );
> -void Mds_MpduProcess(  struct wb35_adapter *adapter,  PDESCRIPTOR pRxDes );
> -void Mds_reset_descriptor(  struct wb35_adapter *adapter );
> +unsigned char Mds_initial(  struct wbsoft_priv *adapter );
> +void Mds_Destroy(  struct wbsoft_priv *adapter );
> +void Mds_Tx(  struct wbsoft_priv *adapter );
> +void Mds_HeaderCopy(  struct wbsoft_priv *adapter,  PDESCRIPTOR pDes,  u8 *TargetBuffer );
> +u16 Mds_BodyCopy(  struct wbsoft_priv *adapter,  PDESCRIPTOR pDes,  u8 *TargetBuffer );
> +void Mds_DurationSet(  struct wbsoft_priv *adapter,  PDESCRIPTOR pDes,  u8 *TargetBuffer );
> +void Mds_SendComplete(  struct wbsoft_priv *adapter,  PT02_DESCRIPTOR pT02 );
> +void Mds_MpduProcess(  struct wbsoft_priv *adapter,  PDESCRIPTOR pRxDes );
> +void Mds_reset_descriptor(  struct wbsoft_priv *adapter );
>  extern void DataDmp(u8 *pdata, u32 len, u32 offset);
>  
>  
> -void vRxTimerInit(struct wb35_adapter *adapter);
> -void vRxTimerStart(struct wb35_adapter *adapter, int timeout_value);
> -void vRxTimerStop(struct wb35_adapter *adapter);
> +void vRxTimerInit(struct wbsoft_priv *adapter);
> +void vRxTimerStart(struct wbsoft_priv *adapter, int timeout_value);
> +void vRxTimerStop(struct wbsoft_priv *adapter);
>  
>  // For Asynchronous indicating. The routine collocates with USB.
> -void Mds_MsduProcess(  struct wb35_adapter *adapter,  PRXLAYER1 pRxLayer1,  u8 SlotIndex);
> +void Mds_MsduProcess(  struct wbsoft_priv *adapter,  PRXLAYER1 pRxLayer1,  u8 SlotIndex);
>  
>  // For data frame sending 20060802
> -u16 MDS_GetPacketSize(  struct wb35_adapter *adapter );
> -void MDS_GetNextPacket(  struct wb35_adapter *adapter,  PDESCRIPTOR pDes );
> -void MDS_GetNextPacketComplete(  struct wb35_adapter *adapter,  PDESCRIPTOR pDes );
> -void MDS_SendResult(  struct wb35_adapter *adapter,  u8 PacketId,  unsigned char SendOK );
> +u16 MDS_GetPacketSize(  struct wbsoft_priv *adapter );
> +void MDS_GetNextPacket(  struct wbsoft_priv *adapter,  PDESCRIPTOR pDes );
> +void MDS_GetNextPacketComplete(  struct wbsoft_priv *adapter,  PDESCRIPTOR pDes );
> +void MDS_SendResult(  struct wbsoft_priv *adapter,  u8 PacketId,  unsigned char SendOK );
>  
>  #endif
> diff --git a/drivers/staging/winbond/mlmetxrx.c b/drivers/staging/winbond/mlmetxrx.c
> index 308309b..d83795f 100644
> --- a/drivers/staging/winbond/mlmetxrx.c
> +++ b/drivers/staging/winbond/mlmetxrx.c
> @@ -19,7 +19,7 @@
>  
>  #include "mds_f.h"
>  
> -void MLMEResetTxRx(struct wb35_adapter * adapter)
> +void MLMEResetTxRx(struct wbsoft_priv * adapter)
>  {
>  	s32     i;
>  
> @@ -55,7 +55,7 @@ void MLMEResetTxRx(struct wb35_adapter * adapter)
>  //=============================================================================
>  
>  /* FIXME: Should this just be replaced with kmalloc() and kfree()? */
> -u8 *MLMEGetMMPDUBuffer(struct wb35_adapter * adapter)
> +u8 *MLMEGetMMPDUBuffer(struct wbsoft_priv * adapter)
>  {
>  	s32 i;
>  	u8 *returnVal;
> @@ -73,7 +73,7 @@ u8 *MLMEGetMMPDUBuffer(struct wb35_adapter * adapter)
>  }
>  
>  //=============================================================================
> -u8 MLMESendFrame(struct wb35_adapter * adapter, u8 *pMMPDU, u16 len, u8 DataType)
> +u8 MLMESendFrame(struct wbsoft_priv * adapter, u8 *pMMPDU, u16 len, u8 DataType)
>  /*	DataType : FRAME_TYPE_802_11_MANAGEMENT, FRAME_TYPE_802_11_MANAGEMENT_CHALLENGE,
>  				FRAME_TYPE_802_11_DATA */
>  {
> @@ -98,7 +98,7 @@ u8 MLMESendFrame(struct wb35_adapter * adapter, u8 *pMMPDU, u16 len, u8 DataType
>  	return true;
>  }
>  
> -void MLME_GetNextPacket(struct wb35_adapter *adapter, PDESCRIPTOR desc)
> +void MLME_GetNextPacket(struct wbsoft_priv *adapter, PDESCRIPTOR desc)
>  {
>  	desc->InternalUsed = desc->buffer_start_index + desc->buffer_number;
>  	desc->InternalUsed %= MAX_DESCRIPTOR_BUFFER_INDEX;
> @@ -109,7 +109,7 @@ void MLME_GetNextPacket(struct wb35_adapter *adapter, PDESCRIPTOR desc)
>  	desc->Type = adapter->sMlmeFrame.DataType;
>  }
>  
> -void MLMEfreeMMPDUBuffer(struct wb35_adapter * adapter, s8 *pData)
> +void MLMEfreeMMPDUBuffer(struct wbsoft_priv * adapter, s8 *pData)
>  {
>  	int i;
>  
> @@ -127,7 +127,7 @@ void MLMEfreeMMPDUBuffer(struct wb35_adapter * adapter, s8 *pData)
>  }
>  
>  void
> -MLME_SendComplete(struct wb35_adapter * adapter, u8 PacketID, unsigned char SendOK)
> +MLME_SendComplete(struct wbsoft_priv * adapter, u8 PacketID, unsigned char SendOK)
>  {
>  	MLME_TXCALLBACK	TxCallback;
>  
> diff --git a/drivers/staging/winbond/mlmetxrx_f.h b/drivers/staging/winbond/mlmetxrx_f.h
> index 0f264ed..905c301 100644
> --- a/drivers/staging/winbond/mlmetxrx_f.h
> +++ b/drivers/staging/winbond/mlmetxrx_f.h
> @@ -8,34 +8,34 @@
>  #ifndef _MLMETXRX_H
>  #define _MLMETXRX_H
>  
> -#include "adapter.h"
> +#include "core.h"
>  
>  void
>  MLMEProcThread(
> -     struct wb35_adapter *    adapter
> +     struct wbsoft_priv *    adapter
>  	);
>  
> -void MLMEResetTxRx( struct wb35_adapter * adapter);
> +void MLMEResetTxRx( struct wbsoft_priv * adapter);
>  
>  u8 *
>  MLMEGetMMPDUBuffer(
> -     struct wb35_adapter *    adapter
> +     struct wbsoft_priv *    adapter
>     );
>  
> -void MLMEfreeMMPDUBuffer( struct wb35_adapter * adapter,  s8 * pData);
> +void MLMEfreeMMPDUBuffer( struct wbsoft_priv * adapter,  s8 * pData);
>  
> -void MLME_GetNextPacket(  struct wb35_adapter * adapter,  PDESCRIPTOR pDes );
> -u8 MLMESendFrame( struct wb35_adapter * adapter,
> +void MLME_GetNextPacket(  struct wbsoft_priv * adapter,  PDESCRIPTOR pDes );
> +u8 MLMESendFrame( struct wbsoft_priv * adapter,
>  					u8	*pMMPDU,
>  					u16	len,
>  					 u8	DataType);
>  
>  void
> -MLME_SendComplete(  struct wb35_adapter * adapter,  u8 PacketID,  unsigned char SendOK );
> +MLME_SendComplete(  struct wbsoft_priv * adapter,  u8 PacketID,  unsigned char SendOK );
>  
>  void
>  MLMERcvFrame(
> -     struct wb35_adapter *    adapter,
> +     struct wbsoft_priv *    adapter,
>       PRXBUFFER        pRxBufferArray,
>       u8            NumOfBuffer,
>       u8            ReturnSlotIndex
> @@ -43,11 +43,11 @@ MLMERcvFrame(
>  
>  void
>  MLMEReturnPacket(
> -     struct wb35_adapter *    adapter,
> +     struct wbsoft_priv *    adapter,
>       u8 *          pRxBufer
>     );
>  #ifdef _IBSS_BEACON_SEQ_STICK_
> -s8 SendBCNullData(struct wb35_adapter * adapter, u16 wIdx);
> +s8 SendBCNullData(struct wbsoft_priv * adapter, u16 wIdx);
>  #endif
>  
>  #endif
> diff --git a/drivers/staging/winbond/mto.h b/drivers/staging/winbond/mto.h
> index 9a17544..536c4f1 100644
> --- a/drivers/staging/winbond/mto.h
> +++ b/drivers/staging/winbond/mto.h
> @@ -131,7 +131,7 @@ typedef struct _MTO_PARAMETERS
>  } MTO_PARAMETERS, *PMTO_PARAMETERS;
>  
>  
> -#define MTO_FUNC_INPUT              struct wb35_adapter *	adapter
> +#define MTO_FUNC_INPUT              struct wbsoft_priv *	adapter
>  #define MTO_FUNC_INPUT_DATA         adapter
>  #define MTO_DATA()                  (adapter->sMtoPara)
>  #define MTO_HAL()                   (&adapter->sHwData)
> diff --git a/drivers/staging/winbond/mto_f.h b/drivers/staging/winbond/mto_f.h
> index ce4319d..81f5913 100644
> --- a/drivers/staging/winbond/mto_f.h
> +++ b/drivers/staging/winbond/mto_f.h
> @@ -1,11 +1,11 @@
>  #ifndef __WINBOND_MTO_F_H
>  #define __WINBOND_MTO_F_H
>  
> -#include "adapter.h"
> +#include "core.h"
>  
> -extern void MTO_Init(struct wb35_adapter *);
> -extern void MTO_PeriodicTimerExpired(struct wb35_adapter *);
> -extern void MTO_SetDTORateRange(struct wb35_adapter *, u8 *, u8);
> +extern void MTO_Init(struct wbsoft_priv *);
> +extern void MTO_PeriodicTimerExpired(struct wbsoft_priv *);
> +extern void MTO_SetDTORateRange(struct wbsoft_priv *, u8 *, u8);
>  extern u8 MTO_GetTxRate(MTO_FUNC_INPUT, u32 fpdu_len);
>  extern u8 MTO_GetTxFallbackRate(MTO_FUNC_INPUT);
>  extern void MTO_SetTxCount(MTO_FUNC_INPUT, u8 t0, u8 index);
> diff --git a/drivers/staging/winbond/rxisr.c b/drivers/staging/winbond/rxisr.c
> index d48fed7..f4619d9 100644
> --- a/drivers/staging/winbond/rxisr.c
> +++ b/drivers/staging/winbond/rxisr.c
> @@ -1,19 +1,19 @@
>  #include "sysdef.h"
> -#include "adapter.h"
> +#include "core.h"
>  
>  static void RxTimerHandler(unsigned long data)
>  {
>  	WARN_ON(1);
>  }
>  
> -void vRxTimerInit(struct wb35_adapter *adapter)
> +void vRxTimerInit(struct wbsoft_priv *adapter)
>  {
>  	init_timer(&adapter->Mds.timer);
>  	adapter->Mds.timer.function = RxTimerHandler;
>  	adapter->Mds.timer.data = (unsigned long) adapter;
>  }
>  
> -void vRxTimerStart(struct wb35_adapter *adapter, int timeout_value)
> +void vRxTimerStart(struct wbsoft_priv *adapter, int timeout_value)
>  {
>  	if (timeout_value < MIN_TIMEOUT_VAL)
>  		timeout_value = MIN_TIMEOUT_VAL;
> @@ -22,7 +22,7 @@ void vRxTimerStart(struct wb35_adapter *adapter, int timeout_value)
>  	add_timer(&adapter->Mds.timer);
>  }
>  
> -void vRxTimerStop(struct wb35_adapter *adapter)
> +void vRxTimerStop(struct wbsoft_priv *adapter)
>  {
>  	del_timer_sync(&adapter->Mds.timer);
>  }
> diff --git a/drivers/staging/winbond/scan_s.h b/drivers/staging/winbond/scan_s.h
> index 7269546..775bb81 100644
> --- a/drivers/staging/winbond/scan_s.h
> +++ b/drivers/staging/winbond/scan_s.h
> @@ -114,8 +114,8 @@ typedef struct _SCAN_PARAMETERS
>  
>  // static functions
>  
> -//static void ScanTimerHandler(struct wb35_adapter * adapter);
> -//static void vScanTimerStart(struct wb35_adapter *	adapter, int timeout_value);
> -//static void vScanTimerStop(struct wb35_adapter * adapter);
> +//static void ScanTimerHandler(struct wbsoft_priv * adapter);
> +//static void vScanTimerStart(struct wbsoft_priv *	adapter, int timeout_value);
> +//static void vScanTimerStop(struct wbsoft_priv * adapter);
>  
>  #endif
> diff --git a/drivers/staging/winbond/wb35tx.c b/drivers/staging/winbond/wb35tx.c
> index ce7e981..32ee391 100644
> --- a/drivers/staging/winbond/wb35tx.c
> +++ b/drivers/staging/winbond/wb35tx.c
> @@ -23,7 +23,7 @@ Wb35Tx_get_tx_buffer(phw_data_t pHwData, u8 **pBuffer)
>  	return true;
>  }
>  
> -void Wb35Tx_start(struct wb35_adapter *adapter)
> +void Wb35Tx_start(struct wbsoft_priv *adapter)
>  {
>  	phw_data_t pHwData = &adapter->sHwData;
>  	PWB35TX pWb35Tx = &pHwData->Wb35Tx;
> @@ -37,7 +37,7 @@ void Wb35Tx_start(struct wb35_adapter *adapter)
>  }
>  
>  
> -void Wb35Tx(struct wb35_adapter *adapter)
> +void Wb35Tx(struct wbsoft_priv *adapter)
>  {
>  	phw_data_t	pHwData = &adapter->sHwData;
>  	PWB35TX		pWb35Tx = &pHwData->Wb35Tx;
> @@ -91,7 +91,7 @@ void Wb35Tx(struct wb35_adapter *adapter)
>  
>  void Wb35Tx_complete(struct urb * pUrb)
>  {
> -	struct wb35_adapter *adapter = pUrb->context;
> +	struct wbsoft_priv *adapter = pUrb->context;
>  	phw_data_t	pHwData = &adapter->sHwData;
>  	PWB35TX		pWb35Tx = &pHwData->Wb35Tx;
>  	PMDS		pMds = &adapter->Mds;
> @@ -194,7 +194,7 @@ void Wb35Tx_destroy(phw_data_t pHwData)
>  	#endif
>  }
>  
> -void Wb35Tx_CurrentTime(struct wb35_adapter *adapter, u32 TimeCount)
> +void Wb35Tx_CurrentTime(struct wbsoft_priv *adapter, u32 TimeCount)
>  {
>  	phw_data_t pHwData = &adapter->sHwData;
>  	PWB35TX pWb35Tx = &pHwData->Wb35Tx;
> @@ -211,7 +211,7 @@ void Wb35Tx_CurrentTime(struct wb35_adapter *adapter, u32 TimeCount)
>  	}
>  }
>  
> -void Wb35Tx_EP2VM_start(struct wb35_adapter *adapter)
> +void Wb35Tx_EP2VM_start(struct wbsoft_priv *adapter)
>  {
>  	phw_data_t pHwData = &adapter->sHwData;
>  	PWB35TX pWb35Tx = &pHwData->Wb35Tx;
> @@ -226,7 +226,7 @@ void Wb35Tx_EP2VM_start(struct wb35_adapter *adapter)
>  }
>  
>  
> -void Wb35Tx_EP2VM(struct wb35_adapter *adapter)
> +void Wb35Tx_EP2VM(struct wbsoft_priv *adapter)
>  {
>  	phw_data_t	pHwData = &adapter->sHwData;
>  	PWB35TX pWb35Tx = &pHwData->Wb35Tx;
> @@ -265,7 +265,7 @@ error:
>  
>  void Wb35Tx_EP2VM_complete(struct urb * pUrb)
>  {
> -	struct wb35_adapter *adapter = pUrb->context;
> +	struct wbsoft_priv *adapter = pUrb->context;
>  	phw_data_t	pHwData = &adapter->sHwData;
>  	T02_DESCRIPTOR	T02, TSTATUS;
>  	PWB35TX		pWb35Tx = &pHwData->Wb35Tx;
> diff --git a/drivers/staging/winbond/wb35tx_f.h b/drivers/staging/winbond/wb35tx_f.h
> index 466eb6f..277faa7 100644
> --- a/drivers/staging/winbond/wb35tx_f.h
> +++ b/drivers/staging/winbond/wb35tx_f.h
> @@ -1,7 +1,7 @@
>  #ifndef __WINBOND_WB35TX_F_H
>  #define __WINBOND_WB35TX_F_H
>  
> -#include "adapter.h"
> +#include "core.h"
>  #include "wbhal_f.h"
>  
>  //====================================
> @@ -11,16 +11,16 @@ unsigned char Wb35Tx_initial(	 phw_data_t pHwData );
>  void Wb35Tx_destroy(  phw_data_t pHwData );
>  unsigned char Wb35Tx_get_tx_buffer(  phw_data_t pHwData,  u8 **pBuffer );
>  
> -void Wb35Tx_EP2VM(struct wb35_adapter *adapter);
> -void Wb35Tx_EP2VM_start(struct wb35_adapter *adapter);
> +void Wb35Tx_EP2VM(struct wbsoft_priv *adapter);
> +void Wb35Tx_EP2VM_start(struct wbsoft_priv *adapter);
>  void Wb35Tx_EP2VM_complete(struct urb *urb);
>  
> -void Wb35Tx_start(struct wb35_adapter *adapter);
> +void Wb35Tx_start(struct wbsoft_priv *adapter);
>  void Wb35Tx_stop(  phw_data_t pHwData );
> -void Wb35Tx(struct wb35_adapter *adapter);
> +void Wb35Tx(struct wbsoft_priv *adapter);
>  void Wb35Tx_complete(struct urb *urb);
>  void Wb35Tx_reset_descriptor(  phw_data_t pHwData );
>  
> -void Wb35Tx_CurrentTime(struct wb35_adapter *adapter,  u32 TimeCount);
> +void Wb35Tx_CurrentTime(struct wbsoft_priv *adapter,  u32 TimeCount);
>  
>  #endif
> diff --git a/drivers/staging/winbond/wbhal.c b/drivers/staging/winbond/wbhal.c
> index a7d25a6..289ca7e 100644
> --- a/drivers/staging/winbond/wbhal.c
> +++ b/drivers/staging/winbond/wbhal.c
> @@ -32,7 +32,7 @@ void hal_get_permanent_address( phw_data_t pHwData, u8 *pethernet_address )
>  
>  static void hal_led_control(unsigned long data)
>  {
> -	struct wb35_adapter *adapter = (struct wb35_adapter *) data;
> +	struct wbsoft_priv *adapter = (struct wbsoft_priv *) data;
>  	phw_data_t pHwData = &adapter->sHwData;
>  	struct wb35_reg *reg = &pHwData->reg;
>  	u32	LEDSet = (pHwData->SoftwareSet & HAL_LED_SET_MASK) >> HAL_LED_SET_SHIFT;
> @@ -316,7 +316,7 @@ static void hal_led_control(unsigned long data)
>  }
>  
>  
> -u8 hal_init_hardware(phw_data_t pHwData, struct wb35_adapter * adapter)
> +u8 hal_init_hardware(phw_data_t pHwData, struct wbsoft_priv * adapter)
>  {
>  	u16 SoftwareSet;
>  
> @@ -671,7 +671,7 @@ s32 hal_get_rssi(  phw_data_t pHwData,  u32 *HalRssiArry,  u8 Count )
>  	return ltmp;
>  }
>  //----------------------------------------------------------------------------------------------------
> -s32 hal_get_rssi_bss(struct wb35_adapter *adapter,  u16 idx,  u8 Count)
> +s32 hal_get_rssi_bss(struct wbsoft_priv *adapter,  u16 idx,  u8 Count)
>  {
>  	phw_data_t pHwData = &adapter->sHwData;
>  	struct wb35_reg *reg = &pHwData->reg;
> @@ -841,7 +841,7 @@ void hal_system_power_change(phw_data_t pHwData, u32 PowerState)
>  	}
>  }
>  
> -void hal_surprise_remove(struct wb35_adapter *adapter)
> +void hal_surprise_remove(struct wbsoft_priv *adapter)
>  {
>  	phw_data_t pHwData = &adapter->sHwData;
>  
> @@ -853,7 +853,7 @@ void hal_surprise_remove(struct wb35_adapter *adapter)
>  	}
>  }
>  
> -void hal_rate_change(struct wb35_adapter *adapter) // Notify the HAL rate is changing 20060613.1
> +void hal_rate_change(struct wbsoft_priv *adapter) // Notify the HAL rate is changing 20060613.1
>  {
>  	phw_data_t pHwData = &adapter->sHwData;
>  	u8		rate = CURRENT_TX_RATE;
> diff --git a/drivers/staging/winbond/wbhal_f.h b/drivers/staging/winbond/wbhal_f.h
> index 4cb4da0..e7a1d61 100644
> --- a/drivers/staging/winbond/wbhal_f.h
> +++ b/drivers/staging/winbond/wbhal_f.h
> @@ -5,7 +5,7 @@
>  #include "wb35tx_f.h"
>  #include "wb35rx_f.h"
>  
> -#include "adapter.h"
> +#include "core.h"
>  
>  //====================================================================================
>  // Function declaration
> @@ -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_set_ethernet_address(  phw_data_t pHwData,  u8 *current_address );
>  void hal_get_permanent_address(  phw_data_t pHwData,  u8 *pethernet_address );
> -unsigned char hal_init_hardware(  phw_data_t pHwData,  struct wb35_adapter * adapter );
> +unsigned char hal_init_hardware(  phw_data_t pHwData,  struct wbsoft_priv * adapter );
>  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_set_slot_time(  phw_data_t pHwData,  u8 type );
> @@ -61,7 +61,7 @@ void hal_set_cwmax(  phw_data_t pHwData,  u16 cwin_max );
>  void hal_set_rsn_wpa(  phw_data_t pHwData,  u32 * RSN_IE_Bitmap , u32 * RSN_OUI_type , unsigned char bDesiredAuthMode);
>  //s32 hal_get_rssi(  phw_data_t pHwData,  u32 HalRssi );
>  s32 hal_get_rssi(  phw_data_t pHwData,  u32 *HalRssiArry,  u8 Count );
> -s32 hal_get_rssi_bss(struct wb35_adapter *adapter,  u16 idx,  u8 Count);
> +s32 hal_get_rssi_bss(struct wbsoft_priv *adapter,  u16 idx,  u8 Count);
>  void hal_set_connect_info(  phw_data_t pHwData,  unsigned char boConnect );
>  u8 hal_get_est_sq3(  phw_data_t pHwData,  u8 Count );
>  void hal_set_rf_power(  phw_data_t pHwData,  u8 PowerIndex ); // 20060621 Modify
> @@ -82,13 +82,13 @@ u8 hal_get_hw_radio_off			(  phw_data_t pHwData );
>  #define hal_scan_interval( _A )		(_A->Scan_Interval)
>  void hal_scan_status_indicate(  phw_data_t pHwData, u8 status);	// 0: complete, 1: in progress
>  void hal_system_power_change(  phw_data_t pHwData, u32 PowerState ); // 20051230 -=D0 1=D1 ..
> -void hal_surprise_remove(struct wb35_adapter *adapter);
> +void hal_surprise_remove(struct wbsoft_priv *adapter);
>  
>  #define PHY_DEBUG( msg, args... )
>  
>  
>  
> -void hal_rate_change(struct wb35_adapter *adapter); // Notify the HAL rate is changing 20060613.1
> +void hal_rate_change(struct wbsoft_priv *adapter); // Notify the HAL rate is changing 20060613.1
>  unsigned char hal_get_dxx_reg(  phw_data_t pHwData,  u16 number,  u32 * pValue );
>  unsigned char hal_set_dxx_reg(  phw_data_t pHwData,  u16 number,  u32 value );
>  #define hal_get_time_count( _P )	(_P->time_count/10)	// return 100ms count
> diff --git a/drivers/staging/winbond/wblinux.c b/drivers/staging/winbond/wblinux.c
> index 5d3acc8..3b02aae 100644
> --- a/drivers/staging/winbond/wblinux.c
> +++ b/drivers/staging/winbond/wblinux.c
> @@ -17,14 +17,14 @@
>  #include "wblinux_f.h"
>  
>  unsigned char
> -WBLINUX_Initial(struct wb35_adapter * adapter)
> +WBLINUX_Initial(struct wbsoft_priv * adapter)
>  {
>  	spin_lock_init( &adapter->SpinLock );
>  	return true;
>  }
>  
>  void
> -WBLINUX_Destroy(struct wb35_adapter * adapter)
> +WBLINUX_Destroy(struct wbsoft_priv * adapter)
>  {
>  	WBLINUX_stop( adapter );
>  #ifdef _PE_USB_INI_DUMP_
> @@ -33,7 +33,7 @@ WBLINUX_Destroy(struct wb35_adapter * adapter)
>  }
>  
>  void
> -WBLINUX_stop(  struct wb35_adapter * adapter )
> +WBLINUX_stop(  struct wbsoft_priv * adapter )
>  {
>  	struct sk_buff *pSkb;
>  
> @@ -63,7 +63,7 @@ WBLINUX_stop(  struct wb35_adapter * adapter )
>  }
>  
>  void
> -WbWlanHalt(  struct wb35_adapter * adapter )
> +WbWlanHalt(  struct wbsoft_priv * adapter )
>  {
>  	//---------------------
>  	adapter->sLocalPara.ShutDowned = true;
> @@ -85,7 +85,7 @@ WbWlanHalt(  struct wb35_adapter * adapter )
>  }
>  
>  unsigned char
> -WbWLanInitialize(struct wb35_adapter * adapter)
> +WbWLanInitialize(struct wbsoft_priv * adapter)
>  {
>  	phw_data_t	pHwData;
>  	u8		*pMacAddr;
> diff --git a/drivers/staging/winbond/wblinux_f.h b/drivers/staging/winbond/wblinux_f.h
> index ed2676b..4b786fc 100644
> --- a/drivers/staging/winbond/wblinux_f.h
> +++ b/drivers/staging/winbond/wblinux_f.h
> @@ -1,7 +1,7 @@
>  #ifndef __WBLINUX_F_H
>  #define __WBLINUX_F_H
>  
> -#include "adapter.h"
> +#include "core.h"
>  #include "mds_s.h"
>  
>  //=========================================================================
> @@ -9,14 +9,14 @@
>  //
>  // wblinux_f.h
>  //
> -unsigned char WBLINUX_Initial(  struct wb35_adapter *adapter );
> +unsigned char WBLINUX_Initial(  struct wbsoft_priv *adapter );
>  int wb35_start_xmit(struct sk_buff *skb, struct net_device *netdev );
> -void WBLINUX_stop(  struct wb35_adapter *adapter );
> -void WBLINUX_Destroy(  struct wb35_adapter *adapter );
> +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 wb35_adapter *adapter );
> -void WbWlanHalt(  struct wb35_adapter *adapter );
> -unsigned char WbWLanInitialize(struct wb35_adapter *adapter);
> +void WBLINUX_stop(  struct wbsoft_priv *adapter );
> +void WbWlanHalt(  struct wbsoft_priv *adapter );
> +unsigned char WbWLanInitialize(struct wbsoft_priv *adapter);
>  
>  #endif
> diff --git a/drivers/staging/winbond/wbusb.c b/drivers/staging/winbond/wbusb.c
> index d8fa9e5..a6bc78e 100644
> --- a/drivers/staging/winbond/wbusb.c
> +++ b/drivers/staging/winbond/wbusb.c
> @@ -120,7 +120,7 @@ static int wbsoft_tx(struct ieee80211_hw *dev, struct sk_buff *skb)
>  {
>  	struct wbsoft_priv *priv = dev->priv;
>  
> -	MLMESendFrame(priv->adapter, skb->data, skb->len, FRAME_TYPE_802_11_MANAGEMENT);
> +	MLMESendFrame(priv, skb->data, skb->len, FRAME_TYPE_802_11_MANAGEMENT);
>  
>  	return NETDEV_TX_OK;
>  }
> @@ -144,20 +144,20 @@ static int wbsoft_config(struct ieee80211_hw *dev, struct ieee80211_conf *conf)
>  	ch.ChanNo = 1;	/* Should use channel_num, or something, as that is already pre-translated */
>  
>  
> -	hal_set_current_channel(&priv->adapter->sHwData, ch);
> -	hal_set_beacon_period(&priv->adapter->sHwData, conf->beacon_int);
> -//	hal_set_cap_info(&priv->adapter->sHwData, ?? );
> +	hal_set_current_channel(&priv->sHwData, ch);
> +	hal_set_beacon_period(&priv->sHwData, conf->beacon_int);
> +//	hal_set_cap_info(&priv->sHwData, ?? );
>  // hal_set_ssid(phw_data_t pHwData,  u8 * pssid,  u8 ssid_len); ??
> -	hal_set_accept_broadcast(&priv->adapter->sHwData, 1);
> -	hal_set_accept_promiscuous(&priv->adapter->sHwData,  1);
> -	hal_set_accept_multicast(&priv->adapter->sHwData,  1);
> -	hal_set_accept_beacon(&priv->adapter->sHwData,  1);
> -	hal_set_radio_mode(&priv->adapter->sHwData,  0);
> +	hal_set_accept_broadcast(&priv->sHwData, 1);
> +	hal_set_accept_promiscuous(&priv->sHwData,  1);
> +	hal_set_accept_multicast(&priv->sHwData,  1);
> +	hal_set_accept_beacon(&priv->sHwData,  1);
> +	hal_set_radio_mode(&priv->sHwData,  0);
>  	//hal_set_antenna_number(  phw_data_t pHwData, u8 number )
>  	//hal_set_rf_power(phw_data_t pHwData, u8 PowerIndex)
>  
>  
> -//	hal_start_bss(&priv->adapter->sHwData, WLAN_BSSTYPE_INFRASTRUCTURE);	??
> +//	hal_start_bss(&priv->sHwData, WLAN_BSSTYPE_INFRASTRUCTURE);	??
>  
>  //void hal_set_rates(phw_data_t pHwData, u8 * pbss_rates,
>  //		   u8 length, unsigned char basic_rate_set)
> @@ -196,7 +196,6 @@ static const struct ieee80211_ops wbsoft_ops = {
>  
>  static int wb35_probe(struct usb_interface *intf, const struct usb_device_id *id_table)
>  {
> -	struct wb35_adapter *adapter;
>  	PWBUSB		pWbUsb;
>          struct usb_host_interface *interface;
>  	struct usb_endpoint_descriptor *endpoint;
> @@ -221,13 +220,14 @@ static int wb35_probe(struct usb_interface *intf, const struct usb_device_id *id
>  		goto error;
>  	}
>  
> -	adapter = kzalloc(sizeof(*adapter), GFP_KERNEL);
> -	if (!adapter) {
> -		err = -ENOMEM;
> +	dev = ieee80211_alloc_hw(sizeof(*priv), &wbsoft_ops);
> +	if (!dev)
>  		goto error;
> -	}
>  
> -	pWbUsb = &adapter->sHwData.WbUsb;
> +	priv = dev->priv;
> +	my_dev = dev;
> +
> +	pWbUsb = &priv->sHwData.WbUsb;
>  	pWbUsb->udev = udev;
>  
>          interface = intf->cur_altsetting;
> @@ -238,23 +238,14 @@ static int wb35_probe(struct usb_interface *intf, const struct usb_device_id *id
>  		pWbUsb->IsUsb20 = 1;
>  	}
>  
> -	if (!WbWLanInitialize(adapter)) {
> +	if (!WbWLanInitialize(priv)) {
>  		err = -EINVAL;
> -		goto error_free_adapter;
> +		goto error_free_hw;
>  	}
>  
> -	dev = ieee80211_alloc_hw(sizeof(*priv), &wbsoft_ops);
> -	if (!dev)
> -		goto error_free_adapter;
> -
> -	priv = dev->priv;
> -	priv->adapter = adapter;
> -
> -	my_dev = dev;
> -
>  	SET_IEEE80211_DEV(dev, &udev->dev);
>  	{
> -		phw_data_t pHwData = &adapter->sHwData;
> +		phw_data_t pHwData = &priv->sHwData;
>  		unsigned char		dev_addr[MAX_ADDR_LEN];
>  		hal_get_permanent_address(pHwData, dev_addr);
>  		SET_IEEE80211_PERM_ADDR(dev, dev_addr);
> @@ -272,14 +263,12 @@ static int wb35_probe(struct usb_interface *intf, const struct usb_device_id *id
>  	if (err)
>  		goto error_free_hw;
>  
> -	usb_set_intfdata(intf, adapter);
> +	usb_set_intfdata(intf, priv);
>  
>  	return 0;
>  
>  error_free_hw:
>  	ieee80211_free_hw(dev);
> -error_free_adapter:
> -	kfree(adapter);
>  error:
>  	usb_put_dev(udev);
>  	return err;
> @@ -315,9 +304,9 @@ void packet_came(char *pRxBufferAddress, int PacketSize)
>  
>  static void wb35_disconnect(struct usb_interface *intf)
>  {
> -	struct wb35_adapter *adapter = usb_get_intfdata(intf);
> +	struct wbsoft_priv *priv = usb_get_intfdata(intf);
>  
> -	WbWlanHalt(adapter);
> +	WbWlanHalt(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] 9+ messages in thread

* Re: [PATCH] w35und: remove global struct ieee80211_hw
  2008-10-30 14:14       ` [PATCH] w35und: remove global struct ieee80211_hw Pekka Enberg
@ 2008-10-30 19:12         ` Pavel Machek
  0 siblings, 0 replies; 9+ messages in thread
From: Pavel Machek @ 2008-10-30 19:12 UTC (permalink / raw)
  To: Pekka Enberg; +Cc: greg, linux-kernel

On Thu 2008-10-30 16:14:39, Pekka Enberg wrote:
> 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: Pavel Machek <pavel@suse.cz>

> Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
> ---
>  drivers/staging/winbond/wb35rx.c    |   29 +++++++++-----
>  drivers/staging/winbond/wb35rx_f.h  |    7 ++-
>  drivers/staging/winbond/wbhal.c     |   11 +++--
>  drivers/staging/winbond/wbhal_f.h   |    2 +-
>  drivers/staging/winbond/wblinux.c   |   73 ++++++++++++++++++-----------------
>  drivers/staging/winbond/wblinux_f.h |    3 +-
>  drivers/staging/winbond/wbusb.c     |    8 +--
>  7 files changed, 72 insertions(+), 61 deletions(-)
> 
> diff --git a/drivers/staging/winbond/wb35rx.c b/drivers/staging/winbond/wb35rx.c
> index 15a0650..cd5a8e1 100644
> --- a/drivers/staging/winbond/wb35rx.c
> +++ b/drivers/staging/winbond/wb35rx.c
> @@ -10,24 +10,29 @@
>  //============================================================================
>  #include <linux/usb.h>
>  
> +#include "core.h"
>  #include "sysdef.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;
>  
>  	// Allow only one thread to run into the Wb35Rx() function
>  	if (atomic_inc_return(&pWb35Rx->RxFireCounter) == 1) {
>  		pWb35Rx->EP3vm_state = VM_RUNNING;
> -		Wb35Rx(pHwData);
> +		Wb35Rx(hw);
>  	} else
>  		atomic_dec(&pWb35Rx->RxFireCounter);
>  }
>  
>  // 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;
>  	u8 *	pRxBufferAddress;
>  	struct urb *urb = pWb35Rx->RxUrb;
> @@ -69,7 +74,7 @@ void Wb35Rx(  phw_data_t pHwData )
>  	usb_fill_bulk_urb(urb, pHwData->WbUsb.udev,
>  			  usb_rcvbulkpipe(pHwData->WbUsb.udev, 3),
>  			  pRxBufferAddress, MAX_USB_RX_BUFFER,
> -			  Wb35Rx_Complete, pHwData);
> +			  Wb35Rx_Complete, hw);
>  
>  	pWb35Rx->EP3vm_state = VM_RUNNING;
>  
> @@ -89,7 +94,9 @@ error:
>  
>  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;
>  	u8 *		pRxBufferAddress;
>  	u32		SizeCheck;
> @@ -150,11 +157,11 @@ void Wb35Rx_Complete(struct urb *urb)
>  	pWb35Rx->RxBufferSize[ RxBufferId ] = BulkLength;
>  
>  	if (!pWb35Rx->RxOwner[ RxBufferId ])
> -		Wb35Rx_indicate(pHwData);
> +		Wb35Rx_indicate(hw);
>  
>  	kfree(pWb35Rx->pDRx);
>  	// Do the next receive
> -	Wb35Rx(pHwData);
> +	Wb35Rx(hw);
>  	return;
>  
>  error:
> @@ -257,11 +264,13 @@ void Wb35Rx_adjust(PDESCRIPTOR pRxDes)
>  	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;
>  	PWB35RX	pWb35Rx = &pHwData->Wb35Rx;
>  	u8 *		pRxBufferAddress;
> @@ -317,7 +326,7 @@ u16 Wb35Rx_indicate(phw_data_t pHwData)
>  			RxDes.buffer_total_size = RxDes.buffer_size[0];
>  			Wb35Rx_adjust(&RxDes);
>  
> -			packet_came(pRxBufferAddress, PacketSize);
> +			packet_came(hw, pRxBufferAddress, PacketSize);
>  
>  			// Move RxBuffer point to the next
>  			stmp = PacketSize + 3;
> diff --git a/drivers/staging/winbond/wb35rx_f.h b/drivers/staging/winbond/wb35rx_f.h
> index 9fb2e2a..5585b55 100644
> --- a/drivers/staging/winbond/wb35rx_f.h
> +++ b/drivers/staging/winbond/wb35rx_f.h
> @@ -1,6 +1,7 @@
>  #ifndef __WINBOND_WB35RX_F_H
>  #define __WINBOND_WB35RX_F_H
>  
> +#include <net/mac80211.h>
>  #include "wbhal_s.h"
>  
>  //====================================
> @@ -10,11 +11,11 @@ void		Wb35Rx_reset_descriptor(  phw_data_t pHwData );
>  unsigned char		Wb35Rx_initial(  phw_data_t pHwData );
>  void		Wb35Rx_destroy(  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_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);
>  
>  #endif
> diff --git a/drivers/staging/winbond/wbhal.c b/drivers/staging/winbond/wbhal.c
> index 289ca7e..d2be5fb 100644
> --- a/drivers/staging/winbond/wbhal.c
> +++ b/drivers/staging/winbond/wbhal.c
> @@ -315,9 +315,10 @@ static void hal_led_control(unsigned long data)
>  	add_timer(&pHwData->LEDTimer);
>  }
>  
> -
> -u8 hal_init_hardware(phw_data_t pHwData, struct wbsoft_priv * adapter)
> +u8 hal_init_hardware(struct ieee80211_hw *hw)
>  {
> +	struct wbsoft_priv *priv = hw->priv;
> +	phw_data_t pHwData = &priv->sHwData;
>  	u16 SoftwareSet;
>  
>  	// Initial the variable
> @@ -333,7 +334,7 @@ u8 hal_init_hardware(phw_data_t pHwData, struct wbsoft_priv * adapter)
>  				pHwData->InitialResource = 4;
>  				init_timer(&pHwData->LEDTimer);
>  				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);
>  				add_timer(&pHwData->LEDTimer);
>  
> @@ -349,8 +350,8 @@ u8 hal_init_hardware(phw_data_t pHwData, struct wbsoft_priv * adapter)
>  					return false;
>  				#endif
>  
> -				Wb35Rx_start( pHwData );
> -				Wb35Tx_EP2VM_start(adapter);
> +				Wb35Rx_start(hw);
> +				Wb35Tx_EP2VM_start(priv);
>  
>  				return true;
>  			}
> diff --git a/drivers/staging/winbond/wbhal_f.h b/drivers/staging/winbond/wbhal_f.h
> index e7a1d61..dc5709f 100644
> --- a/drivers/staging/winbond/wbhal_f.h
> +++ b/drivers/staging/winbond/wbhal_f.h
> @@ -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_set_ethernet_address(  phw_data_t pHwData,  u8 *current_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_get_power_save_mode(  phw_data_t pHwData,   u8 *pin_pwr_save );
>  void hal_set_slot_time(  phw_data_t pHwData,  u8 type );
> diff --git a/drivers/staging/winbond/wblinux.c b/drivers/staging/winbond/wblinux.c
> index 3b02aae..31f2d20 100644
> --- a/drivers/staging/winbond/wblinux.c
> +++ b/drivers/staging/winbond/wblinux.c
> @@ -85,8 +85,9 @@ WbWlanHalt(  struct wbsoft_priv * adapter )
>  }
>  
>  unsigned char
> -WbWLanInitialize(struct wbsoft_priv * adapter)
> +WbWLanInitialize(struct ieee80211_hw *hw)
>  {
> +	struct wbsoft_priv *priv = hw->priv;
>  	phw_data_t	pHwData;
>  	u8		*pMacAddr;
>  	u8		*pMacAddr2;
> @@ -97,22 +98,22 @@ WbWLanInitialize(struct wbsoft_priv * adapter)
>  	//
>  	// Setting default value for Linux
>  	//
> -	adapter->sLocalPara.region_INF = REGION_AUTO;
> -	adapter->sLocalPara.TxRateMode = RATE_AUTO;
> -	psLOCAL->bMacOperationMode = MODE_802_11_BG;	// B/G mode
> -	adapter->Mds.TxRTSThreshold = DEFAULT_RTSThreshold;
> -	adapter->Mds.TxFragmentThreshold = DEFAULT_FRAGMENT_THRESHOLD;
> -	hal_set_phy_type( &adapter->sHwData, RF_WB_242_1 );
> -	adapter->sLocalPara.MTUsize = MAX_ETHERNET_PACKET_SIZE;
> -	psLOCAL->bPreambleMode = AUTO_MODE;
> -	adapter->sLocalPara.RadioOffStatus.boSwRadioOff = false;
> -	pHwData = &adapter->sHwData;
> +	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(adapter)) {
> +	if (!WBLINUX_Initial(priv)) {
>  #ifdef _PE_USB_INI_DUMP_
>  		WBDEBUG(("[w35und]WBNDIS initialization failed\n"));
>  #endif
> @@ -120,33 +121,33 @@ WbWLanInitialize(struct wbsoft_priv * adapter)
>  	}
>  
>  	// Initial Software variable
> -	adapter->sLocalPara.ShutDowned = false;
> +	priv->sLocalPara.ShutDowned = false;
>  
>  	//added by ws for wep key error detection
> -	adapter->sLocalPara.bWepKeyError= false;
> -	adapter->sLocalPara.bToSelfPacketReceived = false;
> -	adapter->sLocalPara.WepKeyDetectTimerCount= 2 * 100; /// 2 seconds
> +	priv->sLocalPara.bWepKeyError= false;
> +	priv->sLocalPara.bToSelfPacketReceived = false;
> +	priv->sLocalPara.WepKeyDetectTimerCount= 2 * 100; /// 2 seconds
>  
>  	// Initial USB hal
>  	InitStep = 1;
> -	pHwData = &adapter->sHwData;
> -	if (!hal_init_hardware(pHwData, adapter))
> +	pHwData = &priv->sHwData;
> +	if (!hal_init_hardware(hw))
>  		goto error;
>  
>  	EEPROM_region = hal_get_region_from_EEPROM( pHwData );
>  	if (EEPROM_region != REGION_AUTO)
> -		psLOCAL->region = EEPROM_region;
> +		priv->sLocalPara.region = EEPROM_region;
>  	else {
> -		if (psLOCAL->region_INF != REGION_AUTO)
> -			psLOCAL->region = psLOCAL->region_INF;
> +		if (priv->sLocalPara.region_INF != REGION_AUTO)
> +			priv->sLocalPara.region = priv->sLocalPara.region_INF;
>  		else
> -			psLOCAL->region = REGION_USA;	//default setting
> +			priv->sLocalPara.region = REGION_USA;	//default setting
>  	}
>  
>  	// Get Software setting flag from hal
> -	adapter->sLocalPara.boAntennaDiversity = false;
> +	priv->sLocalPara.boAntennaDiversity = false;
>  	if (hal_software_set(pHwData) & 0x00000001)
> -		adapter->sLocalPara.boAntennaDiversity = true;
> +		priv->sLocalPara.boAntennaDiversity = true;
>  
>  	//
>  	// For TS module
> @@ -155,7 +156,7 @@ WbWLanInitialize(struct wbsoft_priv * adapter)
>  
>  	// For MDS module
>  	InitStep = 3;
> -	Mds_initial(adapter);
> +	Mds_initial(priv);
>  
>  	//=======================================
>  	// Initialize the SME, SCAN, MLME, ROAM
> @@ -165,18 +166,18 @@ WbWLanInitialize(struct wbsoft_priv * adapter)
>  	InitStep = 6;
>  
>  	// If no user-defined address in the registry, use the addresss "burned" on the NIC instead.
> -	pMacAddr = adapter->sLocalPara.ThisMacAddress;
> -	pMacAddr2 = adapter->sLocalPara.PermanentAddress;
> -	hal_get_permanent_address( pHwData, adapter->sLocalPara.PermanentAddress );// Reading ethernet address from EEPROM
> +	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, adapter->sLocalPara.ThisMacAddress);
> +		hal_set_ethernet_address(pHwData, priv->sLocalPara.ThisMacAddress);
>  	}
>  
>  	//get current antenna
> -	psLOCAL->bAntennaNo = hal_get_antenna_number(pHwData);
> +	priv->sLocalPara.bAntennaNo = hal_get_antenna_number(pHwData);
>  #ifdef _PE_STATE_DUMP_
>  	WBDEBUG(("Driver init, antenna no = %d\n", psLOCAL->bAntennaNo));
>  #endif
> @@ -186,25 +187,25 @@ WbWLanInitialize(struct wbsoft_priv * adapter)
>  	while (!hal_idle(pHwData))
>  		msleep(10);
>  
> -	MTO_Init(adapter);
> +	MTO_Init(priv);
>  
>  	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.
>  	//set a tx power for reference.....
> -//	sme_set_tx_power_level(adapter, 12);	FIXME?
> +//	sme_set_tx_power_level(priv, 12);	FIXME?
>  	return true;
>  
>  error:
>  	switch (InitStep) {
>  	case 5:
>  	case 4:
> -	case 3: Mds_Destroy( adapter );
> +	case 3: Mds_Destroy( priv );
>  	case 2:
> -	case 1: WBLINUX_Destroy( adapter );
> +	case 1: WBLINUX_Destroy( priv );
>  		hal_halt( pHwData, NULL );
>  	case 0: break;
>  	}
> diff --git a/drivers/staging/winbond/wblinux_f.h b/drivers/staging/winbond/wblinux_f.h
> index 4b786fc..15e6a65 100644
> --- a/drivers/staging/winbond/wblinux_f.h
> +++ b/drivers/staging/winbond/wblinux_f.h
> @@ -17,6 +17,7 @@ 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 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 a6bc78e..40bb77c 100644
> --- a/drivers/staging/winbond/wbusb.c
> +++ b/drivers/staging/winbond/wbusb.c
> @@ -45,7 +45,6 @@ static struct ieee80211_supported_band wbsoft_band_2GHz = {
>  };
>  
>  int wbsoft_enabled;
> -struct ieee80211_hw *my_dev;
>  
>  static int wbsoft_add_interface(struct ieee80211_hw *dev,
>  				 struct ieee80211_if_init_conf *conf)
> @@ -225,7 +224,6 @@ static int wb35_probe(struct usb_interface *intf, const struct usb_device_id *id
>  		goto error;
>  
>  	priv = dev->priv;
> -	my_dev = dev;
>  
>  	pWbUsb = &priv->sHwData.WbUsb;
>  	pWbUsb->udev = udev;
> @@ -238,7 +236,7 @@ static int wb35_probe(struct usb_interface *intf, const struct usb_device_id *id
>  		pWbUsb->IsUsb20 = 1;
>  	}
>  
> -	if (!WbWLanInitialize(priv)) {
> +	if (!WbWLanInitialize(dev)) {
>  		err = -EINVAL;
>  		goto error_free_hw;
>  	}
> @@ -274,7 +272,7 @@ error:
>  	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 ieee80211_rx_status rx_status = {0};
> @@ -299,7 +297,7 @@ void packet_came(char *pRxBufferAddress, int PacketSize)
>  	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)

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2008-10-30 19:11 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-10-30 14:14 [PATCH] w35und: move struct wbsoft_priv to core.h and use it Pekka Enberg
2008-10-30 14:14 ` [PATCH] w35und: remove ->adapter from struct _HW_DATA_T Pekka Enberg
2008-10-30 14:14   ` [PATCH] w35und: clean up adapter.h a bit Pekka Enberg
2008-10-30 14:14     ` [PATCH] w35und: merge struct wb35_adapter to struct wbsoft_priv Pekka Enberg
2008-10-30 14:14       ` [PATCH] w35und: remove global struct ieee80211_hw Pekka Enberg
2008-10-30 19:12         ` Pavel Machek
2008-10-30 19:11       ` [PATCH] w35und: merge struct wb35_adapter to struct wbsoft_priv Pavel Machek
2008-10-30 19:10     ` [PATCH] w35und: clean up adapter.h a bit Pavel Machek
2008-10-30 19:09   ` [PATCH] w35und: remove ->adapter from struct _HW_DATA_T Pavel Machek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).