Lines Matching refs:priv

102 int lbs_set_iface_type(struct lbs_private *priv, enum nl80211_iftype type)  in lbs_set_iface_type()  argument
108 ret = lbs_set_monitor_mode(priv, 1); in lbs_set_iface_type()
111 if (priv->wdev->iftype == NL80211_IFTYPE_MONITOR) in lbs_set_iface_type()
112 ret = lbs_set_monitor_mode(priv, 0); in lbs_set_iface_type()
114 ret = lbs_set_snmp_mib(priv, SNMP_MIB_OID_BSS_TYPE, 1); in lbs_set_iface_type()
117 if (priv->wdev->iftype == NL80211_IFTYPE_MONITOR) in lbs_set_iface_type()
118 ret = lbs_set_monitor_mode(priv, 0); in lbs_set_iface_type()
120 ret = lbs_set_snmp_mib(priv, SNMP_MIB_OID_BSS_TYPE, 2); in lbs_set_iface_type()
128 int lbs_start_iface(struct lbs_private *priv) in lbs_start_iface() argument
133 if (priv->power_restore) { in lbs_start_iface()
134 ret = priv->power_restore(priv); in lbs_start_iface()
141 memcpy(cmd.macadd, priv->current_addr, ETH_ALEN); in lbs_start_iface()
143 ret = lbs_cmd_with_response(priv, CMD_802_11_MAC_ADDRESS, &cmd); in lbs_start_iface()
149 ret = lbs_set_iface_type(priv, priv->wdev->iftype); in lbs_start_iface()
155 ret = lbs_set_11d_domain_info(priv); in lbs_start_iface()
161 lbs_update_channel(priv); in lbs_start_iface()
163 priv->iface_running = true; in lbs_start_iface()
167 if (priv->power_save) in lbs_start_iface()
168 priv->power_save(priv); in lbs_start_iface()
180 struct lbs_private *priv = dev->ml_priv; in lbs_dev_open() local
183 if (!priv->iface_running) { in lbs_dev_open()
184 ret = lbs_start_iface(priv); in lbs_dev_open()
189 spin_lock_irq(&priv->driver_lock); in lbs_dev_open()
193 if (!priv->tx_pending_len) in lbs_dev_open()
196 spin_unlock_irq(&priv->driver_lock); in lbs_dev_open()
202 static bool lbs_command_queue_empty(struct lbs_private *priv) in lbs_command_queue_empty() argument
206 spin_lock_irqsave(&priv->driver_lock, flags); in lbs_command_queue_empty()
207 ret = priv->cur_cmd == NULL && list_empty(&priv->cmdpendingq); in lbs_command_queue_empty()
208 spin_unlock_irqrestore(&priv->driver_lock, flags); in lbs_command_queue_empty()
212 int lbs_stop_iface(struct lbs_private *priv) in lbs_stop_iface() argument
217 spin_lock_irqsave(&priv->driver_lock, flags); in lbs_stop_iface()
218 priv->iface_running = false; in lbs_stop_iface()
219 dev_kfree_skb_irq(priv->currenttxskb); in lbs_stop_iface()
220 priv->currenttxskb = NULL; in lbs_stop_iface()
221 priv->tx_pending_len = 0; in lbs_stop_iface()
222 spin_unlock_irqrestore(&priv->driver_lock, flags); in lbs_stop_iface()
224 cancel_work_sync(&priv->mcast_work); in lbs_stop_iface()
225 del_timer_sync(&priv->tx_lockup_timer); in lbs_stop_iface()
229 wait_event(priv->waitq, lbs_command_queue_empty(priv)); in lbs_stop_iface()
232 if (priv->power_save) in lbs_stop_iface()
233 ret = priv->power_save(priv); in lbs_stop_iface()
246 struct lbs_private *priv = dev->ml_priv; in lbs_eth_stop() local
248 if (priv->connect_status == LBS_CONNECTED) in lbs_eth_stop()
249 lbs_disconnect(priv, WLAN_REASON_DEAUTH_LEAVING); in lbs_eth_stop()
251 spin_lock_irq(&priv->driver_lock); in lbs_eth_stop()
253 spin_unlock_irq(&priv->driver_lock); in lbs_eth_stop()
255 lbs_update_mcast(priv); in lbs_eth_stop()
256 cancel_delayed_work_sync(&priv->scan_work); in lbs_eth_stop()
257 if (priv->scan_req) in lbs_eth_stop()
258 lbs_scan_done(priv); in lbs_eth_stop()
260 netif_carrier_off(priv->dev); in lbs_eth_stop()
262 if (!lbs_iface_active(priv)) in lbs_eth_stop()
263 lbs_stop_iface(priv); in lbs_eth_stop()
268 void lbs_host_to_card_done(struct lbs_private *priv) in lbs_host_to_card_done() argument
272 spin_lock_irqsave(&priv->driver_lock, flags); in lbs_host_to_card_done()
273 del_timer(&priv->tx_lockup_timer); in lbs_host_to_card_done()
275 priv->dnld_sent = DNLD_RES_RECEIVED; in lbs_host_to_card_done()
278 if (!priv->cur_cmd || priv->tx_pending_len > 0) { in lbs_host_to_card_done()
279 if (!priv->wakeup_dev_required) in lbs_host_to_card_done()
280 wake_up(&priv->waitq); in lbs_host_to_card_done()
283 spin_unlock_irqrestore(&priv->driver_lock, flags); in lbs_host_to_card_done()
290 struct lbs_private *priv = dev->ml_priv; in lbs_set_mac_address() local
297 if (lbs_iface_active(priv)) in lbs_set_mac_address()
301 dev = priv->dev; in lbs_set_mac_address()
303 memcpy(priv->current_addr, phwaddr->sa_data, ETH_ALEN); in lbs_set_mac_address()
305 if (priv->mesh_dev) in lbs_set_mac_address()
306 eth_hw_addr_set(priv->mesh_dev, phwaddr->sa_data); in lbs_set_mac_address()
360 void lbs_update_mcast(struct lbs_private *priv) in lbs_update_mcast() argument
365 int old_mac_control = priv->mac_control; in lbs_update_mcast()
367 if (netif_running(priv->dev)) in lbs_update_mcast()
368 dev_flags |= priv->dev->flags; in lbs_update_mcast()
369 if (priv->mesh_dev && netif_running(priv->mesh_dev)) in lbs_update_mcast()
370 dev_flags |= priv->mesh_dev->flags; in lbs_update_mcast()
373 priv->mac_control |= CMD_ACT_MAC_PROMISCUOUS_ENABLE; in lbs_update_mcast()
374 priv->mac_control &= ~(CMD_ACT_MAC_ALL_MULTICAST_ENABLE | in lbs_update_mcast()
379 priv->mac_control |= CMD_ACT_MAC_ALL_MULTICAST_ENABLE; in lbs_update_mcast()
380 priv->mac_control &= ~(CMD_ACT_MAC_PROMISCUOUS_ENABLE | in lbs_update_mcast()
386 nr_addrs = lbs_add_mcast_addrs(&mcast_cmd, priv->dev, 0); in lbs_update_mcast()
387 if (nr_addrs >= 0 && priv->mesh_dev) in lbs_update_mcast()
388 nr_addrs = lbs_add_mcast_addrs(&mcast_cmd, priv->mesh_dev, nr_addrs); in lbs_update_mcast()
400 lbs_cmd_async(priv, CMD_MAC_MULTICAST_ADR, &mcast_cmd.hdr, size); in lbs_update_mcast()
402 priv->mac_control |= CMD_ACT_MAC_MULTICAST_ENABLE; in lbs_update_mcast()
404 priv->mac_control &= ~CMD_ACT_MAC_MULTICAST_ENABLE; in lbs_update_mcast()
406 priv->mac_control &= ~(CMD_ACT_MAC_PROMISCUOUS_ENABLE | in lbs_update_mcast()
409 if (priv->mac_control != old_mac_control) in lbs_update_mcast()
410 lbs_set_mac_control(priv); in lbs_update_mcast()
415 struct lbs_private *priv = container_of(work, struct lbs_private, mcast_work); in lbs_set_mcast_worker() local
416 lbs_update_mcast(priv); in lbs_set_mcast_worker()
421 struct lbs_private *priv = dev->ml_priv; in lbs_set_multicast_list() local
423 schedule_work(&priv->mcast_work); in lbs_set_multicast_list()
437 struct lbs_private *priv = dev->ml_priv; in lbs_thread() local
447 priv->currenttxskb, priv->dnld_sent); in lbs_thread()
449 add_wait_queue(&priv->waitq, &wait); in lbs_thread()
451 spin_lock_irq(&priv->driver_lock); in lbs_thread()
455 else if (priv->surpriseremoved) in lbs_thread()
457 else if (priv->psstate == PS_STATE_SLEEP) in lbs_thread()
459 else if (priv->cmd_timed_out) in lbs_thread()
461 else if (!priv->fw_ready) in lbs_thread()
463 else if (priv->dnld_sent) in lbs_thread()
465 else if (priv->tx_pending_len > 0) in lbs_thread()
467 else if (priv->resp_len[priv->resp_idx]) in lbs_thread()
469 else if (priv->cur_cmd) in lbs_thread()
471 else if (!list_empty(&priv->cmdpendingq) && in lbs_thread()
472 !(priv->wakeup_dev_required)) in lbs_thread()
474 else if (kfifo_len(&priv->event_fifo)) in lbs_thread()
482 priv->connect_status, in lbs_thread()
483 priv->psmode, priv->psstate); in lbs_thread()
484 spin_unlock_irq(&priv->driver_lock); in lbs_thread()
487 spin_unlock_irq(&priv->driver_lock); in lbs_thread()
490 priv->currenttxskb, priv->dnld_sent); in lbs_thread()
493 remove_wait_queue(&priv->waitq, &wait); in lbs_thread()
496 priv->currenttxskb, priv->dnld_sent); in lbs_thread()
503 if (priv->surpriseremoved) { in lbs_thread()
509 priv->currenttxskb, priv->dnld_sent); in lbs_thread()
512 spin_lock_irq(&priv->driver_lock); in lbs_thread()
513 resp_idx = priv->resp_idx; in lbs_thread()
514 if (priv->resp_len[resp_idx]) { in lbs_thread()
515 spin_unlock_irq(&priv->driver_lock); in lbs_thread()
516 lbs_process_command_response(priv, in lbs_thread()
517 priv->resp_buf[resp_idx], in lbs_thread()
518 priv->resp_len[resp_idx]); in lbs_thread()
519 spin_lock_irq(&priv->driver_lock); in lbs_thread()
520 priv->resp_len[resp_idx] = 0; in lbs_thread()
522 spin_unlock_irq(&priv->driver_lock); in lbs_thread()
525 spin_lock_irq(&priv->driver_lock); in lbs_thread()
526 while (kfifo_len(&priv->event_fifo)) { in lbs_thread()
529 if (kfifo_out(&priv->event_fifo, in lbs_thread()
533 spin_unlock_irq(&priv->driver_lock); in lbs_thread()
534 lbs_process_event(priv, event); in lbs_thread()
535 spin_lock_irq(&priv->driver_lock); in lbs_thread()
537 spin_unlock_irq(&priv->driver_lock); in lbs_thread()
539 if (priv->wakeup_dev_required) { in lbs_thread()
542 if (priv->exit_deep_sleep(priv)) in lbs_thread()
548 if (priv->cmd_timed_out && priv->cur_cmd) { in lbs_thread()
549 struct cmd_ctrl_node *cmdnode = priv->cur_cmd; in lbs_thread()
553 lbs_complete_command(priv, cmdnode, -ETIMEDOUT); in lbs_thread()
557 if (!dev->dismantle && priv->reset_card) in lbs_thread()
558 priv->reset_card(priv); in lbs_thread()
560 priv->cmd_timed_out = 0; in lbs_thread()
562 if (!priv->fw_ready) in lbs_thread()
566 if (priv->psstate == PS_STATE_PRE_SLEEP && in lbs_thread()
567 !priv->dnld_sent && !priv->cur_cmd) { in lbs_thread()
568 if (priv->connect_status == LBS_CONNECTED) { in lbs_thread()
571 priv->currenttxskb, priv->dnld_sent, in lbs_thread()
572 priv->cur_cmd); in lbs_thread()
574 lbs_ps_confirm_sleep(priv); in lbs_thread()
581 priv->psstate = PS_STATE_AWAKE; in lbs_thread()
590 if ((priv->psstate == PS_STATE_SLEEP) || in lbs_thread()
591 (priv->psstate == PS_STATE_PRE_SLEEP)) in lbs_thread()
594 if (priv->is_deep_sleep) in lbs_thread()
598 if (!priv->dnld_sent && !priv->cur_cmd) in lbs_thread()
599 lbs_execute_next_command(priv); in lbs_thread()
601 spin_lock_irq(&priv->driver_lock); in lbs_thread()
602 if (!priv->dnld_sent && priv->tx_pending_len > 0) { in lbs_thread()
603 int ret = priv->hw_host_to_card(priv, MVMS_DAT, in lbs_thread()
604 priv->tx_pending_buf, in lbs_thread()
605 priv->tx_pending_len); in lbs_thread()
608 priv->dnld_sent = DNLD_RES_RECEIVED; in lbs_thread()
610 mod_timer(&priv->tx_lockup_timer, in lbs_thread()
613 priv->tx_pending_len = 0; in lbs_thread()
614 if (!priv->currenttxskb) { in lbs_thread()
617 if (priv->connect_status == LBS_CONNECTED) in lbs_thread()
618 netif_wake_queue(priv->dev); in lbs_thread()
619 if (priv->mesh_dev && in lbs_thread()
620 netif_running(priv->mesh_dev)) in lbs_thread()
621 netif_wake_queue(priv->mesh_dev); in lbs_thread()
624 spin_unlock_irq(&priv->driver_lock); in lbs_thread()
627 del_timer(&priv->command_timer); in lbs_thread()
628 del_timer(&priv->tx_lockup_timer); in lbs_thread()
629 del_timer(&priv->auto_deepsleep_timer); in lbs_thread()
641 static int lbs_setup_firmware(struct lbs_private *priv) in lbs_setup_firmware() argument
647 eth_broadcast_addr(priv->current_addr); in lbs_setup_firmware()
648 ret = lbs_update_hw_spec(priv); in lbs_setup_firmware()
653 ret = lbs_get_tx_power(priv, &curlevel, &minlevel, &maxlevel); in lbs_setup_firmware()
655 priv->txpower_cur = curlevel; in lbs_setup_firmware()
656 priv->txpower_min = minlevel; in lbs_setup_firmware()
657 priv->txpower_max = maxlevel; in lbs_setup_firmware()
661 ret = lbs_set_snmp_mib(priv, SNMP_MIB_OID_11D_ENABLE, 1); in lbs_setup_firmware()
665 ret = lbs_set_mac_control_sync(priv); in lbs_setup_firmware()
670 int lbs_suspend(struct lbs_private *priv) in lbs_suspend() argument
674 if (priv->is_deep_sleep) { in lbs_suspend()
675 ret = lbs_set_deep_sleep(priv, 0); in lbs_suspend()
677 netdev_err(priv->dev, in lbs_suspend()
681 priv->deep_sleep_required = 1; in lbs_suspend()
684 ret = lbs_set_host_sleep(priv, 1); in lbs_suspend()
686 netif_device_detach(priv->dev); in lbs_suspend()
687 if (priv->mesh_dev) in lbs_suspend()
688 netif_device_detach(priv->mesh_dev); in lbs_suspend()
694 int lbs_resume(struct lbs_private *priv) in lbs_resume() argument
698 ret = lbs_set_host_sleep(priv, 0); in lbs_resume()
700 netif_device_attach(priv->dev); in lbs_resume()
701 if (priv->mesh_dev) in lbs_resume()
702 netif_device_attach(priv->mesh_dev); in lbs_resume()
704 if (priv->deep_sleep_required) { in lbs_resume()
705 priv->deep_sleep_required = 0; in lbs_resume()
706 ret = lbs_set_deep_sleep(priv, 1); in lbs_resume()
708 netdev_err(priv->dev, in lbs_resume()
712 if (priv->setup_fw_on_resume) in lbs_resume()
713 ret = lbs_setup_firmware(priv); in lbs_resume()
727 struct lbs_private *priv = from_timer(priv, t, command_timer); in lbs_cmd_timeout_handler() local
730 spin_lock_irqsave(&priv->driver_lock, flags); in lbs_cmd_timeout_handler()
732 if (!priv->cur_cmd) in lbs_cmd_timeout_handler()
735 netdev_info(priv->dev, "command 0x%04x timed out\n", in lbs_cmd_timeout_handler()
736 le16_to_cpu(priv->cur_cmd->cmdbuf->command)); in lbs_cmd_timeout_handler()
738 priv->cmd_timed_out = 1; in lbs_cmd_timeout_handler()
744 if (priv->dnld_sent == DNLD_CMD_SENT) in lbs_cmd_timeout_handler()
745 priv->dnld_sent = DNLD_RES_RECEIVED; in lbs_cmd_timeout_handler()
747 wake_up(&priv->waitq); in lbs_cmd_timeout_handler()
749 spin_unlock_irqrestore(&priv->driver_lock, flags); in lbs_cmd_timeout_handler()
761 struct lbs_private *priv = from_timer(priv, t, tx_lockup_timer); in lbs_tx_lockup_handler() local
764 spin_lock_irqsave(&priv->driver_lock, flags); in lbs_tx_lockup_handler()
766 netdev_info(priv->dev, "TX lockup detected\n"); in lbs_tx_lockup_handler()
767 if (priv->reset_card) in lbs_tx_lockup_handler()
768 priv->reset_card(priv); in lbs_tx_lockup_handler()
770 priv->dnld_sent = DNLD_RES_RECEIVED; in lbs_tx_lockup_handler()
771 wake_up_interruptible(&priv->waitq); in lbs_tx_lockup_handler()
773 spin_unlock_irqrestore(&priv->driver_lock, flags); in lbs_tx_lockup_handler()
784 struct lbs_private *priv = from_timer(priv, t, auto_deepsleep_timer); in auto_deepsleep_timer_fn() local
786 if (priv->is_activity_detected) { in auto_deepsleep_timer_fn()
787 priv->is_activity_detected = 0; in auto_deepsleep_timer_fn()
789 if (priv->is_auto_deep_sleep_enabled && in auto_deepsleep_timer_fn()
790 (!priv->wakeup_dev_required) && in auto_deepsleep_timer_fn()
791 (priv->connect_status != LBS_CONNECTED)) { in auto_deepsleep_timer_fn()
797 lbs_cmd_async(priv, CMD_802_11_DEEP_SLEEP, &cmd, in auto_deepsleep_timer_fn()
801 mod_timer(&priv->auto_deepsleep_timer , jiffies + in auto_deepsleep_timer_fn()
802 (priv->auto_deep_sleep_timeout * HZ)/1000); in auto_deepsleep_timer_fn()
805 int lbs_enter_auto_deep_sleep(struct lbs_private *priv) in lbs_enter_auto_deep_sleep() argument
807 priv->is_auto_deep_sleep_enabled = 1; in lbs_enter_auto_deep_sleep()
808 if (priv->is_deep_sleep) in lbs_enter_auto_deep_sleep()
809 priv->wakeup_dev_required = 1; in lbs_enter_auto_deep_sleep()
810 mod_timer(&priv->auto_deepsleep_timer , in lbs_enter_auto_deep_sleep()
811 jiffies + (priv->auto_deep_sleep_timeout * HZ)/1000); in lbs_enter_auto_deep_sleep()
816 int lbs_exit_auto_deep_sleep(struct lbs_private *priv) in lbs_exit_auto_deep_sleep() argument
818 priv->is_auto_deep_sleep_enabled = 0; in lbs_exit_auto_deep_sleep()
819 priv->auto_deep_sleep_timeout = 0; in lbs_exit_auto_deep_sleep()
820 del_timer(&priv->auto_deepsleep_timer); in lbs_exit_auto_deep_sleep()
825 static int lbs_init_adapter(struct lbs_private *priv) in lbs_init_adapter() argument
829 eth_broadcast_addr(priv->current_addr); in lbs_init_adapter()
831 priv->connect_status = LBS_DISCONNECTED; in lbs_init_adapter()
832 priv->channel = DEFAULT_AD_HOC_CHANNEL; in lbs_init_adapter()
833 priv->mac_control = CMD_ACT_MAC_RX_ON | CMD_ACT_MAC_TX_ON; in lbs_init_adapter()
834 priv->radio_on = 1; in lbs_init_adapter()
835 priv->psmode = LBS802_11POWERMODECAM; in lbs_init_adapter()
836 priv->psstate = PS_STATE_FULL_POWER; in lbs_init_adapter()
837 priv->is_deep_sleep = 0; in lbs_init_adapter()
838 priv->is_auto_deep_sleep_enabled = 0; in lbs_init_adapter()
839 priv->deep_sleep_required = 0; in lbs_init_adapter()
840 priv->wakeup_dev_required = 0; in lbs_init_adapter()
841 init_waitqueue_head(&priv->ds_awake_q); in lbs_init_adapter()
842 init_waitqueue_head(&priv->scan_q); in lbs_init_adapter()
843 priv->authtype_auto = 1; in lbs_init_adapter()
844 priv->is_host_sleep_configured = 0; in lbs_init_adapter()
845 priv->is_host_sleep_activated = 0; in lbs_init_adapter()
846 init_waitqueue_head(&priv->host_sleep_q); in lbs_init_adapter()
847 init_waitqueue_head(&priv->fw_waitq); in lbs_init_adapter()
848 mutex_init(&priv->lock); in lbs_init_adapter()
850 timer_setup(&priv->command_timer, lbs_cmd_timeout_handler, 0); in lbs_init_adapter()
851 timer_setup(&priv->tx_lockup_timer, lbs_tx_lockup_handler, 0); in lbs_init_adapter()
852 timer_setup(&priv->auto_deepsleep_timer, auto_deepsleep_timer_fn, 0); in lbs_init_adapter()
854 INIT_LIST_HEAD(&priv->cmdfreeq); in lbs_init_adapter()
855 INIT_LIST_HEAD(&priv->cmdpendingq); in lbs_init_adapter()
857 spin_lock_init(&priv->driver_lock); in lbs_init_adapter()
860 if (lbs_allocate_cmd_buffer(priv)) { in lbs_init_adapter()
865 priv->resp_idx = 0; in lbs_init_adapter()
866 priv->resp_len[0] = priv->resp_len[1] = 0; in lbs_init_adapter()
869 ret = kfifo_alloc(&priv->event_fifo, sizeof(u32) * 16, GFP_KERNEL); in lbs_init_adapter()
872 lbs_free_cmd_buffer(priv); in lbs_init_adapter()
880 static void lbs_free_adapter(struct lbs_private *priv) in lbs_free_adapter() argument
882 lbs_free_cmd_buffer(priv); in lbs_free_adapter()
883 kfifo_free(&priv->event_fifo); in lbs_free_adapter()
884 del_timer(&priv->command_timer); in lbs_free_adapter()
885 del_timer(&priv->tx_lockup_timer); in lbs_free_adapter()
886 del_timer(&priv->auto_deepsleep_timer); in lbs_free_adapter()
910 struct lbs_private *priv = NULL; in lbs_add_card() local
922 priv = wdev_priv(wdev); in lbs_add_card()
923 priv->wdev = wdev; in lbs_add_card()
925 err = lbs_init_adapter(priv); in lbs_add_card()
939 dev->ml_priv = priv; in lbs_add_card()
942 priv->dev = dev; in lbs_add_card()
949 priv->card = card; in lbs_add_card()
954 init_waitqueue_head(&priv->waitq); in lbs_add_card()
955 priv->main_thread = kthread_run(lbs_thread, dev, "lbs_main"); in lbs_add_card()
956 if (IS_ERR(priv->main_thread)) { in lbs_add_card()
957 err = PTR_ERR(priv->main_thread); in lbs_add_card()
962 priv->work_thread = create_singlethread_workqueue("lbs_worker"); in lbs_add_card()
963 INIT_WORK(&priv->mcast_work, lbs_set_mcast_worker); in lbs_add_card()
965 priv->wol_criteria = EHS_REMOVE_WAKEUP; in lbs_add_card()
966 priv->wol_gpio = 0xff; in lbs_add_card()
967 priv->wol_gap = 20; in lbs_add_card()
968 priv->ehs_remove_supported = true; in lbs_add_card()
970 return priv; in lbs_add_card()
976 lbs_free_adapter(priv); in lbs_add_card()
979 lbs_cfg_free(priv); in lbs_add_card()
987 void lbs_remove_card(struct lbs_private *priv) in lbs_remove_card() argument
989 struct net_device *dev = priv->dev; in lbs_remove_card()
991 lbs_remove_mesh(priv); in lbs_remove_card()
993 if (priv->wiphy_registered) in lbs_remove_card()
994 lbs_scan_deinit(priv); in lbs_remove_card()
996 lbs_wait_for_firmware_load(priv); in lbs_remove_card()
1002 destroy_workqueue(priv->work_thread); in lbs_remove_card()
1005 if (priv->psmode == LBS802_11POWERMODEMAX_PSP) { in lbs_remove_card()
1006 priv->psmode = LBS802_11POWERMODECAM; in lbs_remove_card()
1011 if (priv->psstate != PS_STATE_FULL_POWER) in lbs_remove_card()
1012 lbs_set_ps_mode(priv, PS_MODE_ACTION_EXIT_PS, true); in lbs_remove_card()
1015 if (priv->is_deep_sleep) { in lbs_remove_card()
1016 priv->is_deep_sleep = 0; in lbs_remove_card()
1017 wake_up_interruptible(&priv->ds_awake_q); in lbs_remove_card()
1020 priv->is_host_sleep_configured = 0; in lbs_remove_card()
1021 priv->is_host_sleep_activated = 0; in lbs_remove_card()
1022 wake_up_interruptible(&priv->host_sleep_q); in lbs_remove_card()
1025 priv->surpriseremoved = 1; in lbs_remove_card()
1026 kthread_stop(priv->main_thread); in lbs_remove_card()
1028 lbs_free_adapter(priv); in lbs_remove_card()
1029 lbs_cfg_free(priv); in lbs_remove_card()
1035 int lbs_rtap_supported(struct lbs_private *priv) in lbs_rtap_supported() argument
1037 if (MRVL_FW_MAJOR_REV(priv->fwrelease) == MRVL_FW_V5) in lbs_rtap_supported()
1041 return ((MRVL_FW_MAJOR_REV(priv->fwrelease) >= MRVL_FW_V10) && in lbs_rtap_supported()
1042 (priv->fwcapinfo & MESH_CAPINFO_ENABLE_MASK)); in lbs_rtap_supported()
1046 int lbs_start_card(struct lbs_private *priv) in lbs_start_card() argument
1048 struct net_device *dev = priv->dev; in lbs_start_card()
1052 ret = lbs_setup_firmware(priv); in lbs_start_card()
1057 lbs_init_mesh(priv); in lbs_start_card()
1061 ret = lbs_cfg_register(priv); in lbs_start_card()
1067 if (lbs_mesh_activated(priv)) in lbs_start_card()
1068 lbs_start_mesh(priv); in lbs_start_card()
1070 lbs_debugfs_init_one(priv, dev); in lbs_start_card()
1082 void lbs_stop_card(struct lbs_private *priv) in lbs_stop_card() argument
1086 if (!priv) in lbs_stop_card()
1088 dev = priv->dev; in lbs_stop_card()
1098 lbs_debugfs_remove_one(priv); in lbs_stop_card()
1099 lbs_deinit_mesh(priv); in lbs_stop_card()
1105 void lbs_queue_event(struct lbs_private *priv, u32 event) in lbs_queue_event() argument
1109 spin_lock_irqsave(&priv->driver_lock, flags); in lbs_queue_event()
1111 if (priv->psstate == PS_STATE_SLEEP) in lbs_queue_event()
1112 priv->psstate = PS_STATE_AWAKE; in lbs_queue_event()
1114 kfifo_in(&priv->event_fifo, (unsigned char *) &event, sizeof(u32)); in lbs_queue_event()
1116 wake_up(&priv->waitq); in lbs_queue_event()
1118 spin_unlock_irqrestore(&priv->driver_lock, flags); in lbs_queue_event()
1122 void lbs_notify_command_response(struct lbs_private *priv, u8 resp_idx) in lbs_notify_command_response() argument
1124 if (priv->psstate == PS_STATE_SLEEP) in lbs_notify_command_response()
1125 priv->psstate = PS_STATE_AWAKE; in lbs_notify_command_response()
1129 priv->resp_idx = resp_idx; in lbs_notify_command_response()
1131 wake_up(&priv->waitq); in lbs_notify_command_response()