]> git.openfabrics.org - ~shefty/rdma-dev.git/commitdiff
drivers: net: Remove casts to same type
authorJoe Perches <joe@perches.com>
Mon, 4 Jun 2012 12:44:18 +0000 (12:44 +0000)
committerDavid S. Miller <davem@davemloft.net>
Wed, 6 Jun 2012 16:31:33 +0000 (09:31 -0700)
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>
13 files changed:
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

index dd5e04813b7623cf2125dcdf41e3da8848c6b9c5..545c09ed9079baead2abff5ad9b309a5a0856cac 100644 (file)
@@ -936,7 +936,7 @@ static int cops_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
 {
         struct cops_local *lp = netdev_priv(dev);
         struct sockaddr_at *sa = (struct sockaddr_at *)&ifr->ifr_addr;
-        struct atalk_addr *aa = (struct atalk_addr *)&lp->node_addr;
+        struct atalk_addr *aa = &lp->node_addr;
 
         switch(cmd)
         {
index 3f88473423e9c5e40005c4cb1c781dbbba70faba..ea3143895e6dfafaf2a8823c0fa54801902055ce 100644 (file)
@@ -597,7 +597,7 @@ static int __devinit bfin_can_probe(struct platform_device *pdev)
        dev_info(&pdev->dev,
                "%s device registered"
                "(&reg_base=%p, rx_irq=%d, tx_irq=%d, err_irq=%d, sclk=%d)\n",
-               DRV_NAME, (void *)priv->membase, priv->rx_irq,
+               DRV_NAME, priv->membase, priv->rx_irq,
                priv->tx_irq, priv->err_irq, priv->can.clock.freq);
        return 0;
 
index 346785c56a2579956d664da920f5c62bd3c13056..9120a36ec7025294c84732eaef7e3635f43f0c6b 100644 (file)
@@ -1020,8 +1020,7 @@ static int __devinit mcp251x_can_probe(struct spi_device *spi)
                                                      GFP_DMA);
 
                if (priv->spi_tx_buf) {
-                       priv->spi_rx_buf = (u8 *)(priv->spi_tx_buf +
-                                                 (PAGE_SIZE / 2));
+                       priv->spi_rx_buf = (priv->spi_tx_buf + (PAGE_SIZE / 2));
                        priv->spi_rx_dma = (dma_addr_t)(priv->spi_tx_dma +
                                                        (PAGE_SIZE / 2));
                } else {
index 4ad80f7710995ba831e94800eb4be0b4f07c7f69..6695a1dadf4e32d592118feea843eb33aaa5f327 100644 (file)
@@ -2962,7 +2962,7 @@ static int dfx_rcv_init(DFX_board_t *bp, int get_buffers)
                        bp->descr_block_virt->rcv_data[i+j].long_0 = (u32) (PI_RCV_DESCR_M_SOP |
                                ((PI_RCV_DATA_K_SIZE_MAX / PI_ALIGN_K_RCV_DATA_BUFF) << PI_RCV_DESCR_V_SEG_LEN));
                        bp->descr_block_virt->rcv_data[i+j].long_1 = (u32) (bp->rcv_block_phys + (i * PI_RCV_DATA_K_SIZE_MAX));
-                       bp->p_rcv_buff_va[i+j] = (char *) (bp->rcv_block_virt + (i * PI_RCV_DATA_K_SIZE_MAX));
+                       bp->p_rcv_buff_va[i+j] = (bp->rcv_block_virt + (i * PI_RCV_DATA_K_SIZE_MAX));
                        }
 #endif
        }
@@ -3030,7 +3030,7 @@ static void dfx_rcv_queue_process(
 #ifdef DYNAMIC_BUFFERS
                p_buff = (char *) (((struct sk_buff *)bp->p_rcv_buff_va[entry])->data);
 #else
-               p_buff = (char *) bp->p_rcv_buff_va[entry];
+               p_buff = bp->p_rcv_buff_va[entry];
 #endif
                memcpy(&descr, p_buff + RCV_BUFF_K_DESCR, sizeof(u32));
 
index 9ac4665d7411323e4dd2f7514b1f000e7755770c..24d8566cfd8b98cdd50540b09b19c9287757e914 100644 (file)
@@ -1242,7 +1242,7 @@ static int smt_set_para(struct s_smc *smc, struct smt_para *pa, int index,
                        if (len < 8)
                                goto len_error ;
                        if (set)
-                               memcpy((char *) to,(char *) from+2,6) ;
+                               memcpy(to,from+2,6) ;
                        to += 8 ;
                        from += 8 ;
                        len -= 8 ;
@@ -1251,7 +1251,7 @@ static int smt_set_para(struct s_smc *smc, struct smt_para *pa, int index,
                        if (len < 4)
                                goto len_error ;
                        if (set)
-                               memcpy((char *) to,(char *) from,4) ;
+                               memcpy(to,from,4) ;
                        to += 4 ;
                        from += 4 ;
                        len -= 4 ;
@@ -1260,7 +1260,7 @@ static int smt_set_para(struct s_smc *smc, struct smt_para *pa, int index,
                        if (len < 8)
                                goto len_error ;
                        if (set)
-                               memcpy((char *) to,(char *) from,8) ;
+                               memcpy(to,from,8) ;
                        to += 8 ;
                        from += 8 ;
                        len -= 8 ;
@@ -1269,7 +1269,7 @@ static int smt_set_para(struct s_smc *smc, struct smt_para *pa, int index,
                        if (len < 32)
                                goto len_error ;
                        if (set)
-                               memcpy((char *) to,(char *) from,32) ;
+                               memcpy(to,from,32) ;
                        to += 32 ;
                        from += 32 ;
                        len -= 32 ;
index aed1a6105b24d01dc339cdfe9e9f68ad19b1ada2..2c0894a92abd65cad7807b9f24cbce2b224e4afe 100644 (file)
@@ -485,7 +485,7 @@ static void ax_encaps(struct net_device *dev, unsigned char *icp, int len)
 
                        return;
                default:
-                       count = kiss_esc(p, (unsigned char *)ax->xbuff, len);
+                       count = kiss_esc(p, ax->xbuff, len);
                }
        } else {
                unsigned short crc;
@@ -497,7 +497,7 @@ static void ax_encaps(struct net_device *dev, unsigned char *icp, int len)
                case CRC_MODE_SMACK:
                        *p |= 0x80;
                        crc = swab16(crc16(0, p, len));
-                       count = kiss_esc_crc(p, (unsigned char *)ax->xbuff, crc, len+2);
+                       count = kiss_esc_crc(p, ax->xbuff, crc, len+2);
                        break;
                case CRC_MODE_FLEX_TEST:
                        ax->crcmode = CRC_MODE_NONE;
@@ -506,11 +506,11 @@ static void ax_encaps(struct net_device *dev, unsigned char *icp, int len)
                case CRC_MODE_FLEX:
                        *p |= 0x20;
                        crc = calc_crc_flex(p, len);
-                       count = kiss_esc_crc(p, (unsigned char *)ax->xbuff, crc, len+2);
+                       count = kiss_esc_crc(p, ax->xbuff, crc, len+2);
                        break;
 
                default:
-                       count = kiss_esc(p, (unsigned char *)ax->xbuff, len);
+                       count = kiss_esc(p, ax->xbuff, len);
                }
        }
        spin_unlock_bh(&ax->buflock);
index 8b919471472fb1dba4d34ffcf0bfe5b4c723af7b..4363c76e0d6358ed0bb0629429202065dbef7340 100644 (file)
@@ -614,7 +614,7 @@ retry_send_cmplt:
 static void netvsc_receive_completion(void *context)
 {
        struct hv_netvsc_packet *packet = context;
-       struct hv_device *device = (struct hv_device *)packet->device;
+       struct hv_device *device = packet->device;
        struct netvsc_device *net_device;
        u64 transaction_id = 0;
        bool fsend_receive_comp = false;
index dcc80d652b78bea2dbc70a016f0914fe87ccd320..84872043b5c65be8b0d2e77bc596ee07fae52ce5 100644 (file)
@@ -1017,7 +1017,7 @@ static void ali_ircc_fir_change_speed(struct ali_ircc_cb *priv, __u32 baud)
 {
                
        int iobase; 
-       struct ali_ircc_cb *self = (struct ali_ircc_cb *) priv;
+       struct ali_ircc_cb *self = priv;
        struct net_device *dev;
 
        IRDA_DEBUG(1, "%s(), ---------------- Start ----------------\n", __func__ );
@@ -1052,7 +1052,7 @@ static void ali_ircc_fir_change_speed(struct ali_ircc_cb *priv, __u32 baud)
  */
 static void ali_ircc_sir_change_speed(struct ali_ircc_cb *priv, __u32 speed)
 {
-       struct ali_ircc_cb *self = (struct ali_ircc_cb *) priv;
+       struct ali_ircc_cb *self = priv;
        unsigned long flags;
        int iobase; 
        int fcr;    /* FIFO control reg */
@@ -1121,7 +1121,7 @@ static void ali_ircc_sir_change_speed(struct ali_ircc_cb *priv, __u32 speed)
 static void ali_ircc_change_dongle_speed(struct ali_ircc_cb *priv, int speed)
 {
        
-       struct ali_ircc_cb *self = (struct ali_ircc_cb *) priv;
+       struct ali_ircc_cb *self = priv;
        int iobase,dongle_id;
        int tmp = 0;
                        
index fc503aa5288e3f164843f754c6977abf4345705c..e09417df8f39bed4aeebb2f1c6bc2b34cce9e8ed 100644 (file)
@@ -794,7 +794,7 @@ static int __devinit au1k_irda_net_init(struct net_device *dev)
 
        /* allocate the data buffers */
        aup->db[0].vaddr =
-               (void *)dma_alloc(MAX_BUF_SIZE * 2 * NUM_IR_DESC, &temp);
+               dma_alloc(MAX_BUF_SIZE * 2 * NUM_IR_DESC, &temp);
        if (!aup->db[0].vaddr)
                goto out3;
 
index d4c9db3da22a0c8b6c0561e9d3afb5f10b879c98..a34d6bf5e43b5b29325215e358cca9ee3fc734ee 100644 (file)
@@ -390,10 +390,10 @@ static void sl_encaps(struct slip *sl, unsigned char *icp, int len)
 #endif
 #ifdef CONFIG_SLIP_MODE_SLIP6
        if (sl->mode & SL_MODE_SLIP6)
-               count = slip_esc6(p, (unsigned char *) sl->xbuff, len);
+               count = slip_esc6(p, sl->xbuff, len);
        else
 #endif
-               count = slip_esc(p, (unsigned char *) sl->xbuff, len);
+               count = slip_esc(p, sl->xbuff, len);
 
        /* Order of next two lines is *very* important.
         * When we are sending a little amount of data,
index 3f04ba0a5454cabb470db7bd2db1ffd437401bf3..93e0cfb739b89b3f53964e6596c5b36e804b4a1b 100644 (file)
@@ -1037,7 +1037,7 @@ vmxnet3_tq_xmit(struct sk_buff *skb, struct vmxnet3_tx_queue *tq,
 #endif
        dev_dbg(&adapter->netdev->dev,
                "txd[%u]: SOP 0x%Lx 0x%x 0x%x\n",
-               (u32)((union Vmxnet3_GenericDesc *)ctx.sop_txd -
+               (u32)(ctx.sop_txd -
                tq->tx_ring.base), le64_to_cpu(gdesc->txd.addr),
                le32_to_cpu(gdesc->dword[2]), le32_to_cpu(gdesc->dword[3]));
 
index d7a65e141d1a0bff90f9d3f1d691fb7876226ba7..44db8b75a531dd1f00a29f89651c97d496cfe881 100644 (file)
@@ -231,7 +231,7 @@ static void x25_asy_encaps(struct x25_asy *sl, unsigned char *icp, int len)
        }
 
        p = icp;
-       count = x25_asy_esc(p, (unsigned char *) sl->xbuff, len);
+       count = x25_asy_esc(p, sl->xbuff, len);
 
        /* Order of next two lines is *very* important.
         * When we are sending a little amount of data,
index 7cbd7d231e11f4efde628650bc4e6843939fbe25..d09e44970e637c3a6600b28d070896009bf9341d 100644 (file)
@@ -1268,7 +1268,7 @@ int i2400m_fw_check(struct i2400m *i2400m, const void *bcf, size_t bcf_size)
                size_t leftover, offset, header_len, size;
 
                leftover = top - itr;
-               offset = itr - (const void *) bcf;
+               offset = itr - bcf;
                if (leftover <= sizeof(*bcf_hdr)) {
                        dev_err(dev, "firmware %s: %zu B left at @%zx, "
                                "not enough for BCF header\n",