Subject: [RFC][PATCH 07/11] broadcom: trivial sparse annotations
Subsystems (7)
--- drivers/net/ethernet/broadcom/bcmsysport.c | 2 +- drivers/net/ethernet/broadcom/bgmac.h | 6 +++--- drivers/net/ethernet/broadcom/bnx2.c | 6 +++--- drivers/net/ethernet/broadcom/cnic_if.h | 8 ++++---- drivers/net/ethernet/broadcom/genet/bcmgenet.c | 4 ++-- drivers/net/ethernet/broadcom/tg3.c | 2 +- 6 files changed, 14 insertions(+), 14 deletions(-)
drivers/net/ethernet/broadcom/bcmsysport.c +1 -1
@@ -1156,7 +1156,7 @@ static struct sk_buff *bcm_sysport_insert_tsb(struct sk_buff *skb,memset (tsb,0 ,sizeof (*tsb));if (skb->ip_summed ==CHECKSUM_PARTIAL ) { - ip_ver =htons (skb->protocol); + ip_ver =ntohs (skb->protocol);switch (ip_ver) {case ETH_P_IP : ip_proto =ip_hdr (skb)->protocol;
drivers/net/ethernet/broadcom/bgmac.h +3 -3
@@ -479,9 +479,9 @@ struct bgmac_rx_header { struct bgmac { union { struct { - void *base; - void *idm_base; - void *nicpm_base; + void __iomem *base; + void __iomem *idm_base; + void __iomem *nicpm_base; } plat; struct { struct bcma_device *core;
drivers/net/ethernet/broadcom/bnx2.c +3 -3
@@ -8330,9 +8330,9 @@ bnx2_init_board(struct pci_dev *pdev, struct net_device *dev)if (j <32 ) bp->fw_version[j++] =' ' ;for (i =0 ; i <3 && j <28 ; i++) { - reg =bnx2_reg_rd_ind (bp, addr + i *4 ); - reg =be32_to_cpu (reg); -memcpy (&bp->fw_version[j], ®,4 ); +__be32 v; + v =cpu_to_be32 (bnx2_reg_rd_ind (bp, addr + i *4 )); +memcpy (&bp->fw_version[j], &v,4 ); j +=4 ; } }
drivers/net/ethernet/broadcom/cnic_if.h +4 -4
@@ -260,10 +260,10 @@ struct cnic_sockaddr {struct cnic_sock {struct cnic_dev *dev;void *context; -u32 src_ip[4 ]; -u32 dst_ip[4 ]; -u16 src_port; -u16 dst_port; +__be32 src_ip[4 ]; +__be32 dst_ip[4 ]; +__be16 src_port; +__be16 dst_port;u16 vlan_id;unsigned char old_ha[ETH_ALEN ];unsigned char ha[ETH_ALEN ];
drivers/net/ethernet/broadcom/genet/bcmgenet.c +2 -2
@@ -1321,7 +1321,7 @@ static struct sk_buff *bcmgenet_free_tx_cb(struct device *dev,dma_unmap_addr_set (cb, dma_addr,0 ); } -return 0 ; +return NULL ; }/* Simple helper to free a receive control block's resources */
@@ -1480,7 +1480,7 @@ static struct sk_buff *bcmgenet_put_tx_csum(struct net_device *dev, status = (struct status_64 *)skb->data;if (skb->ip_summed ==CHECKSUM_PARTIAL ) { - ip_ver =htons (skb->protocol); + ip_ver =ntohs (skb->protocol);switch (ip_ver) {case ETH_P_IP : ip_proto =ip_hdr (skb)->protocol;
drivers/net/ethernet/broadcom/tg3.c +1 -1
@@ -3744,7 +3744,7 @@ static int tg3_load_firmware_cpu(struct tg3 *tp, u32 cpu_base, } do { - u32 *fw_data = (u32 *)(fw_hdr + 1); + __be32 *fw_data = (__be32 *)(fw_hdr + 1); for (i = 0; i < tg3_fw_data_len(tp, fw_hdr); i++) write_op(tp, cpu_scratch_base + (be32_to_cpu(fw_hdr->base_addr) & 0xffff) +
Signature · 1 line
2.11.0
Quoted 16 lines · Al Viro
Signed-off-by Al Viro <[email protected]>--- drivers/net/ethernet/broadcom/bcmsysport.c | 2 +- drivers/net/ethernet/broadcom/bgmac.h | 6 +++--- drivers/net/ethernet/broadcom/bnx2.c | 6 +++--- drivers/net/ethernet/broadcom/cnic_if.h | 8 ++++---- drivers/net/ethernet/broadcom/genet/bcmgenet.c | 4 ++-- drivers/net/ethernet/broadcom/tg3.c | 2 +- 6 files changed, 14 insertions(+), 14 deletions(-)drivers/net/ethernet/broadcom/bcmsysport.c +0
-0
drivers/net/ethernet/broadcom/bcmsysport.c static struct sk_buff *bcm_sysport_insert_tsb(struct sk_buff *skb, · line 1159
Quoted 5 lines
drivers/net/ethernet/broadcom/bcmsysport.c +1
-1@@ -1156,7 +1156,7 @@ static struct sk_buff *bcm_sysport_insert_tsb(struct sk_buff *skb,memset (tsb,0 ,sizeof (*tsb));if (skb->ip_summed ==CHECKSUM_PARTIAL ) { - ip_ver =htons (skb->protocol); + ip_ver =ntohs (skb->protocol);
Al can you make sure you CC drivers maintainers for these changes? You change bcmsysport.c and bcmgenet.c but you leave tg3.c with the same type of construct in tg3_start_xmit() any reason for that? I am also curious about this conversion considering the following numbers:
grep 'skb->protocol == htons' {net/*,drivers/net/*} | wc -l 151
git grep 'skb->protocol == ntohs' {net/*,drivers/net/*} | wc -l 0
Quoted 8 lines
drivers/net/ethernet/broadcom/bcmsysport.c +0
-0switch (ip_ver) {case ETH_P_IP : ip_proto =ip_hdr (skb)->protocol;drivers/net/ethernet/broadcom/bgmac.h +0
-0
drivers/net/ethernet/broadcom/bgmac.h struct bgmac_rx_header { · line 485
Quoted 10 lines
drivers/net/ethernet/broadcom/bgmac.h +3
-3@@ -479,9 +479,9 @@ struct bgmac_rx_header {struct bgmac {union {struct { -void *base; -void *idm_base; -void *nicpm_base; +void __iomem *base; +void __iomem *idm_base; +void __iomem *nicpm_base; } plat;
This part of the patch is correct.
Quoted 43 lines
drivers/net/ethernet/broadcom/bgmac.h +0
-0struct {struct bcma_device *core;drivers/net/ethernet/broadcom/bnx2.c +3
-3@@ -8330,9 +8330,9 @@ bnx2_init_board(struct pci_dev *pdev, struct net_device *dev)if (j <32 ) bp->fw_version[j++] =' ' ;for (i =0 ; i <3 && j <28 ; i++) { - reg =bnx2_reg_rd_ind (bp, addr + i *4 ); - reg =be32_to_cpu (reg); -memcpy (&bp->fw_version[j], ®,4 ); +__be32 v; + v =cpu_to_be32 (bnx2_reg_rd_ind (bp, addr + i *4 )); +memcpy (&bp->fw_version[j], &v,4 ); j +=4 ; } }drivers/net/ethernet/broadcom/cnic_if.h +4
-4@@ -260,10 +260,10 @@ struct cnic_sockaddr {struct cnic_sock {struct cnic_dev *dev;void *context; -u32 src_ip[4 ]; -u32 dst_ip[4 ]; -u16 src_port; -u16 dst_port; +__be32 src_ip[4 ]; +__be32 dst_ip[4 ]; +__be16 src_port; +__be16 dst_port;u16 vlan_id;unsigned char old_ha[ETH_ALEN ];unsigned char ha[ETH_ALEN ];drivers/net/ethernet/broadcom/genet/bcmgenet.c +0
-0
drivers/net/ethernet/broadcom/genet/bcmgenet.c static struct sk_buff *bcmgenet_free_tx_cb(struct device *dev, · line 1324
Quoted 5 lines
drivers/net/ethernet/broadcom/genet/bcmgenet.c +1
-1@@ -1321,7 +1321,7 @@ static struct sk_buff *bcmgenet_free_tx_cb(struct device *dev,dma_unmap_addr_set (cb, dma_addr,0 ); } -return 0 ; +return NULL ;
And this part as well is correct.
Quoted 26 lines
drivers/net/ethernet/broadcom/genet/bcmgenet.c +1
-1}/* Simple helper to free a receive control block's resources */ @@ -1480,7 +1480,7 @@ static struct sk_buff *bcmgenet_put_tx_csum(struct net_device *dev, status = (struct status_64 *)skb->data;if (skb->ip_summed ==CHECKSUM_PARTIAL ) { - ip_ver =htons (skb->protocol); + ip_ver =ntohs (skb->protocol);switch (ip_ver) {case ETH_P_IP : ip_proto =ip_hdr (skb)->protocol;drivers/net/ethernet/broadcom/tg3.c +1
-1@@ -3744,7 +3744,7 @@ static int tg3_load_firmware_cpu(struct tg3 *tp, u32 cpu_base, } do { - u32 *fw_data = (u32 *)(fw_hdr + 1); + __be32 *fw_data = (__be32 *)(fw_hdr + 1); for (i = 0; i < tg3_fw_data_len(tp, fw_hdr); i++) write_op(tp, cpu_scratch_base + (be32_to_cpu(fw_hdr->base_addr) & 0xffff) +
Signature · 1 line
Florian