rndis_wlan: move link up/down work to separate functions
Move link up/down work to separate functions and use local array for allocating memory for info structure instead of kzmalloc. Signed-off-by: Jussi Kivilinna <jussi.kivilinna@mbnet.fi> Signed-off-by: John W. Linville <linville@tuxdriver.com>
This commit is contained in:
parent
b1d25a6764
commit
0848e6c698
|
@ -2319,27 +2319,22 @@ static const struct iw_handler_def rndis_iw_handlers = {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
static void rndis_wlan_worker(struct work_struct *work)
|
static void rndis_wlan_do_link_up_work(struct usbnet *usbdev)
|
||||||
{
|
{
|
||||||
struct rndis_wlan_private *priv =
|
|
||||||
container_of(work, struct rndis_wlan_private, work);
|
|
||||||
struct usbnet *usbdev = priv->usbdev;
|
|
||||||
union iwreq_data evt;
|
|
||||||
unsigned char bssid[ETH_ALEN];
|
|
||||||
struct ndis_80211_assoc_info *info;
|
struct ndis_80211_assoc_info *info;
|
||||||
int assoc_size = sizeof(*info) + IW_CUSTOM_MAX + 32;
|
union iwreq_data evt;
|
||||||
|
u8 assoc_buf[sizeof(*info) + IW_CUSTOM_MAX + 32];
|
||||||
|
u8 bssid[ETH_ALEN];
|
||||||
int ret, offset;
|
int ret, offset;
|
||||||
|
|
||||||
if (test_and_clear_bit(WORK_LINK_UP, &priv->work_pending)) {
|
memset(assoc_buf, 0, sizeof(assoc_buf));
|
||||||
netif_carrier_on(usbdev->net);
|
info = (void *)assoc_buf;
|
||||||
|
|
||||||
info = kzalloc(assoc_size, GFP_KERNEL);
|
netif_carrier_on(usbdev->net);
|
||||||
if (!info)
|
|
||||||
goto get_bssid;
|
|
||||||
|
|
||||||
/* Get association info IEs from device and send them back to
|
/* Get association info IEs from device and send them back to
|
||||||
* userspace. */
|
* userspace. */
|
||||||
ret = get_association_info(usbdev, info, assoc_size);
|
ret = get_association_info(usbdev, info, sizeof(assoc_buf));
|
||||||
if (!ret) {
|
if (!ret) {
|
||||||
evt.data.length = le32_to_cpu(info->req_ie_length);
|
evt.data.length = le32_to_cpu(info->req_ie_length);
|
||||||
if (evt.data.length > 0) {
|
if (evt.data.length > 0) {
|
||||||
|
@ -2356,11 +2351,10 @@ static void rndis_wlan_worker(struct work_struct *work)
|
||||||
IWEVASSOCRESPIE, &evt,
|
IWEVASSOCRESPIE, &evt,
|
||||||
(char *)info + offset);
|
(char *)info + offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
usbnet_resume_rx(usbdev);
|
||||||
}
|
}
|
||||||
|
|
||||||
kfree(info);
|
|
||||||
|
|
||||||
get_bssid:
|
|
||||||
ret = get_bssid(usbdev, bssid);
|
ret = get_bssid(usbdev, bssid);
|
||||||
if (!ret) {
|
if (!ret) {
|
||||||
evt.data.flags = 0;
|
evt.data.flags = 0;
|
||||||
|
@ -2372,7 +2366,10 @@ get_bssid:
|
||||||
usbnet_resume_rx(usbdev);
|
usbnet_resume_rx(usbdev);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (test_and_clear_bit(WORK_LINK_DOWN, &priv->work_pending)) {
|
static void rndis_wlan_do_link_down_work(struct usbnet *usbdev)
|
||||||
|
{
|
||||||
|
union iwreq_data evt;
|
||||||
|
|
||||||
netif_carrier_off(usbdev->net);
|
netif_carrier_off(usbdev->net);
|
||||||
|
|
||||||
evt.data.flags = 0;
|
evt.data.flags = 0;
|
||||||
|
@ -2381,6 +2378,18 @@ get_bssid:
|
||||||
wireless_send_event(usbdev->net, SIOCGIWAP, &evt, NULL);
|
wireless_send_event(usbdev->net, SIOCGIWAP, &evt, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void rndis_wlan_worker(struct work_struct *work)
|
||||||
|
{
|
||||||
|
struct rndis_wlan_private *priv =
|
||||||
|
container_of(work, struct rndis_wlan_private, work);
|
||||||
|
struct usbnet *usbdev = priv->usbdev;
|
||||||
|
|
||||||
|
if (test_and_clear_bit(WORK_LINK_UP, &priv->work_pending))
|
||||||
|
rndis_wlan_do_link_up_work(usbdev);
|
||||||
|
|
||||||
|
if (test_and_clear_bit(WORK_LINK_DOWN, &priv->work_pending))
|
||||||
|
rndis_wlan_do_link_down_work(usbdev);
|
||||||
|
|
||||||
if (test_and_clear_bit(WORK_SET_MULTICAST_LIST, &priv->work_pending))
|
if (test_and_clear_bit(WORK_SET_MULTICAST_LIST, &priv->work_pending))
|
||||||
set_multicast_list(usbdev);
|
set_multicast_list(usbdev);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue