File 0003-Fix-kernel-logs.patch of Package aic8800-dkms

From 3e8b6d6734aa901899533e87d73a2b911014fc2e Mon Sep 17 00:00:00 2001
From: Franck Duriez <franck.lucien.duriez@gmail.com>
Date: Sun, 28 Apr 2024 20:23:26 +0200
Subject: [PATCH 3/3] Fix kernel logs

diff --git a/aic8800_fdrv/aicwf_compat_8800dc.c b/aic8800_fdrv/aicwf_compat_8800dc.c
index ae4b080..0674ccf 100644
--- a/aic8800_fdrv/aicwf_compat_8800dc.c
+++ b/aic8800_fdrv/aicwf_compat_8800dc.c
@@ -2603,7 +2603,7 @@ int aicwf_patch_table_load(struct rwnx_hw *rwnx_hw, char *filename)
 	if (!err && (i < size)) {
 		err = rwnx_send_dbg_mem_block_write_req(rwnx_hw, fmacfw_patch_tbl_8800dc_u02_describe_base, fmacfw_patch_tbl_8800dc_u02_describe_size + 4, dst);
 		if(err){
-			printk("write describe information fail \n");
+			AICWFDBG(LOGINFO, "write describe information fail \n");
 		}
 
 		describle = kzalloc(fmacfw_patch_tbl_8800dc_u02_describe_size, GFP_KERNEL);
@@ -2844,7 +2844,7 @@ void aicwf_patch_config_8800dc(struct rwnx_hw *rwnx_hw)
         } else if (chip_sub_id == 1) {
             ret = aicwf_patch_table_load(rwnx_hw, RWNX_MAC_PATCH_TABLE_8800DC_U02);
             if(ret){
-                printk("patch_tbl upload fail: err:%d\r\n", ret);
+                AICWFDBG(LOGINFO, "patch_tbl upload fail: err:%d\r\n", ret);
             }
 #ifdef CONFIG_FOR_IPCAM
             if ((ret = rwnx_send_dbg_mem_write_req(rwnx_hw, 0x00111944, 0x00000101))) {
@@ -2854,14 +2854,14 @@ void aicwf_patch_config_8800dc(struct rwnx_hw *rwnx_hw)
         } else if (chip_sub_id == 2) {
             ret = aicwf_patch_table_load(rwnx_hw, RWNX_MAC_PATCH_TABLE_8800DC_H_U02);
             if(ret){
-                printk("patch_tbl upload fail: err:%d\r\n", ret);
+                AICWFDBG(LOGINFO, "patch_tbl upload fail: err:%d\r\n", ret);
             }
             ret = aicwf_patch_var_config_8800dc(rwnx_hw);
             if (ret) {
-                printk("patch_var cfg fail: err:%d\r\n", ret);
+                AICWFDBG(LOGINFO, "patch_var cfg fail: err:%d\r\n", ret);
             }
         } else {
-            printk("unsupported id: %d\n", chip_sub_id);
+            AICWFDBG(LOGINFO, "unsupported id: %d\n", chip_sub_id);
         }
 
         #endif
@@ -3012,7 +3012,7 @@ int aicwf_plat_patch_load_8800dc(struct rwnx_hw *rwnx_hw)
 		//wifi patch
         ret = rwnx_plat_bin_fw_upload_2(rwnx_hw, ROM_FMAC_PATCH_ADDR, RWNX_MAC_PATCH_NAME2_8800DC_H_U02);
     } else {
-        printk("unsupported id: %d\n", chip_sub_id);
+        AICWFDBG(LOGINFO, "unsupported id: %d\n", chip_sub_id);
     }
 #endif
     return ret;
@@ -3052,7 +3052,7 @@ int aicwf_misc_ram_valid_check_8800dc(struct rwnx_hw *rwnx_hw, int *valid_out)
         AICWFDBG(LOGERROR, "boot argc [0x%x] rd fail: %d\n", boot_argc_read_addr, ret);
             return ret;
     }
-       printk("boot argc %x\n", cfm.memdata); 
+       AICWFDBG(LOGINFO, "boot argc %x\n", cfm.memdata); 
     if (cfm.memdata & 0x10) {
         *valid_out = 1;
         return ret;
@@ -3064,7 +3064,7 @@ int aicwf_misc_ram_valid_check_8800dc(struct rwnx_hw *rwnx_hw, int *valid_out)
             return ret;
         }
         flash_size = cfm.memdata & 0xff;
-       printk("flash size %x\n", flash_size); 
+       AICWFDBG(LOGINFO, "flash size %x\n", flash_size); 
         if (flash_size == 0x16) {
             dpd_info_read_addr += 0x4300000;
         } else if (flash_size == 0x15) {
@@ -3675,9 +3675,9 @@ void system_config_8800dc(struct rwnx_hw *rwnx_hw){
 	//Crystal provided by CPU (end)
 
 	ret = rwnx_send_dbg_mem_read_req(rwnx_hw, 0x40500010, &rd_mem_addr_cfm);
-	printk("[0x40500010]=%x\n", rd_mem_addr_cfm.memdata);
+	AICWFDBG(LOGINFO, "[0x40500010]=%x\n", rd_mem_addr_cfm.memdata);
 	if (ret) {
-	    printk("[0x40500010] rd fail: %d\n", ret);
+	    AICWFDBG(LOGERROR, "[0x40500010] rd fail: %d\n", ret);
 	    return;
 	}
 
diff --git a/aic8800_fdrv/aicwf_debug.h b/aic8800_fdrv/aicwf_debug.h
index 50777a5..47aa522 100644
--- a/aic8800_fdrv/aicwf_debug.h
+++ b/aic8800_fdrv/aicwf_debug.h
@@ -15,19 +15,19 @@
 extern int aicwf_dbg_level;
 void rwnx_data_dump(char* tag, void* data, unsigned long len);
 
-#define AICWF_LOG		"AICWFDBG("
+#define AICWF_LOG		KERN_DEFAULT "aic8800"
 
 #define AICWFDBG(level, args, arg...)	\
 do {	\
 	if (aicwf_dbg_level & level) {	\
-		printk(AICWF_LOG#level")\t" args, ##arg); \
+		printk(AICWF_LOG": " args, ##arg); \
 	}	\
 } while (0)
 
 #define RWNX_DBG(fmt, ...)	\
 do {	\
 	if (aicwf_dbg_level & LOGTRACE) {	\
-		printk(AICWF_LOG"LOGTRACE)\t"fmt , ##__VA_ARGS__); 	\
+		printk(AICWF_LOG": "fmt , ##__VA_ARGS__); 	\
 	}	\
 } while (0)
 
diff --git a/aic8800_fdrv/rwnx_main.c b/aic8800_fdrv/rwnx_main.c
index 4b72315..a74c92e 100644
--- a/aic8800_fdrv/rwnx_main.c
+++ b/aic8800_fdrv/rwnx_main.c
@@ -6276,7 +6276,7 @@ static void rwnx_reg_notifier(struct wiphy *wiphy,
 {
     struct rwnx_hw *rwnx_hw = wiphy_priv(wiphy);
 
-    printk("%s Enter\r\n", __func__);
+    AICWFDBG(LOGINFO, "%s Enter\r\n", __func__);
 
     // For now trust all initiator
 #ifdef CONFIG_RADAR_OR_IR_DETECT
diff --git a/aic8800_fdrv/rwnx_tx.c b/aic8800_fdrv/rwnx_tx.c
index d94a894..2b23d21 100644
--- a/aic8800_fdrv/rwnx_tx.c
+++ b/aic8800_fdrv/rwnx_tx.c
@@ -1072,7 +1072,7 @@ int aic_br_client_tx(struct rwnx_vif *vif, struct sk_buff **pskb)
 		rcu_read_unlock();
 #endif /* (LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 35)) */
 #ifdef BR_SUPPORT_DEBUG
-		printk("SA=%pM, br_mac=%pM, type=0x%x, da[0]=%x, scdb=%pM, vif_type=%d\n", skb->data + MACADDRLEN,  vif->br_mac, *((unsigned short *)(skb->data + MACADDRLEN * 2)),
+		AICWFDBG(LOGINFO, "SA=%pM, br_mac=%pM, type=0x%x, da[0]=%x, scdb=%pM, vif_type=%d\n", skb->data + MACADDRLEN,  vif->br_mac, *((unsigned short *)(skb->data + MACADDRLEN * 2)),
 			skb->data[0], vif->scdb_mac,RWNX_VIF_TYPE(vif));
 #endif
         spin_lock_bh(&vif->br_ext_lock);
@@ -1146,7 +1146,7 @@ int aic_br_client_tx(struct rwnx_vif *vif, struct sk_buff **pskb)
 					newskb = skb_copy(skb, in_interrupt() ? GFP_ATOMIC : GFP_KERNEL);
 					if (newskb == NULL) {
 						/* priv->ext_stats.tx_drops++; */
-						printk("TX DROP: skb_copy fail!\n");
+						AICWFDBG(LOGINFO, "TX DROP: skb_copy fail!\n");
 						/* goto stop_proc; */
 						return -1;
 					}
@@ -1162,7 +1162,7 @@ int aic_br_client_tx(struct rwnx_vif *vif, struct sk_buff **pskb)
 				}
 
 				if (skb_is_nonlinear(skb))
-					printk("%s(): skb_is_nonlinear!!\n", __FUNCTION__);
+					AICWFDBG(LOGINFO, "%s(): skb_is_nonlinear!!\n", __FUNCTION__);
 
 
 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 18))
@@ -1171,7 +1171,7 @@ int aic_br_client_tx(struct rwnx_vif *vif, struct sk_buff **pskb)
 				res = skb_linearize(skb);
 #endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 18)) */
 				if (res < 0) {
-					printk("TX DROP: skb_linearize fail!\n");
+					AICWFDBG(LOGINFO, "TX DROP: skb_linearize fail!\n");
 					/* goto free_and_stop; */
 					return -1;
 				}
@@ -1180,7 +1180,7 @@ int aic_br_client_tx(struct rwnx_vif *vif, struct sk_buff **pskb)
 				if (res < 0) {
 					if (res == -2) {
 						/* priv->ext_stats.tx_drops++; */
-						printk("TX DROP: nat25_db_handle fail!\n");
+						AICWFDBG(LOGINFO, "TX DROP: nat25_db_handle fail!\n");
 						/* goto free_and_stop; */
 						return -1;
 
@@ -1223,13 +1223,13 @@ int aic_br_client_tx(struct rwnx_vif *vif, struct sk_buff **pskb)
 		/* check if SA is equal to our MAC */
 		if (memcmp(skb->data + MACADDRLEN, vif->ndev->dev_addr, MACADDRLEN)) {
 			/* priv->ext_stats.tx_drops++; */
-			printk("TX DROP: untransformed frame SA:%02X%02X%02X%02X%02X%02X!\n",
+			AICWFDBG(LOGINFO, "TX DROP: untransformed frame SA:%02X%02X%02X%02X%02X%02X!\n",
 				skb->data[6], skb->data[7], skb->data[8], skb->data[9], skb->data[10], skb->data[11]);
 			/* goto free_and_stop; */
 			return -1;
 		}
 	}
-	printk("%s:exit\n",__func__);
+	AICWFDBG(LOGINFO, "%s:exit\n",__func__);
 	return 0;
 }
 #endif /* CONFIG_BR_SUPPORT */
diff --git a/aic_load_fw/aicbluetooth.c b/aic_load_fw/aicbluetooth.c
index d25bb37..ba10213 100644
--- a/aic_load_fw/aicbluetooth.c
+++ b/aic_load_fw/aicbluetooth.c
@@ -279,7 +279,7 @@ void aic_bt_platform_deinit(struct aic_usb_dev *usbdev)
 }
 
 #define MD5(x) x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11],x[12],x[13],x[14],x[15]
-#define MD5PINRT "file md5:%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x\r\n"
+#define MD5PINRT KERN_INFO "file md5:%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x\r\n"
 
 static int aic_load_firmware(u32 ** fw_buf, const char *name, struct device *device)
 {
diff --git a/aic_load_fw/aicwf_debug.h b/aic_load_fw/aicwf_debug.h
index be72268..5d67ced 100644
--- a/aic_load_fw/aicwf_debug.h
+++ b/aic_load_fw/aicwf_debug.h
@@ -14,19 +14,19 @@
 extern int aicwf_dbg_level;
 void rwnx_data_dump(char* tag, void* data, unsigned long len);
 
-#define AICWF_LOG		"AICWFDBG("
+#define AICWF_LOG		KERN_DEFAULT "aic8800"
 
 #define AICWFDBG(level, args, arg...)	\
 do {	\
 	if (aicwf_dbg_level & level) {	\
-		printk(AICWF_LOG#level")\t" args, ##arg); \
+		printk(AICWF_LOG": " args, ##arg); \
 	}	\
 } while (0)
 
 #define RWNX_DBG(fmt, ...)	\
 do {	\
 	if (aicwf_dbg_level & LOGTRACE) {	\
-		printk(AICWF_LOG"LOGTRACE)\t"fmt , ##__VA_ARGS__); 	\
+		printk(AICWF_LOG": "fmt , ##__VA_ARGS__)); 	\
 	}	\
 } while (0)
 
openSUSE Build Service is sponsored by