]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/net/hamradio/hdlcdrv.c
[IEEE80211]: Fix softmac lockdep reports.
[linux-2.6-omap-h63xx.git] / drivers / net / hamradio / hdlcdrv.c
index b4c836e4fe860d4a4e7fe0d82a52736dd7432f2c..b33adc6a340b055ad8b1a2076331f5697f83a517 100644 (file)
@@ -42,7 +42,6 @@
 
 /*****************************************************************************/
 
-#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/types.h>
 #include <linux/net.h>
 #include <linux/errno.h>
 #include <linux/init.h>
 #include <linux/bitops.h>
-#include <asm/uaccess.h>
 
 #include <linux/netdevice.h>
 #include <linux/if_arp.h>
-#include <linux/etherdevice.h>
 #include <linux/skbuff.h>
 #include <linux/hdlcdrv.h>
-/* prototypes for ax25_encapsulate and ax25_rebuild_header */
+#include <linux/random.h>
 #include <net/ax25.h> 
+#include <asm/uaccess.h>
 
-/* make genksyms happy */
-#include <linux/ip.h>
-#include <linux/udp.h>
-#include <linux/tcp.h>
 #include <linux/crc-ccitt.h>
 
 /* --------------------------------------------------------------------- */
 
-/*
- * The name of the card. Is used for messages and in the requests for
- * io regions, irqs and dma channels
- */
-
-static char ax25_bcast[AX25_ADDR_LEN] =
-{'Q' << 1, 'S' << 1, 'T' << 1, ' ' << 1, ' ' << 1, ' ' << 1, '0' << 1};
-static char ax25_nocall[AX25_ADDR_LEN] =
-{'L' << 1, 'I' << 1, 'N' << 1, 'U' << 1, 'X' << 1, ' ' << 1, '1' << 1};
-
-/* --------------------------------------------------------------------- */
-
 #define KISS_VERBOSE
 
 /* --------------------------------------------------------------------- */
@@ -335,7 +317,9 @@ void hdlcdrv_transmitter(struct net_device *dev, struct hdlcdrv_state *s)
                                dev_kfree_skb_irq(skb);
                                break;
                        }
-                       memcpy(s->hdlctx.buffer, skb->data+1, pkt_len);
+                       skb_copy_from_linear_data_offset(skb, 1,
+                                                        s->hdlctx.buffer,
+                                                        pkt_len);
                        dev_kfree_skb_irq(skb);
                        s->hdlctx.bp = s->hdlctx.buffer;
                        append_crc_ccitt(s->hdlctx.buffer, pkt_len);
@@ -390,16 +374,6 @@ static void start_tx(struct net_device *dev, struct hdlcdrv_state *s)
 
 /* ---------------------------------------------------------------------- */
 
-static unsigned short random_seed;
-
-static inline unsigned short random_num(void)
-{
-       random_seed = 28629 * random_seed + 157;
-       return random_seed;
-}
-
-/* ---------------------------------------------------------------------- */
-
 void hdlcdrv_arbitrate(struct net_device *dev, struct hdlcdrv_state *s)
 {
        if (!s || s->magic != HDLCDRV_MAGIC || s->hdlctx.ptt || !s->skb) 
@@ -415,7 +389,7 @@ void hdlcdrv_arbitrate(struct net_device *dev, struct hdlcdrv_state *s)
        if ((--s->hdlctx.slotcnt) > 0)
                return;
        s->hdlctx.slotcnt = s->ch_params.slottime;
-       if ((random_num() % 256) > s->ch_params.ppersist)
+       if ((random32() % 256) > s->ch_params.ppersist)
                return;
        start_tx(dev, s);
 }
@@ -708,21 +682,16 @@ static void hdlcdrv_setup(struct net_device *dev)
 
        s->skb = NULL;
        
-#if defined(CONFIG_AX25) || defined(CONFIG_AX25_MODULE)
-       dev->hard_header = ax25_encapsulate;
+       dev->hard_header = ax25_hard_header;
        dev->rebuild_header = ax25_rebuild_header;
-#else /* CONFIG_AX25 || CONFIG_AX25_MODULE */
-       dev->hard_header = NULL;
-       dev->rebuild_header = NULL;
-#endif /* CONFIG_AX25 || CONFIG_AX25_MODULE */
        dev->set_mac_address = hdlcdrv_set_mac_address;
        
        dev->type = ARPHRD_AX25;           /* AF_AX25 device */
        dev->hard_header_len = AX25_MAX_HEADER_LEN + AX25_BPQ_HEADER_LEN;
        dev->mtu = AX25_DEF_PACLEN;        /* eth_mtu is the default */
        dev->addr_len = AX25_ADDR_LEN;     /* sizeof an ax.25 address */
-       memcpy(dev->broadcast, ax25_bcast, AX25_ADDR_LEN);
-       memcpy(dev->dev_addr, ax25_nocall, AX25_ADDR_LEN);
+       memcpy(dev->broadcast, &ax25_bcast, AX25_ADDR_LEN);
+       memcpy(dev->dev_addr, &ax25_defaddr, AX25_ADDR_LEN);
        dev->tx_queue_len = 16;
 }