X-Git-Url: http://ftp.safe.ca/?a=blobdiff_plain;f=drivers%2Fnet%2Fhamradio%2Fmkiss.c;h=cfcd15af501e794777c0926ba45539b0dbfe89c1;hb=79ea13ce07c951bb4d95471e7300baa0f1be9e78;hp=f4424cf886c563a3a5c4955336f7c3c2c8f52f04;hpb=c1854ebc7f13b23c3d6a6e641a1a1db1116ca998;p=safe%2Fjmp%2Flinux-2.6 diff --git a/drivers/net/hamradio/mkiss.c b/drivers/net/hamradio/mkiss.c index f4424cf..cfcd15a 100644 --- a/drivers/net/hamradio/mkiss.c +++ b/drivers/net/hamradio/mkiss.c @@ -16,7 +16,6 @@ * Copyright (C) 2004, 05 Ralf Baechle DL5RB * Copyright (C) 2004, 05 Thomas Osterried DL9SAU */ -#include #include #include #include @@ -357,9 +356,9 @@ static int ax_set_mac_address(struct net_device *dev, void *addr) { struct sockaddr_ax25 *sa = addr; - spin_lock_irq(&dev->xmit_lock); + netif_tx_lock_bh(dev); memcpy(dev->dev_addr, &sa->sax25_call, AX25_ADDR_LEN); - spin_unlock_irq(&dev->xmit_lock); + netif_tx_unlock_bh(dev); return 0; } @@ -579,11 +578,12 @@ static int ax_open_dev(struct net_device *dev) #if defined(CONFIG_AX25) || defined(CONFIG_AX25_MODULE) /* Return the frame type ID */ -static int ax_header(struct sk_buff *skb, struct net_device *dev, unsigned short type, - void *daddr, void *saddr, unsigned len) +static int ax_header(struct sk_buff *skb, struct net_device *dev, + unsigned short type, const void *daddr, + const void *saddr, unsigned len) { #ifdef CONFIG_INET - if (type != htons(ETH_P_AX25)) + if (type != ETH_P_AX25) return ax25_hard_header(skb, dev, type, daddr, saddr, len); #endif return 0; @@ -671,13 +671,13 @@ static struct net_device_stats *ax_get_stats(struct net_device *dev) return &ax->stats; } +static const struct header_ops ax_header_ops = { + .create = ax_header, + .rebuild = ax_rebuild_header, +}; + static void ax_setup(struct net_device *dev) { - static char ax25_bcast[AX25_ADDR_LEN] = - {'Q'<<1,'S'<<1,'T'<<1,' '<<1,' '<<1,' '<<1,'0'<<1}; - static char ax25_test[AX25_ADDR_LEN] = - {'L'<<1,'I'<<1,'N'<<1,'U'<<1,'X'<<1,' '<<1,'1'<<1}; - /* Finish setting up the DEVICE info. */ dev->mtu = AX_MTU; dev->hard_start_xmit = ax_xmit; @@ -689,11 +689,11 @@ static void ax_setup(struct net_device *dev) dev->addr_len = 0; dev->type = ARPHRD_AX25; dev->tx_queue_len = 10; - dev->hard_header = ax_header; - dev->rebuild_header = ax_rebuild_header; + dev->header_ops = &ax_header_ops; + - memcpy(dev->broadcast, ax25_bcast, AX25_ADDR_LEN); - memcpy(dev->dev_addr, ax25_test, AX25_ADDR_LEN); + memcpy(dev->broadcast, &ax25_bcast, AX25_ADDR_LEN); + memcpy(dev->dev_addr, &ax25_defaddr, AX25_ADDR_LEN); dev->flags = IFF_BROADCAST | IFF_MULTICAST; } @@ -753,6 +753,7 @@ static int mkiss_open(struct tty_struct *tty) ax->tty = tty; tty->disc_data = ax; + tty->receive_room = 65535; if (tty->driver->flush_buffer) tty->driver->flush_buffer(tty); @@ -820,7 +821,7 @@ static void mkiss_close(struct tty_struct *tty) tty->disc_data = NULL; write_unlock(&disc_data_lock); - if (ax == 0) + if (!ax) return; /* @@ -885,9 +886,9 @@ static int mkiss_ioctl(struct tty_struct *tty, struct file *file, break; } - spin_lock_irq(&dev->xmit_lock); + netif_tx_lock_bh(dev); memcpy(dev->dev_addr, addr, AX25_ADDR_LEN); - spin_unlock_irq(&dev->xmit_lock); + netif_tx_unlock_bh(dev); err = 0; break; @@ -940,11 +941,6 @@ static void mkiss_receive_buf(struct tty_struct *tty, const unsigned char *cp, tty->driver->unthrottle(tty); } -static int mkiss_receive_room(struct tty_struct *tty) -{ - return 65536; /* We can handle an infinite amount of data. :-) */ -} - /* * Called by the driver when there's room for more data. If we have * more packets to send, we send them here. @@ -983,7 +979,6 @@ static struct tty_ldisc ax_ldisc = { .close = mkiss_close, .ioctl = mkiss_ioctl, .receive_buf = mkiss_receive_buf, - .receive_room = mkiss_receive_room, .write_wakeup = mkiss_write_wakeup }; @@ -1017,7 +1012,7 @@ static void __exit mkiss_exit_driver(void) MODULE_AUTHOR("Ralf Baechle DL5RB "); MODULE_DESCRIPTION("KISS driver for AX.25 over TTYs"); -MODULE_PARM(crc_force, "i"); +module_param(crc_force, int, 0); MODULE_PARM_DESC(crc_force, "crc [0 = auto | 1 = none | 2 = flexnet | 3 = smack]"); MODULE_LICENSE("GPL"); MODULE_ALIAS_LDISC(N_AX25);