| .. | .. |
|---|
| 1 | | -/****************************************************************************** |
|---|
| 2 | | - * |
|---|
| 3 | | - * Copyright(c) 2009-2012 Realtek Corporation. All rights reserved. |
|---|
| 4 | | - * |
|---|
| 5 | | - * This program is free software; you can redistribute it and/or modify it |
|---|
| 6 | | - * under the terms of version 2 of the GNU General Public License as |
|---|
| 7 | | - * published by the Free Software Foundation. |
|---|
| 8 | | - * |
|---|
| 9 | | - * This program is distributed in the hope that it will be useful, but WITHOUT |
|---|
| 10 | | - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|---|
| 11 | | - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
|---|
| 12 | | - * more details. |
|---|
| 13 | | - * |
|---|
| 14 | | - * The full GNU General Public License is included in this distribution in the |
|---|
| 15 | | - * file called LICENSE. |
|---|
| 16 | | - * |
|---|
| 17 | | - * Contact Information: |
|---|
| 18 | | - * wlanfae <wlanfae@realtek.com> |
|---|
| 19 | | - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, |
|---|
| 20 | | - * Hsinchu 300, Taiwan. |
|---|
| 21 | | - * |
|---|
| 22 | | - *****************************************************************************/ |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0 |
|---|
| 2 | +/* Copyright(c) 2009-2012 Realtek Corporation.*/ |
|---|
| 23 | 3 | |
|---|
| 24 | 4 | #include "wifi.h" |
|---|
| 25 | 5 | #include "core.h" |
|---|
| .. | .. |
|---|
| 214 | 194 | _usb_write_async(to_usb_device(dev), addr, val, 4); |
|---|
| 215 | 195 | } |
|---|
| 216 | 196 | |
|---|
| 217 | | -static void _usb_writeN_sync(struct rtl_priv *rtlpriv, u32 addr, void *data, |
|---|
| 197 | +static void _usb_writen_sync(struct rtl_priv *rtlpriv, u32 addr, void *data, |
|---|
| 218 | 198 | u16 len) |
|---|
| 219 | 199 | { |
|---|
| 220 | 200 | struct device *dev = rtlpriv->io.dev; |
|---|
| .. | .. |
|---|
| 249 | 229 | rtlpriv->io.read8_sync = _usb_read8_sync; |
|---|
| 250 | 230 | rtlpriv->io.read16_sync = _usb_read16_sync; |
|---|
| 251 | 231 | rtlpriv->io.read32_sync = _usb_read32_sync; |
|---|
| 252 | | - rtlpriv->io.writeN_sync = _usb_writeN_sync; |
|---|
| 232 | + rtlpriv->io.writen_sync = _usb_writen_sync; |
|---|
| 253 | 233 | } |
|---|
| 254 | 234 | |
|---|
| 255 | 235 | static void _rtl_usb_io_handler_release(struct ieee80211_hw *hw) |
|---|
| .. | .. |
|---|
| 259 | 239 | mutex_destroy(&rtlpriv->io.bb_mutex); |
|---|
| 260 | 240 | } |
|---|
| 261 | 241 | |
|---|
| 262 | | -/** |
|---|
| 263 | | - * |
|---|
| 264 | | - * Default aggregation handler. Do nothing and just return the oldest skb. |
|---|
| 265 | | - */ |
|---|
| 242 | +/* Default aggregation handler. Do nothing and just return the oldest skb. */ |
|---|
| 266 | 243 | static struct sk_buff *_none_usb_tx_aggregate_hdl(struct ieee80211_hw *hw, |
|---|
| 267 | 244 | struct sk_buff_head *list) |
|---|
| 268 | 245 | { |
|---|
| .. | .. |
|---|
| 282 | 259 | ? USB_HIGH_SPEED_BULK_SIZE |
|---|
| 283 | 260 | : USB_FULL_SPEED_BULK_SIZE; |
|---|
| 284 | 261 | |
|---|
| 285 | | - RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, "USB Max Bulk-out Size=%d\n", |
|---|
| 286 | | - rtlusb->max_bulk_out_size); |
|---|
| 262 | + rtl_dbg(rtlpriv, COMP_INIT, DBG_DMESG, "USB Max Bulk-out Size=%d\n", |
|---|
| 263 | + rtlusb->max_bulk_out_size); |
|---|
| 287 | 264 | |
|---|
| 288 | 265 | for (i = 0; i < __RTL_TXQ_NUM; i++) { |
|---|
| 289 | 266 | u32 ep_num = rtlusb->ep_map.ep_mapping[i]; |
|---|
| 267 | + |
|---|
| 290 | 268 | if (!ep_num) { |
|---|
| 291 | | - RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, |
|---|
| 292 | | - "Invalid endpoint map setting!\n"); |
|---|
| 269 | + rtl_dbg(rtlpriv, COMP_INIT, DBG_DMESG, |
|---|
| 270 | + "Invalid endpoint map setting!\n"); |
|---|
| 293 | 271 | return -EINVAL; |
|---|
| 294 | 272 | } |
|---|
| 295 | 273 | } |
|---|
| .. | .. |
|---|
| 311 | 289 | return 0; |
|---|
| 312 | 290 | } |
|---|
| 313 | 291 | |
|---|
| 314 | | -static void _rtl_rx_work(unsigned long param); |
|---|
| 292 | +static void _rtl_rx_work(struct tasklet_struct *t); |
|---|
| 315 | 293 | |
|---|
| 316 | 294 | static int _rtl_usb_init_rx(struct ieee80211_hw *hw) |
|---|
| 317 | 295 | { |
|---|
| .. | .. |
|---|
| 332 | 310 | init_usb_anchor(&rtlusb->rx_cleanup_urbs); |
|---|
| 333 | 311 | |
|---|
| 334 | 312 | skb_queue_head_init(&rtlusb->rx_queue); |
|---|
| 335 | | - rtlusb->rx_work_tasklet.func = _rtl_rx_work; |
|---|
| 336 | | - rtlusb->rx_work_tasklet.data = (unsigned long)rtlusb; |
|---|
| 313 | + rtlusb->rx_work_tasklet.func = (void(*))_rtl_rx_work; |
|---|
| 314 | + rtlusb->rx_work_tasklet.data = (unsigned long)&rtlusb->rx_work_tasklet; |
|---|
| 337 | 315 | |
|---|
| 338 | 316 | return 0; |
|---|
| 339 | 317 | } |
|---|
| .. | .. |
|---|
| 351 | 329 | rtlusb->out_ep_nums = rtlusb->in_ep_nums = 0; |
|---|
| 352 | 330 | for (epidx = 0; epidx < epnums; epidx++) { |
|---|
| 353 | 331 | struct usb_endpoint_descriptor *pep_desc; |
|---|
| 332 | + |
|---|
| 354 | 333 | pep_desc = &usb_intf->cur_altsetting->endpoint[epidx].desc; |
|---|
| 355 | 334 | |
|---|
| 356 | 335 | if (usb_endpoint_dir_in(pep_desc)) |
|---|
| .. | .. |
|---|
| 358 | 337 | else if (usb_endpoint_dir_out(pep_desc)) |
|---|
| 359 | 338 | rtlusb->out_ep_nums++; |
|---|
| 360 | 339 | |
|---|
| 361 | | - RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, |
|---|
| 362 | | - "USB EP(0x%02x), MaxPacketSize=%d, Interval=%d\n", |
|---|
| 363 | | - pep_desc->bEndpointAddress, pep_desc->wMaxPacketSize, |
|---|
| 364 | | - pep_desc->bInterval); |
|---|
| 340 | + rtl_dbg(rtlpriv, COMP_INIT, DBG_DMESG, |
|---|
| 341 | + "USB EP(0x%02x), MaxPacketSize=%d, Interval=%d\n", |
|---|
| 342 | + pep_desc->bEndpointAddress, pep_desc->wMaxPacketSize, |
|---|
| 343 | + pep_desc->bInterval); |
|---|
| 365 | 344 | } |
|---|
| 366 | 345 | if (rtlusb->in_ep_nums < rtlpriv->cfg->usb_interface_cfg->in_ep_num) { |
|---|
| 367 | 346 | pr_err("Too few input end points found\n"); |
|---|
| .. | .. |
|---|
| 413 | 392 | rtlusb->irq_mask[0] = 0xFFFFFFFF; |
|---|
| 414 | 393 | /* HIMR_EX - turn all on */ |
|---|
| 415 | 394 | rtlusb->irq_mask[1] = 0xFFFFFFFF; |
|---|
| 416 | | - rtlusb->disableHWSM = true; |
|---|
| 395 | + rtlusb->disablehwsm = true; |
|---|
| 417 | 396 | } |
|---|
| 418 | 397 | |
|---|
| 419 | 398 | static void _rtl_rx_completed(struct urb *urb); |
|---|
| .. | .. |
|---|
| 549 | 528 | |
|---|
| 550 | 529 | #define __RX_SKB_MAX_QUEUED 64 |
|---|
| 551 | 530 | |
|---|
| 552 | | -static void _rtl_rx_work(unsigned long param) |
|---|
| 531 | +static void _rtl_rx_work(struct tasklet_struct *t) |
|---|
| 553 | 532 | { |
|---|
| 554 | | - struct rtl_usb *rtlusb = (struct rtl_usb *)param; |
|---|
| 533 | + struct rtl_usb *rtlusb = from_tasklet(rtlusb, t, rx_work_tasklet); |
|---|
| 555 | 534 | struct ieee80211_hw *hw = usb_get_intfdata(rtlusb->intf); |
|---|
| 556 | 535 | struct sk_buff *skb; |
|---|
| 557 | 536 | |
|---|
| .. | .. |
|---|
| 701 | 680 | tasklet_kill(&rtlusb->rx_work_tasklet); |
|---|
| 702 | 681 | cancel_work_sync(&rtlpriv->works.lps_change_work); |
|---|
| 703 | 682 | |
|---|
| 704 | | - flush_workqueue(rtlpriv->works.rtl_wq); |
|---|
| 705 | | - destroy_workqueue(rtlpriv->works.rtl_wq); |
|---|
| 683 | + if (rtlpriv->works.rtl_wq) { |
|---|
| 684 | + destroy_workqueue(rtlpriv->works.rtl_wq); |
|---|
| 685 | + rtlpriv->works.rtl_wq = NULL; |
|---|
| 686 | + } |
|---|
| 706 | 687 | |
|---|
| 707 | 688 | skb_queue_purge(&rtlusb->rx_queue); |
|---|
| 708 | 689 | |
|---|
| .. | .. |
|---|
| 776 | 757 | |
|---|
| 777 | 758 | return err; |
|---|
| 778 | 759 | } |
|---|
| 779 | | -/** |
|---|
| 780 | | - * |
|---|
| 781 | | - * |
|---|
| 782 | | - */ |
|---|
| 783 | 760 | |
|---|
| 784 | 761 | /*======================= tx =========================================*/ |
|---|
| 785 | 762 | static void rtl_usb_cleanup(struct ieee80211_hw *hw) |
|---|
| .. | .. |
|---|
| 806 | 783 | usb_kill_anchored_urbs(&rtlusb->tx_submitted); |
|---|
| 807 | 784 | } |
|---|
| 808 | 785 | |
|---|
| 809 | | -/** |
|---|
| 810 | | - * |
|---|
| 811 | | - * We may add some struct into struct rtl_usb later. Do deinit here. |
|---|
| 812 | | - * |
|---|
| 813 | | - */ |
|---|
| 786 | +/* We may add some struct into struct rtl_usb later. Do deinit here. */ |
|---|
| 814 | 787 | static void rtl_usb_deinit(struct ieee80211_hw *hw) |
|---|
| 815 | 788 | { |
|---|
| 816 | 789 | rtl_usb_cleanup(hw); |
|---|
| .. | .. |
|---|
| 960 | 933 | |
|---|
| 961 | 934 | memset(&tcb_desc, 0, sizeof(struct rtl_tcb_desc)); |
|---|
| 962 | 935 | if (ieee80211_is_auth(fc)) { |
|---|
| 963 | | - RT_TRACE(rtlpriv, COMP_SEND, DBG_DMESG, "MAC80211_LINKING\n"); |
|---|
| 936 | + rtl_dbg(rtlpriv, COMP_SEND, DBG_DMESG, "MAC80211_LINKING\n"); |
|---|
| 964 | 937 | } |
|---|
| 965 | 938 | |
|---|
| 966 | 939 | if (rtlpriv->psc.sw_ps_enabled) { |
|---|
| .. | .. |
|---|
| 1042 | 1015 | hw = ieee80211_alloc_hw(sizeof(struct rtl_priv) + |
|---|
| 1043 | 1016 | sizeof(struct rtl_usb_priv), &rtl_ops); |
|---|
| 1044 | 1017 | if (!hw) { |
|---|
| 1045 | | - WARN_ONCE(true, "rtl_usb: ieee80211 alloc failed\n"); |
|---|
| 1018 | + pr_warn("rtl_usb: ieee80211 alloc failed\n"); |
|---|
| 1046 | 1019 | return -ENOMEM; |
|---|
| 1047 | 1020 | } |
|---|
| 1048 | 1021 | rtlpriv = hw->priv; |
|---|
| .. | .. |
|---|
| 1114 | 1087 | usb_put_dev(udev); |
|---|
| 1115 | 1088 | complete(&rtlpriv->firmware_loading_complete); |
|---|
| 1116 | 1089 | kfree(rtlpriv->usb_data); |
|---|
| 1090 | + ieee80211_free_hw(hw); |
|---|
| 1117 | 1091 | return -ENODEV; |
|---|
| 1118 | 1092 | } |
|---|
| 1119 | 1093 | EXPORT_SYMBOL(rtl_usb_probe); |
|---|