aboutsummaryrefslogtreecommitdiffstats
path: root/net/packet
diff options
context:
space:
mode:
authorJason Lunz <lunz@falooley.org>2007-02-21 02:19:54 -0500
committerDavid S. Miller <davem@sunset.davemloft.net>2007-02-26 14:42:45 -0500
commitad930650c0e694233971c56e8de8e78b896e2613 (patch)
treec14d67f354f8d8d93cd1e160f196e08474d43061 /net/packet
parentca17c23345308a8692a65a0cca363d9108a665ca (diff)
[AF_PACKET]: Remove unnecessary casts.
packet_lookup_frame() always returns tpacket_hdr*, so there's no reason to return char* and require casting by callers. Also, remove a cast of void*. Signed-off-by: Jason Lunz <lunz@falooley.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/packet')
-rw-r--r--net/packet/af_packet.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index bf2699074774..28d47e8f2873 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -227,17 +227,14 @@ struct packet_skb_cb {
227 227
228#ifdef CONFIG_PACKET_MMAP 228#ifdef CONFIG_PACKET_MMAP
229 229
230static inline char *packet_lookup_frame(struct packet_sock *po, unsigned int position) 230static inline struct tpacket_hdr *packet_lookup_frame(struct packet_sock *po, unsigned int position)
231{ 231{
232 unsigned int pg_vec_pos, frame_offset; 232 unsigned int pg_vec_pos, frame_offset;
233 char *frame;
234 233
235 pg_vec_pos = position / po->frames_per_block; 234 pg_vec_pos = position / po->frames_per_block;
236 frame_offset = position % po->frames_per_block; 235 frame_offset = position % po->frames_per_block;
237 236
238 frame = po->pg_vec[pg_vec_pos] + (frame_offset * po->frame_size); 237 return (struct tpacket_hdr *)(po->pg_vec[pg_vec_pos] + (frame_offset * po->frame_size));
239
240 return frame;
241} 238}
242#endif 239#endif
243 240
@@ -639,7 +636,7 @@ static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev, struct packe
639 } 636 }
640 637
641 spin_lock(&sk->sk_receive_queue.lock); 638 spin_lock(&sk->sk_receive_queue.lock);
642 h = (struct tpacket_hdr *)packet_lookup_frame(po, po->head); 639 h = packet_lookup_frame(po, po->head);
643 640
644 if (h->tp_status) 641 if (h->tp_status)
645 goto ring_is_full; 642 goto ring_is_full;
@@ -1473,7 +1470,7 @@ static int packet_notifier(struct notifier_block *this, unsigned long msg, void
1473{ 1470{
1474 struct sock *sk; 1471 struct sock *sk;
1475 struct hlist_node *node; 1472 struct hlist_node *node;
1476 struct net_device *dev = (struct net_device*)data; 1473 struct net_device *dev = data;
1477 1474
1478 read_lock(&packet_sklist_lock); 1475 read_lock(&packet_sklist_lock);
1479 sk_for_each(sk, node, &packet_sklist) { 1476 sk_for_each(sk, node, &packet_sklist) {
@@ -1588,7 +1585,7 @@ static unsigned int packet_poll(struct file * file, struct socket *sock,
1588 unsigned last = po->head ? po->head-1 : po->frame_max; 1585 unsigned last = po->head ? po->head-1 : po->frame_max;
1589 struct tpacket_hdr *h; 1586 struct tpacket_hdr *h;
1590 1587
1591 h = (struct tpacket_hdr *)packet_lookup_frame(po, last); 1588 h = packet_lookup_frame(po, last);
1592 1589
1593 if (h->tp_status) 1590 if (h->tp_status)
1594 mask |= POLLIN | POLLRDNORM; 1591 mask |= POLLIN | POLLRDNORM;