diff options
author | Forest Bond <forest@alittletooquiet.net> | 2009-06-01 20:00:14 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2009-06-19 11:00:51 -0700 |
commit | c9d0352914e8fdaece56c8c3ea489d7214b0353e (patch) | |
tree | 8e7e003cd64108e7449cfe1e0717207bce112ba4 /drivers | |
parent | e2ce5277eb9fdd6923f35b25e64ebfc7a70a03c3 (diff) |
Staging: vt6655: Replace net_device->priv accesses with netdev_priv calls.
vt6655: Replace net_device->priv accesses with netdev_priv calls.
Signed-off-by: Forest Bond <forest@alittletooquiet.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/staging/vt6655/device_main.c | 30 | ||||
-rw-r--r-- | drivers/staging/vt6655/hostap.c | 6 | ||||
-rw-r--r-- | drivers/staging/vt6655/iwctl.c | 62 | ||||
-rw-r--r-- | drivers/staging/vt6655/wpactl.c | 7 |
4 files changed, 51 insertions, 54 deletions
diff --git a/drivers/staging/vt6655/device_main.c b/drivers/staging/vt6655/device_main.c index d8f7f4f7bac..93c626b8a0b 100644 --- a/drivers/staging/vt6655/device_main.c +++ b/drivers/staging/vt6655/device_main.c @@ -997,11 +997,13 @@ device_found1(struct pci_dev *pcid, const struct pci_device_id *ent) #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) - dev = alloc_etherdev(0); + dev = alloc_etherdev(sizeof(DEVICE_INFO)); #else dev = init_etherdev(dev, 0); #endif + pDevice = (PSDevice) netdev_priv(dev); + if (dev == NULL) { printk(KERN_ERR DEVICE_NAME ": allocate net device failed \n"); return -ENODEV; @@ -1025,7 +1027,6 @@ device_found1(struct pci_dev *pcid, const struct pci_device_id *ent) pDevice->dev = dev; pDevice->next_module = root_device_dev; root_device_dev = dev; - dev->priv = pDevice; dev->irq = pcid->irq; if (pci_enable_device(pcid)) { @@ -1194,7 +1195,6 @@ device_found1(struct pci_dev *pcid, const struct pci_device_id *ent) printk("Fail to Register WPADEV?\n"); unregister_netdev(pDevice->dev); free_netdev(dev); - kfree(pDevice); } device_print_info(pDevice); pci_set_drvdata(pcid, pDevice); @@ -1226,11 +1226,6 @@ static BOOL device_init_info(struct pci_dev* pcid, PSDevice* ppDevice, PSDevice p; - *ppDevice = kmalloc(sizeof(DEVICE_INFO),GFP_ATOMIC); - - if (*ppDevice == NULL) - return FALSE; - memset(*ppDevice,0,sizeof(DEVICE_INFO)); if (pDevice_Infos == NULL) { @@ -1374,8 +1369,6 @@ device_release_WPADEV(pDevice); if (pDevice->pcid) { pci_set_drvdata(pDevice->pcid,NULL); } - kfree(pDevice); - } #endif// ifndef PRIVATE_OBJ @@ -2059,7 +2052,7 @@ int __device_open(HANDLE pExDevice) { #else static int device_open(struct net_device *dev) { - PSDevice pDevice=(PSDevice) dev->priv; + PSDevice pDevice=(PSDevice) netdev_priv(dev); int i; #endif pDevice->rx_buf_sz = PKT_BUF_SZ; @@ -2212,7 +2205,7 @@ int __device_close(HANDLE pExDevice) { #else static int device_close(struct net_device *dev) { - PSDevice pDevice=(PSDevice) dev->priv; + PSDevice pDevice=(PSDevice) netdev_priv(dev); #endif PSMgmtObject pMgmt = pDevice->pMgmt; //PLICE_DEBUG-> @@ -2282,7 +2275,7 @@ int __device_dma0_tx_80211(HANDLE pExDevice, struct sk_buff *skb) { static int device_dma0_tx_80211(struct sk_buff *skb, struct net_device *dev) { - PSDevice pDevice=dev->priv; + PSDevice pDevice=netdev_priv(dev); #endif PBYTE pbMPDU; UINT cbMPDULen = 0; @@ -2494,7 +2487,7 @@ int __device_xmit(HANDLE pExDevice, struct sk_buff *skb) { #else static int device_xmit(struct sk_buff *skb, struct net_device *dev) { - PSDevice pDevice=dev->priv; + PSDevice pDevice=netdev_priv(dev); #endif PSMgmtObject pMgmt = pDevice->pMgmt; @@ -2950,7 +2943,7 @@ int __device_intr(int irq, HANDLE pExDevice, struct pt_regs *regs) { #else static irqreturn_t device_intr(int irq, void *dev_instance) { struct net_device* dev=dev_instance; - PSDevice pDevice=(PSDevice) dev->priv; + PSDevice pDevice=(PSDevice) netdev_priv(dev); #endif int max_count=0; @@ -3367,7 +3360,7 @@ void __device_set_multi(HANDLE pExDevice) { #else static void device_set_multi(struct net_device *dev) { - PSDevice pDevice = (PSDevice) dev->priv; + PSDevice pDevice = (PSDevice) netdev_priv(dev); #endif PSMgmtObject pMgmt = pDevice->pMgmt; @@ -3441,7 +3434,7 @@ struct net_device_stats *__device_get_stats(HANDLE pExDevice) { #else static struct net_device_stats *device_get_stats(struct net_device *dev) { - PSDevice pDevice=(PSDevice) dev->priv; + PSDevice pDevice=(PSDevice) netdev_priv(dev); #endif return &pDevice->stats; @@ -3458,7 +3451,7 @@ int __device_ioctl(HANDLE pExDevice, struct ifreq *rq, int cmd) { #else static int device_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) { - PSDevice pDevice = (PSDevice)dev->priv; + PSDevice pDevice = (PSDevice)netdev_priv(dev); #endif #ifdef WIRELESS_EXT @@ -4116,7 +4109,6 @@ int __device_hw_init(HANDLE pExDevice){ PSDevice_info pDevice_info = (PSDevice_info)pExDevice; PSDevice pDevice; - pDevice = (PSDevice)kmalloc(sizeof(DEVICE_INFO), (int)GFP_ATOMIC); if (pDevice == NULL) return FALSE; diff --git a/drivers/staging/vt6655/hostap.c b/drivers/staging/vt6655/hostap.c index 134de869cb8..620b8bd745b 100644 --- a/drivers/staging/vt6655/hostap.c +++ b/drivers/staging/vt6655/hostap.c @@ -100,6 +100,7 @@ static int msglevel =MSG_LEVEL_INFO; static int hostap_enable_hostapd(PSDevice pDevice, int rtnl_locked) { + PSDevice apdev_priv; struct net_device *dev = pDevice->dev; int ret; @@ -124,12 +125,13 @@ static int hostap_enable_hostapd(PSDevice pDevice, int rtnl_locked) dev->name, pDevice->apdev->name); #else - pDevice->apdev = (struct net_device *)kmalloc(sizeof(struct net_device), GFP_KERNEL); + pDevice->apdev = (struct net_device *)kmalloc(sizeof(struct net_device), GFP_KERNEL); if (pDevice->apdev == NULL) return -ENOMEM; memset(pDevice->apdev, 0, sizeof(struct net_device)); - pDevice->apdev->priv = pDevice; + apdev_priv = netdev_priv(pDevice->apdev); + *apdev_priv = *pDevice; memcpy(pDevice->apdev->dev_addr, dev->dev_addr, ETH_ALEN); pDevice->apdev->hard_start_xmit = pDevice->tx_80211; pDevice->apdev->type = ARPHRD_IEEE80211; diff --git a/drivers/staging/vt6655/iwctl.c b/drivers/staging/vt6655/iwctl.c index 160baf0abc0..60ea9b4d44b 100644 --- a/drivers/staging/vt6655/iwctl.c +++ b/drivers/staging/vt6655/iwctl.c @@ -113,7 +113,7 @@ static int msglevel =MSG_LEVEL_INFO; struct iw_statistics *iwctl_get_wireless_stats(struct net_device *dev) { - PSDevice pDevice = dev->priv; + PSDevice pDevice = netdev_priv(dev); long ldBm; pDevice->wstats.status = pDevice->eOPMode; #ifdef Calcu_LinkQual @@ -209,7 +209,7 @@ int iwctl_siwscan(struct net_device *dev, struct iw_point *wrq, char *extra) { - PSDevice pDevice = (PSDevice)dev->priv; + PSDevice pDevice = (PSDevice)netdev_priv(dev); struct iw_scan_req *req = (struct iw_scan_req *)extra; PSMgmtObject pMgmt = &(pDevice->sMgmtObj); BYTE abyScanSSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1]; @@ -276,7 +276,7 @@ int iwctl_giwscan(struct net_device *dev, char *extra) { int ii, jj, kk; - PSDevice pDevice = (PSDevice)dev->priv; + PSDevice pDevice = (PSDevice)netdev_priv(dev); PSMgmtObject pMgmt = &(pDevice->sMgmtObj); PKnownBSS pBSS; PWLAN_IE_SSID pItemSSID; @@ -522,7 +522,7 @@ int iwctl_siwfreq(struct net_device *dev, struct iw_freq *wrq, char *extra) { - PSDevice pDevice = (PSDevice)dev->priv; + PSDevice pDevice = (PSDevice)netdev_priv(dev); int rc = 0; DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWFREQ \n"); @@ -568,7 +568,7 @@ int iwctl_giwfreq(struct net_device *dev, struct iw_freq *wrq, char *extra) { - PSDevice pDevice = (PSDevice)dev->priv; + PSDevice pDevice = (PSDevice)netdev_priv(dev); PSMgmtObject pMgmt = &(pDevice->sMgmtObj); DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWFREQ \n"); @@ -598,7 +598,7 @@ int iwctl_siwmode(struct net_device *dev, __u32 *wmode, char *extra) { - PSDevice pDevice = (PSDevice)dev->priv; + PSDevice pDevice = (PSDevice)netdev_priv(dev); PSMgmtObject pMgmt = &(pDevice->sMgmtObj); int rc = 0; @@ -665,7 +665,7 @@ int iwctl_giwmode(struct net_device *dev, __u32 *wmode, char *extra) { - PSDevice pDevice = (PSDevice)dev->priv; + PSDevice pDevice = (PSDevice)netdev_priv(dev); PSMgmtObject pMgmt = &(pDevice->sMgmtObj); @@ -819,7 +819,7 @@ int iwctl_siwap(struct net_device *dev, struct sockaddr *wrq, char *extra) { - PSDevice pDevice = (PSDevice)dev->priv; + PSDevice pDevice = (PSDevice)netdev_priv(dev); PSMgmtObject pMgmt = &(pDevice->sMgmtObj); int rc = 0; BYTE ZeroBSSID[WLAN_BSSID_LEN]={0x00,0x00,0x00,0x00,0x00,0x00}; @@ -877,7 +877,7 @@ int iwctl_giwap(struct net_device *dev, struct sockaddr *wrq, char *extra) { - PSDevice pDevice = (PSDevice)dev->priv; + PSDevice pDevice = (PSDevice)netdev_priv(dev); PSMgmtObject pMgmt = &(pDevice->sMgmtObj); @@ -911,7 +911,7 @@ int iwctl_giwaplist(struct net_device *dev, int ii,jj, rc = 0; struct sockaddr sock[IW_MAX_AP]; struct iw_quality qual[IW_MAX_AP]; - PSDevice pDevice = (PSDevice)dev->priv; + PSDevice pDevice = (PSDevice)netdev_priv(dev); PSMgmtObject pMgmt = &(pDevice->sMgmtObj); @@ -960,7 +960,7 @@ int iwctl_siwessid(struct net_device *dev, struct iw_point *wrq, char *extra) { - PSDevice pDevice = (PSDevice)dev->priv; + PSDevice pDevice = (PSDevice)netdev_priv(dev); PSMgmtObject pMgmt = &(pDevice->sMgmtObj); PWLAN_IE_SSID pItemSSID; //2008-0409-05, <Add> by Einsn Liu @@ -1089,7 +1089,7 @@ int iwctl_giwessid(struct net_device *dev, char *extra) { - PSDevice pDevice = (PSDevice)dev->priv; + PSDevice pDevice = (PSDevice)netdev_priv(dev); PSMgmtObject pMgmt = &(pDevice->sMgmtObj); PWLAN_IE_SSID pItemSSID; @@ -1125,7 +1125,7 @@ int iwctl_siwrate(struct net_device *dev, struct iw_param *wrq, char *extra) { - PSDevice pDevice = (PSDevice)dev->priv; + PSDevice pDevice = (PSDevice)netdev_priv(dev); int rc = 0; u8 brate = 0; int i; @@ -1210,7 +1210,7 @@ int iwctl_giwrate(struct net_device *dev, struct iw_param *wrq, char *extra) { - PSDevice pDevice = (PSDevice)dev->priv; + PSDevice pDevice = (PSDevice)netdev_priv(dev); //2007-0118-05,<Mark> by EinsnLiu //Mark the unnecessary sentences. // PSMgmtObject pMgmt = &(pDevice->sMgmtObj); @@ -1276,7 +1276,7 @@ int iwctl_siwrts(struct net_device *dev, struct iw_param *wrq, char *extra) { - PSDevice pDevice = (PSDevice)dev->priv; + PSDevice pDevice = (PSDevice)netdev_priv(dev); int rc = 0; DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWRTS \n"); @@ -1304,7 +1304,7 @@ int iwctl_giwrts(struct net_device *dev, struct iw_param *wrq, char *extra) { - PSDevice pDevice = (PSDevice)dev->priv; + PSDevice pDevice = (PSDevice)netdev_priv(dev); DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWRTS \n"); wrq->value = pDevice->wRTSThreshold; @@ -1323,7 +1323,7 @@ int iwctl_siwfrag(struct net_device *dev, struct iw_param *wrq, char *extra) { - PSDevice pDevice = (PSDevice)dev->priv; + PSDevice pDevice = (PSDevice)netdev_priv(dev); int rc = 0; int fthr = wrq->value; @@ -1352,7 +1352,7 @@ int iwctl_giwfrag(struct net_device *dev, struct iw_param *wrq, char *extra) { - PSDevice pDevice = (PSDevice)dev->priv; + PSDevice pDevice = (PSDevice)netdev_priv(dev); DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWFRAG \n"); wrq->value = pDevice->wFragmentationThreshold; @@ -1372,7 +1372,7 @@ int iwctl_siwretry(struct net_device *dev, struct iw_param *wrq, char *extra) { - PSDevice pDevice = (PSDevice)dev->priv; + PSDevice pDevice = (PSDevice)netdev_priv(dev); int rc = 0; @@ -1410,7 +1410,7 @@ int iwctl_giwretry(struct net_device *dev, struct iw_param *wrq, char *extra) { - PSDevice pDevice = (PSDevice)dev->priv; + PSDevice pDevice = (PSDevice)netdev_priv(dev); DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWRETRY \n"); wrq->disabled = 0; // Can't be disabled @@ -1441,7 +1441,7 @@ int iwctl_siwencode(struct net_device *dev, struct iw_point *wrq, char *extra) { - PSDevice pDevice = (PSDevice)dev->priv; + PSDevice pDevice = (PSDevice)netdev_priv(dev); PSMgmtObject pMgmt = &(pDevice->sMgmtObj); DWORD dwKeyIndex = (DWORD)(wrq->flags & IW_ENCODE_INDEX); int ii,uu, rc = 0; @@ -1660,7 +1660,7 @@ int iwctl_giwencode(struct net_device *dev, struct iw_point *wrq, char *extra) { - PSDevice pDevice = (PSDevice)dev->priv; + PSDevice pDevice = (PSDevice)netdev_priv(dev); PSMgmtObject pMgmt = &(pDevice->sMgmtObj); int rc = 0; char abyKey[WLAN_WEP232_KEYLEN]; @@ -1729,7 +1729,7 @@ int iwctl_giwencode(struct net_device *dev, struct iw_point *wrq, char *extra) { - PSDevice pDevice = (PSDevice)dev->priv; + PSDevice pDevice = (PSDevice)netdev_priv(dev); PSMgmtObject pMgmt = &(pDevice->sMgmtObj); char abyKey[WLAN_WEP232_KEYLEN]; @@ -1790,7 +1790,7 @@ int iwctl_siwpower(struct net_device *dev, struct iw_param *wrq, char *extra) { - PSDevice pDevice = (PSDevice)dev->priv; + PSDevice pDevice = (PSDevice)netdev_priv(dev); PSMgmtObject pMgmt = &(pDevice->sMgmtObj); int rc = 0; @@ -1840,7 +1840,7 @@ int iwctl_giwpower(struct net_device *dev, struct iw_param *wrq, char *extra) { - PSDevice pDevice = (PSDevice)dev->priv; + PSDevice pDevice = (PSDevice)netdev_priv(dev); PSMgmtObject pMgmt = &(pDevice->sMgmtObj); int mode = pDevice->ePSMode; @@ -1872,7 +1872,7 @@ int iwctl_giwsens(struct net_device *dev, struct iw_param *wrq, char *extra) { - PSDevice pDevice = (PSDevice)dev->priv; + PSDevice pDevice = (PSDevice)netdev_priv(dev); long ldBm; DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWSENS \n"); @@ -1898,7 +1898,7 @@ int iwctl_siwauth(struct net_device *dev, struct iw_param *wrq, char *extra) { - PSDevice pDevice = (PSDevice)dev->priv; + PSDevice pDevice = (PSDevice)netdev_priv(dev); PSMgmtObject pMgmt = &(pDevice->sMgmtObj); int ret=0; static int wpa_version=0; //must be static to save the last value,einsn liu @@ -2023,7 +2023,7 @@ int iwctl_siwgenie(struct net_device *dev, struct iw_point *wrq, char *extra) { - PSDevice pDevice = (PSDevice)dev->priv; + PSDevice pDevice = (PSDevice)netdev_priv(dev); PSMgmtObject pMgmt = &(pDevice->sMgmtObj); int ret=0; @@ -2056,7 +2056,7 @@ int iwctl_giwgenie(struct net_device *dev, struct iw_point *wrq, char *extra) { - PSDevice pDevice = (PSDevice)dev->priv; + PSDevice pDevice = (PSDevice)netdev_priv(dev); PSMgmtObject pMgmt = &(pDevice->sMgmtObj); int ret=0; int space = wrq->length; @@ -2081,7 +2081,7 @@ int iwctl_siwencodeext(struct net_device *dev, struct iw_point *wrq, char *extra) { - PSDevice pDevice = (PSDevice)dev->priv; + PSDevice pDevice = (PSDevice)netdev_priv(dev); struct iw_encode_ext *ext = (struct iw_encode_ext*)extra; struct viawget_wpa_param *param=NULL; //original member @@ -2232,7 +2232,7 @@ int iwctl_siwmlme(struct net_device *dev, struct iw_point *wrq, char *extra) { - PSDevice pDevice = (PSDevice)dev->priv; + PSDevice pDevice = (PSDevice)netdev_priv(dev); PSMgmtObject pMgmt = &(pDevice->sMgmtObj); struct iw_mlme *mlme = (struct iw_mlme *)extra; //u16 reason = cpu_to_le16(mlme->reason_code); diff --git a/drivers/staging/vt6655/wpactl.c b/drivers/staging/vt6655/wpactl.c index ee7109d1b8e..cc4f0adb963 100644 --- a/drivers/staging/vt6655/wpactl.c +++ b/drivers/staging/vt6655/wpactl.c @@ -112,14 +112,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; + wpadev_priv = netdev_priv(pDevice->wpadev); + *wpadev_priv = *pDevice; + memcpy(pDevice->wpadev->dev_addr, dev->dev_addr, U_ETHER_ADDR_LEN); pDevice->wpadev->base_addr = dev->base_addr; pDevice->wpadev->irq = dev->irq; |