libertas: add access functions for mesh open/connect status
authorHolger Schurig <holgerschurig@googlemail.com>
Wed, 2 Dec 2009 14:26:01 +0000 (15:26 +0100)
committerJohn W. Linville <linville@tuxdriver.com>
Tue, 22 Dec 2009 18:38:29 +0000 (13:38 -0500)
Signed-off-by: Holger Schurig <holgerschurig@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/libertas/cmd.c
drivers/net/wireless/libertas/main.c
drivers/net/wireless/libertas/mesh.c
drivers/net/wireless/libertas/mesh.h
drivers/net/wireless/libertas/scan.c
drivers/net/wireless/libertas/tx.c
drivers/net/wireless/libertas/wext.c

index dd69191f24ebdda99fe7a961938c1e17d3c3f2c2..4a198113f9be004f7e4a64f855de91cad409d5f7 100644 (file)
@@ -1304,7 +1304,7 @@ int lbs_execute_next_command(struct lbs_private *priv)
                if ((priv->psmode != LBS802_11POWERMODECAM) &&
                    (priv->psstate == PS_STATE_FULL_POWER) &&
                    ((priv->connect_status == LBS_CONNECTED) ||
-                   (priv->mesh_connect_status == LBS_CONNECTED))) {
+                   lbs_mesh_connected(priv))) {
                        if (priv->secinfo.WPAenabled ||
                            priv->secinfo.WPA2enabled) {
                                /* check for valid WPA group keys */
index 127b7f60c320bbad99fd875dec6f569dde098e57..64b327d4548bba5f5f3e8a7cfac6e4e4505e5cbf 100644 (file)
@@ -123,7 +123,7 @@ static ssize_t lbs_rtap_set(struct device *dev,
                if (priv->monitormode == monitor_mode)
                        return strlen(buf);
                if (!priv->monitormode) {
-                       if (priv->infra_open || priv->mesh_open)
+                       if (priv->infra_open || lbs_mesh_open(priv))
                                return -EBUSY;
                        if (priv->mode == IW_MODE_INFRA)
                                lbs_cmd_80211_deauthenticate(priv,
@@ -619,7 +619,7 @@ static int lbs_thread(void *data)
                                if (priv->connect_status == LBS_CONNECTED)
                                        netif_wake_queue(priv->dev);
                                if (priv->mesh_dev &&
-                                   priv->mesh_connect_status == LBS_CONNECTED)
+                                   lbs_mesh_connected(priv))
                                        netif_wake_queue(priv->mesh_dev);
                        }
                }
@@ -833,7 +833,6 @@ static int lbs_init_adapter(struct lbs_private *priv)
        memset(priv->current_addr, 0xff, ETH_ALEN);
 
        priv->connect_status = LBS_DISCONNECTED;
-       priv->mesh_connect_status = LBS_DISCONNECTED;
        priv->secinfo.auth_mode = IW_AUTH_ALG_OPEN_SYSTEM;
        priv->mode = IW_MODE_INFRA;
        priv->channel = DEFAULT_AD_HOC_CHANNEL;
index 4f67c8b62edc2bc13ad425195012b3412d126ded..954cd00f74526e19d917c301f0c67d9e8f4a6876 100644 (file)
@@ -1,4 +1,3 @@
-#include <linux/moduleparam.h>
 #include <linux/delay.h>
 #include <linux/etherdevice.h>
 #include <linux/netdevice.h>
@@ -196,6 +195,8 @@ int lbs_init_mesh(struct lbs_private *priv)
 
        lbs_deb_enter(LBS_DEB_MESH);
 
+       priv->mesh_connect_status = LBS_DISCONNECTED;
+
        /* Determine mesh_fw_ver from fwrelease and fwcapinfo */
        /* 5.0.16p0 9.0.0.p0 is known to NOT support any mesh */
        /* 5.110.22 have mesh command with 0xa3 command id */
index b642d5d116999782b236fbc6e6133bce7cc841ce..388c39281b7d017cf4e595a1b218b2507fc8a122 100644 (file)
@@ -84,4 +84,10 @@ void lbs_mesh_ethtool_get_strings(struct net_device *dev,
        uint32_t stringset, uint8_t *s);
 
 
+/* Accessors */
+
+#define lbs_mesh_open(priv) (priv->mesh_open)
+#define lbs_mesh_connected(priv) (priv->mesh_connect_status == LBS_CONNECTED)
+
+
 #endif
index c6a6c042b82f66acddc00fe02e9f4e523d11b600..4a0c3e3cd3b1bbf4e731e31f2d734199c415f0db 100644 (file)
@@ -640,7 +640,7 @@ out:
                if (!priv->tx_pending_len)
                        netif_wake_queue(priv->dev);
        }
-       if (priv->mesh_dev && (priv->mesh_connect_status == LBS_CONNECTED)) {
+       if (priv->mesh_dev && lbs_mesh_connected(priv)) {
                netif_carrier_on(priv->mesh_dev);
                if (!priv->tx_pending_len)
                        netif_wake_queue(priv->mesh_dev);
index 315d1ce286caa1d4c0939ffa30304b4775e2b07d..52d244ea3d972809f7a528d8077dea7262879505 100644 (file)
@@ -198,7 +198,7 @@ void lbs_send_tx_feedback(struct lbs_private *priv, u32 try_count)
        if (priv->connect_status == LBS_CONNECTED)
                netif_wake_queue(priv->dev);
 
-       if (priv->mesh_dev && (priv->mesh_connect_status == LBS_CONNECTED))
+       if (priv->mesh_dev && lbs_mesh_connected(priv))
                netif_wake_queue(priv->mesh_dev);
 }
 EXPORT_SYMBOL_GPL(lbs_send_tx_feedback);
index a8eb9e1fcf36ac7cca8cd3c4965af40f1454f310..c0c7bc40b1098f4e6b44545b86ee0f957acbfe28 100644 (file)
@@ -192,7 +192,7 @@ static void copy_active_data_rates(struct lbs_private *priv, u8 *rates)
        lbs_deb_enter(LBS_DEB_WEXT);
 
        if ((priv->connect_status != LBS_CONNECTED) &&
-               (priv->mesh_connect_status != LBS_CONNECTED))
+               !lbs_mesh_connected(priv))
                memcpy(rates, lbs_bg_rates, MAX_RATES);
        else
                memcpy(rates, priv->curbssparams.rates, MAX_RATES);
@@ -307,7 +307,7 @@ static int mesh_get_nick(struct net_device *dev, struct iw_request_info *info,
 
        /* Use nickname to indicate that mesh is on */
 
-       if (priv->mesh_connect_status == LBS_CONNECTED) {
+       if (lbs_mesh_connected(priv)) {
                strncpy(extra, "Mesh", 12);
                extra[12] = '\0';
                dwrq->length = strlen(extra);
@@ -863,7 +863,7 @@ static struct iw_statistics *lbs_get_wireless_stats(struct net_device *dev)
 
        /* If we're not associated, all quality values are meaningless */
        if ((priv->connect_status != LBS_CONNECTED) &&
-           (priv->mesh_connect_status != LBS_CONNECTED))
+           !lbs_mesh_connected(priv))
                goto out;
 
        /* Quality by RSSI */