diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2007-12-21 03:30:16 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-28 18:09:05 -0500 |
commit | 8a9faf3cd08b91aca1502dbe18e3b5063fda2e87 (patch) | |
tree | 4588f25ca8cd11833252370c3b0c7566004de050 /drivers/net/wireless/hostap/hostap_ioctl.c | |
parent | 3eb9b41f2474c53fe469fbe383955d5aae9e76e4 (diff) |
hostap annotations
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/hostap/hostap_ioctl.c')
-rw-r--r-- | drivers/net/wireless/hostap/hostap_ioctl.c | 66 |
1 files changed, 31 insertions, 35 deletions
diff --git a/drivers/net/wireless/hostap/hostap_ioctl.c b/drivers/net/wireless/hostap/hostap_ioctl.c index 3a57d48cc360..0ca0bfeb0ada 100644 --- a/drivers/net/wireless/hostap/hostap_ioctl.c +++ b/drivers/net/wireless/hostap/hostap_ioctl.c | |||
@@ -84,7 +84,7 @@ static int prism2_get_datarates(struct net_device *dev, u8 *rates) | |||
84 | if (len < 2) | 84 | if (len < 2) |
85 | return 0; | 85 | return 0; |
86 | 86 | ||
87 | val = le16_to_cpu(*(u16 *) buf); /* string length */ | 87 | val = le16_to_cpu(*(__le16 *) buf); /* string length */ |
88 | 88 | ||
89 | if (len - 2 < val || val > 10) | 89 | if (len - 2 < val || val > 10) |
90 | return 0; | 90 | return 0; |
@@ -496,7 +496,7 @@ static int prism2_ioctl_giwsens(struct net_device *dev, | |||
496 | { | 496 | { |
497 | struct hostap_interface *iface; | 497 | struct hostap_interface *iface; |
498 | local_info_t *local; | 498 | local_info_t *local; |
499 | u16 val; | 499 | __le16 val; |
500 | 500 | ||
501 | iface = netdev_priv(dev); | 501 | iface = netdev_priv(dev); |
502 | local = iface->local; | 502 | local = iface->local; |
@@ -506,7 +506,7 @@ static int prism2_ioctl_giwsens(struct net_device *dev, | |||
506 | 0) | 506 | 0) |
507 | return -EINVAL; | 507 | return -EINVAL; |
508 | 508 | ||
509 | sens->value = __le16_to_cpu(val); | 509 | sens->value = le16_to_cpu(val); |
510 | sens->fixed = 1; | 510 | sens->fixed = 1; |
511 | 511 | ||
512 | return 0; | 512 | return 0; |
@@ -561,17 +561,17 @@ static int prism2_ioctl_siwrts(struct net_device *dev, | |||
561 | { | 561 | { |
562 | struct hostap_interface *iface; | 562 | struct hostap_interface *iface; |
563 | local_info_t *local; | 563 | local_info_t *local; |
564 | u16 val; | 564 | __le16 val; |
565 | 565 | ||
566 | iface = netdev_priv(dev); | 566 | iface = netdev_priv(dev); |
567 | local = iface->local; | 567 | local = iface->local; |
568 | 568 | ||
569 | if (rts->disabled) | 569 | if (rts->disabled) |
570 | val = __constant_cpu_to_le16(2347); | 570 | val = cpu_to_le16(2347); |
571 | else if (rts->value < 0 || rts->value > 2347) | 571 | else if (rts->value < 0 || rts->value > 2347) |
572 | return -EINVAL; | 572 | return -EINVAL; |
573 | else | 573 | else |
574 | val = __cpu_to_le16(rts->value); | 574 | val = cpu_to_le16(rts->value); |
575 | 575 | ||
576 | if (local->func->set_rid(dev, HFA384X_RID_RTSTHRESHOLD, &val, 2) || | 576 | if (local->func->set_rid(dev, HFA384X_RID_RTSTHRESHOLD, &val, 2) || |
577 | local->func->reset_port(dev)) | 577 | local->func->reset_port(dev)) |
@@ -588,7 +588,7 @@ static int prism2_ioctl_giwrts(struct net_device *dev, | |||
588 | { | 588 | { |
589 | struct hostap_interface *iface; | 589 | struct hostap_interface *iface; |
590 | local_info_t *local; | 590 | local_info_t *local; |
591 | u16 val; | 591 | __le16 val; |
592 | 592 | ||
593 | iface = netdev_priv(dev); | 593 | iface = netdev_priv(dev); |
594 | local = iface->local; | 594 | local = iface->local; |
@@ -597,7 +597,7 @@ static int prism2_ioctl_giwrts(struct net_device *dev, | |||
597 | 0) | 597 | 0) |
598 | return -EINVAL; | 598 | return -EINVAL; |
599 | 599 | ||
600 | rts->value = __le16_to_cpu(val); | 600 | rts->value = le16_to_cpu(val); |
601 | rts->disabled = (rts->value == 2347); | 601 | rts->disabled = (rts->value == 2347); |
602 | rts->fixed = 1; | 602 | rts->fixed = 1; |
603 | 603 | ||
@@ -611,17 +611,17 @@ static int prism2_ioctl_siwfrag(struct net_device *dev, | |||
611 | { | 611 | { |
612 | struct hostap_interface *iface; | 612 | struct hostap_interface *iface; |
613 | local_info_t *local; | 613 | local_info_t *local; |
614 | u16 val; | 614 | __le16 val; |
615 | 615 | ||
616 | iface = netdev_priv(dev); | 616 | iface = netdev_priv(dev); |
617 | local = iface->local; | 617 | local = iface->local; |
618 | 618 | ||
619 | if (rts->disabled) | 619 | if (rts->disabled) |
620 | val = __constant_cpu_to_le16(2346); | 620 | val = cpu_to_le16(2346); |
621 | else if (rts->value < 256 || rts->value > 2346) | 621 | else if (rts->value < 256 || rts->value > 2346) |
622 | return -EINVAL; | 622 | return -EINVAL; |
623 | else | 623 | else |
624 | val = __cpu_to_le16(rts->value & ~0x1); /* even numbers only */ | 624 | val = cpu_to_le16(rts->value & ~0x1); /* even numbers only */ |
625 | 625 | ||
626 | local->fragm_threshold = rts->value & ~0x1; | 626 | local->fragm_threshold = rts->value & ~0x1; |
627 | if (local->func->set_rid(dev, HFA384X_RID_FRAGMENTATIONTHRESHOLD, &val, | 627 | if (local->func->set_rid(dev, HFA384X_RID_FRAGMENTATIONTHRESHOLD, &val, |
@@ -638,7 +638,7 @@ static int prism2_ioctl_giwfrag(struct net_device *dev, | |||
638 | { | 638 | { |
639 | struct hostap_interface *iface; | 639 | struct hostap_interface *iface; |
640 | local_info_t *local; | 640 | local_info_t *local; |
641 | u16 val; | 641 | __le16 val; |
642 | 642 | ||
643 | iface = netdev_priv(dev); | 643 | iface = netdev_priv(dev); |
644 | local = iface->local; | 644 | local = iface->local; |
@@ -647,7 +647,7 @@ static int prism2_ioctl_giwfrag(struct net_device *dev, | |||
647 | &val, 2, 1) < 0) | 647 | &val, 2, 1) < 0) |
648 | return -EINVAL; | 648 | return -EINVAL; |
649 | 649 | ||
650 | rts->value = __le16_to_cpu(val); | 650 | rts->value = le16_to_cpu(val); |
651 | rts->disabled = (rts->value == 2346); | 651 | rts->disabled = (rts->value == 2346); |
652 | rts->fixed = 1; | 652 | rts->fixed = 1; |
653 | 653 | ||
@@ -718,8 +718,8 @@ static int prism2_ioctl_siwap(struct net_device *dev, | |||
718 | if (local->host_roaming == 1 && local->iw_mode == IW_MODE_INFRA) { | 718 | if (local->host_roaming == 1 && local->iw_mode == IW_MODE_INFRA) { |
719 | struct hfa384x_scan_request scan_req; | 719 | struct hfa384x_scan_request scan_req; |
720 | memset(&scan_req, 0, sizeof(scan_req)); | 720 | memset(&scan_req, 0, sizeof(scan_req)); |
721 | scan_req.channel_list = __constant_cpu_to_le16(0x3fff); | 721 | scan_req.channel_list = cpu_to_le16(0x3fff); |
722 | scan_req.txrate = __constant_cpu_to_le16(HFA384X_RATES_1MBPS); | 722 | scan_req.txrate = cpu_to_le16(HFA384X_RATES_1MBPS); |
723 | if (local->func->set_rid(dev, HFA384X_RID_SCANREQUEST, | 723 | if (local->func->set_rid(dev, HFA384X_RID_SCANREQUEST, |
724 | &scan_req, sizeof(scan_req))) { | 724 | &scan_req, sizeof(scan_req))) { |
725 | printk(KERN_DEBUG "%s: ScanResults request failed - " | 725 | printk(KERN_DEBUG "%s: ScanResults request failed - " |
@@ -812,7 +812,7 @@ static int prism2_ioctl_giwnickn(struct net_device *dev, | |||
812 | 812 | ||
813 | len = local->func->get_rid(dev, HFA384X_RID_CNFOWNNAME, | 813 | len = local->func->get_rid(dev, HFA384X_RID_CNFOWNNAME, |
814 | &name, MAX_NAME_LEN + 2, 0); | 814 | &name, MAX_NAME_LEN + 2, 0); |
815 | val = __le16_to_cpu(*(u16 *) name); | 815 | val = le16_to_cpu(*(__le16 *) name); |
816 | if (len > MAX_NAME_LEN + 2 || len < 0 || val > MAX_NAME_LEN) | 816 | if (len > MAX_NAME_LEN + 2 || len < 0 || val > MAX_NAME_LEN) |
817 | return -EOPNOTSUPP; | 817 | return -EOPNOTSUPP; |
818 | 818 | ||
@@ -963,7 +963,7 @@ static int prism2_ioctl_giwessid(struct net_device *dev, | |||
963 | memset(ssid, 0, sizeof(ssid)); | 963 | memset(ssid, 0, sizeof(ssid)); |
964 | len = local->func->get_rid(dev, HFA384X_RID_CURRENTSSID, | 964 | len = local->func->get_rid(dev, HFA384X_RID_CURRENTSSID, |
965 | &ssid, MAX_SSID_LEN + 2, 0); | 965 | &ssid, MAX_SSID_LEN + 2, 0); |
966 | val = __le16_to_cpu(*(u16 *) ssid); | 966 | val = le16_to_cpu(*(__le16 *) ssid); |
967 | if (len > MAX_SSID_LEN + 2 || len < 0 || val > MAX_SSID_LEN) { | 967 | if (len > MAX_SSID_LEN + 2 || len < 0 || val > MAX_SSID_LEN) { |
968 | return -EOPNOTSUPP; | 968 | return -EOPNOTSUPP; |
969 | } | 969 | } |
@@ -1319,7 +1319,7 @@ static int prism2_ioctl_giwpower(struct net_device *dev, | |||
1319 | #else /* PRISM2_NO_STATION_MODES */ | 1319 | #else /* PRISM2_NO_STATION_MODES */ |
1320 | struct hostap_interface *iface; | 1320 | struct hostap_interface *iface; |
1321 | local_info_t *local; | 1321 | local_info_t *local; |
1322 | u16 enable, mcast; | 1322 | __le16 enable, mcast; |
1323 | 1323 | ||
1324 | iface = netdev_priv(dev); | 1324 | iface = netdev_priv(dev); |
1325 | local = iface->local; | 1325 | local = iface->local; |
@@ -1328,7 +1328,7 @@ static int prism2_ioctl_giwpower(struct net_device *dev, | |||
1328 | < 0) | 1328 | < 0) |
1329 | return -EINVAL; | 1329 | return -EINVAL; |
1330 | 1330 | ||
1331 | if (!__le16_to_cpu(enable)) { | 1331 | if (!le16_to_cpu(enable)) { |
1332 | rrq->disabled = 1; | 1332 | rrq->disabled = 1; |
1333 | return 0; | 1333 | return 0; |
1334 | } | 1334 | } |
@@ -1336,29 +1336,29 @@ static int prism2_ioctl_giwpower(struct net_device *dev, | |||
1336 | rrq->disabled = 0; | 1336 | rrq->disabled = 0; |
1337 | 1337 | ||
1338 | if ((rrq->flags & IW_POWER_TYPE) == IW_POWER_TIMEOUT) { | 1338 | if ((rrq->flags & IW_POWER_TYPE) == IW_POWER_TIMEOUT) { |
1339 | u16 timeout; | 1339 | __le16 timeout; |
1340 | if (local->func->get_rid(dev, | 1340 | if (local->func->get_rid(dev, |
1341 | HFA384X_RID_CNFPMHOLDOVERDURATION, | 1341 | HFA384X_RID_CNFPMHOLDOVERDURATION, |
1342 | &timeout, 2, 1) < 0) | 1342 | &timeout, 2, 1) < 0) |
1343 | return -EINVAL; | 1343 | return -EINVAL; |
1344 | 1344 | ||
1345 | rrq->flags = IW_POWER_TIMEOUT; | 1345 | rrq->flags = IW_POWER_TIMEOUT; |
1346 | rrq->value = __le16_to_cpu(timeout) * 1024; | 1346 | rrq->value = le16_to_cpu(timeout) * 1024; |
1347 | } else { | 1347 | } else { |
1348 | u16 period; | 1348 | __le16 period; |
1349 | if (local->func->get_rid(dev, HFA384X_RID_CNFMAXSLEEPDURATION, | 1349 | if (local->func->get_rid(dev, HFA384X_RID_CNFMAXSLEEPDURATION, |
1350 | &period, 2, 1) < 0) | 1350 | &period, 2, 1) < 0) |
1351 | return -EINVAL; | 1351 | return -EINVAL; |
1352 | 1352 | ||
1353 | rrq->flags = IW_POWER_PERIOD; | 1353 | rrq->flags = IW_POWER_PERIOD; |
1354 | rrq->value = __le16_to_cpu(period) * 1024; | 1354 | rrq->value = le16_to_cpu(period) * 1024; |
1355 | } | 1355 | } |
1356 | 1356 | ||
1357 | if (local->func->get_rid(dev, HFA384X_RID_CNFMULTICASTRECEIVE, &mcast, | 1357 | if (local->func->get_rid(dev, HFA384X_RID_CNFMULTICASTRECEIVE, &mcast, |
1358 | 2, 1) < 0) | 1358 | 2, 1) < 0) |
1359 | return -EINVAL; | 1359 | return -EINVAL; |
1360 | 1360 | ||
1361 | if (__le16_to_cpu(mcast)) | 1361 | if (le16_to_cpu(mcast)) |
1362 | rrq->flags |= IW_POWER_ALL_R; | 1362 | rrq->flags |= IW_POWER_ALL_R; |
1363 | else | 1363 | else |
1364 | rrq->flags |= IW_POWER_UNICAST_R; | 1364 | rrq->flags |= IW_POWER_UNICAST_R; |
@@ -1435,7 +1435,7 @@ static int prism2_ioctl_giwretry(struct net_device *dev, | |||
1435 | { | 1435 | { |
1436 | struct hostap_interface *iface; | 1436 | struct hostap_interface *iface; |
1437 | local_info_t *local; | 1437 | local_info_t *local; |
1438 | u16 shortretry, longretry, lifetime, altretry; | 1438 | __le16 shortretry, longretry, lifetime, altretry; |
1439 | 1439 | ||
1440 | iface = netdev_priv(dev); | 1440 | iface = netdev_priv(dev); |
1441 | local = iface->local; | 1441 | local = iface->local; |
@@ -1448,15 +1448,11 @@ static int prism2_ioctl_giwretry(struct net_device *dev, | |||
1448 | &lifetime, 2, 1) < 0) | 1448 | &lifetime, 2, 1) < 0) |
1449 | return -EINVAL; | 1449 | return -EINVAL; |
1450 | 1450 | ||
1451 | le16_to_cpus(&shortretry); | ||
1452 | le16_to_cpus(&longretry); | ||
1453 | le16_to_cpus(&lifetime); | ||
1454 | |||
1455 | rrq->disabled = 0; | 1451 | rrq->disabled = 0; |
1456 | 1452 | ||
1457 | if ((rrq->flags & IW_RETRY_TYPE) == IW_RETRY_LIFETIME) { | 1453 | if ((rrq->flags & IW_RETRY_TYPE) == IW_RETRY_LIFETIME) { |
1458 | rrq->flags = IW_RETRY_LIFETIME; | 1454 | rrq->flags = IW_RETRY_LIFETIME; |
1459 | rrq->value = lifetime * 1024; | 1455 | rrq->value = le16_to_cpu(lifetime) * 1024; |
1460 | } else { | 1456 | } else { |
1461 | if (local->manual_retry_count >= 0) { | 1457 | if (local->manual_retry_count >= 0) { |
1462 | rrq->flags = IW_RETRY_LIMIT; | 1458 | rrq->flags = IW_RETRY_LIMIT; |
@@ -1468,10 +1464,10 @@ static int prism2_ioctl_giwretry(struct net_device *dev, | |||
1468 | rrq->value = local->manual_retry_count; | 1464 | rrq->value = local->manual_retry_count; |
1469 | } else if ((rrq->flags & IW_RETRY_LONG)) { | 1465 | } else if ((rrq->flags & IW_RETRY_LONG)) { |
1470 | rrq->flags = IW_RETRY_LIMIT | IW_RETRY_LONG; | 1466 | rrq->flags = IW_RETRY_LIMIT | IW_RETRY_LONG; |
1471 | rrq->value = longretry; | 1467 | rrq->value = le16_to_cpu(longretry); |
1472 | } else { | 1468 | } else { |
1473 | rrq->flags = IW_RETRY_LIMIT; | 1469 | rrq->flags = IW_RETRY_LIMIT; |
1474 | rrq->value = shortretry; | 1470 | rrq->value = le16_to_cpu(shortretry); |
1475 | if (shortretry != longretry) | 1471 | if (shortretry != longretry) |
1476 | rrq->flags |= IW_RETRY_SHORT; | 1472 | rrq->flags |= IW_RETRY_SHORT; |
1477 | } | 1473 | } |
@@ -3101,7 +3097,7 @@ static int prism2_set_genericelement(struct net_device *dev, u8 *elem, | |||
3101 | if (buf == NULL) | 3097 | if (buf == NULL) |
3102 | return -ENOMEM; | 3098 | return -ENOMEM; |
3103 | 3099 | ||
3104 | *((u16 *) buf) = cpu_to_le16(len); | 3100 | *((__le16 *) buf) = cpu_to_le16(len); |
3105 | memcpy(buf + 2, elem, len); | 3101 | memcpy(buf + 2, elem, len); |
3106 | 3102 | ||
3107 | kfree(local->generic_elem); | 3103 | kfree(local->generic_elem); |
@@ -3761,7 +3757,7 @@ static int prism2_ioctl_siwmlme(struct net_device *dev, | |||
3761 | struct hostap_interface *iface = netdev_priv(dev); | 3757 | struct hostap_interface *iface = netdev_priv(dev); |
3762 | local_info_t *local = iface->local; | 3758 | local_info_t *local = iface->local; |
3763 | struct iw_mlme *mlme = (struct iw_mlme *) extra; | 3759 | struct iw_mlme *mlme = (struct iw_mlme *) extra; |
3764 | u16 reason; | 3760 | __le16 reason; |
3765 | 3761 | ||
3766 | reason = cpu_to_le16(mlme->reason_code); | 3762 | reason = cpu_to_le16(mlme->reason_code); |
3767 | 3763 | ||
@@ -3783,7 +3779,7 @@ static int prism2_ioctl_siwmlme(struct net_device *dev, | |||
3783 | static int prism2_ioctl_mlme(local_info_t *local, | 3779 | static int prism2_ioctl_mlme(local_info_t *local, |
3784 | struct prism2_hostapd_param *param) | 3780 | struct prism2_hostapd_param *param) |
3785 | { | 3781 | { |
3786 | u16 reason; | 3782 | __le16 reason; |
3787 | 3783 | ||
3788 | reason = cpu_to_le16(param->u.mlme.reason_code); | 3784 | reason = cpu_to_le16(param->u.mlme.reason_code); |
3789 | switch (param->u.mlme.cmd) { | 3785 | switch (param->u.mlme.cmd) { |