airo: Kill directly reference of netdev->priv

We have some reasons to kill netdev->priv:
1. netdev->priv is equal to netdev_priv().
2. netdev_priv() wraps the calculation of netdev->priv's offset, obviously
   netdev_priv() is more flexible than netdev->priv.
But we cann't kill netdev->priv, because so many drivers reference to it
directly.

OK, becasue Dave S. Miller said, "every direct netdev->priv usage is a bug",
and I want to kill netdev->priv later, I decided to convert all the direct
reference of netdev->priv first.

In this driver, I don't simply use netdev_priv() to replace netdev->priv.

The reason is:
Pointer netdev->priv was changed in this driver, but it shouldn't.
Because the memory was allocated when alloc_netdev() and netdev->priv
should always point to that memory.

So I use netdev->ml_priv to replace netdev->priv.
After replacing, both ai and ai->wifidev->ml_priv point to the same memory.

Signed-off-by: Wang Chen <wangchen@cn.fujitsu.com>
Cc: John W. Linville <linville@tuxdriver.com>
Cc: Dan Williams <dcbw@redhat.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
This commit is contained in:
Wang Chen 2008-10-14 13:30:33 +08:00 committed by John W. Linville
parent b706e65b40
commit faf3994a9f
1 changed files with 86 additions and 85 deletions

View File

@ -1270,6 +1270,7 @@ static int flashrestart(struct airo_info *ai,struct net_device *dev);
#define airo_print_err(name, fmt, args...) \ #define airo_print_err(name, fmt, args...) \
airo_print(KERN_ERR, name, fmt, ##args) airo_print(KERN_ERR, name, fmt, ##args)
#define AIRO_FLASH(dev) (((struct airo_info *)dev->ml_priv)->flash)
/*********************************************************************** /***********************************************************************
* MIC ROUTINES * * MIC ROUTINES *
@ -1865,7 +1866,7 @@ static void try_auto_wep(struct airo_info *ai)
} }
static int airo_open(struct net_device *dev) { static int airo_open(struct net_device *dev) {
struct airo_info *ai = dev->priv; struct airo_info *ai = dev->ml_priv;
int rc = 0; int rc = 0;
if (test_bit(FLAG_FLASHING, &ai->flags)) if (test_bit(FLAG_FLASHING, &ai->flags))
@ -1912,7 +1913,7 @@ static int airo_open(struct net_device *dev) {
static int mpi_start_xmit(struct sk_buff *skb, struct net_device *dev) { static int mpi_start_xmit(struct sk_buff *skb, struct net_device *dev) {
int npacks, pending; int npacks, pending;
unsigned long flags; unsigned long flags;
struct airo_info *ai = dev->priv; struct airo_info *ai = dev->ml_priv;
if (!skb) { if (!skb) {
airo_print_err(dev->name, "%s: skb == NULL!",__func__); airo_print_err(dev->name, "%s: skb == NULL!",__func__);
@ -1956,7 +1957,7 @@ static int mpi_send_packet (struct net_device *dev)
unsigned char *buffer; unsigned char *buffer;
s16 len; s16 len;
__le16 *payloadLen; __le16 *payloadLen;
struct airo_info *ai = dev->priv; struct airo_info *ai = dev->ml_priv;
u8 *sendbuf; u8 *sendbuf;
/* get a packet to send */ /* get a packet to send */
@ -2085,7 +2086,7 @@ static void get_tx_error(struct airo_info *ai, s32 fid)
static void airo_end_xmit(struct net_device *dev) { static void airo_end_xmit(struct net_device *dev) {
u16 status; u16 status;
int i; int i;
struct airo_info *priv = dev->priv; struct airo_info *priv = dev->ml_priv;
struct sk_buff *skb = priv->xmit.skb; struct sk_buff *skb = priv->xmit.skb;
int fid = priv->xmit.fid; int fid = priv->xmit.fid;
u32 *fids = priv->fids; u32 *fids = priv->fids;
@ -2111,7 +2112,7 @@ static void airo_end_xmit(struct net_device *dev) {
static int airo_start_xmit(struct sk_buff *skb, struct net_device *dev) { static int airo_start_xmit(struct sk_buff *skb, struct net_device *dev) {
s16 len; s16 len;
int i, j; int i, j;
struct airo_info *priv = dev->priv; struct airo_info *priv = dev->ml_priv;
u32 *fids = priv->fids; u32 *fids = priv->fids;
if ( skb == NULL ) { if ( skb == NULL ) {
@ -2150,7 +2151,7 @@ static int airo_start_xmit(struct sk_buff *skb, struct net_device *dev) {
static void airo_end_xmit11(struct net_device *dev) { static void airo_end_xmit11(struct net_device *dev) {
u16 status; u16 status;
int i; int i;
struct airo_info *priv = dev->priv; struct airo_info *priv = dev->ml_priv;
struct sk_buff *skb = priv->xmit11.skb; struct sk_buff *skb = priv->xmit11.skb;
int fid = priv->xmit11.fid; int fid = priv->xmit11.fid;
u32 *fids = priv->fids; u32 *fids = priv->fids;
@ -2176,7 +2177,7 @@ static void airo_end_xmit11(struct net_device *dev) {
static int airo_start_xmit11(struct sk_buff *skb, struct net_device *dev) { static int airo_start_xmit11(struct sk_buff *skb, struct net_device *dev) {
s16 len; s16 len;
int i, j; int i, j;
struct airo_info *priv = dev->priv; struct airo_info *priv = dev->ml_priv;
u32 *fids = priv->fids; u32 *fids = priv->fids;
if (test_bit(FLAG_MPI, &priv->flags)) { if (test_bit(FLAG_MPI, &priv->flags)) {
@ -2220,7 +2221,7 @@ static int airo_start_xmit11(struct sk_buff *skb, struct net_device *dev) {
static void airo_read_stats(struct net_device *dev) static void airo_read_stats(struct net_device *dev)
{ {
struct airo_info *ai = dev->priv; struct airo_info *ai = dev->ml_priv;
StatsRid stats_rid; StatsRid stats_rid;
__le32 *vals = stats_rid.vals; __le32 *vals = stats_rid.vals;
@ -2254,7 +2255,7 @@ static void airo_read_stats(struct net_device *dev)
static struct net_device_stats *airo_get_stats(struct net_device *dev) static struct net_device_stats *airo_get_stats(struct net_device *dev)
{ {
struct airo_info *local = dev->priv; struct airo_info *local = dev->ml_priv;
if (!test_bit(JOB_STATS, &local->jobs)) { if (!test_bit(JOB_STATS, &local->jobs)) {
/* Get stats out of the card if available */ /* Get stats out of the card if available */
@ -2281,7 +2282,7 @@ static void airo_set_promisc(struct airo_info *ai) {
} }
static void airo_set_multicast_list(struct net_device *dev) { static void airo_set_multicast_list(struct net_device *dev) {
struct airo_info *ai = dev->priv; struct airo_info *ai = dev->ml_priv;
if ((dev->flags ^ ai->flags) & IFF_PROMISC) { if ((dev->flags ^ ai->flags) & IFF_PROMISC) {
change_bit(FLAG_PROMISC, &ai->flags); change_bit(FLAG_PROMISC, &ai->flags);
@ -2299,7 +2300,7 @@ static void airo_set_multicast_list(struct net_device *dev) {
static int airo_set_mac_address(struct net_device *dev, void *p) static int airo_set_mac_address(struct net_device *dev, void *p)
{ {
struct airo_info *ai = dev->priv; struct airo_info *ai = dev->ml_priv;
struct sockaddr *addr = p; struct sockaddr *addr = p;
readConfigRid(ai, 1); readConfigRid(ai, 1);
@ -2339,7 +2340,7 @@ static void del_airo_dev(struct airo_info *ai)
} }
static int airo_close(struct net_device *dev) { static int airo_close(struct net_device *dev) {
struct airo_info *ai = dev->priv; struct airo_info *ai = dev->ml_priv;
netif_stop_queue(dev); netif_stop_queue(dev);
@ -2365,7 +2366,7 @@ static int airo_close(struct net_device *dev) {
void stop_airo_card( struct net_device *dev, int freeres ) void stop_airo_card( struct net_device *dev, int freeres )
{ {
struct airo_info *ai = dev->priv; struct airo_info *ai = dev->ml_priv;
set_bit(FLAG_RADIO_DOWN, &ai->flags); set_bit(FLAG_RADIO_DOWN, &ai->flags);
disable_MAC(ai, 1); disable_MAC(ai, 1);
@ -2665,7 +2666,7 @@ static struct net_device *init_wifidev(struct airo_info *ai,
struct net_device *dev = alloc_netdev(0, "wifi%d", wifi_setup); struct net_device *dev = alloc_netdev(0, "wifi%d", wifi_setup);
if (!dev) if (!dev)
return NULL; return NULL;
dev->priv = ethdev->priv; dev->ml_priv = ethdev->ml_priv;
dev->irq = ethdev->irq; dev->irq = ethdev->irq;
dev->base_addr = ethdev->base_addr; dev->base_addr = ethdev->base_addr;
dev->wireless_data = ethdev->wireless_data; dev->wireless_data = ethdev->wireless_data;
@ -2680,7 +2681,7 @@ static struct net_device *init_wifidev(struct airo_info *ai,
} }
static int reset_card( struct net_device *dev , int lock) { static int reset_card( struct net_device *dev , int lock) {
struct airo_info *ai = dev->priv; struct airo_info *ai = dev->ml_priv;
if (lock && down_interruptible(&ai->sem)) if (lock && down_interruptible(&ai->sem))
return -1; return -1;
@ -2765,7 +2766,7 @@ static struct net_device *_init_airo_card( unsigned short irq, int port,
return NULL; return NULL;
} }
ai = dev->priv; ai = dev->ml_priv = netdev_priv(dev);
ai->wifidev = NULL; ai->wifidev = NULL;
ai->flags = 1 << FLAG_RADIO_DOWN; ai->flags = 1 << FLAG_RADIO_DOWN;
ai->jobs = 0; ai->jobs = 0;
@ -2866,7 +2867,7 @@ static struct net_device *_init_airo_card( unsigned short irq, int port,
for( i = 0; i < MAX_FIDS; i++ ) for( i = 0; i < MAX_FIDS; i++ )
ai->fids[i] = transmit_allocate(ai,AIRO_DEF_MTU,i>=MAX_FIDS/2); ai->fids[i] = transmit_allocate(ai,AIRO_DEF_MTU,i>=MAX_FIDS/2);
if (setup_proc_entry(dev, dev->priv) < 0) if (setup_proc_entry(dev, dev->ml_priv) < 0)
goto err_out_wifi; goto err_out_wifi;
return dev; return dev;
@ -2915,7 +2916,7 @@ static int waitbusy (struct airo_info *ai) {
int reset_airo_card( struct net_device *dev ) int reset_airo_card( struct net_device *dev )
{ {
int i; int i;
struct airo_info *ai = dev->priv; struct airo_info *ai = dev->ml_priv;
if (reset_card (dev, 1)) if (reset_card (dev, 1))
return -1; return -1;
@ -2938,7 +2939,7 @@ int reset_airo_card( struct net_device *dev )
EXPORT_SYMBOL(reset_airo_card); EXPORT_SYMBOL(reset_airo_card);
static void airo_send_event(struct net_device *dev) { static void airo_send_event(struct net_device *dev) {
struct airo_info *ai = dev->priv; struct airo_info *ai = dev->ml_priv;
union iwreq_data wrqu; union iwreq_data wrqu;
StatusRid status_rid; StatusRid status_rid;
@ -3015,7 +3016,7 @@ out:
static int airo_thread(void *data) { static int airo_thread(void *data) {
struct net_device *dev = data; struct net_device *dev = data;
struct airo_info *ai = dev->priv; struct airo_info *ai = dev->ml_priv;
int locked; int locked;
set_freezable(); set_freezable();
@ -3130,7 +3131,7 @@ static irqreturn_t airo_interrupt(int irq, void *dev_id)
struct net_device *dev = dev_id; struct net_device *dev = dev_id;
u16 status; u16 status;
u16 fid; u16 fid;
struct airo_info *apriv = dev->priv; struct airo_info *apriv = dev->ml_priv;
u16 savedInterrupts = 0; u16 savedInterrupts = 0;
int handled = 0; int handled = 0;
@ -4600,7 +4601,7 @@ static int proc_status_open(struct inode *inode, struct file *file)
struct proc_data *data; struct proc_data *data;
struct proc_dir_entry *dp = PDE(inode); struct proc_dir_entry *dp = PDE(inode);
struct net_device *dev = dp->data; struct net_device *dev = dp->data;
struct airo_info *apriv = dev->priv; struct airo_info *apriv = dev->ml_priv;
CapabilityRid cap_rid; CapabilityRid cap_rid;
StatusRid status_rid; StatusRid status_rid;
u16 mode; u16 mode;
@ -4683,7 +4684,7 @@ static int proc_stats_rid_open( struct inode *inode,
struct proc_data *data; struct proc_data *data;
struct proc_dir_entry *dp = PDE(inode); struct proc_dir_entry *dp = PDE(inode);
struct net_device *dev = dp->data; struct net_device *dev = dp->data;
struct airo_info *apriv = dev->priv; struct airo_info *apriv = dev->ml_priv;
StatsRid stats; StatsRid stats;
int i, j; int i, j;
__le32 *vals = stats.vals; __le32 *vals = stats.vals;
@ -4746,7 +4747,7 @@ static void proc_config_on_close(struct inode *inode, struct file *file)
struct proc_data *data = file->private_data; struct proc_data *data = file->private_data;
struct proc_dir_entry *dp = PDE(inode); struct proc_dir_entry *dp = PDE(inode);
struct net_device *dev = dp->data; struct net_device *dev = dp->data;
struct airo_info *ai = dev->priv; struct airo_info *ai = dev->ml_priv;
char *line; char *line;
if ( !data->writelen ) return; if ( !data->writelen ) return;
@ -4958,7 +4959,7 @@ static int proc_config_open(struct inode *inode, struct file *file)
struct proc_data *data; struct proc_data *data;
struct proc_dir_entry *dp = PDE(inode); struct proc_dir_entry *dp = PDE(inode);
struct net_device *dev = dp->data; struct net_device *dev = dp->data;
struct airo_info *ai = dev->priv; struct airo_info *ai = dev->ml_priv;
int i; int i;
__le16 mode; __le16 mode;
@ -5049,7 +5050,7 @@ static void proc_SSID_on_close(struct inode *inode, struct file *file)
struct proc_data *data = (struct proc_data *)file->private_data; struct proc_data *data = (struct proc_data *)file->private_data;
struct proc_dir_entry *dp = PDE(inode); struct proc_dir_entry *dp = PDE(inode);
struct net_device *dev = dp->data; struct net_device *dev = dp->data;
struct airo_info *ai = dev->priv; struct airo_info *ai = dev->ml_priv;
SsidRid SSID_rid; SsidRid SSID_rid;
int i; int i;
char *p = data->wbuffer; char *p = data->wbuffer;
@ -5092,7 +5093,7 @@ static void proc_APList_on_close( struct inode *inode, struct file *file ) {
struct proc_data *data = (struct proc_data *)file->private_data; struct proc_data *data = (struct proc_data *)file->private_data;
struct proc_dir_entry *dp = PDE(inode); struct proc_dir_entry *dp = PDE(inode);
struct net_device *dev = dp->data; struct net_device *dev = dp->data;
struct airo_info *ai = dev->priv; struct airo_info *ai = dev->ml_priv;
APListRid APList_rid; APListRid APList_rid;
int i; int i;
@ -5187,7 +5188,7 @@ static void proc_wepkey_on_close( struct inode *inode, struct file *file ) {
struct proc_data *data; struct proc_data *data;
struct proc_dir_entry *dp = PDE(inode); struct proc_dir_entry *dp = PDE(inode);
struct net_device *dev = dp->data; struct net_device *dev = dp->data;
struct airo_info *ai = dev->priv; struct airo_info *ai = dev->ml_priv;
int i; int i;
char key[16]; char key[16];
u16 index = 0; u16 index = 0;
@ -5229,7 +5230,7 @@ static int proc_wepkey_open( struct inode *inode, struct file *file )
struct proc_data *data; struct proc_data *data;
struct proc_dir_entry *dp = PDE(inode); struct proc_dir_entry *dp = PDE(inode);
struct net_device *dev = dp->data; struct net_device *dev = dp->data;
struct airo_info *ai = dev->priv; struct airo_info *ai = dev->ml_priv;
char *ptr; char *ptr;
WepKeyRid wkr; WepKeyRid wkr;
__le16 lastindex; __le16 lastindex;
@ -5278,7 +5279,7 @@ static int proc_SSID_open(struct inode *inode, struct file *file)
struct proc_data *data; struct proc_data *data;
struct proc_dir_entry *dp = PDE(inode); struct proc_dir_entry *dp = PDE(inode);
struct net_device *dev = dp->data; struct net_device *dev = dp->data;
struct airo_info *ai = dev->priv; struct airo_info *ai = dev->ml_priv;
int i; int i;
char *ptr; char *ptr;
SsidRid SSID_rid; SsidRid SSID_rid;
@ -5322,7 +5323,7 @@ static int proc_APList_open( struct inode *inode, struct file *file ) {
struct proc_data *data; struct proc_data *data;
struct proc_dir_entry *dp = PDE(inode); struct proc_dir_entry *dp = PDE(inode);
struct net_device *dev = dp->data; struct net_device *dev = dp->data;
struct airo_info *ai = dev->priv; struct airo_info *ai = dev->ml_priv;
int i; int i;
char *ptr; char *ptr;
APListRid APList_rid; APListRid APList_rid;
@ -5362,7 +5363,7 @@ static int proc_BSSList_open( struct inode *inode, struct file *file ) {
struct proc_data *data; struct proc_data *data;
struct proc_dir_entry *dp = PDE(inode); struct proc_dir_entry *dp = PDE(inode);
struct net_device *dev = dp->data; struct net_device *dev = dp->data;
struct airo_info *ai = dev->priv; struct airo_info *ai = dev->ml_priv;
char *ptr; char *ptr;
BSSListRid BSSList_rid; BSSListRid BSSList_rid;
int rc; int rc;
@ -5440,7 +5441,7 @@ static int proc_close( struct inode *inode, struct file *file )
associated we will check every minute to see if anything has associated we will check every minute to see if anything has
changed. */ changed. */
static void timer_func( struct net_device *dev ) { static void timer_func( struct net_device *dev ) {
struct airo_info *apriv = dev->priv; struct airo_info *apriv = dev->ml_priv;
/* We don't have a link so try changing the authtype */ /* We don't have a link so try changing the authtype */
readConfigRid(apriv, 0); readConfigRid(apriv, 0);
@ -5511,7 +5512,7 @@ static void __devexit airo_pci_remove(struct pci_dev *pdev)
static int airo_pci_suspend(struct pci_dev *pdev, pm_message_t state) static int airo_pci_suspend(struct pci_dev *pdev, pm_message_t state)
{ {
struct net_device *dev = pci_get_drvdata(pdev); struct net_device *dev = pci_get_drvdata(pdev);
struct airo_info *ai = dev->priv; struct airo_info *ai = dev->ml_priv;
Cmd cmd; Cmd cmd;
Resp rsp; Resp rsp;
@ -5543,7 +5544,7 @@ static int airo_pci_suspend(struct pci_dev *pdev, pm_message_t state)
static int airo_pci_resume(struct pci_dev *pdev) static int airo_pci_resume(struct pci_dev *pdev)
{ {
struct net_device *dev = pci_get_drvdata(pdev); struct net_device *dev = pci_get_drvdata(pdev);
struct airo_info *ai = dev->priv; struct airo_info *ai = dev->ml_priv;
pci_power_t prev_state = pdev->current_state; pci_power_t prev_state = pdev->current_state;
pci_set_power_state(pdev, PCI_D0); pci_set_power_state(pdev, PCI_D0);
@ -5722,7 +5723,7 @@ static int airo_set_freq(struct net_device *dev,
struct iw_freq *fwrq, struct iw_freq *fwrq,
char *extra) char *extra)
{ {
struct airo_info *local = dev->priv; struct airo_info *local = dev->ml_priv;
int rc = -EINPROGRESS; /* Call commit handler */ int rc = -EINPROGRESS; /* Call commit handler */
/* If setting by frequency, convert to a channel */ /* If setting by frequency, convert to a channel */
@ -5767,7 +5768,7 @@ static int airo_get_freq(struct net_device *dev,
struct iw_freq *fwrq, struct iw_freq *fwrq,
char *extra) char *extra)
{ {
struct airo_info *local = dev->priv; struct airo_info *local = dev->ml_priv;
StatusRid status_rid; /* Card status info */ StatusRid status_rid; /* Card status info */
int ch; int ch;
@ -5798,7 +5799,7 @@ static int airo_set_essid(struct net_device *dev,
struct iw_point *dwrq, struct iw_point *dwrq,
char *extra) char *extra)
{ {
struct airo_info *local = dev->priv; struct airo_info *local = dev->ml_priv;
SsidRid SSID_rid; /* SSIDs */ SsidRid SSID_rid; /* SSIDs */
/* Reload the list of current SSID */ /* Reload the list of current SSID */
@ -5844,7 +5845,7 @@ static int airo_get_essid(struct net_device *dev,
struct iw_point *dwrq, struct iw_point *dwrq,
char *extra) char *extra)
{ {
struct airo_info *local = dev->priv; struct airo_info *local = dev->ml_priv;
StatusRid status_rid; /* Card status info */ StatusRid status_rid; /* Card status info */
readStatusRid(local, &status_rid, 1); readStatusRid(local, &status_rid, 1);
@ -5872,7 +5873,7 @@ static int airo_set_wap(struct net_device *dev,
struct sockaddr *awrq, struct sockaddr *awrq,
char *extra) char *extra)
{ {
struct airo_info *local = dev->priv; struct airo_info *local = dev->ml_priv;
Cmd cmd; Cmd cmd;
Resp rsp; Resp rsp;
APListRid APList_rid; APListRid APList_rid;
@ -5909,7 +5910,7 @@ static int airo_get_wap(struct net_device *dev,
struct sockaddr *awrq, struct sockaddr *awrq,
char *extra) char *extra)
{ {
struct airo_info *local = dev->priv; struct airo_info *local = dev->ml_priv;
StatusRid status_rid; /* Card status info */ StatusRid status_rid; /* Card status info */
readStatusRid(local, &status_rid, 1); readStatusRid(local, &status_rid, 1);
@ -5930,7 +5931,7 @@ static int airo_set_nick(struct net_device *dev,
struct iw_point *dwrq, struct iw_point *dwrq,
char *extra) char *extra)
{ {
struct airo_info *local = dev->priv; struct airo_info *local = dev->ml_priv;
/* Check the size of the string */ /* Check the size of the string */
if(dwrq->length > 16) { if(dwrq->length > 16) {
@ -5953,7 +5954,7 @@ static int airo_get_nick(struct net_device *dev,
struct iw_point *dwrq, struct iw_point *dwrq,
char *extra) char *extra)
{ {
struct airo_info *local = dev->priv; struct airo_info *local = dev->ml_priv;
readConfigRid(local, 1); readConfigRid(local, 1);
strncpy(extra, local->config.nodeName, 16); strncpy(extra, local->config.nodeName, 16);
@ -5972,7 +5973,7 @@ static int airo_set_rate(struct net_device *dev,
struct iw_param *vwrq, struct iw_param *vwrq,
char *extra) char *extra)
{ {
struct airo_info *local = dev->priv; struct airo_info *local = dev->ml_priv;
CapabilityRid cap_rid; /* Card capability info */ CapabilityRid cap_rid; /* Card capability info */
u8 brate = 0; u8 brate = 0;
int i; int i;
@ -6042,7 +6043,7 @@ static int airo_get_rate(struct net_device *dev,
struct iw_param *vwrq, struct iw_param *vwrq,
char *extra) char *extra)
{ {
struct airo_info *local = dev->priv; struct airo_info *local = dev->ml_priv;
StatusRid status_rid; /* Card status info */ StatusRid status_rid; /* Card status info */
readStatusRid(local, &status_rid, 1); readStatusRid(local, &status_rid, 1);
@ -6064,7 +6065,7 @@ static int airo_set_rts(struct net_device *dev,
struct iw_param *vwrq, struct iw_param *vwrq,
char *extra) char *extra)
{ {
struct airo_info *local = dev->priv; struct airo_info *local = dev->ml_priv;
int rthr = vwrq->value; int rthr = vwrq->value;
if(vwrq->disabled) if(vwrq->disabled)
@ -6088,7 +6089,7 @@ static int airo_get_rts(struct net_device *dev,
struct iw_param *vwrq, struct iw_param *vwrq,
char *extra) char *extra)
{ {
struct airo_info *local = dev->priv; struct airo_info *local = dev->ml_priv;
readConfigRid(local, 1); readConfigRid(local, 1);
vwrq->value = le16_to_cpu(local->config.rtsThres); vwrq->value = le16_to_cpu(local->config.rtsThres);
@ -6107,7 +6108,7 @@ static int airo_set_frag(struct net_device *dev,
struct iw_param *vwrq, struct iw_param *vwrq,
char *extra) char *extra)
{ {
struct airo_info *local = dev->priv; struct airo_info *local = dev->ml_priv;
int fthr = vwrq->value; int fthr = vwrq->value;
if(vwrq->disabled) if(vwrq->disabled)
@ -6132,7 +6133,7 @@ static int airo_get_frag(struct net_device *dev,
struct iw_param *vwrq, struct iw_param *vwrq,
char *extra) char *extra)
{ {
struct airo_info *local = dev->priv; struct airo_info *local = dev->ml_priv;
readConfigRid(local, 1); readConfigRid(local, 1);
vwrq->value = le16_to_cpu(local->config.fragThresh); vwrq->value = le16_to_cpu(local->config.fragThresh);
@ -6151,7 +6152,7 @@ static int airo_set_mode(struct net_device *dev,
__u32 *uwrq, __u32 *uwrq,
char *extra) char *extra)
{ {
struct airo_info *local = dev->priv; struct airo_info *local = dev->ml_priv;
int reset = 0; int reset = 0;
readConfigRid(local, 1); readConfigRid(local, 1);
@ -6214,7 +6215,7 @@ static int airo_get_mode(struct net_device *dev,
__u32 *uwrq, __u32 *uwrq,
char *extra) char *extra)
{ {
struct airo_info *local = dev->priv; struct airo_info *local = dev->ml_priv;
readConfigRid(local, 1); readConfigRid(local, 1);
/* If not managed, assume it's ad-hoc */ /* If not managed, assume it's ad-hoc */
@ -6251,7 +6252,7 @@ static int airo_set_encode(struct net_device *dev,
struct iw_point *dwrq, struct iw_point *dwrq,
char *extra) char *extra)
{ {
struct airo_info *local = dev->priv; struct airo_info *local = dev->ml_priv;
CapabilityRid cap_rid; /* Card capability info */ CapabilityRid cap_rid; /* Card capability info */
int perm = ( dwrq->flags & IW_ENCODE_TEMP ? 0 : 1 ); int perm = ( dwrq->flags & IW_ENCODE_TEMP ? 0 : 1 );
__le16 currentAuthType = local->config.authType; __le16 currentAuthType = local->config.authType;
@ -6338,7 +6339,7 @@ static int airo_get_encode(struct net_device *dev,
struct iw_point *dwrq, struct iw_point *dwrq,
char *extra) char *extra)
{ {
struct airo_info *local = dev->priv; struct airo_info *local = dev->ml_priv;
int index = (dwrq->flags & IW_ENCODE_INDEX) - 1; int index = (dwrq->flags & IW_ENCODE_INDEX) - 1;
CapabilityRid cap_rid; /* Card capability info */ CapabilityRid cap_rid; /* Card capability info */
@ -6386,7 +6387,7 @@ static int airo_set_encodeext(struct net_device *dev,
union iwreq_data *wrqu, union iwreq_data *wrqu,
char *extra) char *extra)
{ {
struct airo_info *local = dev->priv; struct airo_info *local = dev->ml_priv;
struct iw_point *encoding = &wrqu->encoding; struct iw_point *encoding = &wrqu->encoding;
struct iw_encode_ext *ext = (struct iw_encode_ext *)extra; struct iw_encode_ext *ext = (struct iw_encode_ext *)extra;
CapabilityRid cap_rid; /* Card capability info */ CapabilityRid cap_rid; /* Card capability info */
@ -6472,7 +6473,7 @@ static int airo_get_encodeext(struct net_device *dev,
union iwreq_data *wrqu, union iwreq_data *wrqu,
char *extra) char *extra)
{ {
struct airo_info *local = dev->priv; struct airo_info *local = dev->ml_priv;
struct iw_point *encoding = &wrqu->encoding; struct iw_point *encoding = &wrqu->encoding;
struct iw_encode_ext *ext = (struct iw_encode_ext *)extra; struct iw_encode_ext *ext = (struct iw_encode_ext *)extra;
CapabilityRid cap_rid; /* Card capability info */ CapabilityRid cap_rid; /* Card capability info */
@ -6535,7 +6536,7 @@ static int airo_set_auth(struct net_device *dev,
struct iw_request_info *info, struct iw_request_info *info,
union iwreq_data *wrqu, char *extra) union iwreq_data *wrqu, char *extra)
{ {
struct airo_info *local = dev->priv; struct airo_info *local = dev->ml_priv;
struct iw_param *param = &wrqu->param; struct iw_param *param = &wrqu->param;
__le16 currentAuthType = local->config.authType; __le16 currentAuthType = local->config.authType;
@ -6603,7 +6604,7 @@ static int airo_get_auth(struct net_device *dev,
struct iw_request_info *info, struct iw_request_info *info,
union iwreq_data *wrqu, char *extra) union iwreq_data *wrqu, char *extra)
{ {
struct airo_info *local = dev->priv; struct airo_info *local = dev->ml_priv;
struct iw_param *param = &wrqu->param; struct iw_param *param = &wrqu->param;
__le16 currentAuthType = local->config.authType; __le16 currentAuthType = local->config.authType;
@ -6652,7 +6653,7 @@ static int airo_set_txpow(struct net_device *dev,
struct iw_param *vwrq, struct iw_param *vwrq,
char *extra) char *extra)
{ {
struct airo_info *local = dev->priv; struct airo_info *local = dev->ml_priv;
CapabilityRid cap_rid; /* Card capability info */ CapabilityRid cap_rid; /* Card capability info */
int i; int i;
int rc = -EINVAL; int rc = -EINVAL;
@ -6689,7 +6690,7 @@ static int airo_get_txpow(struct net_device *dev,
struct iw_param *vwrq, struct iw_param *vwrq,
char *extra) char *extra)
{ {
struct airo_info *local = dev->priv; struct airo_info *local = dev->ml_priv;
readConfigRid(local, 1); readConfigRid(local, 1);
vwrq->value = le16_to_cpu(local->config.txPower); vwrq->value = le16_to_cpu(local->config.txPower);
@ -6709,7 +6710,7 @@ static int airo_set_retry(struct net_device *dev,
struct iw_param *vwrq, struct iw_param *vwrq,
char *extra) char *extra)
{ {
struct airo_info *local = dev->priv; struct airo_info *local = dev->ml_priv;
int rc = -EINVAL; int rc = -EINVAL;
if(vwrq->disabled) { if(vwrq->disabled) {
@ -6747,7 +6748,7 @@ static int airo_get_retry(struct net_device *dev,
struct iw_param *vwrq, struct iw_param *vwrq,
char *extra) char *extra)
{ {
struct airo_info *local = dev->priv; struct airo_info *local = dev->ml_priv;
vwrq->disabled = 0; /* Can't be disabled */ vwrq->disabled = 0; /* Can't be disabled */
@ -6778,7 +6779,7 @@ static int airo_get_range(struct net_device *dev,
struct iw_point *dwrq, struct iw_point *dwrq,
char *extra) char *extra)
{ {
struct airo_info *local = dev->priv; struct airo_info *local = dev->ml_priv;
struct iw_range *range = (struct iw_range *) extra; struct iw_range *range = (struct iw_range *) extra;
CapabilityRid cap_rid; /* Card capability info */ CapabilityRid cap_rid; /* Card capability info */
int i; int i;
@ -6903,7 +6904,7 @@ static int airo_set_power(struct net_device *dev,
struct iw_param *vwrq, struct iw_param *vwrq,
char *extra) char *extra)
{ {
struct airo_info *local = dev->priv; struct airo_info *local = dev->ml_priv;
readConfigRid(local, 1); readConfigRid(local, 1);
if (vwrq->disabled) { if (vwrq->disabled) {
@ -6960,7 +6961,7 @@ static int airo_get_power(struct net_device *dev,
struct iw_param *vwrq, struct iw_param *vwrq,
char *extra) char *extra)
{ {
struct airo_info *local = dev->priv; struct airo_info *local = dev->ml_priv;
__le16 mode; __le16 mode;
readConfigRid(local, 1); readConfigRid(local, 1);
@ -6991,7 +6992,7 @@ static int airo_set_sens(struct net_device *dev,
struct iw_param *vwrq, struct iw_param *vwrq,
char *extra) char *extra)
{ {
struct airo_info *local = dev->priv; struct airo_info *local = dev->ml_priv;
readConfigRid(local, 1); readConfigRid(local, 1);
local->config.rssiThreshold = local->config.rssiThreshold =
@ -7010,7 +7011,7 @@ static int airo_get_sens(struct net_device *dev,
struct iw_param *vwrq, struct iw_param *vwrq,
char *extra) char *extra)
{ {
struct airo_info *local = dev->priv; struct airo_info *local = dev->ml_priv;
readConfigRid(local, 1); readConfigRid(local, 1);
vwrq->value = le16_to_cpu(local->config.rssiThreshold); vwrq->value = le16_to_cpu(local->config.rssiThreshold);
@ -7030,7 +7031,7 @@ static int airo_get_aplist(struct net_device *dev,
struct iw_point *dwrq, struct iw_point *dwrq,
char *extra) char *extra)
{ {
struct airo_info *local = dev->priv; struct airo_info *local = dev->ml_priv;
struct sockaddr *address = (struct sockaddr *) extra; struct sockaddr *address = (struct sockaddr *) extra;
struct iw_quality qual[IW_MAX_AP]; struct iw_quality qual[IW_MAX_AP];
BSSListRid BSSList; BSSListRid BSSList;
@ -7103,7 +7104,7 @@ static int airo_set_scan(struct net_device *dev,
struct iw_point *dwrq, struct iw_point *dwrq,
char *extra) char *extra)
{ {
struct airo_info *ai = dev->priv; struct airo_info *ai = dev->ml_priv;
Cmd cmd; Cmd cmd;
Resp rsp; Resp rsp;
int wake = 0; int wake = 0;
@ -7149,7 +7150,7 @@ static inline char *airo_translate_scan(struct net_device *dev,
char *end_buf, char *end_buf,
BSSListRid *bss) BSSListRid *bss)
{ {
struct airo_info *ai = dev->priv; struct airo_info *ai = dev->ml_priv;
struct iw_event iwe; /* Temporary buffer */ struct iw_event iwe; /* Temporary buffer */
__le16 capabilities; __le16 capabilities;
char * current_val; /* For rates */ char * current_val; /* For rates */
@ -7331,7 +7332,7 @@ static int airo_get_scan(struct net_device *dev,
struct iw_point *dwrq, struct iw_point *dwrq,
char *extra) char *extra)
{ {
struct airo_info *ai = dev->priv; struct airo_info *ai = dev->ml_priv;
BSSListElement *net; BSSListElement *net;
int err = 0; int err = 0;
char *current_ev = extra; char *current_ev = extra;
@ -7375,7 +7376,7 @@ static int airo_config_commit(struct net_device *dev,
void *zwrq, /* NULL */ void *zwrq, /* NULL */
char *extra) /* NULL */ char *extra) /* NULL */
{ {
struct airo_info *local = dev->priv; struct airo_info *local = dev->ml_priv;
if (!test_bit (FLAG_COMMIT, &local->flags)) if (!test_bit (FLAG_COMMIT, &local->flags))
return 0; return 0;
@ -7520,7 +7521,7 @@ static const struct iw_handler_def airo_handler_def =
static int airo_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) static int airo_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
{ {
int rc = 0; int rc = 0;
struct airo_info *ai = (struct airo_info *)dev->priv; struct airo_info *ai = dev->ml_priv;
if (ai->power.event) if (ai->power.event)
return 0; return 0;
@ -7648,7 +7649,7 @@ static void airo_read_wireless_stats(struct airo_info *local)
static struct iw_statistics *airo_get_wireless_stats(struct net_device *dev) static struct iw_statistics *airo_get_wireless_stats(struct net_device *dev)
{ {
struct airo_info *local = dev->priv; struct airo_info *local = dev->ml_priv;
if (!test_bit(JOB_WSTATS, &local->jobs)) { if (!test_bit(JOB_WSTATS, &local->jobs)) {
/* Get stats out of the card if available */ /* Get stats out of the card if available */
@ -7673,7 +7674,7 @@ static int readrids(struct net_device *dev, aironet_ioctl *comp) {
unsigned short ridcode; unsigned short ridcode;
unsigned char *iobuf; unsigned char *iobuf;
int len; int len;
struct airo_info *ai = dev->priv; struct airo_info *ai = dev->ml_priv;
if (test_bit(FLAG_FLASHING, &ai->flags)) if (test_bit(FLAG_FLASHING, &ai->flags))
return -EIO; return -EIO;
@ -7739,7 +7740,7 @@ static int readrids(struct net_device *dev, aironet_ioctl *comp) {
*/ */
static int writerids(struct net_device *dev, aironet_ioctl *comp) { static int writerids(struct net_device *dev, aironet_ioctl *comp) {
struct airo_info *ai = dev->priv; struct airo_info *ai = dev->ml_priv;
int ridcode; int ridcode;
int enabled; int enabled;
static int (* writer)(struct airo_info *, u16 rid, const void *, int, int); static int (* writer)(struct airo_info *, u16 rid, const void *, int, int);
@ -7862,41 +7863,41 @@ static int flashcard(struct net_device *dev, aironet_ioctl *comp) {
switch(comp->command) switch(comp->command)
{ {
case AIROFLSHRST: case AIROFLSHRST:
return cmdreset((struct airo_info *)dev->priv); return cmdreset((struct airo_info *)dev->ml_priv);
case AIROFLSHSTFL: case AIROFLSHSTFL:
if (!((struct airo_info *)dev->priv)->flash && if (!AIRO_FLASH(dev) &&
(((struct airo_info *)dev->priv)->flash = kmalloc (FLASHSIZE, GFP_KERNEL)) == NULL) (AIRO_FLASH(dev) = kmalloc(FLASHSIZE, GFP_KERNEL)) == NULL)
return -ENOMEM; return -ENOMEM;
return setflashmode((struct airo_info *)dev->priv); return setflashmode((struct airo_info *)dev->ml_priv);
case AIROFLSHGCHR: /* Get char from aux */ case AIROFLSHGCHR: /* Get char from aux */
if(comp->len != sizeof(int)) if(comp->len != sizeof(int))
return -EINVAL; return -EINVAL;
if (copy_from_user(&z,comp->data,comp->len)) if (copy_from_user(&z,comp->data,comp->len))
return -EFAULT; return -EFAULT;
return flashgchar((struct airo_info *)dev->priv,z,8000); return flashgchar((struct airo_info *)dev->ml_priv, z, 8000);
case AIROFLSHPCHR: /* Send char to card. */ case AIROFLSHPCHR: /* Send char to card. */
if(comp->len != sizeof(int)) if(comp->len != sizeof(int))
return -EINVAL; return -EINVAL;
if (copy_from_user(&z,comp->data,comp->len)) if (copy_from_user(&z,comp->data,comp->len))
return -EFAULT; return -EFAULT;
return flashpchar((struct airo_info *)dev->priv,z,8000); return flashpchar((struct airo_info *)dev->ml_priv, z, 8000);
case AIROFLPUTBUF: /* Send 32k to card */ case AIROFLPUTBUF: /* Send 32k to card */
if (!((struct airo_info *)dev->priv)->flash) if (!AIRO_FLASH(dev))
return -ENOMEM; return -ENOMEM;
if(comp->len > FLASHSIZE) if(comp->len > FLASHSIZE)
return -EINVAL; return -EINVAL;
if(copy_from_user(((struct airo_info *)dev->priv)->flash,comp->data,comp->len)) if (copy_from_user(AIRO_FLASH(dev), comp->data, comp->len))
return -EFAULT; return -EFAULT;
flashputbuf((struct airo_info *)dev->priv); flashputbuf((struct airo_info *)dev->ml_priv);
return 0; return 0;
case AIRORESTART: case AIRORESTART:
if(flashrestart((struct airo_info *)dev->priv,dev)) if (flashrestart((struct airo_info *)dev->ml_priv, dev))
return -EIO; return -EIO;
return 0; return 0;
} }