]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - net/packet/af_packet.c
Merge master.kernel.org:/pub/scm/linux/kernel/git/davej/cpufreq
[linux-2.6-omap-h63xx.git] / net / packet / af_packet.c
index 444550917bc1f6f89a297cf20868f4b31de4933c..28d47e8f2873e49403d1d6fe20c6fc298470ea3a 100644 (file)
@@ -50,7 +50,6 @@
  */
 
 #include <linux/types.h>
-#include <linux/sched.h>
 #include <linux/mm.h>
 #include <linux/capability.h>
 #include <linux/fcntl.h>
@@ -228,17 +227,14 @@ struct packet_skb_cb {
 
 #ifdef CONFIG_PACKET_MMAP
 
-static inline char *packet_lookup_frame(struct packet_sock *po, unsigned int position)
+static inline struct tpacket_hdr *packet_lookup_frame(struct packet_sock *po, unsigned int position)
 {
        unsigned int pg_vec_pos, frame_offset;
-       char *frame;
 
        pg_vec_pos = position / po->frames_per_block;
        frame_offset = position % po->frames_per_block;
 
-       frame = po->pg_vec[pg_vec_pos] + (frame_offset * po->frame_size);
-
-       return frame;
+       return (struct tpacket_hdr *)(po->pg_vec[pg_vec_pos] + (frame_offset * po->frame_size));
 }
 #endif
 
@@ -640,7 +636,7 @@ static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev, struct packe
        }
 
        spin_lock(&sk->sk_receive_queue.lock);
-       h = (struct tpacket_hdr *)packet_lookup_frame(po, po->head);
+       h = packet_lookup_frame(po, po->head);
 
        if (h->tp_status)
                goto ring_is_full;
@@ -1474,7 +1470,7 @@ static int packet_notifier(struct notifier_block *this, unsigned long msg, void
 {
        struct sock *sk;
        struct hlist_node *node;
-       struct net_device *dev = (struct net_device*)data;
+       struct net_device *dev = data;
 
        read_lock(&packet_sklist_lock);
        sk_for_each(sk, node, &packet_sklist) {
@@ -1589,7 +1585,7 @@ static unsigned int packet_poll(struct file * file, struct socket *sock,
                unsigned last = po->head ? po->head-1 : po->frame_max;
                struct tpacket_hdr *h;
 
-               h = (struct tpacket_hdr *)packet_lookup_frame(po, last);
+               h = packet_lookup_frame(po, last);
 
                if (h->tp_status)
                        mask |= POLLIN | POLLRDNORM;
@@ -1952,7 +1948,7 @@ static int packet_seq_open(struct inode *inode, struct file *file)
        return seq_open(file, &packet_seq_ops);
 }
 
-static struct file_operations packet_seq_fops = {
+static const struct file_operations packet_seq_fops = {
        .owner          = THIS_MODULE,
        .open           = packet_seq_open,
        .read           = seq_read,