| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * WL3501 Wireless LAN PCMCIA Card Driver for Linux |
|---|
| 3 | 4 | * Written originally for Linux 2.0.30 by Fox Chen, mhchen@golf.ccl.itri.org.tw |
|---|
| .. | .. |
|---|
| 133 | 134 | |
|---|
| 134 | 135 | /** |
|---|
| 135 | 136 | * iw_valid_channel - validate channel in regulatory domain |
|---|
| 136 | | - * @reg_comain - regulatory domain |
|---|
| 137 | | - * @channel - channel to validate |
|---|
| 137 | + * @reg_domain: regulatory domain |
|---|
| 138 | + * @channel: channel to validate |
|---|
| 138 | 139 | * |
|---|
| 139 | 140 | * Returns 0 if invalid in the specified regulatory domain, non-zero if valid. |
|---|
| 140 | 141 | */ |
|---|
| .. | .. |
|---|
| 153 | 154 | |
|---|
| 154 | 155 | /** |
|---|
| 155 | 156 | * iw_default_channel - get default channel for a regulatory domain |
|---|
| 156 | | - * @reg_comain - regulatory domain |
|---|
| 157 | + * @reg_domain: regulatory domain |
|---|
| 157 | 158 | * |
|---|
| 158 | 159 | * Returns the default channel for a regulatory domain |
|---|
| 159 | 160 | */ |
|---|
| .. | .. |
|---|
| 236 | 237 | |
|---|
| 237 | 238 | /** |
|---|
| 238 | 239 | * wl3501_set_to_wla - Move 'size' bytes from PC to card |
|---|
| 240 | + * @this: Card |
|---|
| 239 | 241 | * @dest: Card addressing space |
|---|
| 240 | 242 | * @src: PC addressing space |
|---|
| 241 | 243 | * @size: Bytes to move |
|---|
| .. | .. |
|---|
| 258 | 260 | |
|---|
| 259 | 261 | /** |
|---|
| 260 | 262 | * wl3501_get_from_wla - Move 'size' bytes from card to PC |
|---|
| 263 | + * @this: Card |
|---|
| 261 | 264 | * @src: Card addressing space |
|---|
| 262 | 265 | * @dest: PC addressing space |
|---|
| 263 | 266 | * @size: Bytes to move |
|---|
| .. | .. |
|---|
| 454 | 457 | |
|---|
| 455 | 458 | /** |
|---|
| 456 | 459 | * wl3501_send_pkt - Send a packet. |
|---|
| 457 | | - * @this - card |
|---|
| 458 | | - * |
|---|
| 459 | | - * Send a packet. |
|---|
| 460 | | - * |
|---|
| 461 | | - * data = Ethernet raw frame. (e.g. data[0] - data[5] is Dest MAC Addr, |
|---|
| 460 | + * @this: Card |
|---|
| 461 | + * @data: Ethernet raw frame. (e.g. data[0] - data[5] is Dest MAC Addr, |
|---|
| 462 | 462 | * data[6] - data[11] is Src MAC Addr) |
|---|
| 463 | + * @len: Packet length |
|---|
| 463 | 464 | * Ref: IEEE 802.11 |
|---|
| 464 | 465 | */ |
|---|
| 465 | 466 | static int wl3501_send_pkt(struct wl3501_card *this, u8 *data, u16 len) |
|---|
| .. | .. |
|---|
| 722 | 723 | |
|---|
| 723 | 724 | /** |
|---|
| 724 | 725 | * wl3501_block_interrupt - Mask interrupt from SUTRO |
|---|
| 725 | | - * @this - card |
|---|
| 726 | + * @this: Card |
|---|
| 726 | 727 | * |
|---|
| 727 | 728 | * Mask interrupt from SUTRO. (i.e. SUTRO cannot interrupt the HOST) |
|---|
| 728 | 729 | * Return: 1 if interrupt is originally enabled |
|---|
| .. | .. |
|---|
| 739 | 740 | |
|---|
| 740 | 741 | /** |
|---|
| 741 | 742 | * wl3501_unblock_interrupt - Enable interrupt from SUTRO |
|---|
| 742 | | - * @this - card |
|---|
| 743 | + * @this: Card |
|---|
| 743 | 744 | * |
|---|
| 744 | 745 | * Enable interrupt from SUTRO. (i.e. SUTRO can interrupt the HOST) |
|---|
| 745 | 746 | * Return: 1 if interrupt is originally enabled |
|---|
| .. | .. |
|---|
| 1113 | 1114 | |
|---|
| 1114 | 1115 | /** |
|---|
| 1115 | 1116 | * wl3501_interrupt - Hardware interrupt from card. |
|---|
| 1116 | | - * @irq - Interrupt number |
|---|
| 1117 | | - * @dev_id - net_device |
|---|
| 1117 | + * @irq: Interrupt number |
|---|
| 1118 | + * @dev_id: net_device |
|---|
| 1118 | 1119 | * |
|---|
| 1119 | 1120 | * We must acknowledge the interrupt as soon as possible, and block the |
|---|
| 1120 | 1121 | * interrupt from the same card immediately to prevent re-entry. |
|---|
| .. | .. |
|---|
| 1229 | 1230 | static int wl3501_close(struct net_device *dev) |
|---|
| 1230 | 1231 | { |
|---|
| 1231 | 1232 | struct wl3501_card *this = netdev_priv(dev); |
|---|
| 1232 | | - int rc = -ENODEV; |
|---|
| 1233 | 1233 | unsigned long flags; |
|---|
| 1234 | 1234 | struct pcmcia_device *link; |
|---|
| 1235 | 1235 | link = this->p_dev; |
|---|
| .. | .. |
|---|
| 1244 | 1244 | /* Mask interrupts from the SUTRO */ |
|---|
| 1245 | 1245 | wl3501_block_interrupt(this); |
|---|
| 1246 | 1246 | |
|---|
| 1247 | | - rc = 0; |
|---|
| 1248 | 1247 | printk(KERN_INFO "%s: WL3501 closed\n", dev->name); |
|---|
| 1249 | 1248 | spin_unlock_irqrestore(&this->lock, flags); |
|---|
| 1250 | | - return rc; |
|---|
| 1249 | + return 0; |
|---|
| 1251 | 1250 | } |
|---|
| 1252 | 1251 | |
|---|
| 1253 | 1252 | /** |
|---|
| 1254 | 1253 | * wl3501_reset - Reset the SUTRO. |
|---|
| 1255 | | - * @dev - network device |
|---|
| 1254 | + * @dev: network device |
|---|
| 1256 | 1255 | * |
|---|
| 1257 | 1256 | * It is almost the same as wl3501_open(). In fact, we may just wl3501_close() |
|---|
| 1258 | 1257 | * and wl3501_open() again, but I wouldn't like to free_irq() when the driver |
|---|
| .. | .. |
|---|
| 1290 | 1289 | return rc; |
|---|
| 1291 | 1290 | } |
|---|
| 1292 | 1291 | |
|---|
| 1293 | | -static void wl3501_tx_timeout(struct net_device *dev) |
|---|
| 1292 | +static void wl3501_tx_timeout(struct net_device *dev, unsigned int txqueue) |
|---|
| 1294 | 1293 | { |
|---|
| 1295 | 1294 | struct net_device_stats *stats = &dev->stats; |
|---|
| 1296 | 1295 | int rc; |
|---|
| .. | .. |
|---|
| 1329 | 1328 | } else { |
|---|
| 1330 | 1329 | ++dev->stats.tx_packets; |
|---|
| 1331 | 1330 | dev->stats.tx_bytes += skb->len; |
|---|
| 1332 | | - kfree_skb(skb); |
|---|
| 1331 | + dev_kfree_skb_irq(skb); |
|---|
| 1333 | 1332 | |
|---|
| 1334 | 1333 | if (this->tx_buffer_cnt < 2) |
|---|
| 1335 | 1334 | netif_stop_queue(dev); |
|---|
| .. | .. |
|---|
| 1415 | 1414 | |
|---|
| 1416 | 1415 | /** |
|---|
| 1417 | 1416 | * wl3501_detach - deletes a driver "instance" |
|---|
| 1418 | | - * @link - FILL_IN |
|---|
| 1417 | + * @link: FILL_IN |
|---|
| 1419 | 1418 | * |
|---|
| 1420 | 1419 | * This deletes a driver "instance". The device is de-registered with Card |
|---|
| 1421 | 1420 | * Services. If it has been released, all local data structures are freed. |
|---|
| .. | .. |
|---|
| 1436 | 1435 | wl3501_release(link); |
|---|
| 1437 | 1436 | |
|---|
| 1438 | 1437 | unregister_netdev(dev); |
|---|
| 1439 | | - |
|---|
| 1440 | | - if (link->priv) |
|---|
| 1441 | | - free_netdev(link->priv); |
|---|
| 1438 | + free_netdev(dev); |
|---|
| 1442 | 1439 | } |
|---|
| 1443 | 1440 | |
|---|
| 1444 | 1441 | static int wl3501_get_name(struct net_device *dev, struct iw_request_info *info, |
|---|
| .. | .. |
|---|
| 1865 | 1862 | { |
|---|
| 1866 | 1863 | struct net_device *dev; |
|---|
| 1867 | 1864 | struct wl3501_card *this; |
|---|
| 1865 | + int ret; |
|---|
| 1868 | 1866 | |
|---|
| 1869 | 1867 | /* The io structure describes IO port mapping */ |
|---|
| 1870 | 1868 | p_dev->resource[0]->end = 16; |
|---|
| .. | .. |
|---|
| 1876 | 1874 | |
|---|
| 1877 | 1875 | dev = alloc_etherdev(sizeof(struct wl3501_card)); |
|---|
| 1878 | 1876 | if (!dev) |
|---|
| 1879 | | - goto out_link; |
|---|
| 1880 | | - |
|---|
| 1877 | + return -ENOMEM; |
|---|
| 1881 | 1878 | |
|---|
| 1882 | 1879 | dev->netdev_ops = &wl3501_netdev_ops; |
|---|
| 1883 | 1880 | dev->watchdog_timeo = 5 * HZ; |
|---|
| .. | .. |
|---|
| 1890 | 1887 | netif_stop_queue(dev); |
|---|
| 1891 | 1888 | p_dev->priv = dev; |
|---|
| 1892 | 1889 | |
|---|
| 1893 | | - return wl3501_config(p_dev); |
|---|
| 1894 | | -out_link: |
|---|
| 1895 | | - return -ENOMEM; |
|---|
| 1890 | + ret = wl3501_config(p_dev); |
|---|
| 1891 | + if (ret) |
|---|
| 1892 | + goto out_free_etherdev; |
|---|
| 1893 | + |
|---|
| 1894 | + return 0; |
|---|
| 1895 | + |
|---|
| 1896 | +out_free_etherdev: |
|---|
| 1897 | + free_netdev(dev); |
|---|
| 1898 | + return ret; |
|---|
| 1896 | 1899 | } |
|---|
| 1897 | 1900 | |
|---|
| 1898 | 1901 | static int wl3501_config(struct pcmcia_device *link) |
|---|
| .. | .. |
|---|
| 1948 | 1951 | goto failed; |
|---|
| 1949 | 1952 | } |
|---|
| 1950 | 1953 | |
|---|
| 1951 | | - for (i = 0; i < 6; i++) |
|---|
| 1952 | | - dev->dev_addr[i] = ((char *)&this->mac_addr)[i]; |
|---|
| 1954 | + eth_hw_addr_set(dev, this->mac_addr); |
|---|
| 1953 | 1955 | |
|---|
| 1954 | 1956 | /* print probe information */ |
|---|
| 1955 | 1957 | printk(KERN_INFO "%s: wl3501 @ 0x%3.3x, IRQ %d, " |
|---|