]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/net/wireless/hostap/hostap_ioctl.c
[ARM] Merge most of the PXA work for initial merge
[linux-2.6-omap-h63xx.git] / drivers / net / wireless / hostap / hostap_ioctl.c
index d8f5efcfcab96915d0f41ecfb22958ba556a3936..0ca0bfeb0ada33d44501ab4051d7d12b8007d53e 100644 (file)
@@ -84,7 +84,7 @@ static int prism2_get_datarates(struct net_device *dev, u8 *rates)
        if (len < 2)
                return 0;
 
-       val = le16_to_cpu(*(u16 *) buf); /* string length */
+       val = le16_to_cpu(*(__le16 *) buf); /* string length */
 
        if (len - 2 < val || val > 10)
                return 0;
@@ -496,7 +496,7 @@ static int prism2_ioctl_giwsens(struct net_device *dev,
 {
        struct hostap_interface *iface;
        local_info_t *local;
-       u16 val;
+       __le16 val;
 
        iface = netdev_priv(dev);
        local = iface->local;
@@ -506,7 +506,7 @@ static int prism2_ioctl_giwsens(struct net_device *dev,
            0)
                return -EINVAL;
 
-       sens->value = __le16_to_cpu(val);
+       sens->value = le16_to_cpu(val);
        sens->fixed = 1;
 
        return 0;
@@ -561,17 +561,17 @@ static int prism2_ioctl_siwrts(struct net_device *dev,
 {
        struct hostap_interface *iface;
        local_info_t *local;
-       u16 val;
+       __le16 val;
 
        iface = netdev_priv(dev);
        local = iface->local;
 
        if (rts->disabled)
-               val = __constant_cpu_to_le16(2347);
+               val = cpu_to_le16(2347);
        else if (rts->value < 0 || rts->value > 2347)
                return -EINVAL;
        else
-               val = __cpu_to_le16(rts->value);
+               val = cpu_to_le16(rts->value);
 
        if (local->func->set_rid(dev, HFA384X_RID_RTSTHRESHOLD, &val, 2) ||
            local->func->reset_port(dev))
@@ -588,7 +588,7 @@ static int prism2_ioctl_giwrts(struct net_device *dev,
 {
        struct hostap_interface *iface;
        local_info_t *local;
-       u16 val;
+       __le16 val;
 
        iface = netdev_priv(dev);
        local = iface->local;
@@ -597,7 +597,7 @@ static int prism2_ioctl_giwrts(struct net_device *dev,
            0)
                return -EINVAL;
 
-       rts->value = __le16_to_cpu(val);
+       rts->value = le16_to_cpu(val);
        rts->disabled = (rts->value == 2347);
        rts->fixed = 1;
 
@@ -611,17 +611,17 @@ static int prism2_ioctl_siwfrag(struct net_device *dev,
 {
        struct hostap_interface *iface;
        local_info_t *local;
-       u16 val;
+       __le16 val;
 
        iface = netdev_priv(dev);
        local = iface->local;
 
        if (rts->disabled)
-               val = __constant_cpu_to_le16(2346);
+               val = cpu_to_le16(2346);
        else if (rts->value < 256 || rts->value > 2346)
                return -EINVAL;
        else
-               val = __cpu_to_le16(rts->value & ~0x1); /* even numbers only */
+               val = cpu_to_le16(rts->value & ~0x1); /* even numbers only */
 
        local->fragm_threshold = rts->value & ~0x1;
        if (local->func->set_rid(dev, HFA384X_RID_FRAGMENTATIONTHRESHOLD, &val,
@@ -638,7 +638,7 @@ static int prism2_ioctl_giwfrag(struct net_device *dev,
 {
        struct hostap_interface *iface;
        local_info_t *local;
-       u16 val;
+       __le16 val;
 
        iface = netdev_priv(dev);
        local = iface->local;
@@ -647,7 +647,7 @@ static int prism2_ioctl_giwfrag(struct net_device *dev,
                                 &val, 2, 1) < 0)
                return -EINVAL;
 
-       rts->value = __le16_to_cpu(val);
+       rts->value = le16_to_cpu(val);
        rts->disabled = (rts->value == 2346);
        rts->fixed = 1;
 
@@ -718,8 +718,8 @@ static int prism2_ioctl_siwap(struct net_device *dev,
        if (local->host_roaming == 1 && local->iw_mode == IW_MODE_INFRA) {
                struct hfa384x_scan_request scan_req;
                memset(&scan_req, 0, sizeof(scan_req));
-               scan_req.channel_list = __constant_cpu_to_le16(0x3fff);
-               scan_req.txrate = __constant_cpu_to_le16(HFA384X_RATES_1MBPS);
+               scan_req.channel_list = cpu_to_le16(0x3fff);
+               scan_req.txrate = cpu_to_le16(HFA384X_RATES_1MBPS);
                if (local->func->set_rid(dev, HFA384X_RID_SCANREQUEST,
                                         &scan_req, sizeof(scan_req))) {
                        printk(KERN_DEBUG "%s: ScanResults request failed - "
@@ -812,7 +812,7 @@ static int prism2_ioctl_giwnickn(struct net_device *dev,
 
        len = local->func->get_rid(dev, HFA384X_RID_CNFOWNNAME,
                                   &name, MAX_NAME_LEN + 2, 0);
-       val = __le16_to_cpu(*(u16 *) name);
+       val = le16_to_cpu(*(__le16 *) name);
        if (len > MAX_NAME_LEN + 2 || len < 0 || val > MAX_NAME_LEN)
                return -EOPNOTSUPP;
 
@@ -963,7 +963,7 @@ static int prism2_ioctl_giwessid(struct net_device *dev,
                memset(ssid, 0, sizeof(ssid));
                len = local->func->get_rid(dev, HFA384X_RID_CURRENTSSID,
                                           &ssid, MAX_SSID_LEN + 2, 0);
-               val = __le16_to_cpu(*(u16 *) ssid);
+               val = le16_to_cpu(*(__le16 *) ssid);
                if (len > MAX_SSID_LEN + 2 || len < 0 || val > MAX_SSID_LEN) {
                        return -EOPNOTSUPP;
                }
@@ -1089,6 +1089,9 @@ static int prism2_ioctl_giwrange(struct net_device *dev,
        range->enc_capa = IW_ENC_CAPA_WPA | IW_ENC_CAPA_WPA2 |
                IW_ENC_CAPA_CIPHER_TKIP | IW_ENC_CAPA_CIPHER_CCMP;
 
+       if (local->sta_fw_ver >= PRISM2_FW_VER(1,3,1))
+               range->scan_capa = IW_SCAN_CAPA_ESSID;
+
        return 0;
 }
 
@@ -1316,7 +1319,7 @@ static int prism2_ioctl_giwpower(struct net_device *dev,
 #else /* PRISM2_NO_STATION_MODES */
        struct hostap_interface *iface;
        local_info_t *local;
-       u16 enable, mcast;
+       __le16 enable, mcast;
 
        iface = netdev_priv(dev);
        local = iface->local;
@@ -1325,7 +1328,7 @@ static int prism2_ioctl_giwpower(struct net_device *dev,
            < 0)
                return -EINVAL;
 
-       if (!__le16_to_cpu(enable)) {
+       if (!le16_to_cpu(enable)) {
                rrq->disabled = 1;
                return 0;
        }
@@ -1333,29 +1336,29 @@ static int prism2_ioctl_giwpower(struct net_device *dev,
        rrq->disabled = 0;
 
        if ((rrq->flags & IW_POWER_TYPE) == IW_POWER_TIMEOUT) {
-               u16 timeout;
+               __le16 timeout;
                if (local->func->get_rid(dev,
                                         HFA384X_RID_CNFPMHOLDOVERDURATION,
                                         &timeout, 2, 1) < 0)
                        return -EINVAL;
 
                rrq->flags = IW_POWER_TIMEOUT;
-               rrq->value = __le16_to_cpu(timeout) * 1024;
+               rrq->value = le16_to_cpu(timeout) * 1024;
        } else {
-               u16 period;
+               __le16 period;
                if (local->func->get_rid(dev, HFA384X_RID_CNFMAXSLEEPDURATION,
                                         &period, 2, 1) < 0)
                        return -EINVAL;
 
                rrq->flags = IW_POWER_PERIOD;
-               rrq->value = __le16_to_cpu(period) * 1024;
+               rrq->value = le16_to_cpu(period) * 1024;
        }
 
        if (local->func->get_rid(dev, HFA384X_RID_CNFMULTICASTRECEIVE, &mcast,
                                 2, 1) < 0)
                return -EINVAL;
 
-       if (__le16_to_cpu(mcast))
+       if (le16_to_cpu(mcast))
                rrq->flags |= IW_POWER_ALL_R;
        else
                rrq->flags |= IW_POWER_UNICAST_R;
@@ -1432,7 +1435,7 @@ static int prism2_ioctl_giwretry(struct net_device *dev,
 {
        struct hostap_interface *iface;
        local_info_t *local;
-       u16 shortretry, longretry, lifetime, altretry;
+       __le16 shortretry, longretry, lifetime, altretry;
 
        iface = netdev_priv(dev);
        local = iface->local;
@@ -1445,15 +1448,11 @@ static int prism2_ioctl_giwretry(struct net_device *dev,
                                 &lifetime, 2, 1) < 0)
                return -EINVAL;
 
-       le16_to_cpus(&shortretry);
-       le16_to_cpus(&longretry);
-       le16_to_cpus(&lifetime);
-
        rrq->disabled = 0;
 
        if ((rrq->flags & IW_RETRY_TYPE) == IW_RETRY_LIFETIME) {
                rrq->flags = IW_RETRY_LIFETIME;
-               rrq->value = lifetime * 1024;
+               rrq->value = le16_to_cpu(lifetime) * 1024;
        } else {
                if (local->manual_retry_count >= 0) {
                        rrq->flags = IW_RETRY_LIMIT;
@@ -1465,10 +1464,10 @@ static int prism2_ioctl_giwretry(struct net_device *dev,
                                rrq->value = local->manual_retry_count;
                } else if ((rrq->flags & IW_RETRY_LONG)) {
                        rrq->flags = IW_RETRY_LIMIT | IW_RETRY_LONG;
-                       rrq->value = longretry;
+                       rrq->value = le16_to_cpu(longretry);
                } else {
                        rrq->flags = IW_RETRY_LIMIT;
-                       rrq->value = shortretry;
+                       rrq->value = le16_to_cpu(shortretry);
                        if (shortretry != longretry)
                                rrq->flags |= IW_RETRY_SHORT;
                }
@@ -3098,7 +3097,7 @@ static int prism2_set_genericelement(struct net_device *dev, u8 *elem,
        if (buf == NULL)
                return -ENOMEM;
 
-       *((u16 *) buf) = cpu_to_le16(len);
+       *((__le16 *) buf) = cpu_to_le16(len);
        memcpy(buf + 2, elem, len);
 
        kfree(local->generic_elem);
@@ -3758,7 +3757,7 @@ static int prism2_ioctl_siwmlme(struct net_device *dev,
        struct hostap_interface *iface = netdev_priv(dev);
        local_info_t *local = iface->local;
        struct iw_mlme *mlme = (struct iw_mlme *) extra;
-       u16 reason;
+       __le16 reason;
 
        reason = cpu_to_le16(mlme->reason_code);
 
@@ -3780,7 +3779,7 @@ static int prism2_ioctl_siwmlme(struct net_device *dev,
 static int prism2_ioctl_mlme(local_info_t *local,
                             struct prism2_hostapd_param *param)
 {
-       u16 reason;
+       __le16 reason;
 
        reason = cpu_to_le16(param->u.mlme.reason_code);
        switch (param->u.mlme.cmd) {