X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=drivers%2Fnet%2Fhamradio%2Fscc.c;h=5927784df3f9373a035e4003c3758c9d56d44b3c;hb=43bc926fffd92024b46cafaf7350d669ba9ca884;hp=0e6844fc339bd3a24e55bfc8e578d29f913c9984;hpb=5273a3df6485dc2ad6aa7ddd441b9a21970f003b;p=linux-2.6.git diff --git a/drivers/net/hamradio/scc.c b/drivers/net/hamradio/scc.c index 0e6844fc3..5927784df 100644 --- a/drivers/net/hamradio/scc.c +++ b/drivers/net/hamradio/scc.c @@ -7,7 +7,7 @@ * ------------------ * * You can find a subset of the documentation in - * linux/Documentation/networking/z8530drv.txt. + * Documentation/networking/z8530drv.txt. */ /* @@ -173,6 +173,7 @@ #include #include #include +#include #include @@ -180,7 +181,6 @@ #include #include #include -#include #include "z8530.h" @@ -237,7 +237,7 @@ static io_port Vector_Latch; /* These provide interrupt save 2-step access to the Z8530 registers */ -static spinlock_t iolock = SPIN_LOCK_UNLOCKED; /* Guards paired accesses */ +static DEFINE_SPINLOCK(iolock); /* Guards paired accesses */ static inline unsigned char InReg(io_port port, unsigned char reg) { @@ -304,7 +304,7 @@ static inline void scc_discard_buffers(struct scc_channel *scc) scc->tx_buff = NULL; } - while (skb_queue_len(&scc->tx_queue)) + while (!skb_queue_empty(&scc->tx_queue)) dev_kfree_skb(skb_dequeue(&scc->tx_queue)); spin_unlock_irqrestore(&scc->lock, flags); @@ -1126,8 +1126,7 @@ static void t_dwait(unsigned long channel) if (scc->stat.tx_state == TXS_WAIT) /* maxkeyup or idle timeout */ { - if (skb_queue_len(&scc->tx_queue) == 0) /* nothing to send */ - { + if (skb_queue_empty(&scc->tx_queue)) { /* nothing to send */ scc->stat.tx_state = TXS_IDLE; netif_wake_queue(scc->dev); /* t_maxkeyup locked it. */ return; @@ -1551,14 +1550,13 @@ static unsigned char ax25_nocall[AX25_ADDR_LEN] = static void scc_net_setup(struct net_device *dev) { - SET_MODULE_OWNER(dev); dev->tx_queue_len = 16; /* should be enough... */ dev->open = scc_net_open; dev->stop = scc_net_close; dev->hard_start_xmit = scc_net_tx; - dev->hard_header = ax25_encapsulate; + dev->hard_header = ax25_hard_header; dev->rebuild_header = ax25_rebuild_header; dev->set_mac_address = scc_net_set_mac_address; dev->get_stats = scc_net_get_stats; @@ -1630,10 +1628,7 @@ static void scc_net_rx(struct scc_channel *scc, struct sk_buff *skb) scc->dev_stat.rx_packets++; scc->dev_stat.rx_bytes += skb->len; - skb->dev = scc->dev; - skb->protocol = htons(ETH_P_AX25); - skb->mac.raw = skb->data; - skb->pkt_type = PACKET_HOST; + skb->protocol = ax25_type_trans(skb, scc->dev); netif_rx(skb); scc->dev->last_rx = jiffies; @@ -1714,13 +1709,11 @@ static int scc_net_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) struct scc_mem_config memcfg; struct scc_hw_config hwcfg; struct scc_calibrate cal; - struct scc_channel *scc; + struct scc_channel *scc = (struct scc_channel *) dev->priv; int chan; unsigned char device_name[IFNAMSIZ]; - void *arg; + void __user *arg = ifr->ifr_data; - scc = (struct scc_channel *) dev->priv; - arg = (void *) ifr->ifr_data; if (!Driver_Initialized) {