Skip to contentSkip to conversation

net: hns3: Cleanup for static warnings.

PATCH In review Hao Lan 2 participants 5 messages Nov 12, 2022 – Nov 15, 2022

Subsystems (4)
lore
Share & tools
lore

Hao Lan

author
#0 lore raw

cover net: hns3: Cleanup for static warnings.

Most static warnings are mainly about:
Patch #1: fix hns3 driver header file not self-contained issue. Patch #2: add complete parentheses for some macros.

Hao Chen (1):
net: hns3: fix hns3 driver header file not self-contained issue

Jiantao Xiao (1):
net: hns3: add complete parentheses for some macros

 drivers/net/ethernet/hisilicon/hns3/hclge_mbx.h              | 4 +++-
 .../hisilicon/hns3/hns3_common/hclge_comm_tqp_stats.h        | 2 ++
 drivers/net/ethernet/hisilicon/hns3/hns3_enet.h              | 5 ++++-
 drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_ptp.h       | 5 ++++-
 4 files changed, 13 insertions(+), 3 deletions(-)
Signature · 1 line
2.30.0
author
#1 lore raw

PATCH 1/2 net: hns3: fix hns3 driver header file not self-contained issue

From: Hao Chen <[email protected]>

The hns3 driver header file uses the structure of other files, but does not include corresponding file, which causes a check warning that the header file is not self-contained.

Therefore, the required header file is included in the header file, and the structure declaration is added to the header file to avoid cyclic dependency of the header file.

---
 drivers/net/ethernet/hisilicon/hns3/hclge_mbx.h              | 4 +++-
 .../hisilicon/hns3/hns3_common/hclge_comm_tqp_stats.h        | 2 ++
 drivers/net/ethernet/hisilicon/hns3/hns3_enet.h              | 3 +++
 drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_ptp.h       | 5 ++++-
 4 files changed, 12 insertions(+), 2 deletions(-)
drivers/net/ethernet/hisilicon/hns3/hclge_mbx.h +3 -1
index abcd7877f7d2..487216aeae50 100644
@@ -7,6 +7,8 @@
 #include <linux/mutex.h>
 #include <linux/types.h>
 
+struct hclgevf_dev;
+
 enum HCLGE_MBX_OPCODE {
 	HCLGE_MBX_RESET = 0x01,		/* (VF -> PF) assert reset */
 	HCLGE_MBX_ASSERTING_RESET,	/* (PF -> VF) PF is asserting reset */
@@ -233,7 +235,7 @@ struct hclgevf_mbx_arq_ring {
 	__le16 msg_q[HCLGE_MBX_MAX_ARQ_MSG_NUM][HCLGE_MBX_MAX_ARQ_MSG_SIZE];
 };
 
-struct hclge_dev;
+struct hclge_vport;
 
 #define HCLGE_MBX_OPCODE_MAX 256
 struct hclge_mbx_ops_param {
drivers/net/ethernet/hisilicon/hns3/hns3_common/hclge_comm_tqp_stats.h +2 -0
index a46350162ee8..7aff1a544cf4 100644
@@ -7,6 +7,8 @@
 #include <linux/etherdevice.h>
 #include "hnae3.h"
 
+struct hclge_comm_hw;
+
 /* each tqp has TX & RX two queues */
 #define HCLGE_COMM_QUEUE_PAIR_SIZE 2
 
drivers/net/ethernet/hisilicon/hns3/hns3_enet.h +3 -0
index 133a054af6b7..557a5fa70d0a 100644
@@ -13,6 +13,9 @@
 
 struct iphdr;
 struct ipv6hdr;
+struct gre_base_hdr;
+struct tcphdr;
+struct udphdr;
 
 enum hns3_nic_state {
 	HNS3_NIC_STATE_TESTING,
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_ptp.h +4 -1
index bbee74cd8404..bceb61c791a1 100644
@@ -8,8 +8,11 @@
 #include <linux/net_tstamp.h>
 #include <linux/types.h>
 
-struct hclge_dev;
 struct ifreq;
+struct ethtool_ts_info;
+
+struct hnae3_handle;
+struct hclge_dev;
 
 #define HCLGE_PTP_REG_OFFSET	0x29000
 
Signature · 1 line
2.30.0
author
#2 lore raw

PATCH 2/2 net: hns3: add complete parentheses for some macros

In reply to Hao Lan

From: Jiantao Xiao <[email protected]>

Add complete parentheses for some macros to fix static check warning.

---
 drivers/net/ethernet/hisilicon/hns3/hns3_enet.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/hisilicon/hns3/hns3_enet.h +1 -1
index 557a5fa70d0a..7df4cf656d22 100644
@@ -692,7 +692,7 @@ static inline unsigned int hns3_page_order(struct hns3_enet_ring *ring)
 
 /* iterator for handling rings in ring group */
 #define hns3_for_each_ring(pos, head) \
-	for (pos = (head).ring; (pos); pos = (pos)->next)
+	for ((pos) = (head).ring; (pos); (pos) = (pos)->next)
 
 #define hns3_get_handle(ndev) \
 	(((struct hns3_nic_priv *)netdev_priv(ndev))->ae_handle)
Signature · 1 line
2.30.0
maintainer
#3 lore raw
In reply to Hao Lan
Quoted 3 lines · On Sat, 12 Nov 2022 16:17:47 +0800 Hao Lan wrote:

Most static warnings are mainly about:
Patch #1: fix hns3 driver header file not self-contained issue. Patch #2: add complete parentheses for some macros.

You need to say what static checker was used.
I think it's documented in the "researcher guidelines" doc. In case patch 2 was based on a warning from checkpatch please drop it from the series, we don't take checkpatch-based cleanups.

author
#4 lore raw

Thanks, we will send another patch.

Quoted 11 lines · Jakub Kicinski
Quoted 3 lines · On Sat, 12 Nov 2022 16:17:47 +0800 Hao Lan wrote:

Most static warnings are mainly about:
Patch #1: fix hns3 driver header file not self-contained issue. Patch #2: add complete parentheses for some macros.

You need to say what static checker was used.
I think it's documented in the "researcher guidelines" doc. In case patch 2 was based on a warning from checkpatch please drop it from the series, we don't take checkpatch-based cleanups. .