]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/net/hamradio/yam.c
mmc: struct device - replace bus_id with dev_name(), dev_set_name()
[linux-2.6-omap-h63xx.git] / drivers / net / hamradio / yam.c
index 6d74f08720d5cf0e53656dfb5a00dfa03579f235..1c942862a3f4944710de74c546cba66943b8b81a 100644 (file)
@@ -50,6 +50,7 @@
 #include <linux/slab.h>
 #include <linux/errno.h>
 #include <linux/bitops.h>
+#include <linux/random.h>
 #include <asm/io.h>
 #include <asm/system.h>
 #include <linux/interrupt.h>
@@ -64,6 +65,7 @@
 #include <linux/kernel.h>
 #include <linux/proc_fs.h>
 #include <linux/seq_file.h>
+#include <net/net_namespace.h>
 
 #include <asm/uaccess.h>
 #include <linux/init.h>
@@ -566,14 +568,6 @@ static void yam_start_tx(struct net_device *dev, struct yam_port *yp)
        ptt_on(dev);
 }
 
-static unsigned short random_seed;
-
-static inline unsigned short random_num(void)
-{
-       random_seed = 28629 * random_seed + 157;
-       return random_seed;
-}
-
 static void yam_arbitrate(struct net_device *dev)
 {
        struct yam_port *yp = netdev_priv(dev);
@@ -600,7 +594,7 @@ static void yam_arbitrate(struct net_device *dev)
        yp->slotcnt = yp->slot / 10;
 
        /* is random > persist ? */
-       if ((random_num() % 256) > yp->pers)
+       if ((random32() % 256) > yp->pers)
                return;
 
        yam_start_tx(dev, yp);
@@ -645,7 +639,9 @@ static void yam_tx_byte(struct net_device *dev, struct yam_port *yp)
                                dev_kfree_skb_any(skb);
                                break;
                        }
-                       memcpy(yp->tx_buf, skb->data + 1, yp->tx_len);
+                       skb_copy_from_linear_data_offset(skb, 1,
+                                                        yp->tx_buf,
+                                                        yp->tx_len);
                        dev_kfree_skb_any(skb);
                        yp->tx_count = 0;
                        yp->tx_crcl = 0x21;
@@ -804,7 +800,7 @@ static int yam_info_open(struct inode *inode, struct file *file)
        return seq_open(file, &yam_seqops);
 }
 
-static struct file_operations yam_info_fops = {
+static const struct file_operations yam_info_fops = {
        .owner = THIS_MODULE,
        .open = yam_info_open,
        .read = seq_read,
@@ -1101,8 +1097,7 @@ static void yam_setup(struct net_device *dev)
 
        skb_queue_head_init(&yp->send_queue);
 
-       dev->hard_header = ax25_hard_header;
-       dev->rebuild_header = ax25_rebuild_header;
+       dev->header_ops = &ax25_header_ops;
 
        dev->set_mac_address = yam_set_mac_address;
 
@@ -1147,7 +1142,7 @@ static int __init yam_init_driver(void)
        yam_timer.expires = jiffies + HZ / 100;
        add_timer(&yam_timer);
 
-       proc_net_fops_create("yam", S_IRUGO, &yam_info_fops);
+       proc_net_fops_create(&init_net, "yam", S_IRUGO, &yam_info_fops);
        return 0;
  error:
        while (--i >= 0) {
@@ -1179,7 +1174,7 @@ static void __exit yam_cleanup_driver(void)
                kfree(p);
        }
 
-       proc_net_remove("yam");
+       proc_net_remove(&init_net, "yam");
 }
 
 /* --------------------------------------------------------------------- */