net:hns: annotate IO address space properly
Subsystems (3)
PATCH 2/2 net:hns: print MAC with %pM
In reply to Andy Shevchenkoprintf() has a dedicated specifier to print MAC addresses. Use it instead of pushing each byte via stack.
--- drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c | 49 +++++++--------------- 1 file changed, 14 insertions(+), 35 deletions(-)
drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c +14 -35
@@ -1376,12 +1376,8 @@ int hns_dsaf_set_mac_uc_entry(if (MAC_IS_ALL_ZEROS (mac_entry->addr) ||MAC_IS_BROADCAST (mac_entry->addr) ||MAC_IS_MULTICAST (mac_entry->addr)) { -dev_err (dsaf_dev->dev, -"set_uc %s Mac %02x:%02x:%02x:%02x:%02x:%02x err!\n" , - dsaf_dev->ae_dev.name, mac_entry->addr[0 ], - mac_entry->addr[1 ], mac_entry->addr[2 ], - mac_entry->addr[3 ], mac_entry->addr[4 ], - mac_entry->addr[5 ]); +dev_err (dsaf_dev->dev,"set_uc %s Mac %pM err!\n" , + dsaf_dev->ae_dev.name, mac_entry->addr);return -EINVAL ; }
@@ -1448,12 +1444,8 @@ int hns_dsaf_set_mac_mc_entry(/* mac addr check */ if (MAC_IS_ALL_ZEROS (mac_entry->addr)) { -dev_err (dsaf_dev->dev, -"set uc %s Mac %02x:%02x:%02x:%02x:%02x:%02x err!\n" , - dsaf_dev->ae_dev.name, mac_entry->addr[0 ], - mac_entry->addr[1 ], mac_entry->addr[2 ], - mac_entry->addr[3 ], - mac_entry->addr[4 ], mac_entry->addr[5 ]); +dev_err (dsaf_dev->dev,"set uc %s Mac %pM err!\n" , + dsaf_dev->ae_dev.name, mac_entry->addr);return -EINVAL ; }
@@ -1527,11 +1519,8 @@ int hns_dsaf_add_mac_mc_port(struct dsaf_device *dsaf_dev,/*chechk mac addr */ if (MAC_IS_ALL_ZEROS (mac_entry->addr)) { -dev_err (dsaf_dev->dev, -"set_entry failed,addr %02x:%02x:%02x:%02x:%02x:%02x!\n" , - mac_entry->addr[0 ], mac_entry->addr[1 ], - mac_entry->addr[2 ], mac_entry->addr[3 ], - mac_entry->addr[4 ], mac_entry->addr[5 ]); +dev_err (dsaf_dev->dev,"set_entry failed,addr %pM!\n" , + mac_entry->addr);return -EINVAL ; }
@@ -1614,9 +1603,8 @@ int hns_dsaf_del_mac_entry(struct dsaf_device *dsaf_dev, u16 vlan_id,/*check mac addr */ if (MAC_IS_ALL_ZEROS (addr) ||MAC_IS_BROADCAST (addr)) { -dev_err (dsaf_dev->dev, -"del_entry failed,addr %02x:%02x:%02x:%02x:%02x:%02x!\n" , - addr[0 ], addr[1 ], addr[2 ], addr[3 ], addr[4 ], addr[5 ]); +dev_err (dsaf_dev->dev,"del_entry failed,addr %pM!\n" , + addr);return -EINVAL ; }
@@ -1680,11 +1668,8 @@ int hns_dsaf_del_mac_mc_port(struct dsaf_device *dsaf_dev,/*check mac addr */ if (MAC_IS_ALL_ZEROS (mac_entry->addr)) { -dev_err (dsaf_dev->dev, -"del_port failed, addr %02x:%02x:%02x:%02x:%02x:%02x!\n" , - mac_entry->addr[0 ], mac_entry->addr[1 ], - mac_entry->addr[2 ], mac_entry->addr[3 ], - mac_entry->addr[4 ], mac_entry->addr[5 ]); +dev_err (dsaf_dev->dev,"del_port failed, addr %pM!\n" , + mac_entry->addr);return -EINVAL ; }
@@ -1761,11 +1746,8 @@ int hns_dsaf_get_mac_uc_entry(struct dsaf_device *dsaf_dev,/* check macaddr */ if (MAC_IS_ALL_ZEROS (mac_entry->addr) ||MAC_IS_BROADCAST (mac_entry->addr)) { -dev_err (dsaf_dev->dev, -"get_entry failed,addr %02x:%02x:%02x:%02x:%02x:%02x\n" , - mac_entry->addr[0 ], mac_entry->addr[1 ], - mac_entry->addr[2 ], mac_entry->addr[3 ], - mac_entry->addr[4 ], mac_entry->addr[5 ]); +dev_err (dsaf_dev->dev,"get_entry failed,addr %pM\n" , + mac_entry->addr);return -EINVAL ; }
@@ -1812,11 +1794,8 @@ int hns_dsaf_get_mac_mc_entry(struct dsaf_device *dsaf_dev,/*check mac addr */ if (MAC_IS_ALL_ZEROS (mac_entry->addr) ||MAC_IS_BROADCAST (mac_entry->addr)) { -dev_err (dsaf_dev->dev, -"get_entry failed,addr %02x:%02x:%02x:%02x:%02x:%02x\n" , - mac_entry->addr[0 ], mac_entry->addr[1 ], - mac_entry->addr[2 ], mac_entry->addr[3 ], - mac_entry->addr[4 ], mac_entry->addr[5 ]); +dev_err (dsaf_dev->dev,"get_entry failed,addr %pM\n" , + mac_entry->addr);return -EINVAL ; }
Signature · 1 line
2.6.2
PATCH 1/2 net:hns: annotate IO address space properly
Mark address pointer with __iomem in the IO accessors.
Otherwise we will get a sparse complain like following
.../hns/hns_dsaf_reg.h:991:36: warning: incorrect type in argument 1 (different address spaces).../hns/hns_dsaf_reg.h:991:36: expected unsigned char [noderef] [usertype] <asn:2>*base.../hns/hns_dsaf_reg.h:991:36: got void *base
--- drivers/net/ethernet/hisilicon/hns/hns_dsaf_reg.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
drivers/net/ethernet/hisilicon/hns/hns_dsaf_reg.h +6 -5
@@ -956,7 +956,7 @@#define XGMAC_PAUSE_CTL_RSP_MODE_B 2#define XGMAC_PAUSE_CTL_TX_XOFF_B 3 -static inline void dsaf_write_reg (void *base,u32 reg,u32 value) +static inline void dsaf_write_reg (void __iomem *base,u32 reg,u32 value) {u8 __iomem *reg_addr =ACCESS_ONCE (base);
@@ -966,7 +966,7 @@ static inline void dsaf_write_reg(void *base, u32 reg, u32 value)#define dsaf_write_dev (a, reg, value) \ dsaf_write_reg((a)->io_base, (reg), (value)) -static inline u32 dsaf_read_reg (u8 *base,u32 reg) +static inline u32 dsaf_read_reg (u8 __iomem *base,u32 reg) {u8 __iomem *reg_addr =ACCESS_ONCE (base);
@@ -985,8 +985,8 @@ static inline u32 dsaf_read_reg(u8 *base, u32 reg)#define dsaf_set_bit (origin, shift, val) \ dsaf_set_field((origin), (1ull << (shift)), (shift), (val)) -static inline void dsaf_set_reg_field (void *base,u32 reg,u32 mask,u32 shift, -u32 val) +static inline void dsaf_set_reg_field (void __iomem *base,u32 reg,u32 mask, +u32 shift,u32 val) {u32 origin =dsaf_read_reg (base, reg);
@@ -1005,7 +1005,8 @@ static inline void dsaf_set_reg_field(void *base, u32 reg, u32 mask, u32 shift,#define dsaf_get_bit (origin, shift) \ dsaf_get_field((origin), (1ull << (shift)), (shift)) -static inline u32 dsaf_get_reg_field (void *base,u32 reg,u32 mask,u32 shift) +static inline u32 dsaf_get_reg_field (void __iomem *base,u32 reg,u32 mask, +u32 shift) {u32 origin;
Signature · 1 line
2.6.2
From: Andy Shevchenko <[email protected]>
Date: Thu, 10 Dec 2015 17:23:09 +0200
Quoted 9 lines
Mark address pointer with
__iomemin the IO accessors.Otherwise we will get a sparse complain like following
.../hns/hns_dsaf_reg.h:991:36: warning: incorrect type in argument 1 (different address spaces).../hns/hns_dsaf_reg.h:991:36: expected unsigned char [noderef] [usertype] <asn:2>*base.../hns/hns_dsaf_reg.h:991:36: got void *baseSigned-off-by Andy Shevchenko <[email protected]>
Applied.
Re: [PATCH v1 2/2] net:hns: print MAC with %pM
In reply to Andy ShevchenkoFrom: Andy Shevchenko <[email protected]>
Date: Thu, 10 Dec 2015 17:23:10 +0200
Quoted 4 lines
printf()has a dedicated specifier to print MAC addresses. Use it instead of pushing each byte via stack.Signed-off-by Andy Shevchenko <[email protected]>
Applied.