| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /*============================================================================= |
|---|
| 2 | 3 | * |
|---|
| 3 | 4 | * A PCMCIA client driver for the Raylink wireless LAN card. |
|---|
| 4 | 5 | * The starting point for this module was the skeleton.c in the |
|---|
| 5 | 6 | * PCMCIA 2.9.12 package written by David Hinds, dahinds@users.sourceforge.net |
|---|
| 6 | 7 | * |
|---|
| 7 | | - * |
|---|
| 8 | 8 | * Copyright (c) 1998 Corey Thomas (corey@world.std.com) |
|---|
| 9 | | - * |
|---|
| 10 | | - * This driver is free software; you can redistribute it and/or modify |
|---|
| 11 | | - * it under the terms of version 2 only of the GNU General Public License as |
|---|
| 12 | | - * published by the Free Software Foundation. |
|---|
| 13 | | - * |
|---|
| 14 | | - * It is distributed in the hope that it will be useful, |
|---|
| 15 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 16 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 17 | | - * GNU General Public License for more details. |
|---|
| 18 | | - * |
|---|
| 19 | | - * You should have received a copy of the GNU General Public License |
|---|
| 20 | | - * along with this program; if not, see <http://www.gnu.org/licenses/>. |
|---|
| 21 | 9 | * |
|---|
| 22 | 10 | * Changes: |
|---|
| 23 | 11 | * Arnaldo Carvalho de Melo <acme@conectiva.com.br> - 08/08/2000 |
|---|
| .. | .. |
|---|
| 394 | 382 | goto failed; |
|---|
| 395 | 383 | local->sram = ioremap(link->resource[2]->start, |
|---|
| 396 | 384 | resource_size(link->resource[2])); |
|---|
| 385 | + if (!local->sram) |
|---|
| 386 | + goto failed; |
|---|
| 397 | 387 | |
|---|
| 398 | 388 | /*** Set up 16k window for shared memory (receive buffer) ***************/ |
|---|
| 399 | 389 | link->resource[3]->flags |= |
|---|
| .. | .. |
|---|
| 408 | 398 | goto failed; |
|---|
| 409 | 399 | local->rmem = ioremap(link->resource[3]->start, |
|---|
| 410 | 400 | resource_size(link->resource[3])); |
|---|
| 401 | + if (!local->rmem) |
|---|
| 402 | + goto failed; |
|---|
| 411 | 403 | |
|---|
| 412 | 404 | /*** Set up window for attribute memory ***********************************/ |
|---|
| 413 | 405 | link->resource[4]->flags |= |
|---|
| .. | .. |
|---|
| 422 | 414 | goto failed; |
|---|
| 423 | 415 | local->amem = ioremap(link->resource[4]->start, |
|---|
| 424 | 416 | resource_size(link->resource[4])); |
|---|
| 417 | + if (!local->amem) |
|---|
| 418 | + goto failed; |
|---|
| 425 | 419 | |
|---|
| 426 | 420 | dev_dbg(&link->dev, "ray_config sram=%p\n", local->sram); |
|---|
| 427 | 421 | dev_dbg(&link->dev, "ray_config rmem=%p\n", local->rmem); |
|---|
| .. | .. |
|---|
| 889 | 883 | switch (ccsindex = get_free_tx_ccs(local)) { |
|---|
| 890 | 884 | case ECCSBUSY: |
|---|
| 891 | 885 | pr_debug("ray_hw_xmit tx_ccs table busy\n"); |
|---|
| 886 | + /* fall through */ |
|---|
| 892 | 887 | case ECCSFULL: |
|---|
| 893 | 888 | pr_debug("ray_hw_xmit No free tx ccs\n"); |
|---|
| 889 | + /* fall through */ |
|---|
| 894 | 890 | case ECARDGONE: |
|---|
| 895 | 891 | netif_stop_queue(dev); |
|---|
| 896 | 892 | return XMIT_NO_CCS; |
|---|
| .. | .. |
|---|
| 957 | 953 | if (proto == htons(ETH_P_AARP) || proto == htons(ETH_P_IPX)) { |
|---|
| 958 | 954 | /* This is the selective translation table, only 2 entries */ |
|---|
| 959 | 955 | writeb(0xf8, |
|---|
| 960 | | - &((struct snaphdr_t __iomem *)ptx->var)->org[3]); |
|---|
| 956 | + &((struct snaphdr_t __iomem *)ptx->var)->org[2]); |
|---|
| 961 | 957 | } |
|---|
| 962 | 958 | /* Copy body of ethernet packet without ethernet header */ |
|---|
| 963 | 959 | memcpy_toio((void __iomem *)&ptx->var + |
|---|
| .. | .. |
|---|
| 2209 | 2205 | untranslate(local, skb, total_len); |
|---|
| 2210 | 2206 | } |
|---|
| 2211 | 2207 | } else { /* sniffer mode, so just pass whole packet */ |
|---|
| 2212 | | - }; |
|---|
| 2208 | + } |
|---|
| 2213 | 2209 | |
|---|
| 2214 | 2210 | /************************/ |
|---|
| 2215 | 2211 | /* Now pick up the rest of the fragments if any */ |
|---|
| .. | .. |
|---|
| 2727 | 2723 | return count; |
|---|
| 2728 | 2724 | } |
|---|
| 2729 | 2725 | |
|---|
| 2730 | | -static const struct file_operations ray_cs_essid_proc_fops = { |
|---|
| 2731 | | - .owner = THIS_MODULE, |
|---|
| 2732 | | - .write = ray_cs_essid_proc_write, |
|---|
| 2733 | | - .llseek = noop_llseek, |
|---|
| 2726 | +static const struct proc_ops ray_cs_essid_proc_ops = { |
|---|
| 2727 | + .proc_write = ray_cs_essid_proc_write, |
|---|
| 2728 | + .proc_lseek = noop_llseek, |
|---|
| 2734 | 2729 | }; |
|---|
| 2735 | 2730 | |
|---|
| 2736 | 2731 | static ssize_t int_proc_write(struct file *file, const char __user *buffer, |
|---|
| .. | .. |
|---|
| 2761 | 2756 | return count; |
|---|
| 2762 | 2757 | } |
|---|
| 2763 | 2758 | |
|---|
| 2764 | | -static const struct file_operations int_proc_fops = { |
|---|
| 2765 | | - .owner = THIS_MODULE, |
|---|
| 2766 | | - .write = int_proc_write, |
|---|
| 2767 | | - .llseek = noop_llseek, |
|---|
| 2759 | +static const struct proc_ops int_proc_ops = { |
|---|
| 2760 | + .proc_write = int_proc_write, |
|---|
| 2761 | + .proc_lseek = noop_llseek, |
|---|
| 2768 | 2762 | }; |
|---|
| 2769 | 2763 | #endif |
|---|
| 2770 | 2764 | |
|---|
| .. | .. |
|---|
| 2793 | 2787 | rc = pcmcia_register_driver(&ray_driver); |
|---|
| 2794 | 2788 | pr_debug("raylink init_module register_pcmcia_driver returns 0x%x\n", |
|---|
| 2795 | 2789 | rc); |
|---|
| 2790 | + if (rc) |
|---|
| 2791 | + return rc; |
|---|
| 2796 | 2792 | |
|---|
| 2797 | 2793 | #ifdef CONFIG_PROC_FS |
|---|
| 2798 | 2794 | proc_mkdir("driver/ray_cs", NULL); |
|---|
| 2799 | 2795 | |
|---|
| 2800 | 2796 | proc_create_single("driver/ray_cs/ray_cs", 0, NULL, ray_cs_proc_show); |
|---|
| 2801 | | - proc_create("driver/ray_cs/essid", 0200, NULL, &ray_cs_essid_proc_fops); |
|---|
| 2802 | | - proc_create_data("driver/ray_cs/net_type", 0200, NULL, &int_proc_fops, |
|---|
| 2797 | + proc_create("driver/ray_cs/essid", 0200, NULL, &ray_cs_essid_proc_ops); |
|---|
| 2798 | + proc_create_data("driver/ray_cs/net_type", 0200, NULL, &int_proc_ops, |
|---|
| 2803 | 2799 | &net_type); |
|---|
| 2804 | | - proc_create_data("driver/ray_cs/translate", 0200, NULL, &int_proc_fops, |
|---|
| 2800 | + proc_create_data("driver/ray_cs/translate", 0200, NULL, &int_proc_ops, |
|---|
| 2805 | 2801 | &translate); |
|---|
| 2806 | 2802 | #endif |
|---|
| 2807 | | - if (translate != 0) |
|---|
| 2808 | | - translate = 1; |
|---|
| 2803 | + translate = !!translate; |
|---|
| 2809 | 2804 | return 0; |
|---|
| 2810 | 2805 | } /* init_ray_cs */ |
|---|
| 2811 | 2806 | |
|---|
| .. | .. |
|---|
| 2816 | 2811 | pr_debug("ray_cs: cleanup_module\n"); |
|---|
| 2817 | 2812 | |
|---|
| 2818 | 2813 | #ifdef CONFIG_PROC_FS |
|---|
| 2819 | | - remove_proc_entry("driver/ray_cs/ray_cs", NULL); |
|---|
| 2820 | | - remove_proc_entry("driver/ray_cs/essid", NULL); |
|---|
| 2821 | | - remove_proc_entry("driver/ray_cs/net_type", NULL); |
|---|
| 2822 | | - remove_proc_entry("driver/ray_cs/translate", NULL); |
|---|
| 2823 | | - remove_proc_entry("driver/ray_cs", NULL); |
|---|
| 2814 | + remove_proc_subtree("driver/ray_cs", NULL); |
|---|
| 2824 | 2815 | #endif |
|---|
| 2825 | 2816 | |
|---|
| 2826 | 2817 | pcmcia_unregister_driver(&ray_driver); |
|---|