aboutsummaryrefslogtreecommitdiffstats
path: root/net/packet
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2012-06-03 13:41:40 -0400
committerDavid S. Miller <davem@davemloft.net>2012-06-04 11:45:11 -0400
commite3192690a3c889767d1161b228374f4926d92af0 (patch)
treea2acbe06cc2efedb6002055f9d4ffd7f2ba6ec75 /net/packet
parent29a6b6c060445eb46528785d51a2d8b0e6d898c4 (diff)
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 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>
Diffstat (limited to 'net/packet')
-rw-r--r--net/packet/af_packet.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index 0f661745df0f..71ac6559e0c6 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -592,7 +592,7 @@ static void init_prb_bdqc(struct packet_sock *po,
592 p1->knxt_seq_num = 1; 592 p1->knxt_seq_num = 1;
593 p1->pkbdq = pg_vec; 593 p1->pkbdq = pg_vec;
594 pbd = (struct tpacket_block_desc *)pg_vec[0].buffer; 594 pbd = (struct tpacket_block_desc *)pg_vec[0].buffer;
595 p1->pkblk_start = (char *)pg_vec[0].buffer; 595 p1->pkblk_start = pg_vec[0].buffer;
596 p1->kblk_size = req_u->req3.tp_block_size; 596 p1->kblk_size = req_u->req3.tp_block_size;
597 p1->knum_blocks = req_u->req3.tp_block_nr; 597 p1->knum_blocks = req_u->req3.tp_block_nr;
598 p1->hdrlen = po->tp_hdrlen; 598 p1->hdrlen = po->tp_hdrlen;
@@ -824,8 +824,7 @@ static void prb_open_block(struct tpacket_kbdq_core *pkc1,
824 h1->ts_first_pkt.ts_sec = ts.tv_sec; 824 h1->ts_first_pkt.ts_sec = ts.tv_sec;
825 h1->ts_first_pkt.ts_nsec = ts.tv_nsec; 825 h1->ts_first_pkt.ts_nsec = ts.tv_nsec;
826 pkc1->pkblk_start = (char *)pbd1; 826 pkc1->pkblk_start = (char *)pbd1;
827 pkc1->nxt_offset = (char *)(pkc1->pkblk_start + 827 pkc1->nxt_offset = pkc1->pkblk_start + BLK_PLUS_PRIV(pkc1->blk_sizeof_priv);
828 BLK_PLUS_PRIV(pkc1->blk_sizeof_priv));
829 BLOCK_O2FP(pbd1) = (__u32)BLK_PLUS_PRIV(pkc1->blk_sizeof_priv); 828 BLOCK_O2FP(pbd1) = (__u32)BLK_PLUS_PRIV(pkc1->blk_sizeof_priv);
830 BLOCK_O2PRIV(pbd1) = BLK_HDR_LEN; 829 BLOCK_O2PRIV(pbd1) = BLK_HDR_LEN;
831 pbd1->version = pkc1->version; 830 pbd1->version = pkc1->version;
@@ -1018,7 +1017,7 @@ static void *__packet_lookup_frame_in_block(struct packet_sock *po,
1018 struct tpacket_block_desc *pbd; 1017 struct tpacket_block_desc *pbd;
1019 char *curr, *end; 1018 char *curr, *end;
1020 1019
1021 pkc = GET_PBDQC_FROM_RB(((struct packet_ring_buffer *)&po->rx_ring)); 1020 pkc = GET_PBDQC_FROM_RB(&po->rx_ring);
1022 pbd = GET_CURR_PBLOCK_DESC_FROM_CORE(pkc); 1021 pbd = GET_CURR_PBLOCK_DESC_FROM_CORE(pkc);
1023 1022
1024 /* Queue is frozen when user space is lagging behind */ 1023 /* Queue is frozen when user space is lagging behind */
@@ -1044,7 +1043,7 @@ static void *__packet_lookup_frame_in_block(struct packet_sock *po,
1044 smp_mb(); 1043 smp_mb();
1045 curr = pkc->nxt_offset; 1044 curr = pkc->nxt_offset;
1046 pkc->skb = skb; 1045 pkc->skb = skb;
1047 end = (char *) ((char *)pbd + pkc->kblk_size); 1046 end = (char *)pbd + pkc->kblk_size;
1048 1047
1049 /* first try the current block */ 1048 /* first try the current block */
1050 if (curr+TOTAL_PKT_LEN_INCL_ALIGN(len) < end) { 1049 if (curr+TOTAL_PKT_LEN_INCL_ALIGN(len) < end) {