forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-11 072de836f53be56a70cecf70b43ae43b7ce17376
kernel/drivers/net/wireless/ray_cs.c
....@@ -1,23 +1,11 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*=============================================================================
23 *
34 * A PCMCIA client driver for the Raylink wireless LAN card.
45 * The starting point for this module was the skeleton.c in the
56 * PCMCIA 2.9.12 package written by David Hinds, dahinds@users.sourceforge.net
67 *
7
- *
88 * 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/>.
219 *
2210 * Changes:
2311 * Arnaldo Carvalho de Melo <acme@conectiva.com.br> - 08/08/2000
....@@ -394,6 +382,8 @@
394382 goto failed;
395383 local->sram = ioremap(link->resource[2]->start,
396384 resource_size(link->resource[2]));
385
+ if (!local->sram)
386
+ goto failed;
397387
398388 /*** Set up 16k window for shared memory (receive buffer) ***************/
399389 link->resource[3]->flags |=
....@@ -408,6 +398,8 @@
408398 goto failed;
409399 local->rmem = ioremap(link->resource[3]->start,
410400 resource_size(link->resource[3]));
401
+ if (!local->rmem)
402
+ goto failed;
411403
412404 /*** Set up window for attribute memory ***********************************/
413405 link->resource[4]->flags |=
....@@ -422,6 +414,8 @@
422414 goto failed;
423415 local->amem = ioremap(link->resource[4]->start,
424416 resource_size(link->resource[4]));
417
+ if (!local->amem)
418
+ goto failed;
425419
426420 dev_dbg(&link->dev, "ray_config sram=%p\n", local->sram);
427421 dev_dbg(&link->dev, "ray_config rmem=%p\n", local->rmem);
....@@ -889,8 +883,10 @@
889883 switch (ccsindex = get_free_tx_ccs(local)) {
890884 case ECCSBUSY:
891885 pr_debug("ray_hw_xmit tx_ccs table busy\n");
886
+ /* fall through */
892887 case ECCSFULL:
893888 pr_debug("ray_hw_xmit No free tx ccs\n");
889
+ /* fall through */
894890 case ECARDGONE:
895891 netif_stop_queue(dev);
896892 return XMIT_NO_CCS;
....@@ -957,7 +953,7 @@
957953 if (proto == htons(ETH_P_AARP) || proto == htons(ETH_P_IPX)) {
958954 /* This is the selective translation table, only 2 entries */
959955 writeb(0xf8,
960
- &((struct snaphdr_t __iomem *)ptx->var)->org[3]);
956
+ &((struct snaphdr_t __iomem *)ptx->var)->org[2]);
961957 }
962958 /* Copy body of ethernet packet without ethernet header */
963959 memcpy_toio((void __iomem *)&ptx->var +
....@@ -2209,7 +2205,7 @@
22092205 untranslate(local, skb, total_len);
22102206 }
22112207 } else { /* sniffer mode, so just pass whole packet */
2212
- };
2208
+ }
22132209
22142210 /************************/
22152211 /* Now pick up the rest of the fragments if any */
....@@ -2727,10 +2723,9 @@
27272723 return count;
27282724 }
27292725
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,
27342729 };
27352730
27362731 static ssize_t int_proc_write(struct file *file, const char __user *buffer,
....@@ -2761,10 +2756,9 @@
27612756 return count;
27622757 }
27632758
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,
27682762 };
27692763 #endif
27702764
....@@ -2793,19 +2787,20 @@
27932787 rc = pcmcia_register_driver(&ray_driver);
27942788 pr_debug("raylink init_module register_pcmcia_driver returns 0x%x\n",
27952789 rc);
2790
+ if (rc)
2791
+ return rc;
27962792
27972793 #ifdef CONFIG_PROC_FS
27982794 proc_mkdir("driver/ray_cs", NULL);
27992795
28002796 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,
28032799 &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,
28052801 &translate);
28062802 #endif
2807
- if (translate != 0)
2808
- translate = 1;
2803
+ translate = !!translate;
28092804 return 0;
28102805 } /* init_ray_cs */
28112806
....@@ -2816,11 +2811,7 @@
28162811 pr_debug("ray_cs: cleanup_module\n");
28172812
28182813 #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);
28242815 #endif
28252816
28262817 pcmcia_unregister_driver(&ray_driver);