mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-25 16:11:45 +00:00
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>
This commit is contained in:
parent
82a66bbbe9
commit
13de15e71d
1 changed files with 33 additions and 7 deletions
|
@ -1524,15 +1524,20 @@ static struct iw_statistics *gelic_wl_get_wireless_stats(
|
||||||
struct gelic_eurus_cmd *cmd;
|
struct gelic_eurus_cmd *cmd;
|
||||||
struct iw_statistics *is;
|
struct iw_statistics *is;
|
||||||
struct gelic_eurus_rssi_info *rssi;
|
struct gelic_eurus_rssi_info *rssi;
|
||||||
|
void *buf;
|
||||||
|
|
||||||
pr_debug("%s: <-\n", __func__);
|
pr_debug("%s: <-\n", __func__);
|
||||||
|
|
||||||
|
buf = (void *)__get_free_page(GFP_KERNEL);
|
||||||
|
if (!buf)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
is = &wl->iwstat;
|
is = &wl->iwstat;
|
||||||
memset(is, 0, sizeof(*is));
|
memset(is, 0, sizeof(*is));
|
||||||
cmd = gelic_eurus_sync_cmd(wl, GELIC_EURUS_CMD_GET_RSSI_CFG,
|
cmd = gelic_eurus_sync_cmd(wl, GELIC_EURUS_CMD_GET_RSSI_CFG,
|
||||||
wl->buf, sizeof(*rssi));
|
buf, sizeof(*rssi));
|
||||||
if (cmd && !cmd->status && !cmd->cmd_status) {
|
if (cmd && !cmd->status && !cmd->cmd_status) {
|
||||||
rssi = wl->buf;
|
rssi = buf;
|
||||||
is->qual.level = be16_to_cpu(rssi->rssi);
|
is->qual.level = be16_to_cpu(rssi->rssi);
|
||||||
is->qual.updated = IW_QUAL_LEVEL_UPDATED |
|
is->qual.updated = IW_QUAL_LEVEL_UPDATED |
|
||||||
IW_QUAL_QUAL_INVALID | IW_QUAL_NOISE_INVALID;
|
IW_QUAL_QUAL_INVALID | IW_QUAL_NOISE_INVALID;
|
||||||
|
@ -1541,6 +1546,7 @@ static struct iw_statistics *gelic_wl_get_wireless_stats(
|
||||||
is->qual.updated = IW_QUAL_ALL_INVALID;
|
is->qual.updated = IW_QUAL_ALL_INVALID;
|
||||||
|
|
||||||
kfree(cmd);
|
kfree(cmd);
|
||||||
|
free_page((unsigned long)buf);
|
||||||
pr_debug("%s: ->\n", __func__);
|
pr_debug("%s: ->\n", __func__);
|
||||||
return is;
|
return is;
|
||||||
}
|
}
|
||||||
|
@ -1607,11 +1613,18 @@ static void gelic_wl_scan_complete_event(struct gelic_wl_info *wl)
|
||||||
union iwreq_data data;
|
union iwreq_data data;
|
||||||
unsigned long this_time = jiffies;
|
unsigned long this_time = jiffies;
|
||||||
unsigned int data_len, i, found, r;
|
unsigned int data_len, i, found, r;
|
||||||
|
void *buf;
|
||||||
DECLARE_MAC_BUF(mac);
|
DECLARE_MAC_BUF(mac);
|
||||||
|
|
||||||
pr_debug("%s:start\n", __func__);
|
pr_debug("%s:start\n", __func__);
|
||||||
mutex_lock(&wl->scan_lock);
|
mutex_lock(&wl->scan_lock);
|
||||||
|
|
||||||
|
buf = (void *)__get_free_page(GFP_KERNEL);
|
||||||
|
if (!buf) {
|
||||||
|
pr_info("%s: scan buffer alloc failed\n", __func__);
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
if (wl->scan_stat != GELIC_WL_SCAN_STAT_SCANNING) {
|
if (wl->scan_stat != GELIC_WL_SCAN_STAT_SCANNING) {
|
||||||
/*
|
/*
|
||||||
* stop() may be called while scanning, ignore result
|
* stop() may be called while scanning, ignore result
|
||||||
|
@ -1622,7 +1635,7 @@ static void gelic_wl_scan_complete_event(struct gelic_wl_info *wl)
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd = gelic_eurus_sync_cmd(wl, GELIC_EURUS_CMD_GET_SCAN,
|
cmd = gelic_eurus_sync_cmd(wl, GELIC_EURUS_CMD_GET_SCAN,
|
||||||
wl->buf, PAGE_SIZE);
|
buf, PAGE_SIZE);
|
||||||
if (!cmd || cmd->status || cmd->cmd_status) {
|
if (!cmd || cmd->status || cmd->cmd_status) {
|
||||||
wl->scan_stat = GELIC_WL_SCAN_STAT_INIT;
|
wl->scan_stat = GELIC_WL_SCAN_STAT_INIT;
|
||||||
pr_info("%s:cmd failed\n", __func__);
|
pr_info("%s:cmd failed\n", __func__);
|
||||||
|
@ -1649,7 +1662,7 @@ static void gelic_wl_scan_complete_event(struct gelic_wl_info *wl)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* put them in the newtork_list */
|
/* put them in the newtork_list */
|
||||||
for (i = 0, scan_info_size = 0, scan_info = wl->buf;
|
for (i = 0, scan_info_size = 0, scan_info = buf;
|
||||||
scan_info_size < data_len;
|
scan_info_size < data_len;
|
||||||
i++, scan_info_size += be16_to_cpu(scan_info->size),
|
i++, scan_info_size += be16_to_cpu(scan_info->size),
|
||||||
scan_info = (void *)scan_info + be16_to_cpu(scan_info->size)) {
|
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)
|
||||||
wireless_send_event(port_to_netdev(wl_port(wl)), SIOCGIWSCAN, &data,
|
wireless_send_event(port_to_netdev(wl_port(wl)), SIOCGIWSCAN, &data,
|
||||||
NULL);
|
NULL);
|
||||||
out:
|
out:
|
||||||
|
free_page((unsigned long)buf);
|
||||||
complete(&wl->scan_done);
|
complete(&wl->scan_done);
|
||||||
mutex_unlock(&wl->scan_lock);
|
mutex_unlock(&wl->scan_lock);
|
||||||
pr_debug("%s:end\n", __func__);
|
pr_debug("%s:end\n", __func__);
|
||||||
|
@ -1848,7 +1862,10 @@ static int gelic_wl_do_wep_setup(struct gelic_wl_info *wl)
|
||||||
|
|
||||||
pr_debug("%s: <-\n", __func__);
|
pr_debug("%s: <-\n", __func__);
|
||||||
/* we can assume no one should uses the buffer */
|
/* we can assume no one should uses the buffer */
|
||||||
wep = wl->buf;
|
wep = (struct gelic_eurus_wep_cfg *)__get_free_page(GFP_KERNEL);
|
||||||
|
if (!wep)
|
||||||
|
return -ENOMEM;
|
||||||
|
|
||||||
memset(wep, 0, sizeof(*wep));
|
memset(wep, 0, sizeof(*wep));
|
||||||
|
|
||||||
if (wl->group_cipher_method == GELIC_WL_CIPHER_WEP) {
|
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)
|
||||||
|
|
||||||
kfree(cmd);
|
kfree(cmd);
|
||||||
out:
|
out:
|
||||||
|
free_page((unsigned long)wep);
|
||||||
pr_debug("%s: ->\n", __func__);
|
pr_debug("%s: ->\n", __func__);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -1941,7 +1959,10 @@ static int gelic_wl_do_wpa_setup(struct gelic_wl_info *wl)
|
||||||
|
|
||||||
pr_debug("%s: <-\n", __func__);
|
pr_debug("%s: <-\n", __func__);
|
||||||
/* we can assume no one should uses the buffer */
|
/* we can assume no one should uses the buffer */
|
||||||
wpa = wl->buf;
|
wpa = (struct gelic_eurus_wpa_cfg *)__get_free_page(GFP_KERNEL);
|
||||||
|
if (!wpa)
|
||||||
|
return -ENOMEM;
|
||||||
|
|
||||||
memset(wpa, 0, sizeof(*wpa));
|
memset(wpa, 0, sizeof(*wpa));
|
||||||
|
|
||||||
if (!test_bit(GELIC_WL_STAT_WPA_PSK_SET, &wl->stat))
|
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)
|
||||||
else if (cmd->status || cmd->cmd_status)
|
else if (cmd->status || cmd->cmd_status)
|
||||||
ret = -ENXIO;
|
ret = -ENXIO;
|
||||||
kfree(cmd);
|
kfree(cmd);
|
||||||
|
free_page((unsigned long)wpa);
|
||||||
pr_debug("%s: --> %d\n", __func__, ret);
|
pr_debug("%s: --> %d\n", __func__, ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -2018,7 +2040,10 @@ static int gelic_wl_associate_bss(struct gelic_wl_info *wl,
|
||||||
pr_debug("%s: <-\n", __func__);
|
pr_debug("%s: <-\n", __func__);
|
||||||
|
|
||||||
/* do common config */
|
/* do common config */
|
||||||
common = wl->buf;
|
common = (struct gelic_eurus_common_cfg *)__get_free_page(GFP_KERNEL);
|
||||||
|
if (!common)
|
||||||
|
return -ENOMEM;
|
||||||
|
|
||||||
memset(common, 0, sizeof(*common));
|
memset(common, 0, sizeof(*common));
|
||||||
common->bss_type = cpu_to_be16(GELIC_EURUS_BSS_INFRA);
|
common->bss_type = cpu_to_be16(GELIC_EURUS_BSS_INFRA);
|
||||||
common->op_mode = cpu_to_be16(GELIC_EURUS_OPMODE_11BG);
|
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,
|
||||||
pr_info("%s: connected\n", __func__);
|
pr_info("%s: connected\n", __func__);
|
||||||
}
|
}
|
||||||
out:
|
out:
|
||||||
|
free_page((unsigned long)common);
|
||||||
pr_debug("%s: ->\n", __func__);
|
pr_debug("%s: ->\n", __func__);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue