[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1225376079-9592-1-git-send-email-penberg@cs.helsinki.fi>
Date: Thu, 30 Oct 2008 16:14:35 +0200
From: Pekka Enberg <penberg@...helsinki.fi>
To: greg@...ah.com
Cc: linux-kernel@...r.kernel.org,
Pekka Enberg <penberg@...helsinki.fi>,
Pavel Machek <pavel@...e.cz>
Subject: [PATCH] w35und: move struct wbsoft_priv to core.h and use it
This patch removes my_adapter global variable from wbusb.c by adding a
->adapter member to struct wbsoft_priv.
Cc: Pavel Machek <pavel@...e.cz>
Signed-off-by: Pekka Enberg <penberg@...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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists