]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
staging: vt6656: mac80211 conversion: add vnt_init to bScheduleCommand
authorMalcolm Priestley <tvboxspy@gmail.com>
Wed, 25 Jun 2014 20:14:27 +0000 (21:14 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 27 Jun 2014 00:21:19 +0000 (20:21 -0400)
start driver by linking vnt_init to vt6656_probe use bScheduleCommand
to schedule new command WLAN_CMD_INIT_MAC80211

vResetCommandTimer is now used to initiate command timer.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/vt6656/device.h
drivers/staging/vt6656/main_usb.c
drivers/staging/vt6656/wcmd.c
drivers/staging/vt6656/wcmd.h

index 46d7704a1e2b2adcc2ad8c971572c35371c2f5c9..46584c76bcdf18fafd7ffb2c74cb29a7930ff982 100644 (file)
@@ -397,6 +397,7 @@ struct vnt_private {
        /* mac80211 */
        struct ieee80211_hw *hw;
        struct ieee80211_vif *vif;
+       u8 mac_hw;
        /* netdev */
        struct usb_device *usb;
        struct net_device *dev;
@@ -744,5 +745,6 @@ struct vnt_private {
 
 int device_alloc_frag_buf(struct vnt_private *, PSDeFragControlBlock pDeF);
 void vnt_configure_filter(struct vnt_private *);
+int vnt_init(struct vnt_private *priv);
 
 #endif
index 663ea0cade2201862b9516a5eb82407326d1706d..ee63390b980b2c7c76af45d8b4d7a9f127e51837 100644 (file)
@@ -1383,6 +1383,8 @@ int vnt_init(struct vnt_private *priv)
        if (ieee80211_register_hw(priv->hw))
                return -ENODEV;
 
+       priv->mac_hw = true;
+
        return 0;
 }
 
@@ -1443,6 +1445,11 @@ vt6656_probe(struct usb_interface *intf, const struct usb_device_id *id)
 
        usb_device_reset(priv);
 
+       MP_CLEAR_FLAG(priv, fMP_DISCONNECTED);
+       vResetCommandTimer(priv);
+
+       bScheduleCommand(priv, WLAN_CMD_INIT_MAC80211, NULL);
+
        return 0;
 
 err_nomem:
@@ -1458,7 +1465,8 @@ static void vt6656_disconnect(struct usb_interface *intf)
        if (!priv)
                return;
 
-       ieee80211_unregister_hw(priv->hw);
+       if (priv->mac_hw)
+               ieee80211_unregister_hw(priv->hw);
 
        usb_set_intfdata(intf, NULL);
        usb_put_dev(interface_to_usbdev(intf));
index 4c3790857d3de8a6d961773eb99445334e791a05..85adc1cd33c16954814606ea99a526992757f849 100644 (file)
@@ -287,7 +287,20 @@ void vRunCommand(struct work_struct *work)
                return;
 
        switch (pDevice->eCommandState) {
+       case WLAN_CMD_INIT_MAC80211_START:
+               if (pDevice->mac_hw)
+                       break;
+
+               dev_info(&pDevice->usb->dev, "Starting mac80211\n");
+
+               if (vnt_init(pDevice)) {
+                       /* If fail all ends TODO retry */
+                       dev_err(&pDevice->usb->dev, "failed to start\n");
+                       ieee80211_free_hw(pDevice->hw);
+                       return;
+               }
 
+               break;
        case WLAN_CMD_SCAN_START:
 
                pDevice->byReAssocCount = 0;
@@ -915,6 +928,10 @@ static int s_bCommandComplete(struct vnt_private *pDevice)
                pDevice->cbFreeCmdQueue++;
                pDevice->bCmdRunning = true;
                switch (pDevice->eCommand) {
+               case WLAN_CMD_INIT_MAC80211:
+                       pDevice->eCommandState = WLAN_CMD_INIT_MAC80211_START;
+                       break;
+
                case WLAN_CMD_BSSID_SCAN:
                        DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"eCommandState= WLAN_CMD_BSSID_SCAN\n");
                        pDevice->eCommandState = WLAN_CMD_SCAN_START;
@@ -1083,8 +1100,6 @@ static int s_bClearBSSID_SCAN(struct vnt_private *pDevice)
 //mike add:reset command timer
 void vResetCommandTimer(struct vnt_private *pDevice)
 {
-       cancel_delayed_work_sync(&pDevice->run_command_work);
-
        pDevice->cbFreeCmdQueue = CMD_Q_SIZE;
        pDevice->uCmdDequeueIdx = 0;
        pDevice->uCmdEnqueueIdx = 0;
index 736572101badce8191ec58b9f744f95cce8a282f..894eea16e378be4fa25f25ce5b9d6a3dfd7f0bfc 100644 (file)
@@ -37,6 +37,7 @@
 
 // Command code
 typedef enum tagCMD_CODE {
+    WLAN_CMD_INIT_MAC80211,
     WLAN_CMD_BSSID_SCAN,
     WLAN_CMD_SSID,
     WLAN_CMD_DISASSOCIATE,
@@ -78,6 +79,7 @@ typedef struct tagCMD_ITEM {
 
 // Command state
 typedef enum tagCMD_STATE {
+    WLAN_CMD_INIT_MAC80211_START,
     WLAN_CMD_SCAN_START,
     WLAN_CMD_SCAN_END,
     WLAN_CMD_DISASSOCIATE_START,