Commit c2fd03a0115a244c5f622453b2b1f038ed5700a6
Committed by
David S. Miller
1 parent
2c208890c6
Exists in
smarc-l5.0.0_1.0.0-ga
and in
5 other branches
drivers: net: 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 Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Showing 13 changed files with 23 additions and 24 deletions Side-by-side Diff
- drivers/net/appletalk/cops.c
- drivers/net/can/bfin_can.c
- drivers/net/can/mcp251x.c
- drivers/net/fddi/defxx.c
- drivers/net/fddi/skfp/pmf.c
- drivers/net/hamradio/mkiss.c
- drivers/net/hyperv/netvsc.c
- drivers/net/irda/ali-ircc.c
- drivers/net/irda/au1k_ir.c
- drivers/net/slip/slip.c
- drivers/net/vmxnet3/vmxnet3_drv.c
- drivers/net/wan/x25_asy.c
- drivers/net/wimax/i2400m/fw.c
drivers/net/appletalk/cops.c
... | ... | @@ -936,7 +936,7 @@ |
936 | 936 | { |
937 | 937 | struct cops_local *lp = netdev_priv(dev); |
938 | 938 | struct sockaddr_at *sa = (struct sockaddr_at *)&ifr->ifr_addr; |
939 | - struct atalk_addr *aa = (struct atalk_addr *)&lp->node_addr; | |
939 | + struct atalk_addr *aa = &lp->node_addr; | |
940 | 940 | |
941 | 941 | switch(cmd) |
942 | 942 | { |
drivers/net/can/bfin_can.c
... | ... | @@ -597,7 +597,7 @@ |
597 | 597 | dev_info(&pdev->dev, |
598 | 598 | "%s device registered" |
599 | 599 | "(®_base=%p, rx_irq=%d, tx_irq=%d, err_irq=%d, sclk=%d)\n", |
600 | - DRV_NAME, (void *)priv->membase, priv->rx_irq, | |
600 | + DRV_NAME, priv->membase, priv->rx_irq, | |
601 | 601 | priv->tx_irq, priv->err_irq, priv->can.clock.freq); |
602 | 602 | return 0; |
603 | 603 |
drivers/net/can/mcp251x.c
... | ... | @@ -1020,8 +1020,7 @@ |
1020 | 1020 | GFP_DMA); |
1021 | 1021 | |
1022 | 1022 | if (priv->spi_tx_buf) { |
1023 | - priv->spi_rx_buf = (u8 *)(priv->spi_tx_buf + | |
1024 | - (PAGE_SIZE / 2)); | |
1023 | + priv->spi_rx_buf = (priv->spi_tx_buf + (PAGE_SIZE / 2)); | |
1025 | 1024 | priv->spi_rx_dma = (dma_addr_t)(priv->spi_tx_dma + |
1026 | 1025 | (PAGE_SIZE / 2)); |
1027 | 1026 | } else { |
drivers/net/fddi/defxx.c
... | ... | @@ -2962,7 +2962,7 @@ |
2962 | 2962 | bp->descr_block_virt->rcv_data[i+j].long_0 = (u32) (PI_RCV_DESCR_M_SOP | |
2963 | 2963 | ((PI_RCV_DATA_K_SIZE_MAX / PI_ALIGN_K_RCV_DATA_BUFF) << PI_RCV_DESCR_V_SEG_LEN)); |
2964 | 2964 | bp->descr_block_virt->rcv_data[i+j].long_1 = (u32) (bp->rcv_block_phys + (i * PI_RCV_DATA_K_SIZE_MAX)); |
2965 | - bp->p_rcv_buff_va[i+j] = (char *) (bp->rcv_block_virt + (i * PI_RCV_DATA_K_SIZE_MAX)); | |
2965 | + bp->p_rcv_buff_va[i+j] = (bp->rcv_block_virt + (i * PI_RCV_DATA_K_SIZE_MAX)); | |
2966 | 2966 | } |
2967 | 2967 | #endif |
2968 | 2968 | } |
... | ... | @@ -3030,7 +3030,7 @@ |
3030 | 3030 | #ifdef DYNAMIC_BUFFERS |
3031 | 3031 | p_buff = (char *) (((struct sk_buff *)bp->p_rcv_buff_va[entry])->data); |
3032 | 3032 | #else |
3033 | - p_buff = (char *) bp->p_rcv_buff_va[entry]; | |
3033 | + p_buff = bp->p_rcv_buff_va[entry]; | |
3034 | 3034 | #endif |
3035 | 3035 | memcpy(&descr, p_buff + RCV_BUFF_K_DESCR, sizeof(u32)); |
3036 | 3036 |
drivers/net/fddi/skfp/pmf.c
... | ... | @@ -1242,7 +1242,7 @@ |
1242 | 1242 | if (len < 8) |
1243 | 1243 | goto len_error ; |
1244 | 1244 | if (set) |
1245 | - memcpy((char *) to,(char *) from+2,6) ; | |
1245 | + memcpy(to,from+2,6) ; | |
1246 | 1246 | to += 8 ; |
1247 | 1247 | from += 8 ; |
1248 | 1248 | len -= 8 ; |
... | ... | @@ -1251,7 +1251,7 @@ |
1251 | 1251 | if (len < 4) |
1252 | 1252 | goto len_error ; |
1253 | 1253 | if (set) |
1254 | - memcpy((char *) to,(char *) from,4) ; | |
1254 | + memcpy(to,from,4) ; | |
1255 | 1255 | to += 4 ; |
1256 | 1256 | from += 4 ; |
1257 | 1257 | len -= 4 ; |
... | ... | @@ -1260,7 +1260,7 @@ |
1260 | 1260 | if (len < 8) |
1261 | 1261 | goto len_error ; |
1262 | 1262 | if (set) |
1263 | - memcpy((char *) to,(char *) from,8) ; | |
1263 | + memcpy(to,from,8) ; | |
1264 | 1264 | to += 8 ; |
1265 | 1265 | from += 8 ; |
1266 | 1266 | len -= 8 ; |
... | ... | @@ -1269,7 +1269,7 @@ |
1269 | 1269 | if (len < 32) |
1270 | 1270 | goto len_error ; |
1271 | 1271 | if (set) |
1272 | - memcpy((char *) to,(char *) from,32) ; | |
1272 | + memcpy(to,from,32) ; | |
1273 | 1273 | to += 32 ; |
1274 | 1274 | from += 32 ; |
1275 | 1275 | len -= 32 ; |
drivers/net/hamradio/mkiss.c
... | ... | @@ -485,7 +485,7 @@ |
485 | 485 | |
486 | 486 | return; |
487 | 487 | default: |
488 | - count = kiss_esc(p, (unsigned char *)ax->xbuff, len); | |
488 | + count = kiss_esc(p, ax->xbuff, len); | |
489 | 489 | } |
490 | 490 | } else { |
491 | 491 | unsigned short crc; |
... | ... | @@ -497,7 +497,7 @@ |
497 | 497 | case CRC_MODE_SMACK: |
498 | 498 | *p |= 0x80; |
499 | 499 | crc = swab16(crc16(0, p, len)); |
500 | - count = kiss_esc_crc(p, (unsigned char *)ax->xbuff, crc, len+2); | |
500 | + count = kiss_esc_crc(p, ax->xbuff, crc, len+2); | |
501 | 501 | break; |
502 | 502 | case CRC_MODE_FLEX_TEST: |
503 | 503 | ax->crcmode = CRC_MODE_NONE; |
504 | 504 | |
... | ... | @@ -506,11 +506,11 @@ |
506 | 506 | case CRC_MODE_FLEX: |
507 | 507 | *p |= 0x20; |
508 | 508 | crc = calc_crc_flex(p, len); |
509 | - count = kiss_esc_crc(p, (unsigned char *)ax->xbuff, crc, len+2); | |
509 | + count = kiss_esc_crc(p, ax->xbuff, crc, len+2); | |
510 | 510 | break; |
511 | 511 | |
512 | 512 | default: |
513 | - count = kiss_esc(p, (unsigned char *)ax->xbuff, len); | |
513 | + count = kiss_esc(p, ax->xbuff, len); | |
514 | 514 | } |
515 | 515 | } |
516 | 516 | spin_unlock_bh(&ax->buflock); |
drivers/net/hyperv/netvsc.c
... | ... | @@ -614,7 +614,7 @@ |
614 | 614 | static void netvsc_receive_completion(void *context) |
615 | 615 | { |
616 | 616 | struct hv_netvsc_packet *packet = context; |
617 | - struct hv_device *device = (struct hv_device *)packet->device; | |
617 | + struct hv_device *device = packet->device; | |
618 | 618 | struct netvsc_device *net_device; |
619 | 619 | u64 transaction_id = 0; |
620 | 620 | bool fsend_receive_comp = false; |
drivers/net/irda/ali-ircc.c
... | ... | @@ -1017,7 +1017,7 @@ |
1017 | 1017 | { |
1018 | 1018 | |
1019 | 1019 | int iobase; |
1020 | - struct ali_ircc_cb *self = (struct ali_ircc_cb *) priv; | |
1020 | + struct ali_ircc_cb *self = priv; | |
1021 | 1021 | struct net_device *dev; |
1022 | 1022 | |
1023 | 1023 | IRDA_DEBUG(1, "%s(), ---------------- Start ----------------\n", __func__ ); |
... | ... | @@ -1052,7 +1052,7 @@ |
1052 | 1052 | */ |
1053 | 1053 | static void ali_ircc_sir_change_speed(struct ali_ircc_cb *priv, __u32 speed) |
1054 | 1054 | { |
1055 | - struct ali_ircc_cb *self = (struct ali_ircc_cb *) priv; | |
1055 | + struct ali_ircc_cb *self = priv; | |
1056 | 1056 | unsigned long flags; |
1057 | 1057 | int iobase; |
1058 | 1058 | int fcr; /* FIFO control reg */ |
... | ... | @@ -1121,7 +1121,7 @@ |
1121 | 1121 | static void ali_ircc_change_dongle_speed(struct ali_ircc_cb *priv, int speed) |
1122 | 1122 | { |
1123 | 1123 | |
1124 | - struct ali_ircc_cb *self = (struct ali_ircc_cb *) priv; | |
1124 | + struct ali_ircc_cb *self = priv; | |
1125 | 1125 | int iobase,dongle_id; |
1126 | 1126 | int tmp = 0; |
1127 | 1127 |
drivers/net/irda/au1k_ir.c
drivers/net/slip/slip.c
... | ... | @@ -390,10 +390,10 @@ |
390 | 390 | #endif |
391 | 391 | #ifdef CONFIG_SLIP_MODE_SLIP6 |
392 | 392 | if (sl->mode & SL_MODE_SLIP6) |
393 | - count = slip_esc6(p, (unsigned char *) sl->xbuff, len); | |
393 | + count = slip_esc6(p, sl->xbuff, len); | |
394 | 394 | else |
395 | 395 | #endif |
396 | - count = slip_esc(p, (unsigned char *) sl->xbuff, len); | |
396 | + count = slip_esc(p, sl->xbuff, len); | |
397 | 397 | |
398 | 398 | /* Order of next two lines is *very* important. |
399 | 399 | * When we are sending a little amount of data, |
drivers/net/vmxnet3/vmxnet3_drv.c
... | ... | @@ -1037,7 +1037,7 @@ |
1037 | 1037 | #endif |
1038 | 1038 | dev_dbg(&adapter->netdev->dev, |
1039 | 1039 | "txd[%u]: SOP 0x%Lx 0x%x 0x%x\n", |
1040 | - (u32)((union Vmxnet3_GenericDesc *)ctx.sop_txd - | |
1040 | + (u32)(ctx.sop_txd - | |
1041 | 1041 | tq->tx_ring.base), le64_to_cpu(gdesc->txd.addr), |
1042 | 1042 | le32_to_cpu(gdesc->dword[2]), le32_to_cpu(gdesc->dword[3])); |
1043 | 1043 |
drivers/net/wan/x25_asy.c
drivers/net/wimax/i2400m/fw.c
... | ... | @@ -1268,7 +1268,7 @@ |
1268 | 1268 | size_t leftover, offset, header_len, size; |
1269 | 1269 | |
1270 | 1270 | leftover = top - itr; |
1271 | - offset = itr - (const void *) bcf; | |
1271 | + offset = itr - bcf; | |
1272 | 1272 | if (leftover <= sizeof(*bcf_hdr)) { |
1273 | 1273 | dev_err(dev, "firmware %s: %zu B left at @%zx, " |
1274 | 1274 | "not enough for BCF header\n", |