Staging: Drop memory allocation cast
[safe/jmp/linux-2.6] / drivers / staging / vt6656 / wpactl.c
index 9345459..8f7ad2c 100644 (file)
  *
  */
 
-
-#if !defined(__WPACTL_H__)
 #include "wpactl.h"
-#endif
-#if !defined(__KEY_H__)
 #include "key.h"
-#endif
-#if !defined(__MAC_H__)
 #include "mac.h"
-#endif
-#if !defined(__DEVICE_H__)
 #include "device.h"
-#endif
-#if !defined(__WMGR_H__)
 #include "wmgr.h"
-#endif
-#if !defined(__IOCMD_H__)
 #include "iocmd.h"
-#endif
-#if !defined(__IOWPA_H__)
 #include "iowpa.h"
-#endif
-#if !defined(__CONTROL_H__)
 #include "control.h"
-#endif
-#if !defined(__RNDIS_H__)
 #include "rndis.h"
-#endif
-//2008-0717-05, <Add> by James
-#if !defined(__RF_H__)
 #include "rf.h"
-#endif
 
 /*---------------------  Static Definitions -------------------------*/
 
@@ -115,15 +93,17 @@ static void wpadev_setup(struct net_device *dev)
 
 static int wpa_init_wpadev(PSDevice pDevice)
 {
+    PSDevice wpadev_priv;
        struct net_device *dev = pDevice->dev;
          int ret=0;
 
-       pDevice->wpadev = alloc_netdev(0, "vntwpa", wpadev_setup);
+       pDevice->wpadev = alloc_netdev(sizeof(PSDevice), "vntwpa", wpadev_setup);
        if (pDevice->wpadev == NULL)
                return -ENOMEM;
 
-       pDevice->wpadev->priv = pDevice;
-       memcpy(pDevice->wpadev->dev_addr, dev->dev_addr, U_ETHER_ADDR_LEN);
+    wpadev_priv = netdev_priv(pDevice->wpadev);
+    *wpadev_priv = *pDevice;
+       memcpy(pDevice->wpadev->dev_addr, dev->dev_addr, ETH_ALEN);
          pDevice->wpadev->base_addr = dev->base_addr;
        pDevice->wpadev->irq = dev->irq;
        pDevice->wpadev->mem_start = dev->mem_start;
@@ -509,7 +489,7 @@ static int wpa_set_disassociate(PSDevice pDevice,
     spin_lock_irq(&pDevice->lock);
     if (pDevice->bLinkPass) {
         if (!memcmp(param->addr, pMgmt->abyCurrBSSID, 6))
-            bScheduleCommand((HANDLE)pDevice, WLAN_CMD_DISASSOCIATE, NULL);
+               bScheduleCommand((void *) pDevice, WLAN_CMD_DISASSOCIATE, NULL);
     }
     spin_unlock_irq(&pDevice->lock);
 
@@ -533,7 +513,7 @@ static int wpa_set_disassociate(PSDevice pDevice,
  */
 
 static int wpa_set_scan(PSDevice pDevice,
-                                    struct viawget_wpa_param *param)
+                       struct viawget_wpa_param *param)
 {
        int ret = 0;
 
@@ -551,9 +531,11 @@ memcpy(pItemSSID->abySSID, param->u.scan_req.ssid, param->u.scan_req.ssid_len);
 pItemSSID->len = param->u.scan_req.ssid_len;
 
     spin_lock_irq(&pDevice->lock);
-    BSSvClearBSSList((HANDLE)pDevice, pDevice->bLinkPass);
-  //  bScheduleCommand((HANDLE) pDevice, WLAN_CMD_BSSID_SCAN, NULL);
-        bScheduleCommand((HANDLE) pDevice, WLAN_CMD_BSSID_SCAN, pMgmt->abyDesireSSID);
+    BSSvClearBSSList((void *) pDevice, pDevice->bLinkPass);
+    /* bScheduleCommand((void *) pDevice, WLAN_CMD_BSSID_SCAN, NULL); */
+    bScheduleCommand((void *) pDevice,
+                    WLAN_CMD_BSSID_SCAN,
+                    pMgmt->abyDesireSSID);
     spin_unlock_irq(&pDevice->lock);
 
     return ret;
@@ -906,12 +888,14 @@ static int wpa_set_associate(PSDevice pDevice,
 
     if (pCurr == NULL){
     printk("wpa_set_associate---->hidden mode site survey before associate.......\n");
-    bScheduleCommand((HANDLE) pDevice, WLAN_CMD_BSSID_SCAN, pMgmt->abyDesireSSID);
+    bScheduleCommand((void *) pDevice,
+                    WLAN_CMD_BSSID_SCAN,
+                    pMgmt->abyDesireSSID);
   };
 }
 /****************************************************************/
 
-    bScheduleCommand((HANDLE) pDevice, WLAN_CMD_SSID, NULL);
+    bScheduleCommand((void *) pDevice, WLAN_CMD_SSID, NULL);
     spin_unlock_irq(&pDevice->lock);
 
     return ret;
@@ -942,7 +926,7 @@ int wpa_ioctl(PSDevice pDevice, struct iw_point *p)
            p->length > VIAWGET_WPA_MAX_BUF_SIZE || !p->pointer)
                return -EINVAL;
 
-       param = (struct viawget_wpa_param *) kmalloc((int)p->length, (int)GFP_KERNEL);
+       param = kmalloc((int)p->length, (int)GFP_KERNEL);
        if (param == NULL)
                return -ENOMEM;