diff options
author | Joe Perches <joe@perches.com> | 2012-06-04 08:44:16 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-06-06 12:31:33 -0400 |
commit | 6469933605a3ecdfa66b98160cde98ecd256cb3f (patch) | |
tree | 9d80273c26cbec4b3064eee47ba173be11ac444f /drivers/net/ethernet/neterion | |
parent | 20d5ec435c5fba8142eb7df692a5f54fbb26e892 (diff) |
ethernet: Remove casts to same type
Adding casts of objects to the same type is unnecessary
and confusing for a human reader.
For example, this cast:
int y;
int *p = (int *)&y;
I used the coccinelle script below to find and remove these
unnecessary casts. I manually removed the conversions this
script produces of casts with __force, __iomem and __user.
@@
type T;
T *p;
@@
- (T *)p
+ p
A function in atl1e_main.c was passed a const pointer
when it actually modified elements of the structure.
Change the argument to a non-const pointer.
A function in stmmac needed a __force to avoid a sparse
warning. Added it.
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/neterion')
-rw-r--r-- | drivers/net/ethernet/neterion/s2io.c | 14 | ||||
-rw-r--r-- | drivers/net/ethernet/neterion/vxge/vxge-config.c | 8 | ||||
-rw-r--r-- | drivers/net/ethernet/neterion/vxge/vxge-config.h | 2 | ||||
-rw-r--r-- | drivers/net/ethernet/neterion/vxge/vxge-main.c | 8 | ||||
-rw-r--r-- | drivers/net/ethernet/neterion/vxge/vxge-traffic.c | 5 |
5 files changed, 18 insertions, 19 deletions
diff --git a/drivers/net/ethernet/neterion/s2io.c b/drivers/net/ethernet/neterion/s2io.c index bb367582c1e8..e7cd587d8ae7 100644 --- a/drivers/net/ethernet/neterion/s2io.c +++ b/drivers/net/ethernet/neterion/s2io.c | |||
@@ -6946,9 +6946,9 @@ static int rxd_owner_bit_reset(struct s2io_nic *sp) | |||
6946 | if (sp->rxd_mode == RXD_MODE_3B) | 6946 | if (sp->rxd_mode == RXD_MODE_3B) |
6947 | ba = &ring->ba[j][k]; | 6947 | ba = &ring->ba[j][k]; |
6948 | if (set_rxd_buffer_pointer(sp, rxdp, ba, &skb, | 6948 | if (set_rxd_buffer_pointer(sp, rxdp, ba, &skb, |
6949 | (u64 *)&temp0_64, | 6949 | &temp0_64, |
6950 | (u64 *)&temp1_64, | 6950 | &temp1_64, |
6951 | (u64 *)&temp2_64, | 6951 | &temp2_64, |
6952 | size) == -ENOMEM) { | 6952 | size) == -ENOMEM) { |
6953 | return 0; | 6953 | return 0; |
6954 | } | 6954 | } |
@@ -7149,7 +7149,7 @@ static int s2io_card_up(struct s2io_nic *sp) | |||
7149 | int i, ret = 0; | 7149 | int i, ret = 0; |
7150 | struct config_param *config; | 7150 | struct config_param *config; |
7151 | struct mac_info *mac_control; | 7151 | struct mac_info *mac_control; |
7152 | struct net_device *dev = (struct net_device *)sp->dev; | 7152 | struct net_device *dev = sp->dev; |
7153 | u16 interruptible; | 7153 | u16 interruptible; |
7154 | 7154 | ||
7155 | /* Initialize the H/W I/O registers */ | 7155 | /* Initialize the H/W I/O registers */ |
@@ -7325,7 +7325,7 @@ static void s2io_tx_watchdog(struct net_device *dev) | |||
7325 | static int rx_osm_handler(struct ring_info *ring_data, struct RxD_t * rxdp) | 7325 | static int rx_osm_handler(struct ring_info *ring_data, struct RxD_t * rxdp) |
7326 | { | 7326 | { |
7327 | struct s2io_nic *sp = ring_data->nic; | 7327 | struct s2io_nic *sp = ring_data->nic; |
7328 | struct net_device *dev = (struct net_device *)ring_data->dev; | 7328 | struct net_device *dev = ring_data->dev; |
7329 | struct sk_buff *skb = (struct sk_buff *) | 7329 | struct sk_buff *skb = (struct sk_buff *) |
7330 | ((unsigned long)rxdp->Host_Control); | 7330 | ((unsigned long)rxdp->Host_Control); |
7331 | int ring_no = ring_data->ring_no; | 7331 | int ring_no = ring_data->ring_no; |
@@ -7508,7 +7508,7 @@ aggregate: | |||
7508 | 7508 | ||
7509 | static void s2io_link(struct s2io_nic *sp, int link) | 7509 | static void s2io_link(struct s2io_nic *sp, int link) |
7510 | { | 7510 | { |
7511 | struct net_device *dev = (struct net_device *)sp->dev; | 7511 | struct net_device *dev = sp->dev; |
7512 | struct swStat *swstats = &sp->mac_control.stats_info->sw_stat; | 7512 | struct swStat *swstats = &sp->mac_control.stats_info->sw_stat; |
7513 | 7513 | ||
7514 | if (link != sp->last_link_state) { | 7514 | if (link != sp->last_link_state) { |
@@ -8280,7 +8280,7 @@ static int check_L2_lro_capable(u8 *buffer, struct iphdr **ip, | |||
8280 | return -1; | 8280 | return -1; |
8281 | } | 8281 | } |
8282 | 8282 | ||
8283 | *ip = (struct iphdr *)((u8 *)buffer + ip_off); | 8283 | *ip = (struct iphdr *)(buffer + ip_off); |
8284 | ip_len = (u8)((*ip)->ihl); | 8284 | ip_len = (u8)((*ip)->ihl); |
8285 | ip_len <<= 2; | 8285 | ip_len <<= 2; |
8286 | *tcp = (struct tcphdr *)((unsigned long)*ip + ip_len); | 8286 | *tcp = (struct tcphdr *)((unsigned long)*ip + ip_len); |
diff --git a/drivers/net/ethernet/neterion/vxge/vxge-config.c b/drivers/net/ethernet/neterion/vxge/vxge-config.c index 98e2c10ae08b..32d06824fe3e 100644 --- a/drivers/net/ethernet/neterion/vxge/vxge-config.c +++ b/drivers/net/ethernet/neterion/vxge/vxge-config.c | |||
@@ -2346,7 +2346,7 @@ void __vxge_hw_blockpool_blocks_add(struct __vxge_hw_blockpool *blockpool) | |||
2346 | 2346 | ||
2347 | for (i = 0; i < nreq; i++) | 2347 | for (i = 0; i < nreq; i++) |
2348 | vxge_os_dma_malloc_async( | 2348 | vxge_os_dma_malloc_async( |
2349 | ((struct __vxge_hw_device *)blockpool->hldev)->pdev, | 2349 | (blockpool->hldev)->pdev, |
2350 | blockpool->hldev, VXGE_HW_BLOCK_SIZE); | 2350 | blockpool->hldev, VXGE_HW_BLOCK_SIZE); |
2351 | } | 2351 | } |
2352 | 2352 | ||
@@ -2428,13 +2428,13 @@ __vxge_hw_blockpool_blocks_remove(struct __vxge_hw_blockpool *blockpool) | |||
2428 | break; | 2428 | break; |
2429 | 2429 | ||
2430 | pci_unmap_single( | 2430 | pci_unmap_single( |
2431 | ((struct __vxge_hw_device *)blockpool->hldev)->pdev, | 2431 | (blockpool->hldev)->pdev, |
2432 | ((struct __vxge_hw_blockpool_entry *)p)->dma_addr, | 2432 | ((struct __vxge_hw_blockpool_entry *)p)->dma_addr, |
2433 | ((struct __vxge_hw_blockpool_entry *)p)->length, | 2433 | ((struct __vxge_hw_blockpool_entry *)p)->length, |
2434 | PCI_DMA_BIDIRECTIONAL); | 2434 | PCI_DMA_BIDIRECTIONAL); |
2435 | 2435 | ||
2436 | vxge_os_dma_free( | 2436 | vxge_os_dma_free( |
2437 | ((struct __vxge_hw_device *)blockpool->hldev)->pdev, | 2437 | (blockpool->hldev)->pdev, |
2438 | ((struct __vxge_hw_blockpool_entry *)p)->memblock, | 2438 | ((struct __vxge_hw_blockpool_entry *)p)->memblock, |
2439 | &((struct __vxge_hw_blockpool_entry *)p)->acc_handle); | 2439 | &((struct __vxge_hw_blockpool_entry *)p)->acc_handle); |
2440 | 2440 | ||
@@ -4059,7 +4059,7 @@ __vxge_hw_vpath_sw_reset(struct __vxge_hw_device *hldev, u32 vp_id) | |||
4059 | enum vxge_hw_status status = VXGE_HW_OK; | 4059 | enum vxge_hw_status status = VXGE_HW_OK; |
4060 | struct __vxge_hw_virtualpath *vpath; | 4060 | struct __vxge_hw_virtualpath *vpath; |
4061 | 4061 | ||
4062 | vpath = (struct __vxge_hw_virtualpath *)&hldev->virtual_paths[vp_id]; | 4062 | vpath = &hldev->virtual_paths[vp_id]; |
4063 | 4063 | ||
4064 | if (vpath->ringh) { | 4064 | if (vpath->ringh) { |
4065 | status = __vxge_hw_ring_reset(vpath->ringh); | 4065 | status = __vxge_hw_ring_reset(vpath->ringh); |
diff --git a/drivers/net/ethernet/neterion/vxge/vxge-config.h b/drivers/net/ethernet/neterion/vxge/vxge-config.h index 5046a64f0fe8..9e0c1eed5dc5 100644 --- a/drivers/net/ethernet/neterion/vxge/vxge-config.h +++ b/drivers/net/ethernet/neterion/vxge/vxge-config.h | |||
@@ -1922,7 +1922,7 @@ realloc: | |||
1922 | /* misaligned, free current one and try allocating | 1922 | /* misaligned, free current one and try allocating |
1923 | * size + VXGE_CACHE_LINE_SIZE memory | 1923 | * size + VXGE_CACHE_LINE_SIZE memory |
1924 | */ | 1924 | */ |
1925 | kfree((void *) vaddr); | 1925 | kfree(vaddr); |
1926 | size += VXGE_CACHE_LINE_SIZE; | 1926 | size += VXGE_CACHE_LINE_SIZE; |
1927 | realloc_flag = 1; | 1927 | realloc_flag = 1; |
1928 | goto realloc; | 1928 | goto realloc; |
diff --git a/drivers/net/ethernet/neterion/vxge/vxge-main.c b/drivers/net/ethernet/neterion/vxge/vxge-main.c index 51387c31914b..2578eb1f025d 100644 --- a/drivers/net/ethernet/neterion/vxge/vxge-main.c +++ b/drivers/net/ethernet/neterion/vxge/vxge-main.c | |||
@@ -1134,7 +1134,7 @@ static void vxge_set_multicast(struct net_device *dev) | |||
1134 | "%s:%d", __func__, __LINE__); | 1134 | "%s:%d", __func__, __LINE__); |
1135 | 1135 | ||
1136 | vdev = netdev_priv(dev); | 1136 | vdev = netdev_priv(dev); |
1137 | hldev = (struct __vxge_hw_device *)vdev->devh; | 1137 | hldev = vdev->devh; |
1138 | 1138 | ||
1139 | if (unlikely(!is_vxge_card_up(vdev))) | 1139 | if (unlikely(!is_vxge_card_up(vdev))) |
1140 | return; | 1140 | return; |
@@ -3989,16 +3989,16 @@ static void __devinit vxge_print_parm(struct vxgedev *vdev, u64 vpath_mask) | |||
3989 | continue; | 3989 | continue; |
3990 | vxge_debug_ll_config(VXGE_TRACE, | 3990 | vxge_debug_ll_config(VXGE_TRACE, |
3991 | "%s: MTU size - %d", vdev->ndev->name, | 3991 | "%s: MTU size - %d", vdev->ndev->name, |
3992 | ((struct __vxge_hw_device *)(vdev->devh))-> | 3992 | ((vdev->devh))-> |
3993 | config.vp_config[i].mtu); | 3993 | config.vp_config[i].mtu); |
3994 | vxge_debug_init(VXGE_TRACE, | 3994 | vxge_debug_init(VXGE_TRACE, |
3995 | "%s: VLAN tag stripping %s", vdev->ndev->name, | 3995 | "%s: VLAN tag stripping %s", vdev->ndev->name, |
3996 | ((struct __vxge_hw_device *)(vdev->devh))-> | 3996 | ((vdev->devh))-> |
3997 | config.vp_config[i].rpa_strip_vlan_tag | 3997 | config.vp_config[i].rpa_strip_vlan_tag |
3998 | ? "Enabled" : "Disabled"); | 3998 | ? "Enabled" : "Disabled"); |
3999 | vxge_debug_ll_config(VXGE_TRACE, | 3999 | vxge_debug_ll_config(VXGE_TRACE, |
4000 | "%s: Max frags : %d", vdev->ndev->name, | 4000 | "%s: Max frags : %d", vdev->ndev->name, |
4001 | ((struct __vxge_hw_device *)(vdev->devh))-> | 4001 | ((vdev->devh))-> |
4002 | config.vp_config[i].fifo.max_frags); | 4002 | config.vp_config[i].fifo.max_frags); |
4003 | break; | 4003 | break; |
4004 | } | 4004 | } |
diff --git a/drivers/net/ethernet/neterion/vxge/vxge-traffic.c b/drivers/net/ethernet/neterion/vxge/vxge-traffic.c index 5954fa264da1..99749bd07d72 100644 --- a/drivers/net/ethernet/neterion/vxge/vxge-traffic.c +++ b/drivers/net/ethernet/neterion/vxge/vxge-traffic.c | |||
@@ -533,8 +533,7 @@ __vxge_hw_device_handle_error(struct __vxge_hw_device *hldev, u32 vp_id, | |||
533 | 533 | ||
534 | /* notify driver */ | 534 | /* notify driver */ |
535 | if (hldev->uld_callbacks->crit_err) | 535 | if (hldev->uld_callbacks->crit_err) |
536 | hldev->uld_callbacks->crit_err( | 536 | hldev->uld_callbacks->crit_err(hldev, |
537 | (struct __vxge_hw_device *)hldev, | ||
538 | type, vp_id); | 537 | type, vp_id); |
539 | out: | 538 | out: |
540 | 539 | ||
@@ -1322,7 +1321,7 @@ enum vxge_hw_status vxge_hw_ring_rxd_next_completed( | |||
1322 | /* check whether it is not the end */ | 1321 | /* check whether it is not the end */ |
1323 | if (!own || *t_code == VXGE_HW_RING_T_CODE_FRM_DROP) { | 1322 | if (!own || *t_code == VXGE_HW_RING_T_CODE_FRM_DROP) { |
1324 | 1323 | ||
1325 | vxge_assert(((struct vxge_hw_ring_rxd_1 *)rxdp)->host_control != | 1324 | vxge_assert((rxdp)->host_control != |
1326 | 0); | 1325 | 0); |
1327 | 1326 | ||
1328 | ++ring->cmpl_cnt; | 1327 | ++ring->cmpl_cnt; |