LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Pekka Enberg <penberg@cs.helsinki.fi>
To: greg@kroah.com
Cc: linux-kernel@vger.kernel.org,
	Pekka Enberg <penberg@cs.helsinki.fi>,
	Pavel Machek <pavel@suse.cz>
Subject: [PATCH] w35und: move struct wbsoft_priv to core.h and use it
Date: Thu, 30 Oct 2008 16:14:35 +0200	[thread overview]
Message-ID: <1225376079-9592-1-git-send-email-penberg@cs.helsinki.fi> (raw)
In-Reply-To: <>

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


             reply	other threads:[~2008-10-30 14:14 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-30 14:14 Pekka Enberg [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1225376079-9592-1-git-send-email-penberg@cs.helsinki.fi \
    --to=penberg@cs.helsinki.fi \
    --cc=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pavel@suse.cz \
    --subject='Re: [PATCH] w35und: move struct wbsoft_priv to core.h and use it' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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).