Staging: vt665x: 64bit compile fixes Part 1
authorJim Lieb <lieb@canonical.com>
Fri, 24 Jul 2009 00:20:49 +0000 (17:20 -0700)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 15 Sep 2009 19:02:06 +0000 (12:02 -0700)
Fix compile problems with 64bit.  These issues could cause corrupted
address crashes.  In the process, replaced some definitions to use more
portable kernel types.

Signed-off-by: Jim Lieb <lieb@canonical.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/staging/vt6655/IEEE11h.c
drivers/staging/vt6655/bssdb.c
drivers/staging/vt6655/device_main.c
drivers/staging/vt6655/dpc.c
drivers/staging/vt6655/hostap.c
drivers/staging/vt6655/tmacro.h
drivers/staging/vt6655/wmgr.c
drivers/staging/vt6655/wpa.c

index 5f25b8e88bd9abc4894a85ca8e5b05dbd658e97f..b0f4eb5af891897b87218b6d31547c56ffb0ee5c 100644 (file)
@@ -120,13 +120,13 @@ typedef struct _WLAN_FRAME_TPCREP {
 /*---------------------  Static Functions  --------------------------*/
 static BOOL s_bRxMSRReq(PSMgmtObject pMgmt, PWLAN_FRAME_MSRREQ pMSRReq, UINT uLength)
 {
-    UINT    uNumOfEIDs = 0;
+    size_t    uNumOfEIDs = 0;
     BOOL    bResult = TRUE;
 
     if (uLength <= WLAN_A3FR_MAXLEN) {
         MEMvCopy(pMgmt->abyCurrentMSRReq, pMSRReq, uLength);
     }
-    uNumOfEIDs = ((uLength - OFFSET(WLAN_FRAME_MSRREQ, sMSRReqEIDs))/ (sizeof(WLAN_IE_MEASURE_REQ)));
+    uNumOfEIDs = ((uLength - offsetof(WLAN_FRAME_MSRREQ, sMSRReqEIDs))/ (sizeof(WLAN_IE_MEASURE_REQ)));
     pMgmt->pCurrMeasureEIDRep = &(((PWLAN_FRAME_MSRREP) (pMgmt->abyCurrentMSRRep))->sMSRRepEIDs[0]);
     pMgmt->uLengthOfRepEIDs = 0;
     bResult = CARDbStartMeasure(pMgmt->pAdapter,
@@ -291,7 +291,7 @@ BOOL IEEE11hbMSRRepTx (
 {
     PSMgmtObject            pMgmt = (PSMgmtObject) pMgmtHandle;
     PWLAN_FRAME_MSRREP      pMSRRep = (PWLAN_FRAME_MSRREP) (pMgmt->abyCurrentMSRRep + sizeof(STxMgmtPacket));
-    UINT                    uLength = 0;
+    size_t                    uLength = 0;
     PSTxMgmtPacket          pTxPacket = NULL;
 
     pTxPacket = (PSTxMgmtPacket)pMgmt->abyCurrentMSRRep;
@@ -311,7 +311,7 @@ BOOL IEEE11hbMSRRepTx (
     pMSRRep->byAction = 1;
     pMSRRep->byDialogToken = ((PWLAN_FRAME_MSRREQ) (pMgmt->abyCurrentMSRReq))->byDialogToken;
 
-    uLength = pMgmt->uLengthOfRepEIDs + OFFSET(WLAN_FRAME_MSRREP, sMSRRepEIDs);
+    uLength = pMgmt->uLengthOfRepEIDs + offsetof(WLAN_FRAME_MSRREP, sMSRRepEIDs);
 
     pTxPacket->cbMPDULen = uLength;
     pTxPacket->cbPayloadLen = uLength - WLAN_HDR_ADDR3_LEN;
index 746fadcffe8a747d77bca3d5a8b7a6ae37e7cff0..6eb0798d58d8f0b5e724d6281733985f3db1747e 100644 (file)
@@ -1335,7 +1335,7 @@ start:
              wpahdr->req_ie_len = 0;
              skb_put(pDevice->skb, sizeof(viawget_wpa_header));
              pDevice->skb->dev = pDevice->wpadev;
-             pDevice->skb->mac_header = pDevice->skb->data;
+            skb_reset_mac_header(pDevice->skb);
              pDevice->skb->pkt_type = PACKET_HOST;
              pDevice->skb->protocol = htons(ETH_P_802_2);
              memset(pDevice->skb->cb, 0, sizeof(pDevice->skb->cb));
index cb5fce2702a3727d57edf3e66eb009ae34a656c4..fe9cc783dc781cc036ffa6aa38e0c0b8236b052e 100644 (file)
@@ -332,9 +332,9 @@ static CHIP_INFO chip_info_table[]= {
     {0,NULL}
 };
 
-static struct pci_device_id device_id_table[] __devinitdata = {
-{ 0x1106, 0x3253, PCI_ANY_ID, PCI_ANY_ID, 0, 0, (long)&chip_info_table[0]},
-{ 0, }
+DEFINE_PCI_DEVICE_TABLE(device_id_table) = {
+       { PCI_VDEVICE(VIA, 0x3253), (kernel_ulong_t)chip_info_table},
+       { 0, }
 };
 
 /*---------------------  Static Functions  --------------------------*/
@@ -405,7 +405,7 @@ static char* get_chip_name(int chip_id) {
     return chip_info_table[i].name;
 }
 
-static void __devexit device_remove1(struct pci_dev *pcid)
+static void device_remove1(struct pci_dev *pcid)
 {
     PSDevice pDevice=pci_get_drvdata(pcid);
 
@@ -928,7 +928,7 @@ static BOOL device_release_WPADEV(PSDevice pDevice)
                  wpahdr->req_ie_len = 0;
                  skb_put(pDevice->skb, sizeof(viawget_wpa_header));
                  pDevice->skb->dev = pDevice->wpadev;
-                 pDevice->skb->mac_header = pDevice->skb->data;
+                skb_reset_mac_header(pDevice->skb);
                  pDevice->skb->pkt_type = PACKET_HOST;
                  pDevice->skb->protocol = htons(ETH_P_802_2);
                  memset(pDevice->skb->cb, 0, sizeof(pDevice->skb->cb));
@@ -1678,8 +1678,8 @@ static BOOL device_alloc_rx_buf(PSDevice pDevice, PSRxDesc pRD) {
         return FALSE;
     ASSERT(pRDInfo->skb);
     pRDInfo->skb->dev = pDevice->dev;
-    pRDInfo->skb_dma = pci_map_single(pDevice->pcid, pRDInfo->skb->tail, pDevice->rx_buf_sz,
-                        PCI_DMA_FROMDEVICE);
+    pRDInfo->skb_dma = pci_map_single(pDevice->pcid, skb_tail_pointer(pRDInfo->skb),
+                                     pDevice->rx_buf_sz, PCI_DMA_FROMDEVICE);
     *((PU32) &(pRD->m_rd0RD0)) = 0;
 
     pRD->m_rd0RD0.wResCount = cpu_to_le16(pDevice->rx_buf_sz);
@@ -1775,7 +1775,7 @@ static int device_tx_srv(PSDevice pDevice, UINT uIdx) {
                     DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "tx call back netif.. \n");
                     skb = pTD->pTDInfo->skb;
                        skb->dev = pDevice->apdev;
-                               skb->mac_header = skb->data;
+                       skb_reset_mac_header(skb);
                        skb->pkt_type = PACKET_OTHERHOST;
                    //skb->protocol = htons(ETH_P_802_2);
                        memset(skb->cb, 0, sizeof(skb->cb));
@@ -1940,6 +1940,10 @@ INT MlmeThread(
 static int  device_open(struct net_device *dev) {
     PSDevice    pDevice=(PSDevice) netdev_priv(dev);
     int i;
+#ifdef WPA_SM_Transtatus
+    extern SWPAResult wpa_Result;
+#endif
+
     pDevice->rx_buf_sz = PKT_BUF_SZ;
     if (!device_init_rings(pDevice)) {
         return -ENOMEM;
@@ -1950,7 +1954,6 @@ static int  device_open(struct net_device *dev) {
         return i;
        //printk("DEBUG1\n");
 #ifdef WPA_SM_Transtatus
-     extern SWPAResult wpa_Result;
      memset(wpa_Result.ifname,0,sizeof(wpa_Result.ifname));
      wpa_Result.proto = 0;
      wpa_Result.key_mgmt = 0;
index 11611982a990abdb5c0680a3e9f01841e40cfb05..a3abce98df0aa9aaf33c40593e54d67a6837d147 100644 (file)
@@ -680,7 +680,7 @@ device_receive_frame (
                    skb->data += 4;
                    skb->tail += 4;
                      skb_put(skb, FrameSize);
-                   skb->mac_header = skb->data;
+               skb_reset_mac_header(skb);
                    skb->pkt_type = PACKET_OTHERHOST;
                skb->protocol = htons(ETH_P_802_2);
                    memset(skb->cb, 0, sizeof(skb->cb));
@@ -810,7 +810,7 @@ device_receive_frame (
             skb->data +=  (cbIVOffset + 4);
             skb->tail +=  (cbIVOffset + 4);
             skb_put(skb, FrameSize);
-           skb->mac_header = skb->data;
+           skb_reset_mac_header(skb);
 
        skb->pkt_type = PACKET_OTHERHOST;
             skb->protocol = htons(ETH_P_802_2);
@@ -932,7 +932,7 @@ device_receive_frame (
                      wpahdr->req_ie_len = 0;
                      skb_put(pDevice->skb, sizeof(viawget_wpa_header));
                      pDevice->skb->dev = pDevice->wpadev;
-                     pDevice->skb->mac_header = pDevice->skb->data;
+                    skb_reset_mac_header(pDevice->skb);
                      pDevice->skb->pkt_type = PACKET_HOST;
                      pDevice->skb->protocol = htons(ETH_P_802_2);
                      memset(pDevice->skb->cb, 0, sizeof(pDevice->skb->cb));
index 3788c9422294a22c850d27653c7f8a9540b5fdf4..bf15e266ffe969f4bd4beb4e010a13e4e04710ae 100644 (file)
@@ -103,6 +103,9 @@ static int hostap_enable_hostapd(PSDevice pDevice, int rtnl_locked)
     PSDevice apdev_priv;
        struct net_device *dev = pDevice->dev;
        int ret;
+       const struct net_device_ops apdev_netdev_ops = {
+               .ndo_start_xmit         = pDevice->tx_80211,
+       };
 
     DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%s: Enabling hostapd mode\n", dev->name);
 
@@ -115,9 +118,6 @@ static int hostap_enable_hostapd(PSDevice pDevice, int rtnl_locked)
     *apdev_priv = *pDevice;
        memcpy(pDevice->apdev->dev_addr, dev->dev_addr, ETH_ALEN);
 
-    const struct net_device_ops apdev_netdev_ops = {
-        .ndo_start_xmit         = pDevice->tx_80211,
-    };
     pDevice->apdev->netdev_ops = &apdev_netdev_ops;
 
        pDevice->apdev->type = ARPHRD_IEEE80211;
index 3d932a258dd196986fe3bd7e4e688cb4d861d9f5..b0933d866c6374e011563dc5e4276bb5837092ed 100644 (file)
 
 /****** Misc macros ********************************************************/
 
-// get the field offset in the type(struct, class, ...)
-#define OFFSET(type, field) ((int)(&((type NEAR*)1)->field)-1)
-
-
 /* string equality shorthand */
 #define STR_EQ(x, y)        (strcmp(x, y) == 0)
 #define STR_NE(x, y)        (strcmp(x, y) != 0)
index c0886edac789fb9c448d8bb61eb7b192f8fd447e..6b3bf074620236fdebda38c57b2ca0be34429bc2 100644 (file)
@@ -1125,7 +1125,7 @@ s_vMgrRxAssocResponse(
                        );
                 skb_put(pDevice->skb, sizeof(viawget_wpa_header) + wpahdr->resp_ie_len + wpahdr->req_ie_len);
                 pDevice->skb->dev = pDevice->wpadev;
-                pDevice->skb->mac_header = pDevice->skb->data;
+               skb_reset_mac_header(pDevice->skb);
                 pDevice->skb->pkt_type = PACKET_HOST;
                 pDevice->skb->protocol = htons(ETH_P_802_2);
                 memset(pDevice->skb->cb, 0, sizeof(pDevice->skb->cb));
@@ -1761,7 +1761,7 @@ s_vMgrRxDisassociation(
              wpahdr->req_ie_len = 0;
              skb_put(pDevice->skb, sizeof(viawget_wpa_header));
              pDevice->skb->dev = pDevice->wpadev;
-                pDevice->skb->mac_header = pDevice->skb->data;
+            skb_reset_mac_header(pDevice->skb);
 
              pDevice->skb->pkt_type = PACKET_HOST;
              pDevice->skb->protocol = htons(ETH_P_802_2);
@@ -1849,7 +1849,7 @@ s_vMgrRxDeauthentication(
                  wpahdr->req_ie_len = 0;
                  skb_put(pDevice->skb, sizeof(viawget_wpa_header));
                  pDevice->skb->dev = pDevice->wpadev;
-                 pDevice->skb->mac_header = pDevice->skb->data;
+                skb_reset_mac_header(pDevice->skb);
                  pDevice->skb->pkt_type = PACKET_HOST;
                  pDevice->skb->protocol = htons(ETH_P_802_2);
                  memset(pDevice->skb->cb, 0, sizeof(pDevice->skb->cb));
index 8b4e7fc31efa67a2828d93a37eb95b09011ed6c5..87abae464725e26c349ff1c35d801a36e328a8a1 100644 (file)
@@ -170,7 +170,7 @@ WPA_ParseRSN (
         if (pRSN->len >= 12) //oui1(4)+ver(2)+GKS(4)+PKSCnt(2)
         {
             j = 0;
-            DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"wPKCount: %d, sizeof(pBSSList->abyPKType): %d\n", pRSN->wPKCount, sizeof(pBSSList->abyPKType));
+            DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"wPKCount: %d, sizeof(pBSSList->abyPKType): %ld\n", pRSN->wPKCount, sizeof(pBSSList->abyPKType));
             for(i = 0; (i < pRSN->wPKCount) && (j < sizeof(pBSSList->abyPKType)/sizeof(BYTE)); i++) {
                 if(pRSN->len >= 12+i*4+4) { //oui1(4)+ver(2)+GKS(4)+PKSCnt(2)+PKS(4*i)
                     if (MEMEqualMemory(pRSN->PKSList[i].abyOUI, abyOUI00, 4))
@@ -201,7 +201,7 @@ WPA_ParseRSN (
             // overlay IE_RSN_Auth structure into correct place
             pIE_RSN_Auth = (PWLAN_IE_RSN_AUTH) pRSN->PKSList[m].abyOUI;
             j = 0;
-            DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"wAuthCount: %d, sizeof(pBSSList->abyAuthType): %d\n",
+            DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"wAuthCount: %d, sizeof(pBSSList->abyAuthType): %ld\n",
                           pIE_RSN_Auth->wAuthCount, sizeof(pBSSList->abyAuthType));
             for(i = 0; (i < pIE_RSN_Auth->wAuthCount) && (j < sizeof(pBSSList->abyAuthType)/sizeof(BYTE)); i++) {
                 if(pRSN->len >= 14+4+(m+i)*4) { //oui1(4)+ver(2)+GKS(4)+PKSCnt(2)+PKS(4*m)+AKC(2)+AKS(4*i)