]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/net/wireless/airo.c
airo warning fix
[linux-2.6-omap-h63xx.git] / drivers / net / wireless / airo.c
index e139a18c6acd2c53b4be05d513b22c8e30193f60..32019fb878d824c604fa84dcbc6082fee99bca87 100644 (file)
@@ -520,121 +520,124 @@ typedef struct {
 } SsidRid;
 
 typedef struct {
-        u16 len;
-        u16 modulation;
-#define MOD_DEFAULT 0
-#define MOD_CCK 1
-#define MOD_MOK 2
+        __le16 len;
+        __le16 modulation;
+#define MOD_DEFAULT cpu_to_le16(0)
+#define MOD_CCK cpu_to_le16(1)
+#define MOD_MOK cpu_to_le16(2)
 } ModulationRid;
 
 typedef struct {
-       u16 len; /* sizeof(ConfigRid) */
-       u16 opmode; /* operating mode */
-#define MODE_STA_IBSS 0
-#define MODE_STA_ESS 1
-#define MODE_AP 2
-#define MODE_AP_RPTR 3
-#define MODE_ETHERNET_HOST (0<<8) /* rx payloads converted */
-#define MODE_LLC_HOST (1<<8) /* rx payloads left as is */
-#define MODE_AIRONET_EXTEND (1<<9) /* enable Aironet extenstions */
-#define MODE_AP_INTERFACE (1<<10) /* enable ap interface extensions */
-#define MODE_ANTENNA_ALIGN (1<<11) /* enable antenna alignment */
-#define MODE_ETHER_LLC (1<<12) /* enable ethernet LLC */
-#define MODE_LEAF_NODE (1<<13) /* enable leaf node bridge */
-#define MODE_CF_POLLABLE (1<<14) /* enable CF pollable */
-#define MODE_MIC (1<<15) /* enable MIC */
-       u16 rmode; /* receive mode */
-#define RXMODE_BC_MC_ADDR 0
-#define RXMODE_BC_ADDR 1 /* ignore multicasts */
-#define RXMODE_ADDR 2 /* ignore multicast and broadcast */
-#define RXMODE_RFMON 3 /* wireless monitor mode */
-#define RXMODE_RFMON_ANYBSS 4
-#define RXMODE_LANMON 5 /* lan style monitor -- data packets only */
-#define RXMODE_DISABLE_802_3_HEADER (1<<8) /* disables 802.3 header on rx */
-#define RXMODE_NORMALIZED_RSSI (1<<9) /* return normalized RSSI */
-       u16 fragThresh;
-       u16 rtsThres;
+       __le16 len; /* sizeof(ConfigRid) */
+       __le16 opmode; /* operating mode */
+#define MODE_STA_IBSS cpu_to_le16(0)
+#define MODE_STA_ESS cpu_to_le16(1)
+#define MODE_AP cpu_to_le16(2)
+#define MODE_AP_RPTR cpu_to_le16(3)
+#define MODE_CFG_MASK cpu_to_le16(0xff)
+#define MODE_ETHERNET_HOST cpu_to_le16(0<<8) /* rx payloads converted */
+#define MODE_LLC_HOST cpu_to_le16(1<<8) /* rx payloads left as is */
+#define MODE_AIRONET_EXTEND cpu_to_le16(1<<9) /* enable Aironet extenstions */
+#define MODE_AP_INTERFACE cpu_to_le16(1<<10) /* enable ap interface extensions */
+#define MODE_ANTENNA_ALIGN cpu_to_le16(1<<11) /* enable antenna alignment */
+#define MODE_ETHER_LLC cpu_to_le16(1<<12) /* enable ethernet LLC */
+#define MODE_LEAF_NODE cpu_to_le16(1<<13) /* enable leaf node bridge */
+#define MODE_CF_POLLABLE cpu_to_le16(1<<14) /* enable CF pollable */
+#define MODE_MIC cpu_to_le16(1<<15) /* enable MIC */
+       __le16 rmode; /* receive mode */
+#define RXMODE_BC_MC_ADDR cpu_to_le16(0)
+#define RXMODE_BC_ADDR cpu_to_le16(1) /* ignore multicasts */
+#define RXMODE_ADDR cpu_to_le16(2) /* ignore multicast and broadcast */
+#define RXMODE_RFMON cpu_to_le16(3) /* wireless monitor mode */
+#define RXMODE_RFMON_ANYBSS cpu_to_le16(4)
+#define RXMODE_LANMON cpu_to_le16(5) /* lan style monitor -- data packets only */
+#define RXMODE_MASK cpu_to_le16(255)
+#define RXMODE_DISABLE_802_3_HEADER cpu_to_le16(1<<8) /* disables 802.3 header on rx */
+#define RXMODE_FULL_MASK (RXMODE_MASK | RXMODE_DISABLE_802_3_HEADER)
+#define RXMODE_NORMALIZED_RSSI cpu_to_le16(1<<9) /* return normalized RSSI */
+       __le16 fragThresh;
+       __le16 rtsThres;
        u8 macAddr[ETH_ALEN];
        u8 rates[8];
-       u16 shortRetryLimit;
-       u16 longRetryLimit;
-       u16 txLifetime; /* in kusec */
-       u16 rxLifetime; /* in kusec */
-       u16 stationary;
-       u16 ordering;
-       u16 u16deviceType; /* for overriding device type */
-       u16 cfpRate;
-       u16 cfpDuration;
-       u16 _reserved1[3];
+       __le16 shortRetryLimit;
+       __le16 longRetryLimit;
+       __le16 txLifetime; /* in kusec */
+       __le16 rxLifetime; /* in kusec */
+       __le16 stationary;
+       __le16 ordering;
+       __le16 u16deviceType; /* for overriding device type */
+       __le16 cfpRate;
+       __le16 cfpDuration;
+       __le16 _reserved1[3];
        /*---------- Scanning/Associating ----------*/
-       u16 scanMode;
-#define SCANMODE_ACTIVE 0
-#define SCANMODE_PASSIVE 1
-#define SCANMODE_AIROSCAN 2
-       u16 probeDelay; /* in kusec */
-       u16 probeEnergyTimeout; /* in kusec */
-        u16 probeResponseTimeout;
-       u16 beaconListenTimeout;
-       u16 joinNetTimeout;
-       u16 authTimeout;
-       u16 authType;
-#define AUTH_OPEN 0x1
-#define AUTH_ENCRYPT 0x101
-#define AUTH_SHAREDKEY 0x102
-#define AUTH_ALLOW_UNENCRYPTED 0x200
-       u16 associationTimeout;
-       u16 specifiedApTimeout;
-       u16 offlineScanInterval;
-       u16 offlineScanDuration;
-       u16 linkLossDelay;
-       u16 maxBeaconLostTime;
-       u16 refreshInterval;
-#define DISABLE_REFRESH 0xFFFF
-       u16 _reserved1a[1];
+       __le16 scanMode;
+#define SCANMODE_ACTIVE cpu_to_le16(0)
+#define SCANMODE_PASSIVE cpu_to_le16(1)
+#define SCANMODE_AIROSCAN cpu_to_le16(2)
+       __le16 probeDelay; /* in kusec */
+       __le16 probeEnergyTimeout; /* in kusec */
+        __le16 probeResponseTimeout;
+       __le16 beaconListenTimeout;
+       __le16 joinNetTimeout;
+       __le16 authTimeout;
+       __le16 authType;
+#define AUTH_OPEN cpu_to_le16(0x1)
+#define AUTH_ENCRYPT cpu_to_le16(0x101)
+#define AUTH_SHAREDKEY cpu_to_le16(0x102)
+#define AUTH_ALLOW_UNENCRYPTED cpu_to_le16(0x200)
+       __le16 associationTimeout;
+       __le16 specifiedApTimeout;
+       __le16 offlineScanInterval;
+       __le16 offlineScanDuration;
+       __le16 linkLossDelay;
+       __le16 maxBeaconLostTime;
+       __le16 refreshInterval;
+#define DISABLE_REFRESH cpu_to_le16(0xFFFF)
+       __le16 _reserved1a[1];
        /*---------- Power save operation ----------*/
-       u16 powerSaveMode;
-#define POWERSAVE_CAM 0
-#define POWERSAVE_PSP 1
-#define POWERSAVE_PSPCAM 2
-       u16 sleepForDtims;
-       u16 listenInterval;
-       u16 fastListenInterval;
-       u16 listenDecay;
-       u16 fastListenDelay;
-       u16 _reserved2[2];
+       __le16 powerSaveMode;
+#define POWERSAVE_CAM cpu_to_le16(0)
+#define POWERSAVE_PSP cpu_to_le16(1)
+#define POWERSAVE_PSPCAM cpu_to_le16(2)
+       __le16 sleepForDtims;
+       __le16 listenInterval;
+       __le16 fastListenInterval;
+       __le16 listenDecay;
+       __le16 fastListenDelay;
+       __le16 _reserved2[2];
        /*---------- Ap/Ibss config items ----------*/
-       u16 beaconPeriod;
-       u16 atimDuration;
-       u16 hopPeriod;
-       u16 channelSet;
-       u16 channel;
-       u16 dtimPeriod;
-       u16 bridgeDistance;
-       u16 radioID;
+       __le16 beaconPeriod;
+       __le16 atimDuration;
+       __le16 hopPeriod;
+       __le16 channelSet;
+       __le16 channel;
+       __le16 dtimPeriod;
+       __le16 bridgeDistance;
+       __le16 radioID;
        /*---------- Radio configuration ----------*/
-       u16 radioType;
-#define RADIOTYPE_DEFAULT 0
-#define RADIOTYPE_802_11 1
-#define RADIOTYPE_LEGACY 2
+       __le16 radioType;
+#define RADIOTYPE_DEFAULT cpu_to_le16(0)
+#define RADIOTYPE_802_11 cpu_to_le16(1)
+#define RADIOTYPE_LEGACY cpu_to_le16(2)
        u8 rxDiversity;
        u8 txDiversity;
-       u16 txPower;
+       __le16 txPower;
 #define TXPOWER_DEFAULT 0
-       u16 rssiThreshold;
+       __le16 rssiThreshold;
 #define RSSI_DEFAULT 0
-        u16 modulation;
-#define PREAMBLE_AUTO 0
-#define PREAMBLE_LONG 1
-#define PREAMBLE_SHORT 2
-       u16 preamble;
-       u16 homeProduct;
-       u16 radioSpecific;
+        __le16 modulation;
+#define PREAMBLE_AUTO cpu_to_le16(0)
+#define PREAMBLE_LONG cpu_to_le16(1)
+#define PREAMBLE_SHORT cpu_to_le16(2)
+       __le16 preamble;
+       __le16 homeProduct;
+       __le16 radioSpecific;
        /*---------- Aironet Extensions ----------*/
        u8 nodeName[16];
-       u16 arlThreshold;
-       u16 arlDecay;
-       u16 arlDelay;
-       u16 _reserved4[1];
+       __le16 arlThreshold;
+       __le16 arlDecay;
+       __le16 arlDelay;
+       __le16 _reserved4[1];
        /*---------- Aironet Extensions ----------*/
        u8 magicAction;
 #define MAGIC_ACTION_STSCHG 1
@@ -644,34 +647,34 @@ typedef struct {
 #define MAGIC_SWITCH_TO_PSP (0<<10)
 #define MAGIC_STAY_IN_CAM (1<<10)
        u8 magicControl;
-       u16 autoWake;
+       __le16 autoWake;
 } ConfigRid;
 
 typedef struct {
-       u16 len;
+       __le16 len;
        u8 mac[ETH_ALEN];
-       u16 mode;
-       u16 errorCode;
-       u16 sigQuality;
-       u16 SSIDlen;
+       __le16 mode;
+       __le16 errorCode;
+       __le16 sigQuality;
+       __le16 SSIDlen;
        char SSID[32];
        char apName[16];
        u8 bssid[4][ETH_ALEN];
-       u16 beaconPeriod;
-       u16 dimPeriod;
-       u16 atimDuration;
-       u16 hopPeriod;
-       u16 channelSet;
-       u16 channel;
-       u16 hopsToBackbone;
-       u16 apTotalLoad;
-       u16 generatedLoad;
-       u16 accumulatedArl;
-       u16 signalQuality;
-       u16 currentXmitRate;
-       u16 apDevExtensions;
-       u16 normalizedSignalStrength;
-       u16 shortPreamble;
+       __le16 beaconPeriod;
+       __le16 dimPeriod;
+       __le16 atimDuration;
+       __le16 hopPeriod;
+       __le16 channelSet;
+       __le16 channel;
+       __le16 hopsToBackbone;
+       __le16 apTotalLoad;
+       __le16 generatedLoad;
+       __le16 accumulatedArl;
+       __le16 signalQuality;
+       __le16 currentXmitRate;
+       __le16 apDevExtensions;
+       __le16 normalizedSignalStrength;
+       __le16 shortPreamble;
        u8 apIP[4];
        u8 noisePercent; /* Noise percent in last second */
        u8 noisedBm; /* Noise dBm in last second */
@@ -679,9 +682,9 @@ typedef struct {
        u8 noiseAvedBm; /* Noise dBm in last minute */
        u8 noiseMaxPercent; /* Highest noise percent in last minute */
        u8 noiseMaxdBm; /* Highest noise dbm in last minute */
-       u16 load;
+       __le16 load;
        u8 carrier[4];
-       u16 assocStatus;
+       __le16 assocStatus;
 #define STAT_NOPACKETS 0
 #define STAT_NOCARRIERSET 10
 #define STAT_GOTCARRIERSET 11
@@ -713,7 +716,7 @@ typedef struct {
 
 
 typedef struct {
-       u16 len;
+       __le16 len;
        u8 ap[4][ETH_ALEN];
 } APListRid;
 
@@ -1780,9 +1783,9 @@ static int writeSsidRid(struct airo_info*ai, SsidRid *pssidr, int lock)
        return PC4500_writerid(ai, RID_SSID, pssidr, sizeof(*pssidr), lock);
 }
 
-static int readConfigRid(struct airo_info*ai, int lock) {
+static int readConfigRid(struct airo_info *ai, int lock)
+{
        int rc;
-       u16 *s;
        ConfigRid cfg;
 
        if (ai->config.len)
@@ -1792,24 +1795,12 @@ static int readConfigRid(struct airo_info*ai, int lock) {
        if (rc != SUCCESS)
                return rc;
 
-       for(s = &cfg.len; s <= &cfg.rtsThres; s++) *s = le16_to_cpu(*s);
-
-       for(s = &cfg.shortRetryLimit; s <= &cfg.radioType; s++)
-               *s = le16_to_cpu(*s);
-
-       for(s = &cfg.txPower; s <= &cfg.radioSpecific; s++)
-               *s = le16_to_cpu(*s);
-
-       for(s = &cfg.arlThreshold; s <= &cfg._reserved4[0]; s++)
-               *s = cpu_to_le16(*s);
-
-       for(s = &cfg.autoWake; s <= &cfg.autoWake; s++)
-               *s = cpu_to_le16(*s);
-
        ai->config = cfg;
        return SUCCESS;
 }
-static inline void checkThrottle(struct airo_info *ai) {
+
+static inline void checkThrottle(struct airo_info *ai)
+{
        int i;
 /* Old hardware had a limit on encryption speed */
        if (ai->config.authType != AUTH_OPEN && maxencrypt) {
@@ -1820,8 +1811,9 @@ static inline void checkThrottle(struct airo_info *ai) {
                }
        }
 }
-static int writeConfigRid(struct airo_info*ai, int lock) {
-       u16 *s;
+
+static int writeConfigRid(struct airo_info *ai, int lock)
+{
        ConfigRid cfgr;
 
        if (!test_bit (FLAG_COMMIT, &ai->flags))
@@ -1832,50 +1824,27 @@ static int writeConfigRid(struct airo_info*ai, int lock) {
        checkThrottle(ai);
        cfgr = ai->config;
 
-       if ((cfgr.opmode & 0xFF) == MODE_STA_IBSS)
+       if ((cfgr.opmode & MODE_CFG_MASK) == MODE_STA_IBSS)
                set_bit(FLAG_ADHOC, &ai->flags);
        else
                clear_bit(FLAG_ADHOC, &ai->flags);
 
-       for(s = &cfgr.len; s <= &cfgr.rtsThres; s++) *s = cpu_to_le16(*s);
-
-       for(s = &cfgr.shortRetryLimit; s <= &cfgr.radioType; s++)
-               *s = cpu_to_le16(*s);
-
-       for(s = &cfgr.txPower; s <= &cfgr.radioSpecific; s++)
-               *s = cpu_to_le16(*s);
-
-       for(s = &cfgr.arlThreshold; s <= &cfgr._reserved4[0]; s++)
-               *s = cpu_to_le16(*s);
-
-       for(s = &cfgr.autoWake; s <= &cfgr.autoWake; s++)
-               *s = cpu_to_le16(*s);
-
        return PC4500_writerid( ai, RID_CONFIG, &cfgr, sizeof(cfgr), lock);
 }
-static int readStatusRid(struct airo_info*ai, StatusRid *statr, int lock) {
-       int rc = PC4500_readrid(ai, RID_STATUS, statr, sizeof(*statr), lock);
-       u16 *s;
 
-       statr->len = le16_to_cpu(statr->len);
-       for(s = &statr->mode; s <= &statr->SSIDlen; s++) *s = le16_to_cpu(*s);
-
-       for(s = &statr->beaconPeriod; s <= &statr->shortPreamble; s++)
-               *s = le16_to_cpu(*s);
-       statr->load = le16_to_cpu(statr->load);
-       statr->assocStatus = le16_to_cpu(statr->assocStatus);
-       return rc;
+static int readStatusRid(struct airo_info *ai, StatusRid *statr, int lock)
+{
+       return PC4500_readrid(ai, RID_STATUS, statr, sizeof(*statr), lock);
 }
-static int readAPListRid(struct airo_info*ai, APListRid *aplr) {
-       int rc =  PC4500_readrid(ai, RID_APLIST, aplr, sizeof(*aplr), 1);
-       aplr->len = le16_to_cpu(aplr->len);
-       return rc;
+
+static int readAPListRid(struct airo_info *ai, APListRid *aplr)
+{
+       return PC4500_readrid(ai, RID_APLIST, aplr, sizeof(*aplr), 1);
 }
-static int writeAPListRid(struct airo_info*ai, APListRid *aplr, int lock) {
-       int rc;
-       aplr->len = cpu_to_le16(aplr->len);
-       rc = PC4500_writerid(ai, RID_APLIST, aplr, sizeof(*aplr), lock);
-       return rc;
+
+static int writeAPListRid(struct airo_info *ai, APListRid *aplr, int lock)
+{
+       return PC4500_writerid(ai, RID_APLIST, aplr, sizeof(*aplr), lock);
 }
 
 static int readCapabilityRid(struct airo_info *ai, CapabilityRid *capr, int lock)
@@ -2699,6 +2668,7 @@ static struct net_device *init_wifidev(struct airo_info *ai,
        dev->irq = ethdev->irq;
        dev->base_addr = ethdev->base_addr;
        dev->wireless_data = ethdev->wireless_data;
+       SET_NETDEV_DEV(dev, ethdev->dev.parent);
        memcpy(dev->dev_addr, ethdev->dev_addr, dev->addr_len);
        err = register_netdev(dev);
        if (err<0) {
@@ -2935,7 +2905,7 @@ EXPORT_SYMBOL(init_airo_card);
 
 static int waitbusy (struct airo_info *ai) {
        int delay = 0;
-       while ((IN4500 (ai, COMMAND) & COMMAND_BUSY) & (delay < 10000)) {
+       while ((IN4500(ai, COMMAND) & COMMAND_BUSY) && (delay < 10000)) {
                udelay (10);
                if ((++delay % 20) == 0)
                        OUT4500(ai, EVACK, EV_CLEARCOMMANDBUSY);
@@ -3688,7 +3658,7 @@ void mpi_receive_802_11 (struct airo_info *ai)
        ptr += hdrlen;
        if (hdrlen == 24)
                ptr += 6;
-       gap = le16_to_cpu(get_unaligned((__le16 *)ptr));
+       gap = get_unaligned_le16(ptr);
        ptr += sizeof(__le16);
        if (gap) {
                if (gap <= 8)
@@ -4378,24 +4348,28 @@ static int proc_config_open( struct inode *inode, struct file *file );
 static int proc_wepkey_open( struct inode *inode, struct file *file );
 
 static const struct file_operations proc_statsdelta_ops = {
+       .owner          = THIS_MODULE,
        .read           = proc_read,
        .open           = proc_statsdelta_open,
        .release        = proc_close
 };
 
 static const struct file_operations proc_stats_ops = {
+       .owner          = THIS_MODULE,
        .read           = proc_read,
        .open           = proc_stats_open,
        .release        = proc_close
 };
 
 static const struct file_operations proc_status_ops = {
+       .owner          = THIS_MODULE,
        .read           = proc_read,
        .open           = proc_status_open,
        .release        = proc_close
 };
 
 static const struct file_operations proc_SSID_ops = {
+       .owner          = THIS_MODULE,
        .read           = proc_read,
        .write          = proc_write,
        .open           = proc_SSID_open,
@@ -4403,6 +4377,7 @@ static const struct file_operations proc_SSID_ops = {
 };
 
 static const struct file_operations proc_BSSList_ops = {
+       .owner          = THIS_MODULE,
        .read           = proc_read,
        .write          = proc_write,
        .open           = proc_BSSList_open,
@@ -4410,6 +4385,7 @@ static const struct file_operations proc_BSSList_ops = {
 };
 
 static const struct file_operations proc_APList_ops = {
+       .owner          = THIS_MODULE,
        .read           = proc_read,
        .write          = proc_write,
        .open           = proc_APList_open,
@@ -4417,6 +4393,7 @@ static const struct file_operations proc_APList_ops = {
 };
 
 static const struct file_operations proc_config_ops = {
+       .owner          = THIS_MODULE,
        .read           = proc_read,
        .write          = proc_write,
        .open           = proc_config_open,
@@ -4424,6 +4401,7 @@ static const struct file_operations proc_config_ops = {
 };
 
 static const struct file_operations proc_wepkey_ops = {
+       .owner          = THIS_MODULE,
        .read           = proc_read,
        .write          = proc_write,
        .open           = proc_wepkey_open,
@@ -4442,10 +4420,6 @@ struct proc_data {
        void (*on_close) (struct inode *, struct file *);
 };
 
-#ifndef SETPROC_OPS
-#define SETPROC_OPS(entry, ops) (entry)->proc_fops = &(ops)
-#endif
-
 static int setup_proc_entry( struct net_device *dev,
                             struct airo_info *apriv ) {
        struct proc_dir_entry *entry;
@@ -4461,100 +4435,76 @@ static int setup_proc_entry( struct net_device *dev,
        apriv->proc_entry->owner = THIS_MODULE;
 
        /* Setup the StatsDelta */
-       entry = create_proc_entry("StatsDelta",
-                                 S_IFREG | (S_IRUGO&proc_perm),
-                                 apriv->proc_entry);
+       entry = proc_create_data("StatsDelta",
+                                S_IFREG | (S_IRUGO&proc_perm),
+                                apriv->proc_entry, &proc_statsdelta_ops, dev);
        if (!entry)
                goto fail_stats_delta;
        entry->uid = proc_uid;
        entry->gid = proc_gid;
-       entry->data = dev;
-       entry->owner = THIS_MODULE;
-       SETPROC_OPS(entry, proc_statsdelta_ops);
 
        /* Setup the Stats */
-       entry = create_proc_entry("Stats",
-                                 S_IFREG | (S_IRUGO&proc_perm),
-                                 apriv->proc_entry);
+       entry = proc_create_data("Stats",
+                                S_IFREG | (S_IRUGO&proc_perm),
+                                apriv->proc_entry, &proc_stats_ops, dev);
        if (!entry)
                goto fail_stats;
        entry->uid = proc_uid;
        entry->gid = proc_gid;
-       entry->data = dev;
-       entry->owner = THIS_MODULE;
-       SETPROC_OPS(entry, proc_stats_ops);
 
        /* Setup the Status */
-       entry = create_proc_entry("Status",
-                                 S_IFREG | (S_IRUGO&proc_perm),
-                                 apriv->proc_entry);
+       entry = proc_create_data("Status",
+                                S_IFREG | (S_IRUGO&proc_perm),
+                                apriv->proc_entry, &proc_status_ops, dev);
        if (!entry)
                goto fail_status;
        entry->uid = proc_uid;
        entry->gid = proc_gid;
-       entry->data = dev;
-       entry->owner = THIS_MODULE;
-       SETPROC_OPS(entry, proc_status_ops);
 
        /* Setup the Config */
-       entry = create_proc_entry("Config",
-                                 S_IFREG | proc_perm,
-                                 apriv->proc_entry);
+       entry = proc_create_data("Config",
+                                S_IFREG | proc_perm,
+                                apriv->proc_entry, &proc_config_ops, dev);
        if (!entry)
                goto fail_config;
        entry->uid = proc_uid;
        entry->gid = proc_gid;
-       entry->data = dev;
-       entry->owner = THIS_MODULE;
-       SETPROC_OPS(entry, proc_config_ops);
 
        /* Setup the SSID */
-       entry = create_proc_entry("SSID",
-                                 S_IFREG | proc_perm,
-                                 apriv->proc_entry);
+       entry = proc_create_data("SSID",
+                                S_IFREG | proc_perm,
+                                apriv->proc_entry, &proc_SSID_ops, dev);
        if (!entry)
                goto fail_ssid;
        entry->uid = proc_uid;
        entry->gid = proc_gid;
-       entry->data = dev;
-       entry->owner = THIS_MODULE;
-       SETPROC_OPS(entry, proc_SSID_ops);
 
        /* Setup the APList */
-       entry = create_proc_entry("APList",
-                                 S_IFREG | proc_perm,
-                                 apriv->proc_entry);
+       entry = proc_create_data("APList",
+                                S_IFREG | proc_perm,
+                                apriv->proc_entry, &proc_APList_ops, dev);
        if (!entry)
                goto fail_aplist;
        entry->uid = proc_uid;
        entry->gid = proc_gid;
-       entry->data = dev;
-       entry->owner = THIS_MODULE;
-       SETPROC_OPS(entry, proc_APList_ops);
 
        /* Setup the BSSList */
-       entry = create_proc_entry("BSSList",
-                                 S_IFREG | proc_perm,
-                                 apriv->proc_entry);
+       entry = proc_create_data("BSSList",
+                                S_IFREG | proc_perm,
+                                apriv->proc_entry, &proc_BSSList_ops, dev);
        if (!entry)
                goto fail_bsslist;
        entry->uid = proc_uid;
        entry->gid = proc_gid;
-       entry->data = dev;
-       entry->owner = THIS_MODULE;
-       SETPROC_OPS(entry, proc_BSSList_ops);
 
        /* Setup the WepKey */
-       entry = create_proc_entry("WepKey",
-                                 S_IFREG | proc_perm,
-                                 apriv->proc_entry);
+       entry = proc_create_data("WepKey",
+                                S_IFREG | proc_perm,
+                                apriv->proc_entry, &proc_wepkey_ops, dev);
        if (!entry)
                goto fail_wepkey;
        entry->uid = proc_uid;
        entry->gid = proc_gid;
-       entry->data = dev;
-       entry->owner = THIS_MODULE;
-       SETPROC_OPS(entry, proc_wepkey_ops);
 
        return 0;
 
@@ -4657,13 +4607,15 @@ static ssize_t proc_write( struct file *file,
        return len;
 }
 
-static int proc_status_open( struct inode *inode, struct file *file ) {
+static int proc_status_open(struct inode *inode, struct file *file)
+{
        struct proc_data *data;
        struct proc_dir_entry *dp = PDE(inode);
        struct net_device *dev = dp->data;
        struct airo_info *apriv = dev->priv;
        CapabilityRid cap_rid;
        StatusRid status_rid;
+       u16 mode;
        int i;
 
        if ((file->private_data = kzalloc(sizeof(struct proc_data ), GFP_KERNEL)) == NULL)
@@ -4677,16 +4629,18 @@ static int proc_status_open( struct inode *inode, struct file *file ) {
        readStatusRid(apriv, &status_rid, 1);
        readCapabilityRid(apriv, &cap_rid, 1);
 
+       mode = le16_to_cpu(status_rid.mode);
+
         i = sprintf(data->rbuffer, "Status: %s%s%s%s%s%s%s%s%s\n",
-                    status_rid.mode & 1 ? "CFG ": "",
-                    status_rid.mode & 2 ? "ACT ": "",
-                    status_rid.mode & 0x10 ? "SYN ": "",
-                    status_rid.mode & 0x20 ? "LNK ": "",
-                    status_rid.mode & 0x40 ? "LEAP ": "",
-                    status_rid.mode & 0x80 ? "PRIV ": "",
-                    status_rid.mode & 0x100 ? "KEY ": "",
-                    status_rid.mode & 0x200 ? "WEP ": "",
-                    status_rid.mode & 0x8000 ? "ERR ": "");
+                    mode & 1 ? "CFG ": "",
+                    mode & 2 ? "ACT ": "",
+                    mode & 0x10 ? "SYN ": "",
+                    mode & 0x20 ? "LNK ": "",
+                    mode & 0x40 ? "LEAP ": "",
+                    mode & 0x80 ? "PRIV ": "",
+                    mode & 0x100 ? "KEY ": "",
+                    mode & 0x200 ? "WEP ": "",
+                    mode & 0x8000 ? "ERR ": "");
        sprintf( data->rbuffer+i, "Mode: %x\n"
                 "Signal Strength: %d\n"
                 "Signal Quality: %d\n"
@@ -4699,14 +4653,14 @@ static int proc_status_open( struct inode *inode, struct file *file ) {
                 "Radio type: %x\nCountry: %x\nHardware Version: %x\n"
                 "Software Version: %x\nSoftware Subversion: %x\n"
                 "Boot block version: %x\n",
-                (int)status_rid.mode,
-                (int)status_rid.normalizedSignalStrength,
-                (int)status_rid.signalQuality,
-                (int)status_rid.SSIDlen,
+                le16_to_cpu(status_rid.mode),
+                le16_to_cpu(status_rid.normalizedSignalStrength),
+                le16_to_cpu(status_rid.signalQuality),
+                le16_to_cpu(status_rid.SSIDlen),
                 status_rid.SSID,
                 status_rid.apName,
-                (int)status_rid.channel,
-                (int)status_rid.currentXmitRate/2,
+                le16_to_cpu(status_rid.channel),
+                le16_to_cpu(status_rid.currentXmitRate) / 2,
                 version,
                 cap_rid.prodName,
                 cap_rid.manName,
@@ -4793,7 +4747,14 @@ static int airo_config_commit(struct net_device *dev,
                              struct iw_request_info *info, void *zwrq,
                              char *extra);
 
-static void proc_config_on_close( struct inode *inode, struct file *file ) {
+static inline int sniffing_mode(struct airo_info *ai)
+{
+       return le16_to_cpu(ai->config.rmode & RXMODE_MASK) >=
+               le16_to_cpu(RXMODE_RFMON);
+}
+
+static void proc_config_on_close(struct inode *inode, struct file *file)
+{
        struct proc_data *data = file->private_data;
        struct proc_dir_entry *dp = PDE(inode);
        struct net_device *dev = dp->data;
@@ -4810,16 +4771,16 @@ static void proc_config_on_close( struct inode *inode, struct file *file ) {
 /*** Mode processing */
                if ( !strncmp( line, "Mode: ", 6 ) ) {
                        line += 6;
-                       if ((ai->config.rmode & 0xff) >= RXMODE_RFMON)
-                                       set_bit (FLAG_RESET, &ai->flags);
-                       ai->config.rmode &= 0xfe00;
+                       if (sniffing_mode(ai))
+                               set_bit (FLAG_RESET, &ai->flags);
+                       ai->config.rmode &= ~RXMODE_FULL_MASK;
                        clear_bit (FLAG_802_11, &ai->flags);
-                       ai->config.opmode &= 0xFF00;
+                       ai->config.opmode &= ~MODE_CFG_MASK;
                        ai->config.scanMode = SCANMODE_ACTIVE;
                        if ( line[0] == 'a' ) {
-                               ai->config.opmode |= 0;
+                               ai->config.opmode |= MODE_STA_IBSS;
                        } else {
-                               ai->config.opmode |= 1;
+                               ai->config.opmode |= MODE_STA_ESS;
                                if ( line[0] == 'r' ) {
                                        ai->config.rmode |= RXMODE_RFMON | RXMODE_DISABLE_802_3_HEADER;
                                        ai->config.scanMode = SCANMODE_PASSIVE;
@@ -4885,7 +4846,7 @@ static void proc_config_on_close( struct inode *inode, struct file *file ) {
                        line += 9;
                        v = get_dec_u16(line, &i, i+3);
                        if ( v != -1 ) {
-                               ai->config.channelSet = (u16)v;
+                               ai->config.channelSet = cpu_to_le16(v);
                                set_bit (FLAG_COMMIT, &ai->flags);
                        }
                } else if ( !strncmp( line, "XmitPower: ", 11 ) ) {
@@ -4893,20 +4854,20 @@ static void proc_config_on_close( struct inode *inode, struct file *file ) {
                        line += 11;
                        v = get_dec_u16(line, &i, i+3);
                        if ( v != -1 ) {
-                               ai->config.txPower = (u16)v;
+                               ai->config.txPower = cpu_to_le16(v);
                                set_bit (FLAG_COMMIT, &ai->flags);
                        }
                } else if ( !strncmp( line, "WEP: ", 5 ) ) {
                        line += 5;
                        switch( line[0] ) {
                        case 's':
-                               ai->config.authType = (u16)AUTH_SHAREDKEY;
+                               ai->config.authType = AUTH_SHAREDKEY;
                                break;
                        case 'e':
-                               ai->config.authType = (u16)AUTH_ENCRYPT;
+                               ai->config.authType = AUTH_ENCRYPT;
                                break;
                        default:
-                               ai->config.authType = (u16)AUTH_OPEN;
+                               ai->config.authType = AUTH_OPEN;
                                break;
                        }
                        set_bit (FLAG_COMMIT, &ai->flags);
@@ -4916,7 +4877,7 @@ static void proc_config_on_close( struct inode *inode, struct file *file ) {
                        line += 16;
                        v = get_dec_u16(line, &i, 3);
                        v = (v<0) ? 0 : ((v>255) ? 255 : v);
-                       ai->config.longRetryLimit = (u16)v;
+                       ai->config.longRetryLimit = cpu_to_le16(v);
                        set_bit (FLAG_COMMIT, &ai->flags);
                } else if ( !strncmp( line, "ShortRetryLimit: ", 17 ) ) {
                        int v, i = 0;
@@ -4924,7 +4885,7 @@ static void proc_config_on_close( struct inode *inode, struct file *file ) {
                        line += 17;
                        v = get_dec_u16(line, &i, 3);
                        v = (v<0) ? 0 : ((v>255) ? 255 : v);
-                       ai->config.shortRetryLimit = (u16)v;
+                       ai->config.shortRetryLimit = cpu_to_le16(v);
                        set_bit (FLAG_COMMIT, &ai->flags);
                } else if ( !strncmp( line, "RTSThreshold: ", 14 ) ) {
                        int v, i = 0;
@@ -4932,7 +4893,7 @@ static void proc_config_on_close( struct inode *inode, struct file *file ) {
                        line += 14;
                        v = get_dec_u16(line, &i, 4);
                        v = (v<0) ? 0 : ((v>AIRO_DEF_MTU) ? AIRO_DEF_MTU : v);
-                       ai->config.rtsThres = (u16)v;
+                       ai->config.rtsThres = cpu_to_le16(v);
                        set_bit (FLAG_COMMIT, &ai->flags);
                } else if ( !strncmp( line, "TXMSDULifetime: ", 16 ) ) {
                        int v, i = 0;
@@ -4940,7 +4901,7 @@ static void proc_config_on_close( struct inode *inode, struct file *file ) {
                        line += 16;
                        v = get_dec_u16(line, &i, 5);
                        v = (v<0) ? 0 : v;
-                       ai->config.txLifetime = (u16)v;
+                       ai->config.txLifetime = cpu_to_le16(v);
                        set_bit (FLAG_COMMIT, &ai->flags);
                } else if ( !strncmp( line, "RXMSDULifetime: ", 16 ) ) {
                        int v, i = 0;
@@ -4948,7 +4909,7 @@ static void proc_config_on_close( struct inode *inode, struct file *file ) {
                        line += 16;
                        v = get_dec_u16(line, &i, 5);
                        v = (v<0) ? 0 : v;
-                       ai->config.rxLifetime = (u16)v;
+                       ai->config.rxLifetime = cpu_to_le16(v);
                        set_bit (FLAG_COMMIT, &ai->flags);
                } else if ( !strncmp( line, "TXDiversity: ", 13 ) ) {
                        ai->config.txDiversity =
@@ -4967,7 +4928,7 @@ static void proc_config_on_close( struct inode *inode, struct file *file ) {
                        v = get_dec_u16(line, &i, 4);
                        v = (v<256) ? 256 : ((v>AIRO_DEF_MTU) ? AIRO_DEF_MTU : v);
                        v = v & 0xfffe; /* Make sure its even */
-                       ai->config.fragThresh = (u16)v;
+                       ai->config.fragThresh = cpu_to_le16(v);
                        set_bit (FLAG_COMMIT, &ai->flags);
                } else if (!strncmp(line, "Modulation: ", 12)) {
                        line += 12;
@@ -4994,8 +4955,9 @@ static void proc_config_on_close( struct inode *inode, struct file *file ) {
        airo_config_commit(dev, NULL, NULL, NULL);
 }
 
-static char *get_rmode(u16 mode) {
-        switch(mode&0xff) {
+static char *get_rmode(__le16 mode)
+{
+        switch(mode & RXMODE_MASK) {
         case RXMODE_RFMON:  return "rfmon";
         case RXMODE_RFMON_ANYBSS:  return "yna (any) bss rfmon";
         case RXMODE_LANMON:  return "lanmon";
@@ -5003,12 +4965,14 @@ static char *get_rmode(u16 mode) {
         return "ESS";
 }
 
-static int proc_config_open( struct inode *inode, struct file *file ) {
+static int proc_config_open(struct inode *inode, struct file *file)
+{
        struct proc_data *data;
        struct proc_dir_entry *dp = PDE(inode);
        struct net_device *dev = dp->data;
        struct airo_info *ai = dev->priv;
        int i;
+       __le16 mode;
 
        if ((file->private_data = kzalloc(sizeof(struct proc_data ), GFP_KERNEL)) == NULL)
                return -ENOMEM;
@@ -5027,6 +4991,7 @@ static int proc_config_open( struct inode *inode, struct file *file ) {
 
        readConfigRid(ai, 1);
 
+       mode = ai->config.opmode & MODE_CFG_MASK;
        i = sprintf( data->rbuffer,
                     "Mode: %s\n"
                     "Radio: %s\n"
@@ -5035,15 +5000,16 @@ static int proc_config_open( struct inode *inode, struct file *file ) {
                     "DataRates: %d %d %d %d %d %d %d %d\n"
                     "Channel: %d\n"
                     "XmitPower: %d\n",
-                    (ai->config.opmode & 0xFF) == 0 ? "adhoc" :
-                    (ai->config.opmode & 0xFF) == 1 ? get_rmode(ai->config.rmode):
-                    (ai->config.opmode & 0xFF) == 2 ? "AP" :
-                    (ai->config.opmode & 0xFF) == 3 ? "AP RPTR" : "Error",
+                    mode == MODE_STA_IBSS ? "adhoc" :
+                    mode == MODE_STA_ESS ? get_rmode(ai->config.rmode):
+                    mode == MODE_AP ? "AP" :
+                    mode == MODE_AP_RPTR ? "AP RPTR" : "Error",
                     test_bit(FLAG_RADIO_OFF, &ai->flags) ? "off" : "on",
                     ai->config.nodeName,
-                    ai->config.powerSaveMode == 0 ? "CAM" :
-                    ai->config.powerSaveMode == 1 ? "PSP" :
-                    ai->config.powerSaveMode == 2 ? "PSPCAM" : "Error",
+                    ai->config.powerSaveMode == POWERSAVE_CAM ? "CAM" :
+                    ai->config.powerSaveMode == POWERSAVE_PSP ? "PSP" :
+                    ai->config.powerSaveMode == POWERSAVE_PSPCAM ? "PSPCAM" :
+                    "Error",
                     (int)ai->config.rates[0],
                     (int)ai->config.rates[1],
                     (int)ai->config.rates[2],
@@ -5052,8 +5018,8 @@ static int proc_config_open( struct inode *inode, struct file *file ) {
                     (int)ai->config.rates[5],
                     (int)ai->config.rates[6],
                     (int)ai->config.rates[7],
-                    (int)ai->config.channelSet,
-                    (int)ai->config.txPower
+                    le16_to_cpu(ai->config.channelSet),
+                    le16_to_cpu(ai->config.txPower)
                );
        sprintf( data->rbuffer + i,
                 "LongRetryLimit: %d\n"
@@ -5067,19 +5033,19 @@ static int proc_config_open( struct inode *inode, struct file *file ) {
                 "WEP: %s\n"
                 "Modulation: %s\n"
                 "Preamble: %s\n",
-                (int)ai->config.longRetryLimit,
-                (int)ai->config.shortRetryLimit,
-                (int)ai->config.rtsThres,
-                (int)ai->config.txLifetime,
-                (int)ai->config.rxLifetime,
+                le16_to_cpu(ai->config.longRetryLimit),
+                le16_to_cpu(ai->config.shortRetryLimit),
+                le16_to_cpu(ai->config.rtsThres),
+                le16_to_cpu(ai->config.txLifetime),
+                le16_to_cpu(ai->config.rxLifetime),
                 ai->config.txDiversity == 1 ? "left" :
                 ai->config.txDiversity == 2 ? "right" : "both",
                 ai->config.rxDiversity == 1 ? "left" :
                 ai->config.rxDiversity == 2 ? "right" : "both",
-                (int)ai->config.fragThresh,
+                le16_to_cpu(ai->config.fragThresh),
                 ai->config.authType == AUTH_ENCRYPT ? "encrypt" :
                 ai->config.authType == AUTH_SHAREDKEY ? "shared" : "open",
-                ai->config.modulation == 0 ? "default" :
+                ai->config.modulation == MOD_DEFAULT ? "default" :
                 ai->config.modulation == MOD_CCK ? "cck" :
                 ai->config.modulation == MOD_MOK ? "mok" : "error",
                 ai->config.preamble == PREAMBLE_AUTO ? "auto" :
@@ -5145,7 +5111,7 @@ static void proc_APList_on_close( struct inode *inode, struct file *file ) {
        if ( !data->writelen ) return;
 
        memset( &APList_rid, 0, sizeof(APList_rid) );
-       APList_rid.len = sizeof(APList_rid);
+       APList_rid.len = cpu_to_le16(sizeof(APList_rid));
 
        for( i = 0; i < 4 && data->writelen >= (i+1)*6*3; i++ ) {
                int j;
@@ -5640,9 +5606,9 @@ static int __init airo_init_module( void )
        int have_isa_dev = 0;
 #endif
 
-       airo_entry = create_proc_entry("aironet",
+       airo_entry = create_proc_entry("driver/aironet",
                                       S_IFDIR | airo_perm,
-                                      proc_root_driver);
+                                      NULL);
 
        if (airo_entry) {
                airo_entry->uid = proc_uid;
@@ -5666,7 +5632,7 @@ static int __init airo_init_module( void )
        airo_print_info("", "Finished probing for PCI adapters");
 
        if (i) {
-               remove_proc_entry("aironet", proc_root_driver);
+               remove_proc_entry("driver/aironet", NULL);
                return i;
        }
 #endif
@@ -5688,7 +5654,7 @@ static void __exit airo_cleanup_module( void )
 #ifdef CONFIG_PCI
        pci_unregister_driver(&airo_driver);
 #endif
-       remove_proc_entry("aironet", proc_root_driver);
+       remove_proc_entry("driver/aironet", NULL);
 }
 
 /*
@@ -5727,25 +5693,27 @@ static u8 airo_dbm_to_pct (tdsRssiEntry *rssi_rid, u8 dbm)
 static int airo_get_quality (StatusRid *status_rid, CapabilityRid *cap_rid)
 {
        int quality = 0;
+       u16 sq;
 
-       if ((status_rid->mode & 0x3f) != 0x3f)
+       if ((status_rid->mode & cpu_to_le16(0x3f)) != cpu_to_le16(0x3f))
                return 0;
 
        if (!(cap_rid->hardCap & cpu_to_le16(8)))
                return 0;
 
+       sq = le16_to_cpu(status_rid->signalQuality);
        if (memcmp(cap_rid->prodName, "350", 3))
-               if (status_rid->signalQuality > 0x20)
+               if (sq > 0x20)
                        quality = 0;
                else
-                       quality = 0x20 - status_rid->signalQuality;
+                       quality = 0x20 - sq;
        else
-               if (status_rid->signalQuality > 0xb0)
+               if (sq > 0xb0)
                        quality = 0;
-               else if (status_rid->signalQuality < 0x10)
+               else if (sq < 0x10)
                        quality = 0xa0;
                else
-                       quality = 0xb0 - status_rid->signalQuality;
+                       quality = 0xb0 - sq;
        return quality;
 }
 
@@ -5803,7 +5771,7 @@ static int airo_set_freq(struct net_device *dev,
                } else {
                        readConfigRid(local, 1);
                        /* Yes ! We can set it !!! */
-                       local->config.channelSet = (u16) channel;
+                       local->config.channelSet = cpu_to_le16(channel);
                        set_bit (FLAG_COMMIT, &local->flags);
                }
        }
@@ -5824,12 +5792,12 @@ static int airo_get_freq(struct net_device *dev,
        int ch;
 
        readConfigRid(local, 1);
-       if ((local->config.opmode & 0xFF) == MODE_STA_ESS)
+       if ((local->config.opmode & MODE_CFG_MASK) == MODE_STA_ESS)
                status_rid.channel = local->config.channelSet;
        else
                readStatusRid(local, &status_rid, 1);
 
-       ch = (int)status_rid.channel;
+       ch = le16_to_cpu(status_rid.channel);
        if((ch > 0) && (ch < 15)) {
                fwrq->m = frequency_list[ch - 1] * 100000;
                fwrq->e = 1;
@@ -5905,11 +5873,11 @@ static int airo_get_essid(struct net_device *dev,
         * get the relevant SSID from the SSID list... */
 
        /* Get the current SSID */
-       memcpy(extra, status_rid.SSID, status_rid.SSIDlen);
+       memcpy(extra, status_rid.SSID, le16_to_cpu(status_rid.SSIDlen));
        /* If none, we may want to get the one that was set */
 
        /* Push it out ! */
-       dwrq->length = status_rid.SSIDlen;
+       dwrq->length = le16_to_cpu(status_rid.SSIDlen);
        dwrq->flags = 1; /* active */
 
        return 0;
@@ -5943,7 +5911,7 @@ static int airo_set_wap(struct net_device *dev,
                up(&local->sem);
        } else {
                memset(&APList_rid, 0, sizeof(APList_rid));
-               APList_rid.len = sizeof(APList_rid);
+               APList_rid.len = cpu_to_le16(sizeof(APList_rid));
                memcpy(APList_rid.ap[0], awrq->sa_data, ETH_ALEN);
                disable_MAC(local, 1);
                writeAPListRid(local, &APList_rid, 1);
@@ -6099,7 +6067,7 @@ static int airo_get_rate(struct net_device *dev,
 
        readStatusRid(local, &status_rid, 1);
 
-       vwrq->value = status_rid.currentXmitRate * 500000;
+       vwrq->value = le16_to_cpu(status_rid.currentXmitRate) * 500000;
        /* If more than one rate, set auto */
        readConfigRid(local, 1);
        vwrq->fixed = (local->config.rates[1] == 0);
@@ -6125,7 +6093,7 @@ static int airo_set_rts(struct net_device *dev,
                return -EINVAL;
        }
        readConfigRid(local, 1);
-       local->config.rtsThres = rthr;
+       local->config.rtsThres = cpu_to_le16(rthr);
        set_bit (FLAG_COMMIT, &local->flags);
 
        return -EINPROGRESS;            /* Call commit handler */
@@ -6143,7 +6111,7 @@ static int airo_get_rts(struct net_device *dev,
        struct airo_info *local = dev->priv;
 
        readConfigRid(local, 1);
-       vwrq->value = local->config.rtsThres;
+       vwrq->value = le16_to_cpu(local->config.rtsThres);
        vwrq->disabled = (vwrq->value >= AIRO_DEF_MTU);
        vwrq->fixed = 1;
 
@@ -6169,7 +6137,7 @@ static int airo_set_frag(struct net_device *dev,
        }
        fthr &= ~0x1;   /* Get an even value - is it really needed ??? */
        readConfigRid(local, 1);
-       local->config.fragThresh = (u16)fthr;
+       local->config.fragThresh = cpu_to_le16(fthr);
        set_bit (FLAG_COMMIT, &local->flags);
 
        return -EINPROGRESS;            /* Call commit handler */
@@ -6187,7 +6155,7 @@ static int airo_get_frag(struct net_device *dev,
        struct airo_info *local = dev->priv;
 
        readConfigRid(local, 1);
-       vwrq->value = local->config.fragThresh;
+       vwrq->value = le16_to_cpu(local->config.fragThresh);
        vwrq->disabled = (vwrq->value >= AIRO_DEF_MTU);
        vwrq->fixed = 1;
 
@@ -6207,42 +6175,42 @@ static int airo_set_mode(struct net_device *dev,
        int reset = 0;
 
        readConfigRid(local, 1);
-       if ((local->config.rmode & 0xff) >= RXMODE_RFMON)
+       if (sniffing_mode(local))
                reset = 1;
 
        switch(*uwrq) {
                case IW_MODE_ADHOC:
-                       local->config.opmode &= 0xFF00;
+                       local->config.opmode &= ~MODE_CFG_MASK;
                        local->config.opmode |= MODE_STA_IBSS;
-                       local->config.rmode &= 0xfe00;
+                       local->config.rmode &= ~RXMODE_FULL_MASK;
                        local->config.scanMode = SCANMODE_ACTIVE;
                        clear_bit (FLAG_802_11, &local->flags);
                        break;
                case IW_MODE_INFRA:
-                       local->config.opmode &= 0xFF00;
+                       local->config.opmode &= ~MODE_CFG_MASK;
                        local->config.opmode |= MODE_STA_ESS;
-                       local->config.rmode &= 0xfe00;
+                       local->config.rmode &= ~RXMODE_FULL_MASK;
                        local->config.scanMode = SCANMODE_ACTIVE;
                        clear_bit (FLAG_802_11, &local->flags);
                        break;
                case IW_MODE_MASTER:
-                       local->config.opmode &= 0xFF00;
+                       local->config.opmode &= ~MODE_CFG_MASK;
                        local->config.opmode |= MODE_AP;
-                       local->config.rmode &= 0xfe00;
+                       local->config.rmode &= ~RXMODE_FULL_MASK;
                        local->config.scanMode = SCANMODE_ACTIVE;
                        clear_bit (FLAG_802_11, &local->flags);
                        break;
                case IW_MODE_REPEAT:
-                       local->config.opmode &= 0xFF00;
+                       local->config.opmode &= ~MODE_CFG_MASK;
                        local->config.opmode |= MODE_AP_RPTR;
-                       local->config.rmode &= 0xfe00;
+                       local->config.rmode &= ~RXMODE_FULL_MASK;
                        local->config.scanMode = SCANMODE_ACTIVE;
                        clear_bit (FLAG_802_11, &local->flags);
                        break;
                case IW_MODE_MONITOR:
-                       local->config.opmode &= 0xFF00;
+                       local->config.opmode &= ~MODE_CFG_MASK;
                        local->config.opmode |= MODE_STA_ESS;
-                       local->config.rmode &= 0xfe00;
+                       local->config.rmode &= ~RXMODE_FULL_MASK;
                        local->config.rmode |= RXMODE_RFMON | RXMODE_DISABLE_802_3_HEADER;
                        local->config.scanMode = SCANMODE_PASSIVE;
                        set_bit (FLAG_802_11, &local->flags);
@@ -6270,7 +6238,7 @@ static int airo_get_mode(struct net_device *dev,
 
        readConfigRid(local, 1);
        /* If not managed, assume it's ad-hoc */
-       switch (local->config.opmode & 0xFF) {
+       switch (local->config.opmode & MODE_CFG_MASK) {
                case MODE_STA_ESS:
                        *uwrq = IW_MODE_INFRA;
                        break;
@@ -6306,7 +6274,7 @@ static int airo_set_encode(struct net_device *dev,
        struct airo_info *local = dev->priv;
        CapabilityRid cap_rid;          /* Card capability info */
        int perm = ( dwrq->flags & IW_ENCODE_TEMP ? 0 : 1 );
-       u16 currentAuthType = local->config.authType;
+       __le16 currentAuthType = local->config.authType;
 
        /* Is WEP supported ? */
        readCapabilityRid(local, &cap_rid, 1);
@@ -6443,7 +6411,7 @@ static int airo_set_encodeext(struct net_device *dev,
        struct iw_encode_ext *ext = (struct iw_encode_ext *)extra;
        CapabilityRid cap_rid;          /* Card capability info */
        int perm = ( encoding->flags & IW_ENCODE_TEMP ? 0 : 1 );
-       u16 currentAuthType = local->config.authType;
+       __le16 currentAuthType = local->config.authType;
        int idx, key_len, alg = ext->alg, set_key = 1;
        wep_key_t key;
 
@@ -6589,7 +6557,7 @@ static int airo_set_auth(struct net_device *dev,
 {
        struct airo_info *local = dev->priv;
        struct iw_param *param = &wrqu->param;
-       u16 currentAuthType = local->config.authType;
+       __le16 currentAuthType = local->config.authType;
 
        switch (param->flags & IW_AUTH_INDEX) {
        case IW_AUTH_WPA_VERSION:
@@ -6657,7 +6625,7 @@ static int airo_get_auth(struct net_device *dev,
 {
        struct airo_info *local = dev->priv;
        struct iw_param *param = &wrqu->param;
-       u16 currentAuthType = local->config.authType;
+       __le16 currentAuthType = local->config.authType;
 
        switch (param->flags & IW_AUTH_INDEX) {
        case IW_AUTH_DROP_UNENCRYPTED:
@@ -6708,6 +6676,7 @@ static int airo_set_txpow(struct net_device *dev,
        CapabilityRid cap_rid;          /* Card capability info */
        int i;
        int rc = -EINVAL;
+       __le16 v = cpu_to_le16(vwrq->value);
 
        readCapabilityRid(local, &cap_rid, 1);
 
@@ -6721,9 +6690,9 @@ static int airo_set_txpow(struct net_device *dev,
        }
        clear_bit (FLAG_RADIO_OFF, &local->flags);
        for (i = 0; cap_rid.txPowerLevels[i] && (i < 8); i++)
-               if (vwrq->value == le16_to_cpu(cap_rid.txPowerLevels[i])) {
+               if (v == cap_rid.txPowerLevels[i]) {
                        readConfigRid(local, 1);
-                       local->config.txPower = vwrq->value;
+                       local->config.txPower = v;
                        set_bit (FLAG_COMMIT, &local->flags);
                        rc = -EINPROGRESS;      /* Call commit handler */
                        break;
@@ -6743,7 +6712,7 @@ static int airo_get_txpow(struct net_device *dev,
        struct airo_info *local = dev->priv;
 
        readConfigRid(local, 1);
-       vwrq->value = local->config.txPower;
+       vwrq->value = le16_to_cpu(local->config.txPower);
        vwrq->fixed = 1;        /* No power control */
        vwrq->disabled = test_bit(FLAG_RADIO_OFF, &local->flags);
        vwrq->flags = IW_TXPOW_MWATT;
@@ -6768,20 +6737,21 @@ static int airo_set_retry(struct net_device *dev,
        }
        readConfigRid(local, 1);
        if(vwrq->flags & IW_RETRY_LIMIT) {
+               __le16 v = cpu_to_le16(vwrq->value);
                if(vwrq->flags & IW_RETRY_LONG)
-                       local->config.longRetryLimit = vwrq->value;
+                       local->config.longRetryLimit = v;
                else if (vwrq->flags & IW_RETRY_SHORT)
-                       local->config.shortRetryLimit = vwrq->value;
+                       local->config.shortRetryLimit = v;
                else {
                        /* No modifier : set both */
-                       local->config.longRetryLimit = vwrq->value;
-                       local->config.shortRetryLimit = vwrq->value;
+                       local->config.longRetryLimit = v;
+                       local->config.shortRetryLimit = v;
                }
                set_bit (FLAG_COMMIT, &local->flags);
                rc = -EINPROGRESS;              /* Call commit handler */
        }
        if(vwrq->flags & IW_RETRY_LIFETIME) {
-               local->config.txLifetime = vwrq->value / 1024;
+               local->config.txLifetime = cpu_to_le16(vwrq->value / 1024);
                set_bit (FLAG_COMMIT, &local->flags);
                rc = -EINPROGRESS;              /* Call commit handler */
        }
@@ -6805,14 +6775,14 @@ static int airo_get_retry(struct net_device *dev,
        /* Note : by default, display the min retry number */
        if((vwrq->flags & IW_RETRY_TYPE) == IW_RETRY_LIFETIME) {
                vwrq->flags = IW_RETRY_LIFETIME;
-               vwrq->value = (int)local->config.txLifetime * 1024;
+               vwrq->value = le16_to_cpu(local->config.txLifetime) * 1024;
        } else if((vwrq->flags & IW_RETRY_LONG)) {
                vwrq->flags = IW_RETRY_LIMIT | IW_RETRY_LONG;
-               vwrq->value = (int)local->config.longRetryLimit;
+               vwrq->value = le16_to_cpu(local->config.longRetryLimit);
        } else {
                vwrq->flags = IW_RETRY_LIMIT;
-               vwrq->value = (int)local->config.shortRetryLimit;
-               if((int)local->config.shortRetryLimit != (int)local->config.longRetryLimit)
+               vwrq->value = le16_to_cpu(local->config.shortRetryLimit);
+               if(local->config.shortRetryLimit != local->config.longRetryLimit)
                        vwrq->flags |= IW_RETRY_SHORT;
        }
 
@@ -6957,38 +6927,37 @@ static int airo_set_power(struct net_device *dev,
 
        readConfigRid(local, 1);
        if (vwrq->disabled) {
-               if ((local->config.rmode & 0xFF) >= RXMODE_RFMON) {
+               if (sniffing_mode(local))
                        return -EINVAL;
-               }
                local->config.powerSaveMode = POWERSAVE_CAM;
-               local->config.rmode &= 0xFF00;
+               local->config.rmode &= ~RXMODE_MASK;
                local->config.rmode |= RXMODE_BC_MC_ADDR;
                set_bit (FLAG_COMMIT, &local->flags);
                return -EINPROGRESS;            /* Call commit handler */
        }
        if ((vwrq->flags & IW_POWER_TYPE) == IW_POWER_TIMEOUT) {
-               local->config.fastListenDelay = (vwrq->value + 500) / 1024;
+               local->config.fastListenDelay = cpu_to_le16((vwrq->value + 500) / 1024);
                local->config.powerSaveMode = POWERSAVE_PSPCAM;
                set_bit (FLAG_COMMIT, &local->flags);
        } else if ((vwrq->flags & IW_POWER_TYPE) == IW_POWER_PERIOD) {
-               local->config.fastListenInterval = local->config.listenInterval = (vwrq->value + 500) / 1024;
+               local->config.fastListenInterval =
+               local->config.listenInterval =
+                       cpu_to_le16((vwrq->value + 500) / 1024);
                local->config.powerSaveMode = POWERSAVE_PSPCAM;
                set_bit (FLAG_COMMIT, &local->flags);
        }
        switch (vwrq->flags & IW_POWER_MODE) {
                case IW_POWER_UNICAST_R:
-                       if ((local->config.rmode & 0xFF) >= RXMODE_RFMON) {
+                       if (sniffing_mode(local))
                                return -EINVAL;
-                       }
-                       local->config.rmode &= 0xFF00;
+                       local->config.rmode &= ~RXMODE_MASK;
                        local->config.rmode |= RXMODE_ADDR;
                        set_bit (FLAG_COMMIT, &local->flags);
                        break;
                case IW_POWER_ALL_R:
-                       if ((local->config.rmode & 0xFF) >= RXMODE_RFMON) {
+                       if (sniffing_mode(local))
                                return -EINVAL;
-                       }
-                       local->config.rmode &= 0xFF00;
+                       local->config.rmode &= ~RXMODE_MASK;
                        local->config.rmode |= RXMODE_BC_MC_ADDR;
                        set_bit (FLAG_COMMIT, &local->flags);
                case IW_POWER_ON:
@@ -7012,20 +6981,20 @@ static int airo_get_power(struct net_device *dev,
                          char *extra)
 {
        struct airo_info *local = dev->priv;
-       int mode;
+       __le16 mode;
 
        readConfigRid(local, 1);
        mode = local->config.powerSaveMode;
        if ((vwrq->disabled = (mode == POWERSAVE_CAM)))
                return 0;
        if ((vwrq->flags & IW_POWER_TYPE) == IW_POWER_TIMEOUT) {
-               vwrq->value = (int)local->config.fastListenDelay * 1024;
+               vwrq->value = le16_to_cpu(local->config.fastListenDelay) * 1024;
                vwrq->flags = IW_POWER_TIMEOUT;
        } else {
-               vwrq->value = (int)local->config.fastListenInterval * 1024;
+               vwrq->value = le16_to_cpu(local->config.fastListenInterval) * 1024;
                vwrq->flags = IW_POWER_PERIOD;
        }
-       if ((local->config.rmode & 0xFF) == RXMODE_ADDR)
+       if ((local->config.rmode & RXMODE_MASK) == RXMODE_ADDR)
                vwrq->flags |= IW_POWER_UNICAST_R;
        else
                vwrq->flags |= IW_POWER_ALL_R;
@@ -7045,7 +7014,8 @@ static int airo_set_sens(struct net_device *dev,
        struct airo_info *local = dev->priv;
 
        readConfigRid(local, 1);
-       local->config.rssiThreshold = vwrq->disabled ? RSSI_DEFAULT : vwrq->value;
+       local->config.rssiThreshold =
+               cpu_to_le16(vwrq->disabled ? RSSI_DEFAULT : vwrq->value);
        set_bit (FLAG_COMMIT, &local->flags);
 
        return -EINPROGRESS;            /* Call commit handler */
@@ -7063,7 +7033,7 @@ static int airo_get_sens(struct net_device *dev,
        struct airo_info *local = dev->priv;
 
        readConfigRid(local, 1);
-       vwrq->value = local->config.rssiThreshold;
+       vwrq->value = le16_to_cpu(local->config.rssiThreshold);
        vwrq->disabled = (vwrq->value == 0);
        vwrq->fixed = 1;
 
@@ -7647,18 +7617,22 @@ static void airo_read_wireless_stats(struct airo_info *local)
        up(&local->sem);
 
        /* The status */
-       local->wstats.status = status_rid.mode;
+       local->wstats.status = le16_to_cpu(status_rid.mode);
 
        /* Signal quality and co */
        if (local->rssi) {
-               local->wstats.qual.level = airo_rssi_to_dbm( local->rssi, status_rid.sigQuality );
+               local->wstats.qual.level =
+                       airo_rssi_to_dbm(local->rssi,
+                                        le16_to_cpu(status_rid.sigQuality));
                /* normalizedSignalStrength appears to be a percentage */
-               local->wstats.qual.qual = status_rid.normalizedSignalStrength;
+               local->wstats.qual.qual =
+                       le16_to_cpu(status_rid.normalizedSignalStrength);
        } else {
-               local->wstats.qual.level = (status_rid.normalizedSignalStrength + 321) / 2;
+               local->wstats.qual.level =
+                       (le16_to_cpu(status_rid.normalizedSignalStrength) + 321) / 2;
                local->wstats.qual.qual = airo_get_quality(&status_rid, &cap_rid);
        }
-       if (status_rid.len >= 124) {
+       if (le16_to_cpu(status_rid.len) >= 124) {
                local->wstats.qual.noise = 0x100 - status_rid.noisedBm;
                local->wstats.qual.updated = IW_QUAL_ALL_UPDATED | IW_QUAL_DBM;
        } else {
@@ -7860,9 +7834,9 @@ static int writerids(struct net_device *dev, aironet_ioctl *comp) {
                ConfigRid *cfg = (ConfigRid *)iobuf;
 
                if (test_bit(FLAG_MIC_CAPABLE, &ai->flags))
-                       cfg->opmode |= cpu_to_le16(MODE_MIC);
+                       cfg->opmode |= MODE_MIC;
 
-               if ((le16_to_cpu(cfg->opmode) & 0xFF) == MODE_STA_IBSS)
+               if ((cfg->opmode & MODE_CFG_MASK) == MODE_STA_IBSS)
                        set_bit (FLAG_ADHOC, &ai->flags);
                else
                        clear_bit (FLAG_ADHOC, &ai->flags);