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;
//2008-0409-02, <Mark> by Einsn Liu
/*
#ifdef Safe_Close
- PSDevice pDevice = (PSDevice)dev->priv;
+ PSDevice pDevice = (PSDevice)netdev_priv(dev);
if (!(pDevice->flags & DEVICE_FLAGS_OPENED))
return -EINVAL;
#endif
struct iw_point *wrq,
char *extra)
{
- PSDevice pDevice = (PSDevice)dev->priv;
+ PSDevice pDevice = (PSDevice)netdev_priv(dev);
PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
struct iw_scan_req *req = (struct iw_scan_req *)extra;
BYTE abyScanSSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1];
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;
struct iw_freq *wrq,
char *extra)
{
- PSDevice pDevice = (PSDevice)dev->priv;
+ PSDevice pDevice = (PSDevice)netdev_priv(dev);
int rc = 0;
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWFREQ \n");
struct iw_freq *wrq,
char *extra)
{
- PSDevice pDevice = (PSDevice)dev->priv;
+ PSDevice pDevice = (PSDevice)netdev_priv(dev);
PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWFREQ \n");
__u32 *wmode,
char *extra)
{
- PSDevice pDevice = (PSDevice)dev->priv;
+ PSDevice pDevice = (PSDevice)netdev_priv(dev);
PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
int rc = 0;
__u32 *wmode,
char *extra)
{
- PSDevice pDevice = (PSDevice)dev->priv;
+ PSDevice pDevice = (PSDevice)netdev_priv(dev);
PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
//2008-0409-02, <Mark> by Einsn Liu
/*
#ifdef Safe_Close
- PSDevice pDevice = (PSDevice)dev->priv;
+ PSDevice pDevice = (PSDevice)netdev_priv(dev);
if (!(pDevice->flags & DEVICE_FLAGS_OPENED))
return -EINVAL;
#endif
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};
struct sockaddr *wrq,
char *extra)
{
- PSDevice pDevice = (PSDevice)dev->priv;
+ PSDevice pDevice = (PSDevice)netdev_priv(dev);
PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
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);
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;
char *extra)
{
- PSDevice pDevice = (PSDevice)dev->priv;
+ PSDevice pDevice = (PSDevice)netdev_priv(dev);
PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
PWLAN_IE_SSID pItemSSID;
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;
struct iw_param *wrq,
char *extra)
{
- PSDevice pDevice = (PSDevice)dev->priv;
+ PSDevice pDevice = (PSDevice)netdev_priv(dev);
PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWRATE \n");
struct iw_param *wrq,
char *extra)
{
- PSDevice pDevice = (PSDevice)dev->priv;
+ PSDevice pDevice = (PSDevice)netdev_priv(dev);
int rc = 0;
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWRTS \n");
struct iw_param *wrq,
char *extra)
{
- PSDevice pDevice = (PSDevice)dev->priv;
+ PSDevice pDevice = (PSDevice)netdev_priv(dev);
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWRTS \n");
wrq->value = pDevice->wRTSThreshold;
struct iw_param *wrq,
char *extra)
{
- PSDevice pDevice = (PSDevice)dev->priv;
+ PSDevice pDevice = (PSDevice)netdev_priv(dev);
int rc = 0;
int fthr = wrq->value;
struct iw_param *wrq,
char *extra)
{
- PSDevice pDevice = (PSDevice)dev->priv;
+ PSDevice pDevice = (PSDevice)netdev_priv(dev);
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWFRAG \n");
wrq->value = pDevice->wFragmentationThreshold;
struct iw_param *wrq,
char *extra)
{
- PSDevice pDevice = (PSDevice)dev->priv;
+ PSDevice pDevice = (PSDevice)netdev_priv(dev);
int rc = 0;
struct iw_param *wrq,
char *extra)
{
- PSDevice pDevice = (PSDevice)dev->priv;
+ PSDevice pDevice = (PSDevice)netdev_priv(dev);
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWRETRY \n");
wrq->disabled = 0; // Can't be disabled
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;
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];
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];
struct iw_param *wrq,
char *extra)
{
- PSDevice pDevice = (PSDevice)dev->priv;
+ PSDevice pDevice = (PSDevice)netdev_priv(dev);
PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
int rc = 0;
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;
struct iw_param *wrq,
char *extra)
{
- PSDevice pDevice = (PSDevice)dev->priv;
+ PSDevice pDevice = (PSDevice)netdev_priv(dev);
long ldBm;
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWSENS \n");
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
struct iw_point *wrq,
char *extra)
{
- PSDevice pDevice = (PSDevice)dev->priv;
+ PSDevice pDevice = (PSDevice)netdev_priv(dev);
PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
int ret=0;
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;
struct iw_point *wrq,
char *extra)
{
- PSDevice pDevice = (PSDevice)dev->priv;
+ PSDevice pDevice = (PSDevice)netdev_priv(dev);
PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
struct iw_encode_ext *ext = (struct iw_encode_ext*)extra;
struct viawget_wpa_param *param=NULL;
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);
udev = usb_get_dev(udev);
#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)
- netdev = alloc_etherdev(0);
+ netdev = alloc_etherdev(sizeof(DEVICE_INFO));
#else
netdev = init_etherdev(netdev, 0);
#endif
kfree(pDevice);
goto err_nomem;
}
+
+ pDevice = netdev_priv(netdev);
+ memset(pDevice, 0, sizeof(DEVICE_INFO));
+
pDevice->dev = netdev;
pDevice->usb = udev;
pDevice->tx_80211 = device_dma0_tx_80211;
pDevice->sMgmtObj.pAdapter = (PVOID)pDevice;
- netdev->priv = pDevice;
netdev->open = device_open;
netdev->hard_start_xmit = device_xmit;
netdev->stop = device_close;
/*-----------------------------------------------------------------*/
static int device_open(struct net_device *dev) {
- PSDevice pDevice=(PSDevice) dev->priv;
+ PSDevice pDevice=(PSDevice) netdev_priv(dev);
#ifdef WPA_SM_Transtatus
extern SWPAResult wpa_Result;
static int device_close(struct net_device *dev) {
- PSDevice pDevice=(PSDevice) dev->priv;
+ PSDevice pDevice=(PSDevice) netdev_priv(dev);
PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21)
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;
UINT cbMPDULen = 0;
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;
}
static void device_set_multi(struct net_device *dev) {
- PSDevice pDevice = (PSDevice) dev->priv;
+ PSDevice pDevice = (PSDevice) netdev_priv(dev);
PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
u32 mc_filter[2];
int ii;
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;
}
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);
PSCmdRequest pReq;
//BOOL bCommit = FALSE;