forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-13 9d77db3c730780c8ef5ccd4b66403ff5675cfe4e
kernel/drivers/net/wireless/intersil/prism54/oid_mgt.c
....@@ -1,18 +1,6 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Copyright (C) 2003,2004 Aurelien Alleaume <slts@free.fr>
3
- *
4
- * This program is free software; you can redistribute it and/or modify
5
- * it under the terms of the GNU General Public License as published by
6
- * the Free Software Foundation; either version 2 of the License
7
- *
8
- * This program is distributed in the hope that it will be useful,
9
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
10
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
- * GNU General Public License for more details.
12
- *
13
- * You should have received a copy of the GNU General Public License
14
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
15
- *
164 */
175
186 #include <linux/kernel.h>
....@@ -792,17 +780,17 @@
792780 {
793781 switch (isl_oid[n].flags & OID_FLAG_TYPE) {
794782 case OID_TYPE_U32:
795
- return snprintf(str, PRIV_STR_SIZE, "%u\n", r->u);
783
+ return scnprintf(str, PRIV_STR_SIZE, "%u\n", r->u);
796784 case OID_TYPE_BUFFER:{
797785 struct obj_buffer *buff = r->ptr;
798
- return snprintf(str, PRIV_STR_SIZE,
786
+ return scnprintf(str, PRIV_STR_SIZE,
799787 "size=%u\naddr=0x%X\n", buff->size,
800788 buff->addr);
801789 }
802790 break;
803791 case OID_TYPE_BSS:{
804792 struct obj_bss *bss = r->ptr;
805
- return snprintf(str, PRIV_STR_SIZE,
793
+ return scnprintf(str, PRIV_STR_SIZE,
806794 "age=%u\nchannel=%u\n"
807795 "capinfo=0x%X\nrates=0x%X\n"
808796 "basic_rates=0x%X\n", bss->age,
....@@ -813,9 +801,9 @@
813801 case OID_TYPE_BSSLIST:{
814802 struct obj_bsslist *list = r->ptr;
815803 int i, k;
816
- k = snprintf(str, PRIV_STR_SIZE, "nr=%u\n", list->nr);
804
+ k = scnprintf(str, PRIV_STR_SIZE, "nr=%u\n", list->nr);
817805 for (i = 0; i < list->nr; i++)
818
- k += snprintf(str + k, PRIV_STR_SIZE - k,
806
+ k += scnprintf(str + k, PRIV_STR_SIZE - k,
819807 "bss[%u] :\nage=%u\nchannel=%u\n"
820808 "capinfo=0x%X\nrates=0x%X\n"
821809 "basic_rates=0x%X\n",
....@@ -831,23 +819,23 @@
831819 struct obj_frequencies *freq = r->ptr;
832820 int i, t;
833821 printk("nr : %u\n", freq->nr);
834
- t = snprintf(str, PRIV_STR_SIZE, "nr=%u\n", freq->nr);
822
+ t = scnprintf(str, PRIV_STR_SIZE, "nr=%u\n", freq->nr);
835823 for (i = 0; i < freq->nr; i++)
836
- t += snprintf(str + t, PRIV_STR_SIZE - t,
824
+ t += scnprintf(str + t, PRIV_STR_SIZE - t,
837825 "mhz[%u]=%u\n", i, freq->mhz[i]);
838826 return t;
839827 }
840828 break;
841829 case OID_TYPE_MLME:{
842830 struct obj_mlme *mlme = r->ptr;
843
- return snprintf(str, PRIV_STR_SIZE,
831
+ return scnprintf(str, PRIV_STR_SIZE,
844832 "id=0x%X\nstate=0x%X\ncode=0x%X\n",
845833 mlme->id, mlme->state, mlme->code);
846834 }
847835 break;
848836 case OID_TYPE_MLMEEX:{
849837 struct obj_mlmeex *mlme = r->ptr;
850
- return snprintf(str, PRIV_STR_SIZE,
838
+ return scnprintf(str, PRIV_STR_SIZE,
851839 "id=0x%X\nstate=0x%X\n"
852840 "code=0x%X\nsize=0x%X\n", mlme->id,
853841 mlme->state, mlme->code, mlme->size);
....@@ -855,7 +843,7 @@
855843 break;
856844 case OID_TYPE_ATTACH:{
857845 struct obj_attachment *attach = r->ptr;
858
- return snprintf(str, PRIV_STR_SIZE,
846
+ return scnprintf(str, PRIV_STR_SIZE,
859847 "id=%d\nsize=%d\n",
860848 attach->id,
861849 attach->size);
....@@ -863,7 +851,7 @@
863851 break;
864852 case OID_TYPE_SSID:{
865853 struct obj_ssid *ssid = r->ptr;
866
- return snprintf(str, PRIV_STR_SIZE,
854
+ return scnprintf(str, PRIV_STR_SIZE,
867855 "length=%u\noctets=%.*s\n",
868856 ssid->length, ssid->length,
869857 ssid->octets);
....@@ -872,13 +860,13 @@
872860 case OID_TYPE_KEY:{
873861 struct obj_key *key = r->ptr;
874862 int t, i;
875
- t = snprintf(str, PRIV_STR_SIZE,
863
+ t = scnprintf(str, PRIV_STR_SIZE,
876864 "type=0x%X\nlength=0x%X\nkey=0x",
877865 key->type, key->length);
878866 for (i = 0; i < key->length; i++)
879
- t += snprintf(str + t, PRIV_STR_SIZE - t,
867
+ t += scnprintf(str + t, PRIV_STR_SIZE - t,
880868 "%02X:", key->key[i]);
881
- t += snprintf(str + t, PRIV_STR_SIZE - t, "\n");
869
+ t += scnprintf(str + t, PRIV_STR_SIZE - t, "\n");
882870 return t;
883871 }
884872 break;
....@@ -886,11 +874,11 @@
886874 case OID_TYPE_ADDR:{
887875 unsigned char *buff = r->ptr;
888876 int t, i;
889
- t = snprintf(str, PRIV_STR_SIZE, "hex data=");
877
+ t = scnprintf(str, PRIV_STR_SIZE, "hex data=");
890878 for (i = 0; i < isl_oid[n].size; i++)
891
- t += snprintf(str + t, PRIV_STR_SIZE - t,
879
+ t += scnprintf(str + t, PRIV_STR_SIZE - t,
892880 "%02X:", buff[i]);
893
- t += snprintf(str + t, PRIV_STR_SIZE - t, "\n");
881
+ t += scnprintf(str + t, PRIV_STR_SIZE - t, "\n");
894882 return t;
895883 }
896884 break;