lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <E1eXXjo-0002Fw-KS@ZenIV.linux.org.uk>
Date:   Fri, 05 Jan 2018 19:33:08 +0000
From:   Al Viro <viro@....linux.org.uk>
To:     netdev@...r.kernel.org
Cc:     <yisen.zhuang@...wei.com>, Zhuang@....linux.org.uk,
        Yisen@....linux.org.uk
Subject: Subject: [RFC][PATCH 11/11] hisilicon: trivial sparse annotations


Signed-off-by: Al Viro <viro@...iv.linux.org.uk>
---
 drivers/net/ethernet/hisilicon/hip04_eth.c         | 20 ++++++++++----------
 drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c  |  2 +-
 drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.h  |  2 +-
 drivers/net/ethernet/hisilicon/hns/hns_dsaf_misc.c |  2 +-
 drivers/net/ethernet/hisilicon/hns/hns_dsaf_reg.h  |  2 +-
 drivers/net/ethernet/hisilicon/hns/hns_enet.c      | 11 +++++------
 drivers/net/ethernet/hisilicon/hns/hns_enet.h      |  3 ++-
 drivers/net/ethernet/hisilicon/hns3/hns3_enet.h    |  3 ++-
 drivers/net/ethernet/hisilicon/hns_mdio.c          | 18 +++++++-----------
 9 files changed, 30 insertions(+), 33 deletions(-)

diff --git a/drivers/net/ethernet/hisilicon/hip04_eth.c b/drivers/net/ethernet/hisilicon/hip04_eth.c
index 340e28211135..562805781450 100644
--- a/drivers/net/ethernet/hisilicon/hip04_eth.c
+++ b/drivers/net/ethernet/hisilicon/hip04_eth.c
@@ -132,19 +132,19 @@
 #define HIP04_MIN_TX_COALESCE_FRAMES	100
 
 struct tx_desc {
-	u32 send_addr;
-	u32 send_size;
-	u32 next_addr;
-	u32 cfg;
-	u32 wb_addr;
+	__be32 send_addr;
+	__be32 send_size;
+	__be32 next_addr;
+	__be32 cfg;
+	__be32 wb_addr;
 } __aligned(64);
 
 struct rx_desc {
-	u16 reserved_16;
-	u16 pkt_len;
-	u32 reserve1[3];
-	u32 pkt_err;
-	u32 reserve2[4];
+	__be16 reserved_16;
+	__be16 pkt_len;
+	__be32 reserve1[3];
+	__be32 pkt_err;
+	__be32 reserve2[4];
 };
 
 struct hip04_priv {
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c
index cac86e9ae0dd..8e80498aecbf 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c
+++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c
@@ -350,7 +350,7 @@ int hns_mac_clr_multicast(struct hns_mac_cb *mac_cb, int vfn)
 static void hns_mac_param_get(struct mac_params *param,
 			      struct hns_mac_cb *mac_cb)
 {
-	param->vaddr = (void *)mac_cb->vaddr;
+	param->vaddr = mac_cb->vaddr;
 	param->mac_mode = hns_get_enet_interface(mac_cb);
 	ether_addr_copy(param->addr, mac_cb->addr_entry_idx[0].addr);
 	param->mac_id = mac_cb->mac_id;
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.h b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.h
index bbc0a98e7ca3..7a2e6506c272 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.h
+++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.h
@@ -187,7 +187,7 @@ struct mac_statistics {
 /*mac para struct ,mac get param from nic or dsaf when initialize*/
 struct mac_params {
 	char addr[ETH_ALEN];
-	void *vaddr; /*virtual address*/
+	void __iomem *vaddr; /*virtual address*/
 	struct device *dev;
 	u8 mac_id;
 	/**< Ethernet operation mode (MAC-PHY interface and speed) */
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_misc.c b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_misc.c
index ca247c2cc238..aa0ad05da6ed 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_misc.c
+++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_misc.c
@@ -649,7 +649,7 @@ static int hns_mac_config_sds_loopback(struct hns_mac_cb *mac_cb, bool en)
 		dsaf_set_field(origin, 1ull << 10, 10, en);
 		dsaf_write_syscon(mac_cb->serdes_ctrl, reg_offset, origin);
 	} else {
-		u8 *base_addr = (u8 *)mac_cb->serdes_vaddr +
+		u8 __iomem *base_addr = mac_cb->serdes_vaddr +
 				(mac_cb->mac_id <= 3 ? 0x00280000 : 0x00200000);
 		dsaf_set_reg_field(base_addr, reg_offset, 1ull << 10, 10, en);
 	}
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_reg.h b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_reg.h
index 46a52d9bb196..89569ea4d83c 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_reg.h
+++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_reg.h
@@ -1095,6 +1095,6 @@ static inline u32 dsaf_get_reg_field(void __iomem *base, u32 reg, u32 mask,
 	readb((__iomem unsigned char *)(addr))
 
 #define hns_mac_reg_read64(drv, offset) \
-	readq((__iomem void *)(((u8 *)(drv)->io_base + 0xc00 + (offset))))
+	readq((u8 __iomem *)(drv)->io_base + 0xc00 + (offset))
 
 #endif	/* _DSAF_REG_H */
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_enet.c b/drivers/net/ethernet/hisilicon/hns/hns_enet.c
index 1ccb6443d2ed..e8319059cd31 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_enet.c
+++ b/drivers/net/ethernet/hisilicon/hns/hns_enet.c
@@ -919,8 +919,8 @@ static void hns_nic_adpt_coalesce(struct hns_nic_ring_data *ring_data)
 	}
 }
 
-static int hns_nic_rx_poll_one(struct hns_nic_ring_data *ring_data,
-			       int budget, void *v)
+static int hns_nic_rx_poll_one(struct hns_nic_ring_data *ring_data, int budget,
+		void (*f)(struct hns_nic_ring_data *, struct sk_buff *))
 {
 	struct hnae_ring *ring = ring_data->ring;
 	struct sk_buff *skb;
@@ -957,8 +957,7 @@ static int hns_nic_rx_poll_one(struct hns_nic_ring_data *ring_data,
 		}
 
 		/* do update ip stack process*/
-		((void (*)(struct hns_nic_ring_data *, struct sk_buff *))v)(
-							ring_data, skb);
+		f(ring_data, skb);
 		recv_pkts++;
 	}
 
@@ -1056,8 +1055,8 @@ static int is_valid_clean_head(struct hnae_ring *ring, int h)
 /* reclaim all desc in one budget
  * return error or number of desc left
  */
-static int hns_nic_tx_poll_one(struct hns_nic_ring_data *ring_data,
-			       int budget, void *v)
+static int hns_nic_tx_poll_one(struct hns_nic_ring_data *ring_data, int budget,
+		void (*unused)(struct hns_nic_ring_data *, struct sk_buff *))
 {
 	struct hnae_ring *ring = ring_data->ring;
 	struct net_device *ndev = ring_data->napi.dev;
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_enet.h b/drivers/net/ethernet/hisilicon/hns/hns_enet.h
index 26e9afcbdd50..48ce926a767d 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_enet.h
+++ b/drivers/net/ethernet/hisilicon/hns/hns_enet.h
@@ -39,7 +39,8 @@ struct hns_nic_ring_data {
 	struct napi_struct napi;
 	cpumask_t mask; /* affinity mask */
 	u32 queue_index;
-	int (*poll_one)(struct hns_nic_ring_data *, int, void *);
+	int (*poll_one)(struct hns_nic_ring_data *, int,
+		void (*)(struct hns_nic_ring_data *, struct sk_buff *));
 	void (*ex_process)(struct hns_nic_ring_data *, struct sk_buff *);
 	bool (*fini_process)(struct hns_nic_ring_data *);
 };
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.h b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.h
index a2a7ea3e9a3a..576e0ae25ff7 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.h
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.h
@@ -411,7 +411,8 @@ struct hns3_nic_ring_data {
 	struct hns3_enet_ring *ring;
 	struct napi_struct napi;
 	int queue_index;
-	int (*poll_one)(struct hns3_nic_ring_data *, int, void *);
+	int (*poll_one)(struct hns3_nic_ring_data *, int,
+			void (*)(struct hns3_nic_ring_data *, struct sk_buff *));
 	void (*ex_process)(struct hns3_nic_ring_data *, struct sk_buff *);
 	void (*fini_process)(struct hns3_nic_ring_data *);
 };
diff --git a/drivers/net/ethernet/hisilicon/hns_mdio.c b/drivers/net/ethernet/hisilicon/hns_mdio.c
index 017e08452d8c..11b55c0d9d5b 100644
--- a/drivers/net/ethernet/hisilicon/hns_mdio.c
+++ b/drivers/net/ethernet/hisilicon/hns_mdio.c
@@ -39,7 +39,7 @@ struct hns_mdio_sc_reg {
 };
 
 struct hns_mdio_device {
-	void *vbase;		/* mdio reg base address */
+	void __iomem *vbase;		/* mdio reg base address */
 	struct regmap *subctrl_vbase;
 	struct hns_mdio_sc_reg sc_reg;
 };
@@ -96,21 +96,17 @@ enum mdio_c45_op_seq {
 #define MDIO_SC_CLK_ST		0x531C
 #define MDIO_SC_RESET_ST	0x5A1C
 
-static void mdio_write_reg(void *base, u32 reg, u32 value)
+static void mdio_write_reg(void __iomem *base, u32 reg, u32 value)
 {
-	u8 __iomem *reg_addr = (u8 __iomem *)base;
-
-	writel_relaxed(value, reg_addr + reg);
+	writel_relaxed(value, base + reg);
 }
 
 #define MDIO_WRITE_REG(a, reg, value) \
 	mdio_write_reg((a)->vbase, (reg), (value))
 
-static u32 mdio_read_reg(void *base, u32 reg)
+static u32 mdio_read_reg(void __iomem *base, u32 reg)
 {
-	u8 __iomem *reg_addr = (u8 __iomem *)base;
-
-	return readl_relaxed(reg_addr + reg);
+	return readl_relaxed(base + reg);
 }
 
 #define mdio_set_field(origin, mask, shift, val) \
@@ -121,7 +117,7 @@ static u32 mdio_read_reg(void *base, u32 reg)
 
 #define mdio_get_field(origin, mask, shift) (((origin) >> (shift)) & (mask))
 
-static void mdio_set_reg_field(void *base, u32 reg, u32 mask, u32 shift,
+static void mdio_set_reg_field(void __iomem *base, u32 reg, u32 mask, u32 shift,
 			       u32 val)
 {
 	u32 origin = mdio_read_reg(base, reg);
@@ -133,7 +129,7 @@ static void mdio_set_reg_field(void *base, u32 reg, u32 mask, u32 shift,
 #define MDIO_SET_REG_FIELD(dev, reg, mask, shift, val) \
 	mdio_set_reg_field((dev)->vbase, (reg), (mask), (shift), (val))
 
-static u32 mdio_get_reg_field(void *base, u32 reg, u32 mask, u32 shift)
+static u32 mdio_get_reg_field(void __iomem *base, u32 reg, u32 mask, u32 shift)
 {
 	u32 origin;
 
-- 
2.11.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ