Commit 1e28efa3 authored by Forest Bond's avatar Forest Bond Committed by Greg Kroah-Hartman

Staging: vt6656: Replace net_device->priv accesses with netdev_priv calls.

vt6656: Replace net_device->priv accesses with netdev_priv calls.
Signed-off-by: default avatarForest Bond <forest@alittletooquiet.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 8f9c466f
...@@ -103,6 +103,7 @@ static int msglevel =MSG_LEVEL_INFO; ...@@ -103,6 +103,7 @@ static int msglevel =MSG_LEVEL_INFO;
static int hostap_enable_hostapd(PSDevice pDevice, int rtnl_locked) static int hostap_enable_hostapd(PSDevice pDevice, int rtnl_locked)
{ {
PSDevice apdev_priv;
struct net_device *dev = pDevice->dev; struct net_device *dev = pDevice->dev;
int ret; int ret;
...@@ -113,7 +114,8 @@ static int hostap_enable_hostapd(PSDevice pDevice, int rtnl_locked) ...@@ -113,7 +114,8 @@ static int hostap_enable_hostapd(PSDevice pDevice, int rtnl_locked)
return -ENOMEM; return -ENOMEM;
memset(pDevice->apdev, 0, sizeof(struct net_device)); 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); memcpy(pDevice->apdev->dev_addr, dev->dev_addr, ETH_ALEN);
pDevice->apdev->hard_start_xmit = pDevice->tx_80211; pDevice->apdev->hard_start_xmit = pDevice->tx_80211;
pDevice->apdev->type = ARPHRD_IEEE80211; pDevice->apdev->type = ARPHRD_IEEE80211;
......
...@@ -113,7 +113,7 @@ static int msglevel =MSG_LEVEL_INFO; ...@@ -113,7 +113,7 @@ static int msglevel =MSG_LEVEL_INFO;
struct iw_statistics *iwctl_get_wireless_stats(struct net_device *dev) struct iw_statistics *iwctl_get_wireless_stats(struct net_device *dev)
{ {
PSDevice pDevice = dev->priv; PSDevice pDevice = netdev_priv(dev);
long ldBm; long ldBm;
pDevice->wstats.status = pDevice->eOPMode; pDevice->wstats.status = pDevice->eOPMode;
...@@ -172,7 +172,7 @@ static int iwctl_commit(struct net_device *dev, ...@@ -172,7 +172,7 @@ static int iwctl_commit(struct net_device *dev,
//2008-0409-02, <Mark> by Einsn Liu //2008-0409-02, <Mark> by Einsn Liu
/* /*
#ifdef Safe_Close #ifdef Safe_Close
PSDevice pDevice = (PSDevice)dev->priv; PSDevice pDevice = (PSDevice)netdev_priv(dev);
if (!(pDevice->flags & DEVICE_FLAGS_OPENED)) if (!(pDevice->flags & DEVICE_FLAGS_OPENED))
return -EINVAL; return -EINVAL;
#endif #endif
...@@ -218,7 +218,7 @@ int iwctl_siwscan(struct net_device *dev, ...@@ -218,7 +218,7 @@ int iwctl_siwscan(struct net_device *dev,
struct iw_point *wrq, struct iw_point *wrq,
char *extra) char *extra)
{ {
PSDevice pDevice = (PSDevice)dev->priv; PSDevice pDevice = (PSDevice)netdev_priv(dev);
PSMgmtObject pMgmt = &(pDevice->sMgmtObj); PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
struct iw_scan_req *req = (struct iw_scan_req *)extra; struct iw_scan_req *req = (struct iw_scan_req *)extra;
BYTE abyScanSSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1]; BYTE abyScanSSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1];
...@@ -299,7 +299,7 @@ int iwctl_giwscan(struct net_device *dev, ...@@ -299,7 +299,7 @@ int iwctl_giwscan(struct net_device *dev,
char *extra) char *extra)
{ {
int ii, jj, kk; int ii, jj, kk;
PSDevice pDevice = (PSDevice)dev->priv; PSDevice pDevice = (PSDevice)netdev_priv(dev);
PSMgmtObject pMgmt = &(pDevice->sMgmtObj); PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
PKnownBSS pBSS; PKnownBSS pBSS;
PWLAN_IE_SSID pItemSSID; PWLAN_IE_SSID pItemSSID;
...@@ -582,7 +582,7 @@ int iwctl_siwfreq(struct net_device *dev, ...@@ -582,7 +582,7 @@ int iwctl_siwfreq(struct net_device *dev,
struct iw_freq *wrq, struct iw_freq *wrq,
char *extra) char *extra)
{ {
PSDevice pDevice = (PSDevice)dev->priv; PSDevice pDevice = (PSDevice)netdev_priv(dev);
int rc = 0; int rc = 0;
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWFREQ \n"); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWFREQ \n");
...@@ -625,7 +625,7 @@ int iwctl_giwfreq(struct net_device *dev, ...@@ -625,7 +625,7 @@ int iwctl_giwfreq(struct net_device *dev,
struct iw_freq *wrq, struct iw_freq *wrq,
char *extra) char *extra)
{ {
PSDevice pDevice = (PSDevice)dev->priv; PSDevice pDevice = (PSDevice)netdev_priv(dev);
PSMgmtObject pMgmt = &(pDevice->sMgmtObj); PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWFREQ \n"); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWFREQ \n");
...@@ -655,7 +655,7 @@ int iwctl_siwmode(struct net_device *dev, ...@@ -655,7 +655,7 @@ int iwctl_siwmode(struct net_device *dev,
__u32 *wmode, __u32 *wmode,
char *extra) char *extra)
{ {
PSDevice pDevice = (PSDevice)dev->priv; PSDevice pDevice = (PSDevice)netdev_priv(dev);
PSMgmtObject pMgmt = &(pDevice->sMgmtObj); PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
int rc = 0; int rc = 0;
...@@ -722,7 +722,7 @@ int iwctl_giwmode(struct net_device *dev, ...@@ -722,7 +722,7 @@ int iwctl_giwmode(struct net_device *dev,
__u32 *wmode, __u32 *wmode,
char *extra) char *extra)
{ {
PSDevice pDevice = (PSDevice)dev->priv; PSDevice pDevice = (PSDevice)netdev_priv(dev);
PSMgmtObject pMgmt = &(pDevice->sMgmtObj); PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
...@@ -764,7 +764,7 @@ int iwctl_giwrange(struct net_device *dev, ...@@ -764,7 +764,7 @@ int iwctl_giwrange(struct net_device *dev,
//2008-0409-02, <Mark> by Einsn Liu //2008-0409-02, <Mark> by Einsn Liu
/* /*
#ifdef Safe_Close #ifdef Safe_Close
PSDevice pDevice = (PSDevice)dev->priv; PSDevice pDevice = (PSDevice)netdev_priv(dev);
if (!(pDevice->flags & DEVICE_FLAGS_OPENED)) if (!(pDevice->flags & DEVICE_FLAGS_OPENED))
return -EINVAL; return -EINVAL;
#endif #endif
...@@ -883,7 +883,7 @@ int iwctl_siwap(struct net_device *dev, ...@@ -883,7 +883,7 @@ int iwctl_siwap(struct net_device *dev,
struct sockaddr *wrq, struct sockaddr *wrq,
char *extra) char *extra)
{ {
PSDevice pDevice = (PSDevice)dev->priv; PSDevice pDevice = (PSDevice)netdev_priv(dev);
PSMgmtObject pMgmt = &(pDevice->sMgmtObj); PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
int rc = 0; int rc = 0;
BYTE ZeroBSSID[WLAN_BSSID_LEN]={0x00,0x00,0x00,0x00,0x00,0x00}; BYTE ZeroBSSID[WLAN_BSSID_LEN]={0x00,0x00,0x00,0x00,0x00,0x00};
...@@ -934,7 +934,7 @@ int iwctl_giwap(struct net_device *dev, ...@@ -934,7 +934,7 @@ int iwctl_giwap(struct net_device *dev,
struct sockaddr *wrq, struct sockaddr *wrq,
char *extra) char *extra)
{ {
PSDevice pDevice = (PSDevice)dev->priv; PSDevice pDevice = (PSDevice)netdev_priv(dev);
PSMgmtObject pMgmt = &(pDevice->sMgmtObj); PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
...@@ -970,7 +970,7 @@ int iwctl_giwaplist(struct net_device *dev, ...@@ -970,7 +970,7 @@ int iwctl_giwaplist(struct net_device *dev,
int ii,jj, rc = 0; int ii,jj, rc = 0;
struct sockaddr sock[IW_MAX_AP]; struct sockaddr sock[IW_MAX_AP];
struct iw_quality qual[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); PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
...@@ -1019,7 +1019,7 @@ int iwctl_siwessid(struct net_device *dev, ...@@ -1019,7 +1019,7 @@ int iwctl_siwessid(struct net_device *dev,
struct iw_point *wrq, struct iw_point *wrq,
char *extra) char *extra)
{ {
PSDevice pDevice = (PSDevice)dev->priv; PSDevice pDevice = (PSDevice)netdev_priv(dev);
PSMgmtObject pMgmt = &(pDevice->sMgmtObj); PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
PWLAN_IE_SSID pItemSSID; PWLAN_IE_SSID pItemSSID;
...@@ -1129,7 +1129,7 @@ int iwctl_giwessid(struct net_device *dev, ...@@ -1129,7 +1129,7 @@ int iwctl_giwessid(struct net_device *dev,
char *extra) char *extra)
{ {
PSDevice pDevice = (PSDevice)dev->priv; PSDevice pDevice = (PSDevice)netdev_priv(dev);
PSMgmtObject pMgmt = &(pDevice->sMgmtObj); PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
PWLAN_IE_SSID pItemSSID; PWLAN_IE_SSID pItemSSID;
...@@ -1164,7 +1164,7 @@ int iwctl_siwrate(struct net_device *dev, ...@@ -1164,7 +1164,7 @@ int iwctl_siwrate(struct net_device *dev,
struct iw_param *wrq, struct iw_param *wrq,
char *extra) char *extra)
{ {
PSDevice pDevice = (PSDevice)dev->priv; PSDevice pDevice = (PSDevice)netdev_priv(dev);
int rc = 0; int rc = 0;
u8 brate = 0; u8 brate = 0;
int i; int i;
...@@ -1246,7 +1246,7 @@ int iwctl_giwrate(struct net_device *dev, ...@@ -1246,7 +1246,7 @@ int iwctl_giwrate(struct net_device *dev,
struct iw_param *wrq, struct iw_param *wrq,
char *extra) char *extra)
{ {
PSDevice pDevice = (PSDevice)dev->priv; PSDevice pDevice = (PSDevice)netdev_priv(dev);
PSMgmtObject pMgmt = &(pDevice->sMgmtObj); PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWRATE \n"); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWRATE \n");
...@@ -1295,7 +1295,7 @@ int iwctl_siwrts(struct net_device *dev, ...@@ -1295,7 +1295,7 @@ int iwctl_siwrts(struct net_device *dev,
struct iw_param *wrq, struct iw_param *wrq,
char *extra) char *extra)
{ {
PSDevice pDevice = (PSDevice)dev->priv; PSDevice pDevice = (PSDevice)netdev_priv(dev);
int rc = 0; int rc = 0;
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWRTS \n"); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWRTS \n");
...@@ -1323,7 +1323,7 @@ int iwctl_giwrts(struct net_device *dev, ...@@ -1323,7 +1323,7 @@ int iwctl_giwrts(struct net_device *dev,
struct iw_param *wrq, struct iw_param *wrq,
char *extra) char *extra)
{ {
PSDevice pDevice = (PSDevice)dev->priv; PSDevice pDevice = (PSDevice)netdev_priv(dev);
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWRTS \n"); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWRTS \n");
wrq->value = pDevice->wRTSThreshold; wrq->value = pDevice->wRTSThreshold;
...@@ -1342,7 +1342,7 @@ int iwctl_siwfrag(struct net_device *dev, ...@@ -1342,7 +1342,7 @@ int iwctl_siwfrag(struct net_device *dev,
struct iw_param *wrq, struct iw_param *wrq,
char *extra) char *extra)
{ {
PSDevice pDevice = (PSDevice)dev->priv; PSDevice pDevice = (PSDevice)netdev_priv(dev);
int rc = 0; int rc = 0;
int fthr = wrq->value; int fthr = wrq->value;
...@@ -1371,7 +1371,7 @@ int iwctl_giwfrag(struct net_device *dev, ...@@ -1371,7 +1371,7 @@ int iwctl_giwfrag(struct net_device *dev,
struct iw_param *wrq, struct iw_param *wrq,
char *extra) char *extra)
{ {
PSDevice pDevice = (PSDevice)dev->priv; PSDevice pDevice = (PSDevice)netdev_priv(dev);
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWFRAG \n"); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWFRAG \n");
wrq->value = pDevice->wFragmentationThreshold; wrq->value = pDevice->wFragmentationThreshold;
...@@ -1391,7 +1391,7 @@ int iwctl_siwretry(struct net_device *dev, ...@@ -1391,7 +1391,7 @@ int iwctl_siwretry(struct net_device *dev,
struct iw_param *wrq, struct iw_param *wrq,
char *extra) char *extra)
{ {
PSDevice pDevice = (PSDevice)dev->priv; PSDevice pDevice = (PSDevice)netdev_priv(dev);
int rc = 0; int rc = 0;
...@@ -1429,7 +1429,7 @@ int iwctl_giwretry(struct net_device *dev, ...@@ -1429,7 +1429,7 @@ int iwctl_giwretry(struct net_device *dev,
struct iw_param *wrq, struct iw_param *wrq,
char *extra) char *extra)
{ {
PSDevice pDevice = (PSDevice)dev->priv; PSDevice pDevice = (PSDevice)netdev_priv(dev);
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWRETRY \n"); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWRETRY \n");
wrq->disabled = 0; // Can't be disabled wrq->disabled = 0; // Can't be disabled
...@@ -1460,7 +1460,7 @@ int iwctl_siwencode(struct net_device *dev, ...@@ -1460,7 +1460,7 @@ int iwctl_siwencode(struct net_device *dev,
struct iw_point *wrq, struct iw_point *wrq,
char *extra) char *extra)
{ {
PSDevice pDevice = (PSDevice)dev->priv; PSDevice pDevice = (PSDevice)netdev_priv(dev);
PSMgmtObject pMgmt = &(pDevice->sMgmtObj); PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
DWORD dwKeyIndex = (DWORD)(wrq->flags & IW_ENCODE_INDEX); DWORD dwKeyIndex = (DWORD)(wrq->flags & IW_ENCODE_INDEX);
int ii,uu, rc = 0; int ii,uu, rc = 0;
...@@ -1570,7 +1570,7 @@ int iwctl_giwencode(struct net_device *dev, ...@@ -1570,7 +1570,7 @@ int iwctl_giwencode(struct net_device *dev,
struct iw_point *wrq, struct iw_point *wrq,
char *extra) char *extra)
{ {
PSDevice pDevice = (PSDevice)dev->priv; PSDevice pDevice = (PSDevice)netdev_priv(dev);
PSMgmtObject pMgmt = &(pDevice->sMgmtObj); PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
int rc = 0; int rc = 0;
char abyKey[WLAN_WEP232_KEYLEN]; char abyKey[WLAN_WEP232_KEYLEN];
...@@ -1616,7 +1616,7 @@ int iwctl_giwencode(struct net_device *dev, ...@@ -1616,7 +1616,7 @@ int iwctl_giwencode(struct net_device *dev,
struct iw_point *wrq, struct iw_point *wrq,
char *extra) char *extra)
{ {
PSDevice pDevice = (PSDevice)dev->priv; PSDevice pDevice = (PSDevice)netdev_priv(dev);
PSMgmtObject pMgmt = &(pDevice->sMgmtObj); PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
char abyKey[WLAN_WEP232_KEYLEN]; char abyKey[WLAN_WEP232_KEYLEN];
...@@ -1678,7 +1678,7 @@ int iwctl_siwpower(struct net_device *dev, ...@@ -1678,7 +1678,7 @@ int iwctl_siwpower(struct net_device *dev,
struct iw_param *wrq, struct iw_param *wrq,
char *extra) char *extra)
{ {
PSDevice pDevice = (PSDevice)dev->priv; PSDevice pDevice = (PSDevice)netdev_priv(dev);
PSMgmtObject pMgmt = &(pDevice->sMgmtObj); PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
int rc = 0; int rc = 0;
...@@ -1728,7 +1728,7 @@ int iwctl_giwpower(struct net_device *dev, ...@@ -1728,7 +1728,7 @@ int iwctl_giwpower(struct net_device *dev,
struct iw_param *wrq, struct iw_param *wrq,
char *extra) char *extra)
{ {
PSDevice pDevice = (PSDevice)dev->priv; PSDevice pDevice = (PSDevice)netdev_priv(dev);
PSMgmtObject pMgmt = &(pDevice->sMgmtObj); PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
int mode = pDevice->ePSMode; int mode = pDevice->ePSMode;
...@@ -1760,7 +1760,7 @@ int iwctl_giwsens(struct net_device *dev, ...@@ -1760,7 +1760,7 @@ int iwctl_giwsens(struct net_device *dev,
struct iw_param *wrq, struct iw_param *wrq,
char *extra) char *extra)
{ {
PSDevice pDevice = (PSDevice)dev->priv; PSDevice pDevice = (PSDevice)netdev_priv(dev);
long ldBm; long ldBm;
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWSENS \n"); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWSENS \n");
...@@ -1786,7 +1786,7 @@ int iwctl_siwauth(struct net_device *dev, ...@@ -1786,7 +1786,7 @@ int iwctl_siwauth(struct net_device *dev,
struct iw_param *wrq, struct iw_param *wrq,
char *extra) char *extra)
{ {
PSDevice pDevice = (PSDevice)dev->priv; PSDevice pDevice = (PSDevice)netdev_priv(dev);
PSMgmtObject pMgmt = &(pDevice->sMgmtObj); PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
int ret=0; int ret=0;
static int wpa_version=0; //must be static to save the last value,einsn liu static int wpa_version=0; //must be static to save the last value,einsn liu
...@@ -1918,7 +1918,7 @@ int iwctl_siwgenie(struct net_device *dev, ...@@ -1918,7 +1918,7 @@ int iwctl_siwgenie(struct net_device *dev,
struct iw_point *wrq, struct iw_point *wrq,
char *extra) char *extra)
{ {
PSDevice pDevice = (PSDevice)dev->priv; PSDevice pDevice = (PSDevice)netdev_priv(dev);
PSMgmtObject pMgmt = &(pDevice->sMgmtObj); PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
int ret=0; int ret=0;
...@@ -1951,7 +1951,7 @@ int iwctl_giwgenie(struct net_device *dev, ...@@ -1951,7 +1951,7 @@ int iwctl_giwgenie(struct net_device *dev,
struct iw_point *wrq, struct iw_point *wrq,
char *extra) char *extra)
{ {
PSDevice pDevice = (PSDevice)dev->priv; PSDevice pDevice = (PSDevice)netdev_priv(dev);
PSMgmtObject pMgmt = &(pDevice->sMgmtObj); PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
int ret=0; int ret=0;
int space = wrq->length; int space = wrq->length;
...@@ -1976,7 +1976,7 @@ int iwctl_siwencodeext(struct net_device *dev, ...@@ -1976,7 +1976,7 @@ int iwctl_siwencodeext(struct net_device *dev,
struct iw_point *wrq, struct iw_point *wrq,
char *extra) char *extra)
{ {
PSDevice pDevice = (PSDevice)dev->priv; PSDevice pDevice = (PSDevice)netdev_priv(dev);
PSMgmtObject pMgmt = &(pDevice->sMgmtObj); PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
struct iw_encode_ext *ext = (struct iw_encode_ext*)extra; struct iw_encode_ext *ext = (struct iw_encode_ext*)extra;
struct viawget_wpa_param *param=NULL; struct viawget_wpa_param *param=NULL;
...@@ -2135,7 +2135,7 @@ int iwctl_siwmlme(struct net_device *dev, ...@@ -2135,7 +2135,7 @@ int iwctl_siwmlme(struct net_device *dev,
struct iw_point *wrq, struct iw_point *wrq,
char *extra) char *extra)
{ {
PSDevice pDevice = (PSDevice)dev->priv; PSDevice pDevice = (PSDevice)netdev_priv(dev);
PSMgmtObject pMgmt = &(pDevice->sMgmtObj); PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
struct iw_mlme *mlme = (struct iw_mlme *)extra; struct iw_mlme *mlme = (struct iw_mlme *)extra;
//u16 reason = cpu_to_le16(mlme->reason_code); //u16 reason = cpu_to_le16(mlme->reason_code);
......
...@@ -866,15 +866,8 @@ vntwusb_found1(struct usb_device *udev, UINT interface, const struct usb_device_ ...@@ -866,15 +866,8 @@ vntwusb_found1(struct usb_device *udev, UINT interface, const struct usb_device_
udev = usb_get_dev(udev); udev = usb_get_dev(udev);
#endif #endif
pDevice = kmalloc(sizeof(DEVICE_INFO), GFP_KERNEL);
if (pDevice == NULL) {
printk(KERN_ERR DEVICE_NAME ": allocate usb device failed \n");
goto err_nomem;
}
memset(pDevice, 0, sizeof(DEVICE_INFO));
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
netdev = alloc_etherdev(0); netdev = alloc_etherdev(sizeof(DEVICE_INFO));
#else #else
netdev = init_etherdev(netdev, 0); netdev = init_etherdev(netdev, 0);
#endif #endif
...@@ -884,6 +877,10 @@ vntwusb_found1(struct usb_device *udev, UINT interface, const struct usb_device_ ...@@ -884,6 +877,10 @@ vntwusb_found1(struct usb_device *udev, UINT interface, const struct usb_device_
kfree(pDevice); kfree(pDevice);
goto err_nomem; goto err_nomem;
} }
pDevice = netdev_priv(netdev);
memset(pDevice, 0, sizeof(DEVICE_INFO));
pDevice->dev = netdev; pDevice->dev = netdev;
pDevice->usb = udev; pDevice->usb = udev;
...@@ -899,7 +896,6 @@ vntwusb_found1(struct usb_device *udev, UINT interface, const struct usb_device_ ...@@ -899,7 +896,6 @@ vntwusb_found1(struct usb_device *udev, UINT interface, const struct usb_device_
pDevice->tx_80211 = device_dma0_tx_80211; pDevice->tx_80211 = device_dma0_tx_80211;
pDevice->sMgmtObj.pAdapter = (PVOID)pDevice; pDevice->sMgmtObj.pAdapter = (PVOID)pDevice;
netdev->priv = pDevice;
netdev->open = device_open; netdev->open = device_open;
netdev->hard_start_xmit = device_xmit; netdev->hard_start_xmit = device_xmit;
netdev->stop = device_close; netdev->stop = device_close;
...@@ -1205,7 +1201,7 @@ BOOL device_alloc_frag_buf(PSDevice pDevice, PSDeFragControlBlock pDeF) { ...@@ -1205,7 +1201,7 @@ BOOL device_alloc_frag_buf(PSDevice pDevice, PSDeFragControlBlock pDeF) {
/*-----------------------------------------------------------------*/ /*-----------------------------------------------------------------*/
static int device_open(struct net_device *dev) { static int device_open(struct net_device *dev) {
PSDevice pDevice=(PSDevice) dev->priv; PSDevice pDevice=(PSDevice) netdev_priv(dev);
#ifdef WPA_SM_Transtatus #ifdef WPA_SM_Transtatus
extern SWPAResult wpa_Result; extern SWPAResult wpa_Result;
...@@ -1348,7 +1344,7 @@ free_rx_tx: ...@@ -1348,7 +1344,7 @@ free_rx_tx:
static int device_close(struct net_device *dev) { static int device_close(struct net_device *dev) {
PSDevice pDevice=(PSDevice) dev->priv; PSDevice pDevice=(PSDevice) netdev_priv(dev);
PSMgmtObject pMgmt = &(pDevice->sMgmtObj); PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21) #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21)
...@@ -1507,7 +1503,7 @@ device_release_WPADEV(pDevice); ...@@ -1507,7 +1503,7 @@ device_release_WPADEV(pDevice);
static int device_dma0_tx_80211(struct sk_buff *skb, struct net_device *dev) { static int device_dma0_tx_80211(struct sk_buff *skb, struct net_device *dev) {
PSDevice pDevice=dev->priv; PSDevice pDevice=netdev_priv(dev);
PBYTE pbMPDU; PBYTE pbMPDU;
UINT cbMPDULen = 0; UINT cbMPDULen = 0;
...@@ -1535,7 +1531,7 @@ static int device_dma0_tx_80211(struct sk_buff *skb, struct net_device *dev) { ...@@ -1535,7 +1531,7 @@ static int device_dma0_tx_80211(struct sk_buff *skb, struct net_device *dev) {
static int device_xmit(struct sk_buff *skb, struct net_device *dev) { static int device_xmit(struct sk_buff *skb, struct net_device *dev) {
PSDevice pDevice=dev->priv; PSDevice pDevice=netdev_priv(dev);
struct net_device_stats* pStats = &pDevice->stats; struct net_device_stats* pStats = &pDevice->stats;
...@@ -1768,7 +1764,7 @@ static int Read_config_file(PSDevice pDevice) { ...@@ -1768,7 +1764,7 @@ static int Read_config_file(PSDevice pDevice) {
} }
static void device_set_multi(struct net_device *dev) { static void device_set_multi(struct net_device *dev) {
PSDevice pDevice = (PSDevice) dev->priv; PSDevice pDevice = (PSDevice) netdev_priv(dev);
PSMgmtObject pMgmt = &(pDevice->sMgmtObj); PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
u32 mc_filter[2]; u32 mc_filter[2];
int ii; int ii;
...@@ -1833,14 +1829,14 @@ static void device_set_multi(struct net_device *dev) { ...@@ -1833,14 +1829,14 @@ static void device_set_multi(struct net_device *dev) {
static struct net_device_stats *device_get_stats(struct net_device *dev) { static struct net_device_stats *device_get_stats(struct net_device *dev) {
PSDevice pDevice=(PSDevice) dev->priv; PSDevice pDevice=(PSDevice) netdev_priv(dev);
return &pDevice->stats; return &pDevice->stats;
} }
static int device_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) { static int device_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) {
PSDevice pDevice = (PSDevice)dev->priv; PSDevice pDevice = (PSDevice)netdev_priv(dev);
PSMgmtObject pMgmt = &(pDevice->sMgmtObj); PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
PSCmdRequest pReq; PSCmdRequest pReq;
//BOOL bCommit = FALSE; //BOOL bCommit = FALSE;
......
...@@ -115,14 +115,16 @@ static void wpadev_setup(struct net_device *dev) ...@@ -115,14 +115,16 @@ static void wpadev_setup(struct net_device *dev)
static int wpa_init_wpadev(PSDevice pDevice) static int wpa_init_wpadev(PSDevice pDevice)
{ {
PSDevice wpadev_priv;
struct net_device *dev = pDevice->dev; struct net_device *dev = pDevice->dev;
int ret=0; int ret=0;
pDevice->wpadev = alloc_netdev(0, "vntwpa", wpadev_setup); pDevice->wpadev = alloc_netdev(sizeof(PSDevice), "vntwpa", wpadev_setup);
if (pDevice->wpadev == NULL) if (pDevice->wpadev == NULL)
return -ENOMEM; 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); memcpy(pDevice->wpadev->dev_addr, dev->dev_addr, U_ETHER_ADDR_LEN);
pDevice->wpadev->base_addr = dev->base_addr; pDevice->wpadev->base_addr = dev->base_addr;
pDevice->wpadev->irq = dev->irq; pDevice->wpadev->irq = dev->irq;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment