Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'wireless'

John W. Linville says:

====================
For the cfg80211 fix, Johannes says:

"I have another straggler for 3.9, adding locking forgotten in a previous
fix."

On top of that:

Bing Zhao provides an mwifiex fix to properly order a scan completion.

Franky Lin gives us a brcmfmac fix to fail at the firmware loading
stage if the nvram cannot be downloaded.

Gabor Juhos brings what at first looks like a rather big rt2x00 patch.
I think it is OK because it is really just reorganizing some code
within the rt2x00 driver in order to fix a build failure.

Hante Meuleman offers a trio of brcmfmac fixes related to running in
AP mode.

Robert Shade sends an ath9k fix to reenable interrupts even if a
channel change fails.

Tim Gardner gives us an rt2x00 fix to cut-down on some log SPAM.

Please let me know if there are problems!
====================

Signed-off-by: David S. Miller <davem@davemloft.net>

+390 -290
+4
drivers/net/wireless/ath/ath9k/main.c
··· 280 280 if (r) { 281 281 ath_err(common, 282 282 "Unable to reset channel, reset status %d\n", r); 283 + 284 + ath9k_hw_enable_interrupts(ah); 285 + ath9k_queue_reset(sc, RESET_TYPE_BB_HANG); 286 + 283 287 goto out; 284 288 } 285 289
+3 -3
drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c
··· 3317 3317 goto err; 3318 3318 } 3319 3319 3320 - /* External image takes precedence if specified */ 3321 3320 if (brcmf_sdbrcm_download_code_file(bus)) { 3322 3321 brcmf_err("dongle image file download failed\n"); 3323 3322 goto err; 3324 3323 } 3325 3324 3326 - /* External nvram takes precedence if specified */ 3327 - if (brcmf_sdbrcm_download_nvram(bus)) 3325 + if (brcmf_sdbrcm_download_nvram(bus)) { 3328 3326 brcmf_err("dongle nvram file download failed\n"); 3327 + goto err; 3328 + } 3329 3329 3330 3330 /* Take arm out of reset */ 3331 3331 if (brcmf_sdbrcm_download_state(bus, false)) {
+25 -21
drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c
··· 1891 1891 brcmf_add_keyext(struct wiphy *wiphy, struct net_device *ndev, 1892 1892 u8 key_idx, const u8 *mac_addr, struct key_params *params) 1893 1893 { 1894 + struct brcmf_if *ifp = netdev_priv(ndev); 1894 1895 struct brcmf_wsec_key key; 1895 1896 s32 err = 0; 1897 + u8 keybuf[8]; 1896 1898 1897 1899 memset(&key, 0, sizeof(key)); 1898 1900 key.index = (u32) key_idx; ··· 1918 1916 brcmf_dbg(CONN, "Setting the key index %d\n", key.index); 1919 1917 memcpy(key.data, params->key, key.len); 1920 1918 1921 - if (params->cipher == WLAN_CIPHER_SUITE_TKIP) { 1922 - u8 keybuf[8]; 1919 + if ((ifp->vif->mode != WL_MODE_AP) && 1920 + (params->cipher == WLAN_CIPHER_SUITE_TKIP)) { 1921 + brcmf_dbg(CONN, "Swapping RX/TX MIC key\n"); 1923 1922 memcpy(keybuf, &key.data[24], sizeof(keybuf)); 1924 1923 memcpy(&key.data[24], &key.data[16], sizeof(keybuf)); 1925 1924 memcpy(&key.data[16], keybuf, sizeof(keybuf)); ··· 2016 2013 break; 2017 2014 case WLAN_CIPHER_SUITE_TKIP: 2018 2015 if (ifp->vif->mode != WL_MODE_AP) { 2019 - brcmf_dbg(CONN, "Swapping key\n"); 2016 + brcmf_dbg(CONN, "Swapping RX/TX MIC key\n"); 2020 2017 memcpy(keybuf, &key.data[24], sizeof(keybuf)); 2021 2018 memcpy(&key.data[24], &key.data[16], sizeof(keybuf)); 2022 2019 memcpy(&key.data[16], keybuf, sizeof(keybuf)); ··· 2121 2118 err = -EAGAIN; 2122 2119 goto done; 2123 2120 } 2124 - switch (wsec & ~SES_OW_ENABLED) { 2125 - case WEP_ENABLED: 2121 + if (wsec & WEP_ENABLED) { 2126 2122 sec = &profile->sec; 2127 2123 if (sec->cipher_pairwise & WLAN_CIPHER_SUITE_WEP40) { 2128 2124 params.cipher = WLAN_CIPHER_SUITE_WEP40; ··· 2130 2128 params.cipher = WLAN_CIPHER_SUITE_WEP104; 2131 2129 brcmf_dbg(CONN, "WLAN_CIPHER_SUITE_WEP104\n"); 2132 2130 } 2133 - break; 2134 - case TKIP_ENABLED: 2131 + } else if (wsec & TKIP_ENABLED) { 2135 2132 params.cipher = WLAN_CIPHER_SUITE_TKIP; 2136 2133 brcmf_dbg(CONN, "WLAN_CIPHER_SUITE_TKIP\n"); 2137 - break; 2138 - case AES_ENABLED: 2134 + } else if (wsec & AES_ENABLED) { 2139 2135 params.cipher = WLAN_CIPHER_SUITE_AES_CMAC; 2140 2136 brcmf_dbg(CONN, "WLAN_CIPHER_SUITE_AES_CMAC\n"); 2141 - break; 2142 - default: 2137 + } else { 2143 2138 brcmf_err("Invalid algo (0x%x)\n", wsec); 2144 2139 err = -EINVAL; 2145 2140 goto done; ··· 3823 3824 static int brcmf_cfg80211_stop_ap(struct wiphy *wiphy, struct net_device *ndev) 3824 3825 { 3825 3826 struct brcmf_if *ifp = netdev_priv(ndev); 3826 - s32 err = -EPERM; 3827 + s32 err; 3827 3828 struct brcmf_fil_bss_enable_le bss_enable; 3829 + struct brcmf_join_params join_params; 3828 3830 3829 3831 brcmf_dbg(TRACE, "Enter\n"); 3830 3832 ··· 3833 3833 /* Due to most likely deauths outstanding we sleep */ 3834 3834 /* first to make sure they get processed by fw. */ 3835 3835 msleep(400); 3836 - err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_AP, 0); 3837 - if (err < 0) { 3838 - brcmf_err("setting AP mode failed %d\n", err); 3839 - goto exit; 3840 - } 3836 + 3837 + memset(&join_params, 0, sizeof(join_params)); 3838 + err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_SSID, 3839 + &join_params, sizeof(join_params)); 3840 + if (err < 0) 3841 + brcmf_err("SET SSID error (%d)\n", err); 3841 3842 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_UP, 0); 3842 - if (err < 0) { 3843 + if (err < 0) 3843 3844 brcmf_err("BRCMF_C_UP error %d\n", err); 3844 - goto exit; 3845 - } 3845 + err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_AP, 0); 3846 + if (err < 0) 3847 + brcmf_err("setting AP mode failed %d\n", err); 3848 + err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_INFRA, 0); 3849 + if (err < 0) 3850 + brcmf_err("setting INFRA mode failed %d\n", err); 3846 3851 } else { 3847 3852 bss_enable.bsscfg_idx = cpu_to_le32(ifp->bssidx); 3848 3853 bss_enable.enable = cpu_to_le32(0); ··· 3860 3855 set_bit(BRCMF_VIF_STATUS_AP_CREATING, &ifp->vif->sme_state); 3861 3856 clear_bit(BRCMF_VIF_STATUS_AP_CREATED, &ifp->vif->sme_state); 3862 3857 3863 - exit: 3864 3858 return err; 3865 3859 } 3866 3860
+9 -2
drivers/net/wireless/mwifiex/scan.c
··· 1393 1393 queue_work(adapter->workqueue, &adapter->main_work); 1394 1394 1395 1395 /* Perform internal scan synchronously */ 1396 - if (!priv->scan_request) 1396 + if (!priv->scan_request) { 1397 + dev_dbg(adapter->dev, "wait internal scan\n"); 1397 1398 mwifiex_wait_queue_complete(adapter, cmd_node); 1399 + } 1398 1400 } else { 1399 1401 spin_unlock_irqrestore(&adapter->scan_pending_q_lock, 1400 1402 flags); ··· 1795 1793 /* Need to indicate IOCTL complete */ 1796 1794 if (adapter->curr_cmd->wait_q_enabled) { 1797 1795 adapter->cmd_wait_q.status = 0; 1798 - mwifiex_complete_cmd(adapter, adapter->curr_cmd); 1796 + if (!priv->scan_request) { 1797 + dev_dbg(adapter->dev, 1798 + "complete internal scan\n"); 1799 + mwifiex_complete_cmd(adapter, 1800 + adapter->curr_cmd); 1801 + } 1799 1802 } 1800 1803 if (priv->report_scan_result) 1801 1804 priv->report_scan_result = false;
+7
drivers/net/wireless/rt2x00/Kconfig
··· 20 20 config RT2400PCI 21 21 tristate "Ralink rt2400 (PCI/PCMCIA) support" 22 22 depends on PCI 23 + select RT2X00_LIB_MMIO 23 24 select RT2X00_LIB_PCI 24 25 select EEPROM_93CX6 25 26 ---help--- ··· 32 31 config RT2500PCI 33 32 tristate "Ralink rt2500 (PCI/PCMCIA) support" 34 33 depends on PCI 34 + select RT2X00_LIB_MMIO 35 35 select RT2X00_LIB_PCI 36 36 select EEPROM_93CX6 37 37 ---help--- ··· 45 43 tristate "Ralink rt2501/rt61 (PCI/PCMCIA) support" 46 44 depends on PCI 47 45 select RT2X00_LIB_PCI 46 + select RT2X00_LIB_MMIO 48 47 select RT2X00_LIB_FIRMWARE 49 48 select RT2X00_LIB_CRYPTO 50 49 select CRC_ITU_T ··· 60 57 tristate "Ralink rt27xx/rt28xx/rt30xx (PCI/PCIe/PCMCIA) support" 61 58 depends on PCI || SOC_RT288X || SOC_RT305X 62 59 select RT2800_LIB 60 + select RT2X00_LIB_MMIO 63 61 select RT2X00_LIB_PCI if PCI 64 62 select RT2X00_LIB_SOC if SOC_RT288X || SOC_RT305X 65 63 select RT2X00_LIB_FIRMWARE ··· 187 183 endif 188 184 189 185 config RT2800_LIB 186 + tristate 187 + 188 + config RT2X00_LIB_MMIO 190 189 tristate 191 190 192 191 config RT2X00_LIB_PCI
+1
drivers/net/wireless/rt2x00/Makefile
··· 9 9 rt2x00lib-$(CONFIG_RT2X00_LIB_LEDS) += rt2x00leds.o 10 10 11 11 obj-$(CONFIG_RT2X00_LIB) += rt2x00lib.o 12 + obj-$(CONFIG_RT2X00_LIB_MMIO) += rt2x00mmio.o 12 13 obj-$(CONFIG_RT2X00_LIB_PCI) += rt2x00pci.o 13 14 obj-$(CONFIG_RT2X00_LIB_SOC) += rt2x00soc.o 14 15 obj-$(CONFIG_RT2X00_LIB_USB) += rt2x00usb.o
+1
drivers/net/wireless/rt2x00/rt2400pci.c
··· 34 34 #include <linux/slab.h> 35 35 36 36 #include "rt2x00.h" 37 + #include "rt2x00mmio.h" 37 38 #include "rt2x00pci.h" 38 39 #include "rt2400pci.h" 39 40
+1
drivers/net/wireless/rt2x00/rt2500pci.c
··· 34 34 #include <linux/slab.h> 35 35 36 36 #include "rt2x00.h" 37 + #include "rt2x00mmio.h" 37 38 #include "rt2x00pci.h" 38 39 #include "rt2500pci.h" 39 40
+1
drivers/net/wireless/rt2x00/rt2800pci.c
··· 41 41 #include <linux/eeprom_93cx6.h> 42 42 43 43 #include "rt2x00.h" 44 + #include "rt2x00mmio.h" 44 45 #include "rt2x00pci.h" 45 46 #include "rt2x00soc.h" 46 47 #include "rt2800lib.h"
+216
drivers/net/wireless/rt2x00/rt2x00mmio.c
··· 1 + /* 2 + Copyright (C) 2004 - 2009 Ivo van Doorn <IvDoorn@gmail.com> 3 + <http://rt2x00.serialmonkey.com> 4 + 5 + This program is free software; you can redistribute it and/or modify 6 + it under the terms of the GNU General Public License as published by 7 + the Free Software Foundation; either version 2 of the License, or 8 + (at your option) any later version. 9 + 10 + This program is distributed in the hope that it will be useful, 11 + but WITHOUT ANY WARRANTY; without even the implied warranty of 12 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 + GNU General Public License for more details. 14 + 15 + You should have received a copy of the GNU General Public License 16 + along with this program; if not, write to the 17 + Free Software Foundation, Inc., 18 + 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 19 + */ 20 + 21 + /* 22 + Module: rt2x00mmio 23 + Abstract: rt2x00 generic mmio device routines. 24 + */ 25 + 26 + #include <linux/dma-mapping.h> 27 + #include <linux/kernel.h> 28 + #include <linux/module.h> 29 + #include <linux/slab.h> 30 + 31 + #include "rt2x00.h" 32 + #include "rt2x00mmio.h" 33 + 34 + /* 35 + * Register access. 36 + */ 37 + int rt2x00pci_regbusy_read(struct rt2x00_dev *rt2x00dev, 38 + const unsigned int offset, 39 + const struct rt2x00_field32 field, 40 + u32 *reg) 41 + { 42 + unsigned int i; 43 + 44 + if (!test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags)) 45 + return 0; 46 + 47 + for (i = 0; i < REGISTER_BUSY_COUNT; i++) { 48 + rt2x00pci_register_read(rt2x00dev, offset, reg); 49 + if (!rt2x00_get_field32(*reg, field)) 50 + return 1; 51 + udelay(REGISTER_BUSY_DELAY); 52 + } 53 + 54 + printk_once(KERN_ERR "%s() Indirect register access failed: " 55 + "offset=0x%.08x, value=0x%.08x\n", __func__, offset, *reg); 56 + *reg = ~0; 57 + 58 + return 0; 59 + } 60 + EXPORT_SYMBOL_GPL(rt2x00pci_regbusy_read); 61 + 62 + bool rt2x00pci_rxdone(struct rt2x00_dev *rt2x00dev) 63 + { 64 + struct data_queue *queue = rt2x00dev->rx; 65 + struct queue_entry *entry; 66 + struct queue_entry_priv_pci *entry_priv; 67 + struct skb_frame_desc *skbdesc; 68 + int max_rx = 16; 69 + 70 + while (--max_rx) { 71 + entry = rt2x00queue_get_entry(queue, Q_INDEX); 72 + entry_priv = entry->priv_data; 73 + 74 + if (rt2x00dev->ops->lib->get_entry_state(entry)) 75 + break; 76 + 77 + /* 78 + * Fill in desc fields of the skb descriptor 79 + */ 80 + skbdesc = get_skb_frame_desc(entry->skb); 81 + skbdesc->desc = entry_priv->desc; 82 + skbdesc->desc_len = entry->queue->desc_size; 83 + 84 + /* 85 + * DMA is already done, notify rt2x00lib that 86 + * it finished successfully. 87 + */ 88 + rt2x00lib_dmastart(entry); 89 + rt2x00lib_dmadone(entry); 90 + 91 + /* 92 + * Send the frame to rt2x00lib for further processing. 93 + */ 94 + rt2x00lib_rxdone(entry, GFP_ATOMIC); 95 + } 96 + 97 + return !max_rx; 98 + } 99 + EXPORT_SYMBOL_GPL(rt2x00pci_rxdone); 100 + 101 + void rt2x00pci_flush_queue(struct data_queue *queue, bool drop) 102 + { 103 + unsigned int i; 104 + 105 + for (i = 0; !rt2x00queue_empty(queue) && i < 10; i++) 106 + msleep(10); 107 + } 108 + EXPORT_SYMBOL_GPL(rt2x00pci_flush_queue); 109 + 110 + /* 111 + * Device initialization handlers. 112 + */ 113 + static int rt2x00pci_alloc_queue_dma(struct rt2x00_dev *rt2x00dev, 114 + struct data_queue *queue) 115 + { 116 + struct queue_entry_priv_pci *entry_priv; 117 + void *addr; 118 + dma_addr_t dma; 119 + unsigned int i; 120 + 121 + /* 122 + * Allocate DMA memory for descriptor and buffer. 123 + */ 124 + addr = dma_alloc_coherent(rt2x00dev->dev, 125 + queue->limit * queue->desc_size, 126 + &dma, GFP_KERNEL); 127 + if (!addr) 128 + return -ENOMEM; 129 + 130 + memset(addr, 0, queue->limit * queue->desc_size); 131 + 132 + /* 133 + * Initialize all queue entries to contain valid addresses. 134 + */ 135 + for (i = 0; i < queue->limit; i++) { 136 + entry_priv = queue->entries[i].priv_data; 137 + entry_priv->desc = addr + i * queue->desc_size; 138 + entry_priv->desc_dma = dma + i * queue->desc_size; 139 + } 140 + 141 + return 0; 142 + } 143 + 144 + static void rt2x00pci_free_queue_dma(struct rt2x00_dev *rt2x00dev, 145 + struct data_queue *queue) 146 + { 147 + struct queue_entry_priv_pci *entry_priv = 148 + queue->entries[0].priv_data; 149 + 150 + if (entry_priv->desc) 151 + dma_free_coherent(rt2x00dev->dev, 152 + queue->limit * queue->desc_size, 153 + entry_priv->desc, entry_priv->desc_dma); 154 + entry_priv->desc = NULL; 155 + } 156 + 157 + int rt2x00pci_initialize(struct rt2x00_dev *rt2x00dev) 158 + { 159 + struct data_queue *queue; 160 + int status; 161 + 162 + /* 163 + * Allocate DMA 164 + */ 165 + queue_for_each(rt2x00dev, queue) { 166 + status = rt2x00pci_alloc_queue_dma(rt2x00dev, queue); 167 + if (status) 168 + goto exit; 169 + } 170 + 171 + /* 172 + * Register interrupt handler. 173 + */ 174 + status = request_irq(rt2x00dev->irq, 175 + rt2x00dev->ops->lib->irq_handler, 176 + IRQF_SHARED, rt2x00dev->name, rt2x00dev); 177 + if (status) { 178 + ERROR(rt2x00dev, "IRQ %d allocation failed (error %d).\n", 179 + rt2x00dev->irq, status); 180 + goto exit; 181 + } 182 + 183 + return 0; 184 + 185 + exit: 186 + queue_for_each(rt2x00dev, queue) 187 + rt2x00pci_free_queue_dma(rt2x00dev, queue); 188 + 189 + return status; 190 + } 191 + EXPORT_SYMBOL_GPL(rt2x00pci_initialize); 192 + 193 + void rt2x00pci_uninitialize(struct rt2x00_dev *rt2x00dev) 194 + { 195 + struct data_queue *queue; 196 + 197 + /* 198 + * Free irq line. 199 + */ 200 + free_irq(rt2x00dev->irq, rt2x00dev); 201 + 202 + /* 203 + * Free DMA 204 + */ 205 + queue_for_each(rt2x00dev, queue) 206 + rt2x00pci_free_queue_dma(rt2x00dev, queue); 207 + } 208 + EXPORT_SYMBOL_GPL(rt2x00pci_uninitialize); 209 + 210 + /* 211 + * rt2x00mmio module information. 212 + */ 213 + MODULE_AUTHOR(DRV_PROJECT); 214 + MODULE_VERSION(DRV_VERSION); 215 + MODULE_DESCRIPTION("rt2x00 mmio library"); 216 + MODULE_LICENSE("GPL");
+119
drivers/net/wireless/rt2x00/rt2x00mmio.h
··· 1 + /* 2 + Copyright (C) 2004 - 2009 Ivo van Doorn <IvDoorn@gmail.com> 3 + <http://rt2x00.serialmonkey.com> 4 + 5 + This program is free software; you can redistribute it and/or modify 6 + it under the terms of the GNU General Public License as published by 7 + the Free Software Foundation; either version 2 of the License, or 8 + (at your option) any later version. 9 + 10 + This program is distributed in the hope that it will be useful, 11 + but WITHOUT ANY WARRANTY; without even the implied warranty of 12 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 + GNU General Public License for more details. 14 + 15 + You should have received a copy of the GNU General Public License 16 + along with this program; if not, write to the 17 + Free Software Foundation, Inc., 18 + 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 19 + */ 20 + 21 + /* 22 + Module: rt2x00mmio 23 + Abstract: Data structures for the rt2x00mmio module. 24 + */ 25 + 26 + #ifndef RT2X00MMIO_H 27 + #define RT2X00MMIO_H 28 + 29 + #include <linux/io.h> 30 + 31 + /* 32 + * Register access. 33 + */ 34 + static inline void rt2x00pci_register_read(struct rt2x00_dev *rt2x00dev, 35 + const unsigned int offset, 36 + u32 *value) 37 + { 38 + *value = readl(rt2x00dev->csr.base + offset); 39 + } 40 + 41 + static inline void rt2x00pci_register_multiread(struct rt2x00_dev *rt2x00dev, 42 + const unsigned int offset, 43 + void *value, const u32 length) 44 + { 45 + memcpy_fromio(value, rt2x00dev->csr.base + offset, length); 46 + } 47 + 48 + static inline void rt2x00pci_register_write(struct rt2x00_dev *rt2x00dev, 49 + const unsigned int offset, 50 + u32 value) 51 + { 52 + writel(value, rt2x00dev->csr.base + offset); 53 + } 54 + 55 + static inline void rt2x00pci_register_multiwrite(struct rt2x00_dev *rt2x00dev, 56 + const unsigned int offset, 57 + const void *value, 58 + const u32 length) 59 + { 60 + __iowrite32_copy(rt2x00dev->csr.base + offset, value, length >> 2); 61 + } 62 + 63 + /** 64 + * rt2x00pci_regbusy_read - Read from register with busy check 65 + * @rt2x00dev: Device pointer, see &struct rt2x00_dev. 66 + * @offset: Register offset 67 + * @field: Field to check if register is busy 68 + * @reg: Pointer to where register contents should be stored 69 + * 70 + * This function will read the given register, and checks if the 71 + * register is busy. If it is, it will sleep for a couple of 72 + * microseconds before reading the register again. If the register 73 + * is not read after a certain timeout, this function will return 74 + * FALSE. 75 + */ 76 + int rt2x00pci_regbusy_read(struct rt2x00_dev *rt2x00dev, 77 + const unsigned int offset, 78 + const struct rt2x00_field32 field, 79 + u32 *reg); 80 + 81 + /** 82 + * struct queue_entry_priv_pci: Per entry PCI specific information 83 + * 84 + * @desc: Pointer to device descriptor 85 + * @desc_dma: DMA pointer to &desc. 86 + * @data: Pointer to device's entry memory. 87 + * @data_dma: DMA pointer to &data. 88 + */ 89 + struct queue_entry_priv_pci { 90 + __le32 *desc; 91 + dma_addr_t desc_dma; 92 + }; 93 + 94 + /** 95 + * rt2x00pci_rxdone - Handle RX done events 96 + * @rt2x00dev: Device pointer, see &struct rt2x00_dev. 97 + * 98 + * Returns true if there are still rx frames pending and false if all 99 + * pending rx frames were processed. 100 + */ 101 + bool rt2x00pci_rxdone(struct rt2x00_dev *rt2x00dev); 102 + 103 + /** 104 + * rt2x00pci_flush_queue - Flush data queue 105 + * @queue: Data queue to stop 106 + * @drop: True to drop all pending frames. 107 + * 108 + * This will wait for a maximum of 100ms, waiting for the queues 109 + * to become empty. 110 + */ 111 + void rt2x00pci_flush_queue(struct data_queue *queue, bool drop); 112 + 113 + /* 114 + * Device initialization handlers. 115 + */ 116 + int rt2x00pci_initialize(struct rt2x00_dev *rt2x00dev); 117 + void rt2x00pci_uninitialize(struct rt2x00_dev *rt2x00dev); 118 + 119 + #endif /* RT2X00MMIO_H */
-176
drivers/net/wireless/rt2x00/rt2x00pci.c
··· 33 33 #include "rt2x00pci.h" 34 34 35 35 /* 36 - * Register access. 37 - */ 38 - int rt2x00pci_regbusy_read(struct rt2x00_dev *rt2x00dev, 39 - const unsigned int offset, 40 - const struct rt2x00_field32 field, 41 - u32 *reg) 42 - { 43 - unsigned int i; 44 - 45 - if (!test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags)) 46 - return 0; 47 - 48 - for (i = 0; i < REGISTER_BUSY_COUNT; i++) { 49 - rt2x00pci_register_read(rt2x00dev, offset, reg); 50 - if (!rt2x00_get_field32(*reg, field)) 51 - return 1; 52 - udelay(REGISTER_BUSY_DELAY); 53 - } 54 - 55 - ERROR(rt2x00dev, "Indirect register access failed: " 56 - "offset=0x%.08x, value=0x%.08x\n", offset, *reg); 57 - *reg = ~0; 58 - 59 - return 0; 60 - } 61 - EXPORT_SYMBOL_GPL(rt2x00pci_regbusy_read); 62 - 63 - bool rt2x00pci_rxdone(struct rt2x00_dev *rt2x00dev) 64 - { 65 - struct data_queue *queue = rt2x00dev->rx; 66 - struct queue_entry *entry; 67 - struct queue_entry_priv_pci *entry_priv; 68 - struct skb_frame_desc *skbdesc; 69 - int max_rx = 16; 70 - 71 - while (--max_rx) { 72 - entry = rt2x00queue_get_entry(queue, Q_INDEX); 73 - entry_priv = entry->priv_data; 74 - 75 - if (rt2x00dev->ops->lib->get_entry_state(entry)) 76 - break; 77 - 78 - /* 79 - * Fill in desc fields of the skb descriptor 80 - */ 81 - skbdesc = get_skb_frame_desc(entry->skb); 82 - skbdesc->desc = entry_priv->desc; 83 - skbdesc->desc_len = entry->queue->desc_size; 84 - 85 - /* 86 - * DMA is already done, notify rt2x00lib that 87 - * it finished successfully. 88 - */ 89 - rt2x00lib_dmastart(entry); 90 - rt2x00lib_dmadone(entry); 91 - 92 - /* 93 - * Send the frame to rt2x00lib for further processing. 94 - */ 95 - rt2x00lib_rxdone(entry, GFP_ATOMIC); 96 - } 97 - 98 - return !max_rx; 99 - } 100 - EXPORT_SYMBOL_GPL(rt2x00pci_rxdone); 101 - 102 - void rt2x00pci_flush_queue(struct data_queue *queue, bool drop) 103 - { 104 - unsigned int i; 105 - 106 - for (i = 0; !rt2x00queue_empty(queue) && i < 10; i++) 107 - msleep(10); 108 - } 109 - EXPORT_SYMBOL_GPL(rt2x00pci_flush_queue); 110 - 111 - /* 112 - * Device initialization handlers. 113 - */ 114 - static int rt2x00pci_alloc_queue_dma(struct rt2x00_dev *rt2x00dev, 115 - struct data_queue *queue) 116 - { 117 - struct queue_entry_priv_pci *entry_priv; 118 - void *addr; 119 - dma_addr_t dma; 120 - unsigned int i; 121 - 122 - /* 123 - * Allocate DMA memory for descriptor and buffer. 124 - */ 125 - addr = dma_alloc_coherent(rt2x00dev->dev, 126 - queue->limit * queue->desc_size, 127 - &dma, GFP_KERNEL); 128 - if (!addr) 129 - return -ENOMEM; 130 - 131 - memset(addr, 0, queue->limit * queue->desc_size); 132 - 133 - /* 134 - * Initialize all queue entries to contain valid addresses. 135 - */ 136 - for (i = 0; i < queue->limit; i++) { 137 - entry_priv = queue->entries[i].priv_data; 138 - entry_priv->desc = addr + i * queue->desc_size; 139 - entry_priv->desc_dma = dma + i * queue->desc_size; 140 - } 141 - 142 - return 0; 143 - } 144 - 145 - static void rt2x00pci_free_queue_dma(struct rt2x00_dev *rt2x00dev, 146 - struct data_queue *queue) 147 - { 148 - struct queue_entry_priv_pci *entry_priv = 149 - queue->entries[0].priv_data; 150 - 151 - if (entry_priv->desc) 152 - dma_free_coherent(rt2x00dev->dev, 153 - queue->limit * queue->desc_size, 154 - entry_priv->desc, entry_priv->desc_dma); 155 - entry_priv->desc = NULL; 156 - } 157 - 158 - int rt2x00pci_initialize(struct rt2x00_dev *rt2x00dev) 159 - { 160 - struct data_queue *queue; 161 - int status; 162 - 163 - /* 164 - * Allocate DMA 165 - */ 166 - queue_for_each(rt2x00dev, queue) { 167 - status = rt2x00pci_alloc_queue_dma(rt2x00dev, queue); 168 - if (status) 169 - goto exit; 170 - } 171 - 172 - /* 173 - * Register interrupt handler. 174 - */ 175 - status = request_irq(rt2x00dev->irq, 176 - rt2x00dev->ops->lib->irq_handler, 177 - IRQF_SHARED, rt2x00dev->name, rt2x00dev); 178 - if (status) { 179 - ERROR(rt2x00dev, "IRQ %d allocation failed (error %d).\n", 180 - rt2x00dev->irq, status); 181 - goto exit; 182 - } 183 - 184 - return 0; 185 - 186 - exit: 187 - queue_for_each(rt2x00dev, queue) 188 - rt2x00pci_free_queue_dma(rt2x00dev, queue); 189 - 190 - return status; 191 - } 192 - EXPORT_SYMBOL_GPL(rt2x00pci_initialize); 193 - 194 - void rt2x00pci_uninitialize(struct rt2x00_dev *rt2x00dev) 195 - { 196 - struct data_queue *queue; 197 - 198 - /* 199 - * Free irq line. 200 - */ 201 - free_irq(rt2x00dev->irq, rt2x00dev); 202 - 203 - /* 204 - * Free DMA 205 - */ 206 - queue_for_each(rt2x00dev, queue) 207 - rt2x00pci_free_queue_dma(rt2x00dev, queue); 208 - } 209 - EXPORT_SYMBOL_GPL(rt2x00pci_uninitialize); 210 - 211 - /* 212 36 * PCI driver handlers. 213 37 */ 214 38 static void rt2x00pci_free_reg(struct rt2x00_dev *rt2x00dev)
-88
drivers/net/wireless/rt2x00/rt2x00pci.h
··· 36 36 #define PCI_DEVICE_DATA(__ops) .driver_data = (kernel_ulong_t)(__ops) 37 37 38 38 /* 39 - * Register access. 40 - */ 41 - static inline void rt2x00pci_register_read(struct rt2x00_dev *rt2x00dev, 42 - const unsigned int offset, 43 - u32 *value) 44 - { 45 - *value = readl(rt2x00dev->csr.base + offset); 46 - } 47 - 48 - static inline void rt2x00pci_register_multiread(struct rt2x00_dev *rt2x00dev, 49 - const unsigned int offset, 50 - void *value, const u32 length) 51 - { 52 - memcpy_fromio(value, rt2x00dev->csr.base + offset, length); 53 - } 54 - 55 - static inline void rt2x00pci_register_write(struct rt2x00_dev *rt2x00dev, 56 - const unsigned int offset, 57 - u32 value) 58 - { 59 - writel(value, rt2x00dev->csr.base + offset); 60 - } 61 - 62 - static inline void rt2x00pci_register_multiwrite(struct rt2x00_dev *rt2x00dev, 63 - const unsigned int offset, 64 - const void *value, 65 - const u32 length) 66 - { 67 - __iowrite32_copy(rt2x00dev->csr.base + offset, value, length >> 2); 68 - } 69 - 70 - /** 71 - * rt2x00pci_regbusy_read - Read from register with busy check 72 - * @rt2x00dev: Device pointer, see &struct rt2x00_dev. 73 - * @offset: Register offset 74 - * @field: Field to check if register is busy 75 - * @reg: Pointer to where register contents should be stored 76 - * 77 - * This function will read the given register, and checks if the 78 - * register is busy. If it is, it will sleep for a couple of 79 - * microseconds before reading the register again. If the register 80 - * is not read after a certain timeout, this function will return 81 - * FALSE. 82 - */ 83 - int rt2x00pci_regbusy_read(struct rt2x00_dev *rt2x00dev, 84 - const unsigned int offset, 85 - const struct rt2x00_field32 field, 86 - u32 *reg); 87 - 88 - /** 89 - * struct queue_entry_priv_pci: Per entry PCI specific information 90 - * 91 - * @desc: Pointer to device descriptor 92 - * @desc_dma: DMA pointer to &desc. 93 - * @data: Pointer to device's entry memory. 94 - * @data_dma: DMA pointer to &data. 95 - */ 96 - struct queue_entry_priv_pci { 97 - __le32 *desc; 98 - dma_addr_t desc_dma; 99 - }; 100 - 101 - /** 102 - * rt2x00pci_rxdone - Handle RX done events 103 - * @rt2x00dev: Device pointer, see &struct rt2x00_dev. 104 - * 105 - * Returns true if there are still rx frames pending and false if all 106 - * pending rx frames were processed. 107 - */ 108 - bool rt2x00pci_rxdone(struct rt2x00_dev *rt2x00dev); 109 - 110 - /** 111 - * rt2x00pci_flush_queue - Flush data queue 112 - * @queue: Data queue to stop 113 - * @drop: True to drop all pending frames. 114 - * 115 - * This will wait for a maximum of 100ms, waiting for the queues 116 - * to become empty. 117 - */ 118 - void rt2x00pci_flush_queue(struct data_queue *queue, bool drop); 119 - 120 - /* 121 - * Device initialization handlers. 122 - */ 123 - int rt2x00pci_initialize(struct rt2x00_dev *rt2x00dev); 124 - void rt2x00pci_uninitialize(struct rt2x00_dev *rt2x00dev); 125 - 126 - /* 127 39 * PCI driver handlers. 128 40 */ 129 41 int rt2x00pci_probe(struct pci_dev *pci_dev, const struct rt2x00_ops *ops);
+1
drivers/net/wireless/rt2x00/rt61pci.c
··· 35 35 #include <linux/eeprom_93cx6.h> 36 36 37 37 #include "rt2x00.h" 38 + #include "rt2x00mmio.h" 38 39 #include "rt2x00pci.h" 39 40 #include "rt61pci.h" 40 41
+2
net/wireless/sme.c
··· 224 224 rtnl_lock(); 225 225 cfg80211_lock_rdev(rdev); 226 226 mutex_lock(&rdev->devlist_mtx); 227 + mutex_lock(&rdev->sched_scan_mtx); 227 228 228 229 list_for_each_entry(wdev, &rdev->wdev_list, list) { 229 230 wdev_lock(wdev); ··· 249 248 wdev_unlock(wdev); 250 249 } 251 250 251 + mutex_unlock(&rdev->sched_scan_mtx); 252 252 mutex_unlock(&rdev->devlist_mtx); 253 253 cfg80211_unlock_rdev(rdev); 254 254 rtnl_unlock();