diff options
author | Masakazu Mokuno <mokuno@sm.sony.co.jp> | 2008-05-30 03:27:24 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-06-03 15:00:27 -0400 |
commit | 13de15e71db7a38f02c4d9f642f06541f5acc2b0 (patch) | |
tree | 5683613d98ca5e3e2a6d4bed1de63bca21f8bbb5 /drivers/net/ps3_gelic_wireless.c | |
parent | 82a66bbbe96126ca1bc6bc5ded8e67f529bcdfa4 (diff) |
PS3: gelic: Allocate the bounce buffer dynamically
Allocate the bouce buffer for the wireless command dynamically.
Signed-off-by: Masakazu Mokuno <mokuno@sm.sony.co.jp>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/ps3_gelic_wireless.c')
-rw-r--r-- | drivers/net/ps3_gelic_wireless.c | 40 |
1 files changed, 33 insertions, 7 deletions
diff --git a/drivers/net/ps3_gelic_wireless.c b/drivers/net/ps3_gelic_wireless.c index e5e02339a5cc..c16a30b28bf6 100644 --- a/drivers/net/ps3_gelic_wireless.c +++ b/drivers/net/ps3_gelic_wireless.c | |||
@@ -1524,15 +1524,20 @@ static struct iw_statistics *gelic_wl_get_wireless_stats( | |||
1524 | struct gelic_eurus_cmd *cmd; | 1524 | struct gelic_eurus_cmd *cmd; |
1525 | struct iw_statistics *is; | 1525 | struct iw_statistics *is; |
1526 | struct gelic_eurus_rssi_info *rssi; | 1526 | struct gelic_eurus_rssi_info *rssi; |
1527 | void *buf; | ||
1527 | 1528 | ||
1528 | pr_debug("%s: <-\n", __func__); | 1529 | pr_debug("%s: <-\n", __func__); |
1529 | 1530 | ||
1531 | buf = (void *)__get_free_page(GFP_KERNEL); | ||
1532 | if (!buf) | ||
1533 | return NULL; | ||
1534 | |||
1530 | is = &wl->iwstat; | 1535 | is = &wl->iwstat; |
1531 | memset(is, 0, sizeof(*is)); | 1536 | memset(is, 0, sizeof(*is)); |
1532 | cmd = gelic_eurus_sync_cmd(wl, GELIC_EURUS_CMD_GET_RSSI_CFG, | 1537 | cmd = gelic_eurus_sync_cmd(wl, GELIC_EURUS_CMD_GET_RSSI_CFG, |
1533 | wl->buf, sizeof(*rssi)); | 1538 | buf, sizeof(*rssi)); |
1534 | if (cmd && !cmd->status && !cmd->cmd_status) { | 1539 | if (cmd && !cmd->status && !cmd->cmd_status) { |
1535 | rssi = wl->buf; | 1540 | rssi = buf; |
1536 | is->qual.level = be16_to_cpu(rssi->rssi); | 1541 | is->qual.level = be16_to_cpu(rssi->rssi); |
1537 | is->qual.updated = IW_QUAL_LEVEL_UPDATED | | 1542 | is->qual.updated = IW_QUAL_LEVEL_UPDATED | |
1538 | IW_QUAL_QUAL_INVALID | IW_QUAL_NOISE_INVALID; | 1543 | IW_QUAL_QUAL_INVALID | IW_QUAL_NOISE_INVALID; |
@@ -1541,6 +1546,7 @@ static struct iw_statistics *gelic_wl_get_wireless_stats( | |||
1541 | is->qual.updated = IW_QUAL_ALL_INVALID; | 1546 | is->qual.updated = IW_QUAL_ALL_INVALID; |
1542 | 1547 | ||
1543 | kfree(cmd); | 1548 | kfree(cmd); |
1549 | free_page((unsigned long)buf); | ||
1544 | pr_debug("%s: ->\n", __func__); | 1550 | pr_debug("%s: ->\n", __func__); |
1545 | return is; | 1551 | return is; |
1546 | } | 1552 | } |
@@ -1607,11 +1613,18 @@ static void gelic_wl_scan_complete_event(struct gelic_wl_info *wl) | |||
1607 | union iwreq_data data; | 1613 | union iwreq_data data; |
1608 | unsigned long this_time = jiffies; | 1614 | unsigned long this_time = jiffies; |
1609 | unsigned int data_len, i, found, r; | 1615 | unsigned int data_len, i, found, r; |
1616 | void *buf; | ||
1610 | DECLARE_MAC_BUF(mac); | 1617 | DECLARE_MAC_BUF(mac); |
1611 | 1618 | ||
1612 | pr_debug("%s:start\n", __func__); | 1619 | pr_debug("%s:start\n", __func__); |
1613 | mutex_lock(&wl->scan_lock); | 1620 | mutex_lock(&wl->scan_lock); |
1614 | 1621 | ||
1622 | buf = (void *)__get_free_page(GFP_KERNEL); | ||
1623 | if (!buf) { | ||
1624 | pr_info("%s: scan buffer alloc failed\n", __func__); | ||
1625 | goto out; | ||
1626 | } | ||
1627 | |||
1615 | if (wl->scan_stat != GELIC_WL_SCAN_STAT_SCANNING) { | 1628 | if (wl->scan_stat != GELIC_WL_SCAN_STAT_SCANNING) { |
1616 | /* | 1629 | /* |
1617 | * stop() may be called while scanning, ignore result | 1630 | * stop() may be called while scanning, ignore result |
@@ -1622,7 +1635,7 @@ static void gelic_wl_scan_complete_event(struct gelic_wl_info *wl) | |||
1622 | } | 1635 | } |
1623 | 1636 | ||
1624 | cmd = gelic_eurus_sync_cmd(wl, GELIC_EURUS_CMD_GET_SCAN, | 1637 | cmd = gelic_eurus_sync_cmd(wl, GELIC_EURUS_CMD_GET_SCAN, |
1625 | wl->buf, PAGE_SIZE); | 1638 | buf, PAGE_SIZE); |
1626 | if (!cmd || cmd->status || cmd->cmd_status) { | 1639 | if (!cmd || cmd->status || cmd->cmd_status) { |
1627 | wl->scan_stat = GELIC_WL_SCAN_STAT_INIT; | 1640 | wl->scan_stat = GELIC_WL_SCAN_STAT_INIT; |
1628 | pr_info("%s:cmd failed\n", __func__); | 1641 | pr_info("%s:cmd failed\n", __func__); |
@@ -1649,7 +1662,7 @@ static void gelic_wl_scan_complete_event(struct gelic_wl_info *wl) | |||
1649 | } | 1662 | } |
1650 | 1663 | ||
1651 | /* put them in the newtork_list */ | 1664 | /* put them in the newtork_list */ |
1652 | for (i = 0, scan_info_size = 0, scan_info = wl->buf; | 1665 | for (i = 0, scan_info_size = 0, scan_info = buf; |
1653 | scan_info_size < data_len; | 1666 | scan_info_size < data_len; |
1654 | i++, scan_info_size += be16_to_cpu(scan_info->size), | 1667 | i++, scan_info_size += be16_to_cpu(scan_info->size), |
1655 | scan_info = (void *)scan_info + be16_to_cpu(scan_info->size)) { | 1668 | scan_info = (void *)scan_info + be16_to_cpu(scan_info->size)) { |
@@ -1726,6 +1739,7 @@ static void gelic_wl_scan_complete_event(struct gelic_wl_info *wl) | |||
1726 | wireless_send_event(port_to_netdev(wl_port(wl)), SIOCGIWSCAN, &data, | 1739 | wireless_send_event(port_to_netdev(wl_port(wl)), SIOCGIWSCAN, &data, |
1727 | NULL); | 1740 | NULL); |
1728 | out: | 1741 | out: |
1742 | free_page((unsigned long)buf); | ||
1729 | complete(&wl->scan_done); | 1743 | complete(&wl->scan_done); |
1730 | mutex_unlock(&wl->scan_lock); | 1744 | mutex_unlock(&wl->scan_lock); |
1731 | pr_debug("%s:end\n", __func__); | 1745 | pr_debug("%s:end\n", __func__); |
@@ -1848,7 +1862,10 @@ static int gelic_wl_do_wep_setup(struct gelic_wl_info *wl) | |||
1848 | 1862 | ||
1849 | pr_debug("%s: <-\n", __func__); | 1863 | pr_debug("%s: <-\n", __func__); |
1850 | /* we can assume no one should uses the buffer */ | 1864 | /* we can assume no one should uses the buffer */ |
1851 | wep = wl->buf; | 1865 | wep = (struct gelic_eurus_wep_cfg *)__get_free_page(GFP_KERNEL); |
1866 | if (!wep) | ||
1867 | return -ENOMEM; | ||
1868 | |||
1852 | memset(wep, 0, sizeof(*wep)); | 1869 | memset(wep, 0, sizeof(*wep)); |
1853 | 1870 | ||
1854 | if (wl->group_cipher_method == GELIC_WL_CIPHER_WEP) { | 1871 | if (wl->group_cipher_method == GELIC_WL_CIPHER_WEP) { |
@@ -1898,6 +1915,7 @@ static int gelic_wl_do_wep_setup(struct gelic_wl_info *wl) | |||
1898 | 1915 | ||
1899 | kfree(cmd); | 1916 | kfree(cmd); |
1900 | out: | 1917 | out: |
1918 | free_page((unsigned long)wep); | ||
1901 | pr_debug("%s: ->\n", __func__); | 1919 | pr_debug("%s: ->\n", __func__); |
1902 | return ret; | 1920 | return ret; |
1903 | } | 1921 | } |
@@ -1941,7 +1959,10 @@ static int gelic_wl_do_wpa_setup(struct gelic_wl_info *wl) | |||
1941 | 1959 | ||
1942 | pr_debug("%s: <-\n", __func__); | 1960 | pr_debug("%s: <-\n", __func__); |
1943 | /* we can assume no one should uses the buffer */ | 1961 | /* we can assume no one should uses the buffer */ |
1944 | wpa = wl->buf; | 1962 | wpa = (struct gelic_eurus_wpa_cfg *)__get_free_page(GFP_KERNEL); |
1963 | if (!wpa) | ||
1964 | return -ENOMEM; | ||
1965 | |||
1945 | memset(wpa, 0, sizeof(*wpa)); | 1966 | memset(wpa, 0, sizeof(*wpa)); |
1946 | 1967 | ||
1947 | if (!test_bit(GELIC_WL_STAT_WPA_PSK_SET, &wl->stat)) | 1968 | if (!test_bit(GELIC_WL_STAT_WPA_PSK_SET, &wl->stat)) |
@@ -2000,6 +2021,7 @@ static int gelic_wl_do_wpa_setup(struct gelic_wl_info *wl) | |||
2000 | else if (cmd->status || cmd->cmd_status) | 2021 | else if (cmd->status || cmd->cmd_status) |
2001 | ret = -ENXIO; | 2022 | ret = -ENXIO; |
2002 | kfree(cmd); | 2023 | kfree(cmd); |
2024 | free_page((unsigned long)wpa); | ||
2003 | pr_debug("%s: --> %d\n", __func__, ret); | 2025 | pr_debug("%s: --> %d\n", __func__, ret); |
2004 | return ret; | 2026 | return ret; |
2005 | } | 2027 | } |
@@ -2018,7 +2040,10 @@ static int gelic_wl_associate_bss(struct gelic_wl_info *wl, | |||
2018 | pr_debug("%s: <-\n", __func__); | 2040 | pr_debug("%s: <-\n", __func__); |
2019 | 2041 | ||
2020 | /* do common config */ | 2042 | /* do common config */ |
2021 | common = wl->buf; | 2043 | common = (struct gelic_eurus_common_cfg *)__get_free_page(GFP_KERNEL); |
2044 | if (!common) | ||
2045 | return -ENOMEM; | ||
2046 | |||
2022 | memset(common, 0, sizeof(*common)); | 2047 | memset(common, 0, sizeof(*common)); |
2023 | common->bss_type = cpu_to_be16(GELIC_EURUS_BSS_INFRA); | 2048 | common->bss_type = cpu_to_be16(GELIC_EURUS_BSS_INFRA); |
2024 | common->op_mode = cpu_to_be16(GELIC_EURUS_OPMODE_11BG); | 2049 | common->op_mode = cpu_to_be16(GELIC_EURUS_OPMODE_11BG); |
@@ -2104,6 +2129,7 @@ static int gelic_wl_associate_bss(struct gelic_wl_info *wl, | |||
2104 | pr_info("%s: connected\n", __func__); | 2129 | pr_info("%s: connected\n", __func__); |
2105 | } | 2130 | } |
2106 | out: | 2131 | out: |
2132 | free_page((unsigned long)common); | ||
2107 | pr_debug("%s: ->\n", __func__); | 2133 | pr_debug("%s: ->\n", __func__); |
2108 | return ret; | 2134 | return ret; |
2109 | } | 2135 | } |