]> git.neil.brown.name Git - history.git/commitdiff
Import 2.3.99pre7-5 2.3.99pre7-5
authorLinus Torvalds <torvalds@linuxfoundation.org>
Fri, 23 Nov 2007 20:34:28 +0000 (15:34 -0500)
committerLinus Torvalds <torvalds@linuxfoundation.org>
Fri, 23 Nov 2007 20:34:28 +0000 (15:34 -0500)
72 files changed:
drivers/atm/iphase.c
drivers/isdn/hisax/fsm.c
drivers/isdn/hisax/isdnl3.c
drivers/isdn/hysdn/hysdn_net.c
drivers/isdn/isdn_net.c
drivers/net/atp.c
drivers/net/es3210.c
drivers/net/ethertap.c
drivers/net/ewrk3.c
drivers/net/hamradio/6pack.c
drivers/net/hamradio/baycom_epp.c
drivers/net/hamradio/baycom_par.c
drivers/net/hamradio/baycom_ser_fdx.c
drivers/net/hamradio/baycom_ser_hdx.c
drivers/net/hamradio/bpqether.c
drivers/net/hamradio/dmascc.c
drivers/net/hamradio/hdlcdrv.c
drivers/net/hamradio/mkiss.c
drivers/net/hamradio/scc.c
drivers/net/hamradio/soundmodem/sm.c
drivers/net/hamradio/yam.c
drivers/net/pcmcia/3c574_cs.c
drivers/net/pcmcia/3c589_cs.c
drivers/net/pcmcia/aironet4500_cs.c
drivers/net/pcmcia/fmvj18x_cs.c
drivers/net/pcmcia/netwave_cs.c
drivers/net/pcmcia/nmclan_cs.c
drivers/net/pcmcia/smc91c92_cs.c
drivers/net/pcmcia/wavelan_cs.c
drivers/net/pcmcia/xirc2ps_cs.c
drivers/net/wan/cycx_x25.c
drivers/net/wan/lapbether.c
drivers/net/wan/lmc/lmc_main.c
drivers/net/wan/sdla_chdlc.c
drivers/net/wan/sdla_fr.c
drivers/net/wan/sdla_ppp.c
drivers/net/wan/sdla_x25.c
drivers/net/wan/x25_asy.c
drivers/usb/Config.in
drivers/usb/plusb.c
drivers/usb/serial/Makefile
drivers/usb/serial/digi_acceleport.c [new file with mode: 0644]
drivers/usb/serial/usb-serial.h
drivers/usb/serial/usbserial.c
drivers/usb/uhci.c
drivers/usb/usb.c
include/linux/hdlcdrv.h
include/net/irda/irlan_common.h
mm/filemap.c
mm/vmscan.c
net/ax25/ax25_timer.c
net/bridge/br_if.c
net/bridge/br_private.h
net/bridge/br_stp.c
net/bridge/br_stp_if.c
net/bridge/br_stp_timer.c
net/ipv4/ip_gre.c
net/ipv4/ipip.c
net/ipv4/ipmr.c
net/irda/irlan/irlan_client.c
net/irda/irlan/irlan_common.c
net/irda/irlan/irlan_eth.c
net/lapb/lapb_iface.c
net/lapb/lapb_timer.c
net/netrom/af_netrom.c
net/netrom/nr_loopback.c
net/netrom/nr_timer.c
net/rose/af_rose.c
net/rose/rose_link.c
net/rose/rose_loopback.c
net/sched/sch_teql.c
net/x25/x25_timer.c

index 11a41ddc72d82c169abb3a328e38cd0b0b93e233..a1e5c4dd42bc41696208a497824c29df7b1d260a 100644 (file)
@@ -3255,8 +3255,7 @@ int init_module(void)
                return -ENXIO;  
        }  
        // MOD_INC_USE_COUNT; 
-        ia_timer.next = NULL;
-               ia_timer.prev = NULL;
+       init_timer(&ia_timer);
        ia_timer.expires = jiffies + 3*HZ;
        ia_timer.data = 0UL;
        ia_timer.function = ia_led_timer;
index 665fa2c74a1a7f2e3b0b0928ecf243d9595f3be7..d0d356cf5cd92e5a2ec0fa42f9c8af46b8c2b7c5 100644 (file)
@@ -156,7 +156,7 @@ FsmAddTimer(struct FsmTimer *ft,
                        (long) ft, millisec, where);
 #endif
 
-       if (ft->tl.next || ft->tl.prev) {
+       if (timer_pending(&ft->tl)) {
                printk(KERN_WARNING "FsmAddTimer: timer already active!\n");
                ft->fi->printdebug(ft->fi, "FsmAddTimer already active!");
                return -1;
@@ -180,7 +180,7 @@ FsmRestartTimer(struct FsmTimer *ft,
                        (long) ft, millisec, where);
 #endif
 
-       if (ft->tl.next || ft->tl.prev)
+       if (timer_pending(&ft->tl))
                del_timer(&ft->tl);
        init_timer(&ft->tl);
        ft->event = event;
index 1783c5556d942c5f68041268d50e59eef285677d..a9500ef869a73a55b000b8527c4134b7acaf01d0 100644 (file)
@@ -238,7 +238,7 @@ int
 L3AddTimer(struct L3Timer *t,
           int millisec, int event)
 {
-       if (t->tl.next || t->tl.prev) {
+       if (timer_pending(&t->tl)) {
                printk(KERN_WARNING "L3AddTimer: timer already active!\n");
                return -1;
        }
index 1a3d2101228e32364cf1e7bb7039f57f3f714811..538dfe6d4aba2babc613a034d10f6d9bb3aa606c 100644 (file)
@@ -323,7 +323,6 @@ hysdn_net_create(hysdn_card * card)
        dev->base_addr = card->iobase;  /* IO address */
        dev->irq = card->irq;   /* irq */
        dev->init = net_init;   /* the init function of the device */
-       dev->name = ((struct net_local *) dev)->dev_name;       /* device name */
        if ((i = register_netdev(dev))) {
                printk(KERN_WARNING "HYSDN: unable to create network device\n");
                kfree(dev);
index c22aadc4ac3d23f9c95f88ebf6bbee2e43d3fa01..016302ab2d0fcfa31ee11fa58c7981205aee4f9a 100644 (file)
@@ -2799,7 +2799,7 @@ isdn_net_new(char *name, struct net_device *master)
                strcpy(netdev->local->name, "         ");
        else
                strcpy(netdev->local->name, name);
-       netdev->dev.name = netdev->local->name;
+       strcpy(netdev->dev.name, netdev->local->name);
        netdev->dev.priv = netdev->local;
        netdev->dev.init = isdn_net_init;
        netdev->local->p_encap = ISDN_NET_ENCAP_RAWIP;
index 53f0b2b6500774511868e678e542102ff195bc59..cfb2fdefd41b4722d93c13dd529a010d20e0fd4e 100644 (file)
@@ -130,8 +130,6 @@ static struct timer_list atp_timer = {NULL, NULL, 0, 0, atp_timed_checker};
 
 /* Index to functions, as function prototypes. */
 
-extern int atp_probe(struct net_device *dev);
-
 static int atp_probe1(struct net_device *dev, short ioaddr);
 static void get_node_ID(struct net_device *dev);
 static unsigned short eeprom_op(short ioaddr, unsigned int cmd);
@@ -751,7 +749,7 @@ static void set_multicast_list(struct net_device *dev)
 
 static int io = 0;
 static struct net_device atp_dev = {
-       "", 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, atp_probe };
+       "", 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, atp_init };
        
 MODULE_PARM(io, "I/O port of the pocket adapter");
 
index a9b0f16c08a913854cca139abf6849f528e7e629..2327ffad41146cf9c366af58de3d076141179b96 100644 (file)
@@ -382,10 +382,9 @@ static int es_close(struct net_device *dev)
 #ifdef MODULE
 #define MAX_ES_CARDS   4       /* Max number of ES3210 cards per module */
 #define NAMELEN                8       /* # of chars for storing dev->name */
-static char namelist[NAMELEN * MAX_ES_CARDS] = { 0, };
 static struct net_device dev_es3210[MAX_ES_CARDS] = {
        {
-               NULL,           /* assign a chunk of namelist[] below */
+               "",             /* device name is inserted by net_init.c */
                0, 0, 0, 0,
                0, 0,
                0, 0, 0, NULL, NULL
@@ -407,7 +406,6 @@ init_module(void)
 
        for (this_dev = 0; this_dev < MAX_ES_CARDS; this_dev++) {
                struct net_device *dev = &dev_es3210[this_dev];
-               dev->name = namelist+(NAMELEN*this_dev);
                dev->irq = irq[this_dev];
                dev->base_addr = io[this_dev];
                dev->mem_start = mem[this_dev];         /* Currently ignored by driver */
index c35d2ff8b618fd22222654d7adde2cb37dfa5bac..a4cfce6aebebba9dd8f48dc7e5783cd0a557f23c 100644 (file)
@@ -339,11 +339,9 @@ static struct net_device_stats *ethertap_get_stats(struct net_device *dev)
 static int unit;
 MODULE_PARM(unit,"i");
 
-static char devicename[9] = { 0, };
-
 static struct net_device dev_ethertap =
 {
-       devicename,
+       " ",
        0, 0, 0, 0,
        1, 5,
        0, 0, 0, NULL, ethertap_probe
@@ -352,10 +350,10 @@ static struct net_device dev_ethertap =
 int init_module(void)
 {
        dev_ethertap.base_addr=unit+NETLINK_TAPBASE;
-       sprintf(devicename,"tap%d",unit);
-       if (dev_get(devicename))
+       sprintf(dev_ethertap.name,"tap%d",unit);
+       if (dev_get(dev_ethertap.name))
        {
-               printk(KERN_INFO "%s already loaded.\n", devicename);
+               printk(KERN_INFO "%s already loaded.\n", dev_ethertap.name);
                return -EBUSY;
        }
        if (register_netdev(&dev_ethertap) != 0)
index ae92696c9cd508ede68b5215a1620823c90fd898..6c5964d83f23100e0921dd7addac904dcb094912 100644 (file)
@@ -1409,7 +1409,6 @@ insert_device(struct net_device *dev, u_long iobase, int (*init) (struct net_dev
                new->next = dev->next;
                dev->next = new;
                dev = dev->next;        /* point to the new device */
-               dev->name = (char *) (dev + 1);
                if (num_eth > 9999) {
                        sprintf(dev->name, "eth????");  /* New device name */
                } else {
index 8aa3ef765505849e759f7858957582e1e6015394..81a1ce88fe4feb018866472328ffc35d5c4c400f 100644 (file)
@@ -51,7 +51,6 @@ typedef unsigned char byte;
 
 
 typedef struct sixpack_ctrl {
-       char            if_name[8];     /* "sp0\0" .. "sp99999\0"       */
        struct sixpack  ctrl;           /* 6pack things                 */
        struct net_device       dev;            /* the device                   */
 } sixpack_ctrl_t;
@@ -107,8 +106,7 @@ sp_alloc(void)
                /* Initialize channel control data */
                set_bit(SIXPF_INUSE, &spp->ctrl.flags);
                spp->ctrl.tty         = NULL;
-               sprintf(spp->if_name, "sp%d", i);
-               spp->dev.name         = spp->if_name;
+               sprintf(spp->dev.name, "sp%d", i);
                spp->dev.base_addr    = i;
                spp->dev.priv         = (void*)&(spp->ctrl);
                spp->dev.next         = NULL;
index 8ffc4fd415b589e40855753be6e44308ce477687..cd6815df7c6d17edc975509668cc789875affbde 100644 (file)
@@ -200,8 +200,6 @@ struct baycom_state {
        unsigned int bitrate;
        unsigned char stat;
 
-       char ifname[HDLCDRV_IFNAMELEN];
-
        struct {
                unsigned int intclk;
                unsigned int fclk;
@@ -444,7 +442,7 @@ static void inline do_kiss_params(struct baycom_state *bc,
 {
 
 #ifdef KISS_VERBOSE
-#define PKP(a,b) printk(KERN_INFO "%s: channel params: " a "\n", bc->ifname, b)
+#define PKP(a,b) printk(KERN_INFO "baycomm_epp: channel params: " a "\n", b)
 #else /* KISS_VERBOSE */             
 #define PKP(a,b) 
 #endif /* KISS_VERBOSE */            
@@ -702,7 +700,7 @@ static void do_rxpacket(struct net_device *dev)
                return;
        pktlen = bc->hdlcrx.bufcnt-2+1; /* KISS kludge */
        if (!(skb = dev_alloc_skb(pktlen))) {
-               printk("%s: memory squeeze, dropping packet\n", bc->ifname);
+               printk("%s: memory squeeze, dropping packet\n", dev->name);
                bc->stats.rx_dropped++;
                return;
        }
@@ -1450,20 +1448,19 @@ static int __init init_baycomepp(void)
                 */
                memset(bc, 0, sizeof(struct baycom_state));
                bc->magic = BAYCOM_MAGIC;
-               sprintf(bc->ifname, "bce%d", i);
+               sprintf(dev->name, "bce%d", i);
                bc->cfg.fclk = 19666600;
                bc->cfg.bps = 9600;
                /*
                 * initialize part of the device struct
                 */
-               dev->name = bc->ifname;
                dev->if_port = 0;
                dev->init = baycom_probe;
                dev->base_addr = iobase[i];
                dev->irq = 0;
                dev->dma = 0;
                if (register_netdev(dev)) {
-                       printk(KERN_WARNING "%s: cannot register net device %s\n", bc_drvname, bc->ifname);
+                       printk(KERN_WARNING "%s: cannot register net device %s\n", bc_drvname, dev->name);
                        kfree(dev->priv);
                        return -ENXIO;
                }
index 63dc93cfb6fcece23b1f61b3b2069ebf258a42d0..20865a48deefdf42e8a515e0af81d5cf17b7e7e1 100644 (file)
@@ -505,7 +505,6 @@ static int __init init_baycompar(void)
        int i, j, found = 0;
        char set_hw = 1;
        struct baycom_state *bc;
-       char ifname[HDLCDRV_IFNAMELEN];
 
        printk(bc_drvinfo);
        /*
@@ -513,14 +512,14 @@ static int __init init_baycompar(void)
         */
        for (i = 0; i < NR_PORTS; i++) {
                struct net_device *dev = baycom_device+i;
-               sprintf(ifname, "bcp%d", i);
+               sprintf(dev->name, "bcp%d", i);
 
                if (!mode[i])
                        set_hw = 0;
                if (!set_hw)
                        iobase[i] = 0;
                j = hdlcdrv_register_hdlcdrv(dev, &par96_ops, sizeof(struct baycom_state),
-                                            ifname, iobase[i], 0, 0);
+                                            dev->name, iobase[i], 0, 0);
                if (!j) {
                        bc = (struct baycom_state *)dev->priv;
                        if (set_hw && baycom_setmode(bc, mode[i]))
index a90eb0f8cb4d777c110042104aec047fef887938..6a6603ba397c922546bab40805b9a93263bbebd8 100644 (file)
@@ -621,8 +621,6 @@ static int __init init_baycomserfdx(void)
        int i, j, found = 0;
        char set_hw = 1;
        struct baycom_state *bc;
-       char ifname[HDLCDRV_IFNAMELEN];
-
 
        printk(bc_drvinfo);
        /*
@@ -630,14 +628,14 @@ static int __init init_baycomserfdx(void)
         */
        for (i = 0; i < NR_PORTS; i++) {
                struct net_device *dev = baycom_device+i;
-               sprintf(ifname, "bcsf%d", i);
+               sprintf(dev->name, "bcsf%d", i);
 
                if (!mode[i])
                        set_hw = 0;
                if (!set_hw)
                        iobase[i] = irq[i] = 0;
                j = hdlcdrv_register_hdlcdrv(dev, &ser12_ops, sizeof(struct baycom_state),
-                                            ifname, iobase[i], irq[i], 0);
+                                            dev->name, iobase[i], irq[i], 0);
                if (!j) {
                        bc = (struct baycom_state *)dev->priv;
                        if (set_hw && baycom_setmode(bc, mode[i]))
index 111373ca9dedd13fdb5e10c9e1a7764a973586f7..80483a171926d01bd1a8d0c469e592f5ea008599 100644 (file)
@@ -661,8 +661,6 @@ static int __init init_baycomserhdx(void)
        int i, j, found = 0;
        char set_hw = 1;
        struct baycom_state *bc;
-       char ifname[HDLCDRV_IFNAMELEN];
-
 
        printk(bc_drvinfo);
        /*
@@ -670,14 +668,14 @@ static int __init init_baycomserhdx(void)
         */
        for (i = 0; i < NR_PORTS; i++) {
                struct net_device *dev = baycom_device+i;
-               sprintf(ifname, "bcsh%d", i);
+               sprintf(dev->name, "bcsh%d", i);
 
                if (!mode[i])
                        set_hw = 0;
                if (!set_hw)
                        iobase[i] = irq[i] = 0;
                j = hdlcdrv_register_hdlcdrv(dev, &ser12_ops, sizeof(struct baycom_state),
-                                            ifname, iobase[i], irq[i], 0);
+                                            dev->name, iobase[i], irq[i], 0);
                if (!j) {
                        bc = (struct baycom_state *)dev->priv;
                        if (set_hw && baycom_setmode(bc, mode[i]))
index a48b3f6c6fcdddc0d471d735f90bf4ede348b4c5..6319f983de17fe99501a997c40269cb20b3fd8c4 100644 (file)
@@ -496,7 +496,6 @@ static int bpq_get_info(char *buffer, char **start, off_t offset, int length)
 static int bpq_new_device(struct net_device *dev)
 {
        int k;
-       unsigned char *buf;
        struct bpqdev *bpq, *bpq2;
 
        if ((bpq = kmalloc(sizeof(struct bpqdev), GFP_KERNEL)) == NULL)
@@ -513,14 +512,13 @@ static int bpq_new_device(struct net_device *dev)
        memcpy(bpq->acpt_addr, bcast_addr, sizeof(bpq_eth_addr));
 
        dev = &bpq->axdev;
-       buf = kmalloc(14, GFP_KERNEL);
 
        for (k = 0; k < MAXBPQDEV; k++) {
                struct net_device *odev;
 
-               sprintf(buf, "bpq%d", k);
+               sprintf(dev->name, "bpq%d", k);
 
-               if ((odev = __dev_get_by_name(buf)) == NULL || bpq_check_devices(odev))
+               if ((odev = __dev_get_by_name(dev->name)) == NULL || bpq_check_devices(odev))
                        break;
        }
 
@@ -530,7 +528,6 @@ static int bpq_new_device(struct net_device *dev)
        }
 
        dev->priv = (void *)bpq;        /* pointer back */
-       dev->name = buf;
        dev->init = bpq_dev_init;
 
        /* We should be locked, call register_netdevice() directly. */
index 3e7cd8e44d2b4321b6233e279169a1a15113db4c..c294323d13d8ab2e4ae38fdf8b399e82bc438a49 100644 (file)
@@ -211,7 +211,6 @@ struct scc_hardware {
 };
 
 struct scc_priv {
-  char name[10];
   struct enet_statistics stats;
   struct scc_info *info;
   int channel;
@@ -553,7 +552,6 @@ int __init setup_adapter(int io, int h, int n)
   for (i = 0; i < 2; i++) {
     dev = &info->dev[i];
     priv = &info->priv[i];
-    sprintf(priv->name, "dmascc%i", 2*n+i);
     priv->info = info;
     priv->channel = i;
     priv->cmd = info->scc_base + (i ? SCCB_CMD : SCCA_CMD);
@@ -571,7 +569,7 @@ int __init setup_adapter(int io, int h, int n)
     priv->rx_task.routine = rx_bh;
     priv->rx_task.data = dev;
     dev->priv = priv;
-    dev->name = priv->name;
+    sprintf(dev->name, "dmascc%i", 2*n+i);
     dev->base_addr = io;
     dev->irq = irq;
     dev->open = scc_open;
@@ -593,7 +591,6 @@ int __init setup_adapter(int io, int h, int n)
     dev_init_buffers(dev);
     if (register_netdevice(dev)) {
       printk("dmascc: could not register %s\n", dev->name);
-      dev->name = NULL;
     }
   }
 
index eac33513d4d463b5fa285adea992caeea69e11c2..9ccc0d1b4d2cbbff19095f05c25932107db1fafb 100644 (file)
@@ -217,8 +217,7 @@ static void hdlc_rx_flag(struct net_device *dev, struct hdlcdrv_state *s)
                return;
        pkt_len = s->hdlcrx.len - 2 + 1; /* KISS kludge */
        if (!(skb = dev_alloc_skb(pkt_len))) {
-               printk("%s: memory squeeze, dropping packet\n", 
-                      s->ifname);
+               printk("%s: memory squeeze, dropping packet\n", dev->name);
                s->stats.rx_dropped++;
                return;
        }
@@ -293,7 +292,7 @@ static void inline do_kiss_params(struct hdlcdrv_state *s,
 {
 
 #ifdef KISS_VERBOSE
-#define PKP(a,b) printk(KERN_INFO "%s: channel params: " a "\n", s->ifname, b)
+#define PKP(a,b) printk(KERN_INFO "hdlcdrv.c: channel params: " a "\n", b)
 #else /* KISS_VERBOSE */             
 #define PKP(a,b) 
 #endif /* KISS_VERBOSE */            
@@ -840,12 +839,11 @@ int hdlcdrv_register_hdlcdrv(struct net_device *dev, const struct hdlcdrv_ops *o
         */
        memset(s, 0, privsize);
        s->magic = HDLCDRV_MAGIC;
-       strncpy(s->ifname, ifname, sizeof(s->ifname));
+       strncpy(dev->name, ifname, sizeof(dev->name));
        s->ops = ops;
        /*
         * initialize part of the device struct
         */
-       dev->name = s->ifname;
        dev->if_port = 0;
        dev->init = hdlcdrv_probe;
        dev->base_addr = baseaddr;
@@ -853,7 +851,7 @@ int hdlcdrv_register_hdlcdrv(struct net_device *dev, const struct hdlcdrv_ops *o
        dev->dma = dma;
        if (register_netdev(dev)) {
                printk(KERN_WARNING "hdlcdrv: cannot register net "
-                      "device %s\n", s->ifname);
+                      "device %s\n", dev->name);
                kfree(dev->priv);
                return -ENXIO;
        }
index c55556cc9eade49730d269d358e9fa08a3706ec1..3a861650643d70a1ad13e96dfc360923af9b453a 100644 (file)
@@ -73,7 +73,6 @@ struct mkiss_channel {
 };
 
 typedef struct ax25_ctrl {
-       char if_name[8];        /* "ax0\0" .. "ax99999\0"       */
        struct ax_disp ctrl;    /*                              */
        struct net_device  dev; /* the device                   */
 } ax25_ctrl_t;
@@ -200,9 +199,8 @@ static inline struct ax_disp *ax_alloc(void)
 
                /* Initialize channel control data */
                set_bit(AXF_INUSE, &axp->ctrl.flags);
-               sprintf(axp->if_name, "ax%d", i++);
+               sprintf(axp->dev.name, "ax%d", i++);
                axp->ctrl.tty      = NULL;
-               axp->dev.name      = axp->if_name;
                axp->dev.base_addr = i;
                axp->dev.priv      = (void *)&axp->ctrl;
                axp->dev.next      = NULL;
index c7f27414f9e8f935eecfa3f6d453c6bb8e9d3218..cc60b41a39cfcf691548132e6509ffb6ac440087 100644 (file)
@@ -1554,7 +1554,6 @@ static void z8530_init(void)
 
 static int scc_net_setup(struct scc_channel *scc, unsigned char *name, int addev)
 {
-       unsigned char *buf;
        struct net_device *dev;
 
        if (dev_get(name))
@@ -1569,13 +1568,8 @@ static int scc_net_setup(struct scc_channel *scc, unsigned char *name, int addev
        dev = scc->dev;
        memset(dev, 0, sizeof(struct net_device));
 
-       if ((buf = (unsigned char *) kmalloc(10, GFP_KERNEL)) == NULL)
-               return -ENOMEM;
-
-       strcpy(buf, name);
-
+       strcpy(dev->name, name);
        dev->priv = (void *) scc;
-       dev->name = buf;
        dev->init = scc_net_init;
 
        if ((addev? register_netdevice(dev) : register_netdev(dev)) != 0)
index af04a2c877d7d9b5b70c2c3e84c5ea8ad0371875..c9bf6b1192cd6266e6ae3a15e2f14db5d92ec760 100644 (file)
@@ -278,7 +278,7 @@ void sm_output_status(struct sm_state *sm)
 
 /* --------------------------------------------------------------------- */
 
-static void sm_output_open(struct sm_state *sm)
+static void sm_output_open(struct sm_state *sm, const char *ifname)
 {
        enum uart u = c_uart_unknown;
        struct parport *pp = NULL;
@@ -306,7 +306,7 @@ static void sm_output_open(struct sm_state *sm)
                else if ((~pp->modes) & (PARPORT_MODE_PCSPP | PARPORT_MODE_SAFEININT))
                        printk(KERN_WARNING "%s: parport at address 0x%x cannot be used\n", sm_drvname, sm->hdrv.ptt_out.pariobase);
                else {
-                       sm->pardev = parport_register_device(pp, sm->hdrv.ifname, NULL, NULL, NULL, PARPORT_DEV_EXCL, NULL);
+                       sm->pardev = parport_register_device(pp, ifname, NULL, NULL, NULL, PARPORT_DEV_EXCL, NULL);
                        if (!sm->pardev) {
                                pp = NULL;
                                printk(KERN_WARNING "%s: cannot register parport device (address 0x%x)\n", sm_drvname, sm->hdrv.ptt_out.pariobase);
@@ -393,7 +393,7 @@ static int sm_open(struct net_device *dev)
        err = sm->hwdrv->open(dev, sm);
        if (err)
                return err;
-       sm_output_open(sm);
+       sm_output_open(sm, dev->name);
        MOD_INC_USE_COUNT;
        printk(KERN_INFO "%s: %s mode %s.%s at iobase 0x%lx irq %u dma %u dma2 %u\n",
               sm_drvname, sm->hwdrv->hw_name, sm->mode_tx->name,
@@ -641,7 +641,6 @@ static int __init init_soundmodem(void)
        int i, j, found = 0;
        char set_hw = 1;
        struct sm_state *sm;
-       char ifname[HDLCDRV_IFNAMELEN];
 
        printk(sm_drvinfo);
        /*
@@ -649,7 +648,7 @@ static int __init init_soundmodem(void)
         */
        for (i = 0; i < NR_PORTS; i++) {
                struct net_device *dev = sm_device+i;
-               sprintf(ifname, "sm%d", i);
+               sprintf(dev->name, "sm%d", i);
 
                if (!mode[i])
                        set_hw = 0;
@@ -672,7 +671,7 @@ static int __init init_soundmodem(void)
                }
                if (!set_hw)
                        iobase[i] = irq[i] = 0;
-               j = hdlcdrv_register_hdlcdrv(dev, &sm_ops, sizeof(struct sm_state), ifname, iobase[i], irq[i], dma[i]);
+               j = hdlcdrv_register_hdlcdrv(dev, &sm_ops, sizeof(struct sm_state), dev->name, iobase[i], irq[i], dma[i]);
                if (!j) {
                        sm = (struct sm_state *)dev->priv;
                        sm->hdrv.ptt_out.dma2 = dma2[i];
index 27929e78b770b99a10de5c0f3733a1751b3016ed..6ca7e2cc157aac2bc482eb1782ece0891dc078d6 100644 (file)
@@ -116,7 +116,6 @@ struct yam_port {
        int iobase;
        int irq;
        int dupmode;
-       char name[16];
 
        struct net_device dev;
 
@@ -793,7 +792,7 @@ static int yam_net_get_info(char *buffer, char **start, off_t offset, int length
        for (i = 0; i < NR_PORTS; i++) {
                if (yam_ports[i].iobase == 0 || yam_ports[i].irq == 0)
                        continue;
-               len += sprintf(buffer + len, "Device %s\n", yam_ports[i].name);
+               len += sprintf(buffer + len, "Device yam%d\n", i);
                len += sprintf(buffer + len, "  Up       %d\n", netif_running(&yam_ports[i].dev));
                len += sprintf(buffer + len, "  Speed    %u\n", yam_ports[i].bitrate);
                len += sprintf(buffer + len, "  IoBase   0x%x\n", yam_ports[i].iobase);
@@ -1148,7 +1147,7 @@ int __init yam_init(void)
        memset(yam_ports, 0, sizeof(yam_ports));
 
        for (i = 0; i < NR_PORTS; i++) {
-               sprintf(yam_ports[i].name, "yam%d", i);
+               sprintf(yam_ports[i].dev.name, "yam%d", i);
                yam_ports[i].magic = YAM_MAGIC;
                yam_ports[i].bitrate = DEFAULT_BITRATE;
                yam_ports[i].baudrate = DEFAULT_BITRATE * 2;
@@ -1164,7 +1163,6 @@ int __init yam_init(void)
                dev = &yam_ports[i].dev;
 
                dev->priv = &yam_ports[i];
-               dev->name = yam_ports[i].name;
                dev->base_addr = yam_ports[i].iobase;
                dev->irq = yam_ports[i].irq;
                dev->init = yam_probe;
index 53f841af2937aa03f963edc9ae9d7f6d63e4977f..956de0bd5e9c64049a74c213b83d60743b68cc40 100644 (file)
@@ -336,7 +336,7 @@ static dev_link_t *tc574_attach(void)
        dev->do_ioctl = &el3_ioctl;
        dev->set_multicast_list = &set_rx_mode;
        ether_setup(dev);
-       dev->name = lp->node.dev_name;
+       strcpy(dev->name, lp->node.dev_name);
        dev->init = &tc574_init;
        dev->open = &el3_open;
        dev->stop = &el3_close;
index 010c7cfd029a2a600fb9d1fb0f2f1a8ecc755550..ff072f635c470f52e15c297edf5fbbb187c77947 100644 (file)
@@ -254,7 +254,7 @@ static dev_link_t *tc589_attach(void)
     dev->get_stats = &el3_get_stats;
     dev->set_multicast_list = &set_multicast_list;
     ether_setup(dev);
-    dev->name = lp->node.dev_name;
+    strcpy(dev->name, lp->node.dev_name);
     dev->init = &tc589_init;
     dev->open = &el3_open;
     dev->stop = &el3_close;
index 641c6733287b7c804f4152643830b898e8b01f3d..1ff446fc2a64c53f06d913fa1ece2b2bfa97832a 100644 (file)
@@ -223,9 +223,9 @@ static dev_link_t *awc_attach(void)
        dev->get_stats =                &awc_get_stats;
 //     dev->set_multicast_list =       &awc_set_multicast_list;
 
-       ether_setup(dev);
+       strcpy(dev->name, ((struct awc_private *)dev->priv)->node.dev_name);
 
-       dev->name = ((struct awc_private *)dev->priv)->node.dev_name;
+       ether_setup(dev);
 
        dev->init = &awc_pcmcia_init;
        dev->open = &awc_pcmcia_open;
index a975a4df291ef70c4ea1e4aa049bd6b1bc93741a..c42ccf129f6771e98b9e4a00c2d267079a908e33 100644 (file)
@@ -315,8 +315,8 @@ static dev_link_t *fmvj18x_attach(void)
     dev->set_config = &fjn_config;
     dev->get_stats = &fjn_get_stats;
     dev->set_multicast_list = &set_rx_mode;
+    strcpy(dev->name, lp->node.dev_name);
     ether_setup(dev);
-    dev->name = lp->node.dev_name;
     dev->init = &fmvj18x_init;
     dev->open = &fjn_open;
     dev->stop = &fjn_close;
index e95916c149ce43ece72dc7b1a2b84bf031a4009b..2e67ff35d2a5f5b8a9e27dfa76e4ce7264fac27b 100644 (file)
@@ -502,7 +502,7 @@ static dev_link_t *netwave_attach(void)
     dev->do_ioctl = &netwave_ioctl;
 
     ether_setup(dev);
-    dev->name = priv->node.dev_name;
+    strcpy(dev->name, priv->node.dev_name)
     dev->init = &netwave_init;
     dev->open = &netwave_open;
     dev->stop = &netwave_close;
@@ -1224,8 +1224,7 @@ static int netwave_hw_xmit(unsigned char* data, int len,
     writeb(NETWAVE_CMD_EOC, ramBase + NETWAVE_EREG_CB + 3);
        
     /* If watchdog not already active, activate it... */
-    if(priv->watchdog.prev == (struct timer_list *) NULL) {
-
+    if (!timer_pending(&priv->watchdog)) {
        /* set timer to expire in WATCHDOG_JIFFIES */
        priv->watchdog.expires = jiffies + WATCHDOG_JIFFIES;
        add_timer(&priv->watchdog);
index 22ff48201da9486cf96244c015ca534378276d46..d3170f181125a69f9ca120cc9bda98175484e4a7 100644 (file)
@@ -534,8 +534,8 @@ static dev_link_t *nmclan_attach(void)
     dev->set_config = &mace_config;
     dev->get_stats = &mace_get_stats;
     dev->set_multicast_list = &set_multicast_list;
+    strcpy(dev->name, lp->node.dev_name);
     ether_setup(dev);
-    dev->name = lp->node.dev_name;
     dev->init = &nmclan_init;
     dev->open = &mace_open;
     dev->stop = &mace_close;
index b201d1ec10fb1da8b415111395d996b3be81b1d7..144dfb68088c690e06ac5b7fe4e810f9cbbdb6c8 100644 (file)
@@ -377,8 +377,8 @@ static dev_link_t *smc91c92_attach(void)
     dev->get_stats = &smc91c92_get_stats;
     dev->set_config = &s9k_config;
     dev->set_multicast_list = &set_rx_mode;
+    strcpy(dev->name, smc->node.dev_name);
     ether_setup(dev);
-    dev->name = smc->node.dev_name;
     dev->init = &smc91c92_init;
     dev->open = &smc91c92_open;
     dev->stop = &smc91c92_close;
index ae9bb054811b62542afa15fcb653dec47c48df7d..e75b59cf37e1acafd11b2d7a61faa57629044f16 100644 (file)
@@ -2926,7 +2926,7 @@ wv_packet_write(device *  dev,
   lp->stats.tx_bytes += length;
 
   /* If watchdog not already active, activate it... */
-  if(lp->watchdog.prev == (timer_list *) NULL)
+  if (!timer_pending(&lp->watchdog))
     {
       /* set timer to expire in WATCHDOG_JIFFIES */
       lp->watchdog.expires = jiffies + WATCHDOG_JIFFIES;
@@ -3655,7 +3655,7 @@ wv_hw_reset(device *      dev)
 #endif
 
   /* If watchdog was activated, kill it ! */
-  if(lp->watchdog.prev != (timer_list *) NULL)
+  if (timer_pending(&lp->watchdog))
     del_timer(&lp->watchdog);
 
   lp->nresets++;
@@ -4061,7 +4061,7 @@ wavelan_interrupt(int             irq,
 #endif
 
          /* If watchdog was activated, kill it ! */
-         if(lp->watchdog.prev != (timer_list *) NULL)
+         if(timer_pending(&lp->watchdog))
            del_timer(&lp->watchdog);
 
          /* Get transmission status */
@@ -4353,7 +4353,7 @@ wavelan_close(device *    dev)
 #endif /* WAVELAN_ROAMING */
 
   /* If watchdog was activated, kill it ! */
-  if(lp->watchdog.prev != (timer_list *) NULL)
+  if(timer_pending(&lp->watchdog))
     del_timer(&lp->watchdog);
 
   link->open--;
@@ -4498,8 +4498,7 @@ wavelan_attach(void)
 #endif
 
   /* Other specific data */
-  /* Provide storage area for device name */
-  dev->name = ((net_local *)dev->priv)->node.dev_name;
+  strcpy(dev->name, ((net_local *)dev->priv)->node.dev_name);
   netif_start_queue (dev);
   dev->mtu = WAVELAN_MTU;
 
index b63ff08d5a3b3daf3048eada726715f66d6da0d1..6d9d20c8d306f0be411325fb574f7791f7ab885d 100644 (file)
@@ -716,8 +716,8 @@ xirc2ps_attach(void)
     dev->get_stats = &do_get_stats;
     dev->do_ioctl = &do_ioctl;
     dev->set_multicast_list = &set_multicast_list;
+    strcpy(dev->name, local->node.dev_name);
     ether_setup(dev);
-    dev->name = local->node.dev_name;
     dev->init = &do_init;
     dev->open = &do_open;
     dev->stop = &do_stop;
index 6a68bd5e790104e5c3160ff5dff1eb854f330427..1103907bd0c362bfd84f858820a3ded29b7d6058 100644 (file)
@@ -422,7 +422,7 @@ static int new_if (wan_device_t *wandev, struct net_device *dev,
        }
 
        /* prepare network device data space for registration */
-       dev->name = chan->name;
+       strcpy(dev->name, chan->name);
        dev->init = if_init;
        dev->priv = chan;
 
index 1fa07475bcf0708a647faeb5032054f17c781648..826fb02c6e6f322e08533d52ca09a8a1f74a399e 100644 (file)
@@ -441,7 +441,7 @@ static int lapbeth_new_device(struct net_device *dev)
        }
        
        dev->priv = (void *)lapbeth;    /* pointer back */
-       dev->name = buf;
+       strcpy(dev->name, buf);
        dev->init = lapbeth_dev_init;
 
        if (register_netdev(dev) != 0) {
index 931fca21c856e0e42ae538ce22d785ba1d24a18d..ebf339d2ee965a511d7aa5bd6a1dfa3ae02317d7 100644 (file)
@@ -856,11 +856,6 @@ static struct net_device *lmc_probe1 (struct net_device *dev, unsigned long ioad
     /*
      * Switch to common hdlc%d naming. We name by type not by vendor
      */
-#if LINUX_VERSION_CODE < 0x20363
-    dev->name = ((char *) (dev)) + sizeof (struct ppp_device);
-#else
-    dev->name = ((char *) (dev)) + sizeof (struct net_device);
-#endif
     
     dev_alloc_name(dev, "hdlc%d");
 #else
@@ -868,7 +863,6 @@ static struct net_device *lmc_probe1 (struct net_device *dev, unsigned long ioad
      * GCOM uses LMC vendor name so that clients can know which card
      * to attach to.
      */
-    dev->name = ((char *) (dev)) + sizeof (struct ppp_device);
     dev_alloc_name(dev, "lmc%d");
 #endif
 
index 62881254e26c7426b3aadd8c8590d68ae7e65152..5989cdc474cba729f3cdc5efb00f6aeed618e051 100644 (file)
@@ -603,7 +603,7 @@ static int new_if (wan_device_t* wandev, struct net_device* dev, wanif_conf_t* c
        chdlc_priv_area->mc = conf->mc;
 
        /* prepare network device data space for registration */
-       dev->name = card->u.c.if_name;
+       strcpy(dev->name, card->u.c.if_name);
        dev->init = &if_init;
        dev->priv = chdlc_priv_area;
 
index d7a246dd99667c632d263b05e6c2f8d50643b24a..ab88a8bb3a6def75033c3ab824da79169a0b498b 100644 (file)
@@ -814,7 +814,7 @@ static int new_if (wan_device_t* wandev, struct net_device* dev, wanif_conf_t* c
        chan->transmit_length = 0;
 
        /* prepare network device data space for registration */
-       dev->name = chan->name;
+       strcpy(dev->name, chan->name);
        dev->init = &if_init;
        dev->priv = chan;
 
index f8c8fcae24ea0c02449bd03e3541f23ca08e3b91..8c7d5c6943f7942226dc846d6b677bd0de3b8855 100644 (file)
@@ -501,7 +501,7 @@ static int new_if(wan_device_t *wandev, struct net_device *dev, wanif_conf_t *co
 
 
        /* prepare network device data space for registration */
-       dev->name = card->u.p.if_name;
+       strcpy(dev->name, card->u.p.if_name);
        dev->init = &if_init;
        dev->priv = ppp_priv_area;
 
index dfb5d36a52b1614f46c699897942c1c1d618476a..ab70aec0c3e29abd9979c2b22eca62eece1a3086 100644 (file)
@@ -464,7 +464,7 @@ static int new_if (wan_device_t* wandev, struct net_device* dev, wanif_conf_t* c
        }
 
        /* prepare network device data space for registration */
-       dev->name = chan->name;
+       strcpy(dev->name, chan->name);
        dev->init = &if_init;
        dev->priv = chan;
        return 0;
index 7b647d6632e1b13f41f189a3377338dbac05eb52..5651ddeb29fc4013dae13a82ce444125b2f43a25 100644 (file)
@@ -32,7 +32,6 @@
 #include "x25_asy.h"
 
 typedef struct x25_ctrl {
-       char            if_name[8];     /* "xasy0\0" .. "xasy99999\0"   */
        struct x25_asy  ctrl;           /* X.25 things                  */
        struct net_device       dev;            /* the device                   */
 } x25_asy_ctrl_t;
@@ -82,8 +81,7 @@ static inline struct x25_asy *x25_asy_alloc(void)
                /* Initialize channel control data */
                set_bit(SLF_INUSE, &slp->ctrl.flags);
                slp->ctrl.tty         = NULL;
-               sprintf(slp->if_name, "x25asy%d", i);
-               slp->dev.name         = slp->if_name;
+               sprintf(slp->dev.name, "x25asy%d", i);
                slp->dev.base_addr    = i;
                slp->dev.priv         = (void*)&(slp->ctrl);
                slp->dev.next         = NULL;
index cba82175af379803a30deb0fe4041c9e1e381f80..38efbb11823f36f601e20cfb6bd2098815ce1156 100644 (file)
@@ -33,6 +33,7 @@ comment 'USB Devices'
          bool '    USB ConnectTech WhiteHEAT Serial Driver (EXPERIMENTAL)' CONFIG_USB_SERIAL_WHITEHEAT
          bool '    USB FTDI Single Port Serial Driver (EXPERIMENTAL)' CONFIG_USB_SERIAL_FTDI_SIO
          bool '    USB Keyspan PDA Single Port Serial Driver (EXPERIMENTAL)' CONFIG_USB_SERIAL_KEYSPAN_PDA
+         bool '    USB Digi International AccelePort USB Serial Driver (EXPERIMENTAL)' CONFIG_USB_SERIAL_DIGI_ACCELEPORT
          bool '    USB ZyXEL omni.net LCD Plus Driver (EXPERIMENTAL)' CONFIG_USB_SERIAL_OMNINET
       fi
       bool '    USB Serial Converter verbose debug' CONFIG_USB_SERIAL_DEBUG
index 871cf8945ffa6844576fe443fb28bc94cf97a8f8..9165779cb117bf83021884b5cb5d3a8149c362a4 100644 (file)
@@ -465,8 +465,7 @@ static void plusb_disconnect (struct usb_device *usbdev, void *ptr)
        if(!s->opened && s->net_dev.name) {
                dbg("unregistering netdev: %s",s->net_dev.name);
                unregister_netdev(&s->net_dev);
-               kfree(s->net_dev.name);
-               s->net_dev.name=NULL;
+               s->net_dev.name[0] = '\0';
        }
        
        dbg("plusb_disconnect: finished");
@@ -524,22 +523,15 @@ static void *plusb_probe (struct usb_device *usbdev, unsigned int ifnum)
                return NULL;
        }
 
-       if(!s->net_dev.name) {
-               s->net_dev.name=kmalloc(16, GFP_KERNEL);
-
-               if(!s->net_dev.name || dev_alloc_name(&s->net_dev,"plusb%d")<0) {
-                       err("alloc name failed\n");
-                       return NULL;
-               }
-
+       if(!s->net_dev.name[0]) {
+               strcpy(s->net_dev.name, "plusb%d");
                s->net_dev.init=plusb_net_init;
                s->net_dev.priv=s;
                if(!register_netdev(&s->net_dev))
                        info("registered: %s", s->net_dev.name);
                else {
                        err("register_netdev failed");
-                       kfree(s->net_dev.name);
-                       s->net_dev.name=NULL;
+                       s->net_dev.name[0] = '\0';
                }
        }
                
@@ -598,11 +590,9 @@ void __exit plusb_cleanup (void)
        dbg("plusb_cleanup");
        for (u = 0; u < NRPLUSB; u++) {
                plusb_t *s = &plusb[u];
-               if(s->net_dev.name) {
+               if(s->net_dev.name[0]) {
                        dbg("unregistering netdev: %s",s->net_dev.name);
                        unregister_netdev(&s->net_dev);
-                       kfree(s->net_dev.name);
-                       s->net_dev.name=NULL;
                }
        }
        usb_deregister (&plusb_driver);
index bd4d51a6a94f1f1542b4838ea2d922e3f62aa34f..fa69fa52aa0a9acd2ce4a72457c60949dbb7f86d 100644 (file)
@@ -4,7 +4,7 @@
 
 O_TARGET       := usb-serial.o
 M_OBJS         := usb-serial.o
-O_OBJS         := usbserial.o visor.o whiteheat.o ftdi_sio.o keyspan_pda.o omninet.o
+O_OBJS         := usbserial.o visor.o whiteheat.o ftdi_sio.o keyspan_pda.o omninet.o digi_acceleport.o
 MOD_LIST_NAME  := USB_SERIAL_MODULES
 
 include $(TOPDIR)/Rules.make
diff --git a/drivers/usb/serial/digi_acceleport.c b/drivers/usb/serial/digi_acceleport.c
new file mode 100644 (file)
index 0000000..6700f9e
--- /dev/null
@@ -0,0 +1,975 @@
+/*
+*  Digi AccelePort USB-4 Serial Converter
+*
+*  Copyright 2000 by Digi International
+*
+*  This program is free software; you can redistribute it and/or modify
+*  it under the terms of the GNU General Public License as published by
+*  the Free Software Foundation; either version 2 of the License, or
+*  (at your option) any later version.
+*
+*  Shamelessly based on Brian Warner's keyspan_pda.c and Greg Kroah-Hartman's
+*  usb-serial driver.
+*
+*  Peter Berger (pberger@brimson.com)
+*  Al Borchers (borchers@steinerpoint.com)
+*
+*  (5/3/2000) pberger and borchers
+*  First alpha version of the driver--many known limitations and bugs.
+*
+*  $Id: digi_acceleport.c,v 1.28 2000/05/04 01:47:08 root Exp root $
+*/
+
+#include <linux/config.h>
+
+#ifdef CONFIG_USB_SERIAL_DIGI_ACCELEPORT
+
+#include <linux/kernel.h>
+#include <linux/sched.h>
+#include <linux/signal.h>
+#include <linux/errno.h>
+#include <linux/poll.h>
+#include <linux/init.h>
+#include <linux/malloc.h>
+#include <linux/fcntl.h>
+#include <linux/tty_driver.h>
+#include <linux/tty_flip.h>
+#include <linux/tty.h>
+#include <linux/module.h>
+#include <linux/spinlock.h>
+
+#ifdef CONFIG_USB_SERIAL_DEBUG
+       #define DEBUG
+#else
+       #undef DEBUG
+#endif
+#include <linux/usb.h>
+#include "usb-serial.h"
+
+
+/* Defines */
+
+/* port buffer length -- must be <= transfer buffer length - 2 */
+/* so we can be sure to send the full buffer in one urb */
+#define DIGI_PORT_BUF_LEN                      16
+
+/* AccelePort USB Defines */
+
+/* ids */
+#define DIGI_VENDOR_ID                         0x05c5
+#define DIGI_ID                                        0x0004
+
+/* commands */
+#define DIGI_CMD_SET_BAUD_RATE                 0
+#define DIGI_CMD_SET_WORD_SIZE                 1
+#define DIGI_CMD_SET_PARITY                    2
+#define DIGI_CMD_SET_STOP_BITS                 3
+#define DIGI_CMD_SET_INPUT_FLOW_CONTROL                4
+#define DIGI_CMD_SET_OUTPUT_FLOW_CONTROL       5
+#define DIGI_CMD_SET_DTR_SIGNAL                        6
+#define DIGI_CMD_SET_RTS_SIGNAL                        7
+#define DIGI_CMD_RECEIVE_ENABLE                        10
+#define DIGI_CMD_BREAK_CONTROL                 11
+#define DIGI_CMD_LOCAL_LOOPBACK                        12
+#define DIGI_CMD_TRANSMIT_IDLE                 13
+#define DIGI_CMD_WRITE_UART_REGISTER           15
+#define DIGI_CMD_AND_UART_REGISTER             16
+#define DIGI_CMD_OR_UART_REGISTER              17
+#define DIGI_CMD_SEND_DATA                     18
+
+/* baud rates */
+#define DIGI_BAUD_50                           0
+#define DIGI_BAUD_75                           1
+#define DIGI_BAUD_110                          2
+#define DIGI_BAUD_150                          3
+#define DIGI_BAUD_200                          4
+#define DIGI_BAUD_300                          5
+#define DIGI_BAUD_600                          6
+#define DIGI_BAUD_1200                         7
+#define DIGI_BAUD_1800                         8
+#define DIGI_BAUD_2400                         9
+#define DIGI_BAUD_4800                         10
+#define DIGI_BAUD_7200                         11
+#define DIGI_BAUD_9600                         12
+#define DIGI_BAUD_14400                                13
+#define DIGI_BAUD_19200                                14
+#define DIGI_BAUD_28800                                15
+#define DIGI_BAUD_38400                                16
+#define DIGI_BAUD_57600                                17
+#define DIGI_BAUD_76800                                18
+#define DIGI_BAUD_115200                       19
+#define DIGI_BAUD_153600                       20
+#define DIGI_BAUD_230400                       21
+#define DIGI_BAUD_460800                       22
+
+/* flow control arguments */
+#define DIGI_ENABLE_IXON_IXOFF_FLOW_CONTROL    1
+#define DIGI_ENABLE_RTS_CTS_FLOW_CONTROL       2
+#define DIGI_ENABLE_DTR_DSR_FLOW_CONTROL       4
+
+/* macros */
+#define MAX(a,b)       (((a)>(b))?(a):(b))
+#define MIN(a,b)       (((a)<(b))?(a):(b))
+
+
+/* Structures */
+
+typedef struct digi_private {
+       spinlock_t dp_port_lock;
+       int dp_buf_len;
+       char dp_buf[32];
+} digi_private_t;
+
+struct s_digiusb {
+       u8 opcode;
+       u8 length;
+       u8 val;
+       u8 pad;
+};
+
+
+/* Local Function Declarations */
+
+static void digi_send_cmd( char *mes, struct usb_serial_port *port, int opcode,
+       int length, int val );
+static void digi_send_oob( char *mes, int opcode, int linenum, int data1, int data2 );
+static void digi_rx_throttle (struct usb_serial_port *port);
+static void digi_rx_unthrottle (struct usb_serial_port *port);
+static int digi_setbaud( struct usb_serial_port *port, int baud );
+static void digi_set_termios( struct usb_serial_port *port, 
+       struct termios *old_termios );
+static void digi_break_ctl( struct usb_serial_port *port, int break_state );
+static int digi_get_modem_info( struct usb_serial *serial,
+       unsigned char *value );
+static int digi_set_modem_info( struct usb_serial *serial,
+       unsigned char value );
+static int digi_ioctl( struct usb_serial_port *port, struct file *file,
+       unsigned int cmd, unsigned long arg );
+static int digi_write( struct usb_serial_port *port, int from_user,
+       const unsigned char *buf, int count );
+static void digi_write_bulk_callback( struct urb *urb );
+static int digi_write_room( struct usb_serial_port *port );
+static int digi_chars_in_buffer( struct usb_serial_port *port );
+static int digi_open( struct usb_serial_port *port, struct file *filp );
+static void digi_close( struct usb_serial_port *port, struct file *filp );
+static int digi_startup (struct usb_serial *serial);
+static void digi_shutdown( struct usb_serial *serial );
+static void digi_read_bulk_callback( struct urb *urb );
+
+
+/* Statics */
+
+/* device info needed for the Digi serial converter */
+static __u16   digi_vendor_id          = DIGI_VENDOR_ID;
+static __u16   digi_product_id         = DIGI_ID;
+
+/* out of band port */
+static int oob_port_num;                                       /* index of out-of-band port */
+static struct usb_serial_port *oob_port;       /* out-of-band control port */
+static int oob_read_started = 0;
+
+/* config lock -- used to protect digi statics and globals, like oob vars */
+spinlock_t config_lock;
+
+
+/* Globals */
+
+struct usb_serial_device_type digi_acceleport_device = {
+       name:                   "Digi USB",
+       idVendor:               &digi_vendor_id,
+       idProduct:              &digi_product_id,
+       needs_interrupt_in:     DONT_CARE,
+       needs_bulk_in:          MUST_HAVE,
+       needs_bulk_out:         MUST_HAVE,
+       num_interrupt_in:       0,
+       num_bulk_in:            5,
+       num_bulk_out:           5,
+       num_ports:              4,
+       open:                   digi_open,
+       close:                  digi_close,
+       write:                  digi_write,
+       write_room:             digi_write_room,
+       write_bulk_callback:    digi_write_bulk_callback,
+       read_bulk_callback:     digi_read_bulk_callback,
+       chars_in_buffer:        digi_chars_in_buffer,
+       throttle:               digi_rx_throttle,
+       unthrottle:             digi_rx_unthrottle,
+       ioctl:                  digi_ioctl,
+       set_termios:            digi_set_termios,
+       break_ctl:              digi_break_ctl,
+       startup:                digi_startup,
+       shutdown:               digi_shutdown,
+};
+
+
+/* Functions */
+
+/* Send message on the out-of-Band endpoint */
+static void digi_send_oob( char *mes, int opcode, int linenum, int data1, int data2 )
+{
+       int ret;
+       struct s_digiusb digiusb;
+       digi_private_t *priv = (digi_private_t *)(oob_port->private);
+
+
+dbg( "digi_send_oob: TOP: from '%s', opcode: %d, linenum:%d, data1: %d, data2: %d", mes, opcode, linenum, data1, data2 );
+
+       digiusb.opcode = (u8)opcode;
+       digiusb.length = (u8)linenum;
+       digiusb.val = (u8)data1;
+       digiusb.pad = (u8)data2;
+
+       spin_lock( &priv->dp_port_lock );
+
+       while (oob_port->write_urb->status == -EINPROGRESS) {
+dbg( "digi_send_oob: opcode:%d already writing...", opcode );
+               spin_unlock( &priv->dp_port_lock );
+               interruptible_sleep_on(&oob_port->write_wait);
+               if (signal_pending(current)) {
+                       return;
+               }
+               spin_lock( &priv->dp_port_lock );
+       }
+
+       memcpy( oob_port->write_urb->transfer_buffer, &digiusb, sizeof(digiusb) );
+       oob_port->write_urb->transfer_buffer_length = sizeof(digiusb);
+       if( (ret=usb_submit_urb(oob_port->write_urb)) != 0 ) {
+               dbg(
+               "digi_send_oob: usb_submit_urb(write bulk) failed, opcode=%d, ret=%d",
+               opcode, ret );
+       }
+
+       spin_unlock( &priv->dp_port_lock );
+
+dbg( "digi_send_oob: opcode %d done", opcode );
+
+}
+
+
+static void digi_send_cmd( char *mes, struct usb_serial_port *port, int opcode,
+       int length, int val )
+{
+
+       int ret;
+       struct s_digiusb digiusb;
+       digi_private_t *priv = (digi_private_t *)(port->private);
+
+
+dbg( "digi_send_cmd: TOP: from '%s', opcode: %d, val: %d", mes, opcode, val );
+
+       digiusb.opcode = (u8)opcode;
+       digiusb.length = (u8)length;
+       digiusb.val = (u8)val;
+       digiusb.pad = 0;
+
+       spin_lock( &priv->dp_port_lock );
+
+       while( port->write_urb->status == -EINPROGRESS ) {
+dbg( "digi_send_cmd: opcode=%d already writing...", opcode );
+               spin_unlock( &priv->dp_port_lock );
+               interruptible_sleep_on( &port->write_wait );
+               if( signal_pending(current) ) {
+                       return;
+               }
+               spin_lock( &priv->dp_port_lock );
+       }
+
+       memcpy( port->write_urb->transfer_buffer, &digiusb, sizeof(digiusb) );
+       port->write_urb->transfer_buffer_length = sizeof(digiusb);
+       if( (ret=usb_submit_urb(port->write_urb)) != 0 )
+               dbg(
+               "digi_send_cmd: usb_submit_urb(write bulk) failed, opcode=%d, ret=%d",
+               opcode, ret );
+
+dbg( "digi_send_cmd: opcode %d done", opcode );
+
+       spin_unlock( &priv->dp_port_lock );
+
+}
+
+
+static void digi_rx_throttle( struct usb_serial_port *port )
+{
+
+dbg( "digi_rx_throttle: TOP: port=%d", port->number );
+
+       /* stop receiving characters. We just turn off the URB request, and
+          let chars pile up in the device. If we're doing hardware
+          flowcontrol, the device will signal the other end when its buffer
+          fills up. If we're doing XON/XOFF, this would be a good time to
+          send an XOFF, although it might make sense to foist that off
+          upon the device too. */
+
+       // usb_unlink_urb(port->interrupt_in_urb);
+
+}
+
+
+static void digi_rx_unthrottle( struct usb_serial_port *port )
+{
+
+dbg( "digi_rx_unthrottle: TOP: port=%d", port->number );
+
+       /* just restart the receive interrupt URB */
+       //if (usb_submit_urb(port->interrupt_in_urb))
+       //      dbg( "digi_rx_unthrottle: usb_submit_urb(read urb) failed" );
+
+}
+
+
+static int digi_setbaud( struct usb_serial_port *port, int baud )
+{
+
+       int bindex;
+
+
+dbg( "digi_setbaud: TOP: port=%d", port->number );
+
+       switch( baud ) {
+               case 50: bindex = DIGI_BAUD_50; break;
+               case 75: bindex = DIGI_BAUD_75; break;
+               case 110: bindex = DIGI_BAUD_110; break;
+               case 150: bindex = DIGI_BAUD_150; break;
+               case 200: bindex = DIGI_BAUD_200; break;
+               case 300: bindex = DIGI_BAUD_300; break;
+               case 600: bindex = DIGI_BAUD_600; break;
+               case 1200: bindex = DIGI_BAUD_1200; break;
+               case 1800: bindex = DIGI_BAUD_1800; break;
+               case 2400: bindex = DIGI_BAUD_2400; break;
+               case 4800: bindex = DIGI_BAUD_4800; break;
+               case 7200: bindex = DIGI_BAUD_7200; break;
+               case 9600: bindex = DIGI_BAUD_9600; break;
+               case 14400: bindex = DIGI_BAUD_14400; break;
+               case 19200: bindex = DIGI_BAUD_19200; break;
+               case 28800: bindex = DIGI_BAUD_28800; break;
+               case 38400: bindex = DIGI_BAUD_38400; break;
+               case 57600: bindex = DIGI_BAUD_57600; break;
+               case 76800: bindex = DIGI_BAUD_76800; break;
+               case 115200: bindex = DIGI_BAUD_115200; break;
+               case 153600: bindex = DIGI_BAUD_153600; break;
+               case 230400: bindex = DIGI_BAUD_230400; break;
+               case 460800: bindex = DIGI_BAUD_460800; break;
+               default:
+                       dbg( "digi_setbaud: can't handle requested baud rate %d", baud );
+                       return( -EINVAL );
+                       break;
+       }
+
+       digi_send_cmd( "digi_setbaud:", port, DIGI_CMD_SET_BAUD_RATE, 2, bindex );
+
+       return( 0 );    /* FIX -- send_cmd should return a value??, return it */
+
+}
+
+
+static void digi_set_termios( struct usb_serial_port *port, 
+       struct termios *old_termios )
+{
+
+       unsigned int iflag = port->tty->termios->c_iflag;
+       unsigned int old_iflag = old_termios->c_iflag;
+       unsigned int cflag = port->tty->termios->c_cflag;
+       unsigned int old_cflag = old_termios->c_cflag;
+       int arg;
+
+
+dbg( "digi_set_termios: TOP: port=%d, iflag=0x%x, old_iflag=0x%x, cflag=0x%x, old_cflag=0x%x", port->number, iflag, old_iflag, cflag, old_cflag );
+
+       /* set baud rate */
+       /* if( (cflag&CBAUD) != (old_cflag&CBAUD) ) */ {
+               switch( (cflag&CBAUD) ) {
+                       case B50: digi_setbaud(port, 50); break;
+                       case B75: digi_setbaud(port, 75); break;
+                       case B110: digi_setbaud(port, 110); break;
+                       case B150: digi_setbaud(port, 150); break;
+                       case B200: digi_setbaud(port, 200); break;
+                       case B300: digi_setbaud(port, 300); break;
+                       case B600: digi_setbaud(port, 600); break;
+                       case B1200: digi_setbaud(port, 1200); break;
+                       case B1800: digi_setbaud(port, 1800); break;
+                       case B2400: digi_setbaud(port, 2400); break;
+                       case B4800: digi_setbaud(port, 4800); break;
+                       case B9600: digi_setbaud(port, 9600); break;
+                       case B19200: digi_setbaud(port, 19200); break;
+                       case B38400: digi_setbaud(port, 38400); break;
+                       case B57600: digi_setbaud(port, 57600); break;
+                       case B115200: digi_setbaud(port, 115200); break;
+                       default:
+                               dbg( "digi_set_termios: can't handle baud rate 0x%x",
+                                       (cflag&CBAUD) );
+                               break;
+               }
+       }
+
+       /* set input flow control */
+       /* if( (iflag&IXOFF) != (old_iflag&IXOFF)
+       || (cflag&CRTSCTS) != (old_cflag&CRTSCTS) ) */ {
+
+               arg = 0;
+
+               if( (iflag&IXOFF) )
+                       arg |= DIGI_ENABLE_IXON_IXOFF_FLOW_CONTROL;
+               if( (cflag&CRTSCTS) )
+                       arg |= DIGI_ENABLE_RTS_CTS_FLOW_CONTROL;
+
+               digi_send_cmd( "digi_termios: set input flow control:", port,
+                       DIGI_CMD_SET_INPUT_FLOW_CONTROL, 2, arg );
+
+       }
+
+       /* set output flow control */
+       /* if( (iflag&IXON) != (old_iflag&IXON)
+       || (cflag&CRTSCTS) != (old_cflag&CRTSCTS) ) */ {
+
+               arg = 0;
+
+               if( (iflag&IXON) )
+                       arg |= DIGI_ENABLE_IXON_IXOFF_FLOW_CONTROL;
+               if( (cflag&CRTSCTS) )
+                       arg |= DIGI_ENABLE_RTS_CTS_FLOW_CONTROL;
+
+               digi_send_cmd( "digi_set_termios: set output flow control:", port,
+                       DIGI_CMD_SET_OUTPUT_FLOW_CONTROL, 2, arg );
+
+       }
+
+}
+
+
+static void digi_break_ctl( struct usb_serial_port *port, int break_state )
+{
+dbg( "digi_break_ctl: TOP: port=%d", port->number );
+}
+
+
+/* modem control pins: DTR and RTS are outputs and can be controlled;
+   DCD, RI, DSR, CTS are inputs and can be read */
+
+static int digi_get_modem_info( struct usb_serial *serial,
+       unsigned char *value )
+{
+dbg( "digi_get_modem_info: TOP" );
+       return( 0 );
+}
+
+
+static int digi_set_modem_info( struct usb_serial *serial,
+       unsigned char value )
+{
+dbg( "digi_set_modem_info: TOP" );
+       return( 0 );
+}
+
+
+static int digi_ioctl( struct usb_serial_port *port, struct file *file,
+       unsigned int cmd, unsigned long arg )
+{
+       struct usb_serial *serial = port->serial;
+       int rc;
+       unsigned int value;
+       unsigned char status, mask;
+
+dbg( "digi_ioctl: TOP: port=%d, cmd=0x%x", port->number, cmd );
+return( -ENOIOCTLCMD );
+
+       switch (cmd) {
+       case TIOCMGET: /* get modem pins state */
+               rc = digi_get_modem_info(serial, &status);
+               if (rc < 0)
+                       return rc;
+               value =
+                       ((status & (1<<7)) ? TIOCM_DTR : 0) |
+                       ((status & (1<<6)) ? TIOCM_CAR : 0) |
+                       ((status & (1<<5)) ? TIOCM_RNG : 0) |
+                       ((status & (1<<4)) ? TIOCM_DSR : 0) |
+                       ((status & (1<<3)) ? TIOCM_CTS : 0) |
+                       ((status & (1<<2)) ? TIOCM_RTS : 0);
+               if (copy_to_user((unsigned int *)arg, &value, sizeof(int)))
+                       return -EFAULT;
+               return 0;
+       case TIOCMSET: /* set a state as returned by MGET */
+               if (copy_from_user(&value, (unsigned int *)arg, sizeof(int)))
+                       return -EFAULT;
+               status =
+                       ((value & TIOCM_DTR) ? (1<<7) : 0) |
+                       ((value & TIOCM_CAR) ? (1<<6) : 0) |
+                       ((value & TIOCM_RNG) ? (1<<5) : 0) |
+                       ((value & TIOCM_DSR) ? (1<<4) : 0) |
+                       ((value & TIOCM_CTS) ? (1<<3) : 0) |
+                       ((value & TIOCM_RTS) ? (1<<2) : 0);
+               rc = digi_set_modem_info(serial, status);
+               if (rc < 0)
+                       return rc;
+               return 0;
+       case TIOCMBIS: /* set bits in bitmask <arg> */
+       case TIOCMBIC: /* clear bits from bitmask <arg> */
+               if (copy_from_user(&value, (unsigned int *)arg, sizeof(int)))
+                       return -EFAULT;
+               rc = digi_get_modem_info(serial, &status);
+               if (rc < 0)
+                       return rc;
+               mask =
+                       ((value & TIOCM_RTS) ? (1<<2) : 0) |
+                       ((value & TIOCM_DTR) ? (1<<7) : 0);
+               if (cmd == TIOCMBIS)
+                       status |= mask;
+               else
+                       status &= ~mask;
+               rc = digi_set_modem_info(serial, status);
+               if (rc < 0)
+                       return rc;
+               return 0;
+       case TIOCMIWAIT:
+               /* wait for any of the 4 modem inputs (DCD,RI,DSR,CTS)*/
+               /* TODO */
+       case TIOCGICOUNT:
+               /* return count of modemline transitions */
+               return 0; /* TODO */
+       }
+       
+       return -ENOIOCTLCMD;
+}
+
+
+static int digi_write( struct usb_serial_port *port, int from_user,
+       const unsigned char *buf, int count )
+{
+
+       int i,ret,data_len,new_len;
+       digi_private_t *priv = (digi_private_t *)(port->private);
+
+
+dbg( "digi_write: TOP: port=%d, count=%d, from_user=%d, in_interrupt=%d",
+port->number, count, from_user, in_interrupt() );
+
+       /* be sure only one write proceeds at a time */
+       /* there are races on the port private buffer */
+       /* and races to check write_urb->status */
+       spin_lock( &priv->dp_port_lock );
+
+       /* wait for urb status clear to submit another urb */
+       if( port->write_urb->status == -EINPROGRESS ) {
+
+dbg( "digi_write: -EINPROGRESS set" );
+
+               /* buffer the data if possible */
+               new_len = MIN( count, DIGI_PORT_BUF_LEN-priv->dp_buf_len );
+               memcpy( priv->dp_buf+priv->dp_buf_len, buf, new_len );
+               priv->dp_buf_len += new_len;
+
+               /* unlock and return number of bytes buffered */
+               spin_unlock( &priv->dp_port_lock );
+dbg( "digi_write: buffering, return %d", new_len );
+               return( new_len );
+
+       }
+
+       /* allow space for any buffered data and for new data, up to */
+       /* transfer buffer size - 2 (for command and length bytes) */
+       new_len = MIN( count, port->bulk_out_size-2-priv->dp_buf_len );
+       data_len = new_len + priv->dp_buf_len;
+
+dbg( "digi_write: counts: new data %d, buf data %d, total data %d (max %d)", new_len, priv->dp_buf_len, data_len, port->bulk_out_size-2 );
+
+       /* nothing to send */
+       if( data_len == 0 ) {
+               spin_unlock( &priv->dp_port_lock );
+               return( 0 );
+       }
+
+       /* set command and length bytes */
+       *((u8 *)(port->write_urb->transfer_buffer)) = (u8)DIGI_CMD_SEND_DATA;
+       *((u8 *)(port->write_urb->transfer_buffer)+1) = (u8)data_len;
+
+       /* set total transfer buffer length */
+       port->write_urb->transfer_buffer_length = data_len+2;
+
+       /* copy in buffered data first */
+       memcpy( port->write_urb->transfer_buffer+2, priv->dp_buf,
+               priv->dp_buf_len );
+
+       /* copy in new data */
+       if( from_user ) {
+               copy_from_user( port->write_urb->transfer_buffer+2+priv->dp_buf_len,
+                       buf, new_len );
+       }
+       else {
+               memcpy( port->write_urb->transfer_buffer+2+priv->dp_buf_len,
+                       buf, new_len );
+       }  
+
+#ifdef DEBUG
+       printk( KERN_DEBUG __FILE__ ": digi_write: length=%d, data=",
+               port->write_urb->transfer_buffer_length );
+       for( i=0; i<port->write_urb->transfer_buffer_length; ++i ) {
+               printk( "%.2x ",
+                       ((unsigned char *)port->write_urb->transfer_buffer)[i] );
+       }
+       printk( "\n" );
+#endif
+
+       /* submit urb */
+       if( (ret=usb_submit_urb(port->write_urb)) == 0 ) {
+               /* submit successful, return length of new data written */
+               ret = new_len;
+               /* clear buffer */
+               priv->dp_buf_len = 0;
+       }
+       else {
+               dbg( "digi_write: usb_submit_urb(write bulk) failed, ret=%d", ret );
+               /* no bytes written - should we return the error code or 0? */
+               ret = 0;
+       }
+
+       /* return length of new data written, or error */
+dbg( "digi_write: returning %d", ret );
+       spin_unlock( &priv->dp_port_lock );
+       return( ret );
+
+} 
+
+
+static void digi_write_bulk_callback( struct urb *urb )
+{
+
+       struct usb_serial_port *port = (struct usb_serial_port *)urb->context;
+       struct usb_serial *serial = port->serial;
+       struct tty_struct *tty = port->tty;
+       digi_private_t *priv = (digi_private_t *)(port->private);
+       int ret;
+
+
+dbg( "digi_write_bulk_callback: TOP: port=%d", port->number );
+
+       /* handle callback on out-of-band port */
+       if( port->number == oob_port_num ) {
+               dbg( "digi_write_bulk_callback: oob callback" );
+               wake_up_interruptible( &port->write_wait );
+               return;
+       }
+
+       /* sanity checks */
+       if( port_paranoia_check( port, "digi_write_bulk_callback" )
+       || serial_paranoia_check( serial, "digi_write_bulk_callback" ) ) {
+               return;
+       }
+
+       /* try to send any buffered data on this port */
+       spin_lock( &priv->dp_port_lock );
+       if( port->write_urb->status != -EINPROGRESS && priv->dp_buf_len > 0 ) {
+
+               /* set command and length bytes */
+               *((u8 *)(port->write_urb->transfer_buffer))
+                       = (u8)DIGI_CMD_SEND_DATA;
+               *((u8 *)(port->write_urb->transfer_buffer)+1)
+                       = (u8)priv->dp_buf_len;
+
+               /* set total transfer buffer length */
+               port->write_urb->transfer_buffer_length = priv->dp_buf_len+2;
+
+               /* copy in buffered data */
+               memcpy( port->write_urb->transfer_buffer+2, priv->dp_buf,
+                       priv->dp_buf_len );
+
+               /* submit urb */
+dbg( "digi_write_bulk_callback: submit urb to write buffer, data len=%d",
+priv->dp_buf_len );
+               if( (ret=usb_submit_urb(port->write_urb)) == 0 ) {
+                       /* successful, clear buffer */
+                       priv->dp_buf_len = 0;
+               }
+               else {
+                       dbg( "digi_write_bulk_callback: usb_submit_urb(write bulk) failed, ret=%d", ret );
+               }
+
+       }
+       spin_unlock( &priv->dp_port_lock );
+
+       /* wake up port processes */
+       wake_up_interruptible( &port->write_wait );
+
+       /* wake up line discipline */
+       tty = port->tty;
+       if( (tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) && tty->ldisc.write_wakeup )
+               (tty->ldisc.write_wakeup)(tty);
+
+       /* wake up other tty processes */
+       wake_up_interruptible( &tty->write_wait );
+
+}
+
+
+static int digi_write_room( struct usb_serial_port *port )
+{
+
+       int room;
+       digi_private_t *priv = (digi_private_t *)(port->private);
+
+
+dbg( "digi_write_room: TOP: port=%d", port->number );
+
+       spin_lock( &priv->dp_port_lock );
+
+       if( port->write_urb->status == -EINPROGRESS )
+               room = 0;
+       else
+               room = port->bulk_out_size - 2 - priv->dp_buf_len;
+
+       spin_unlock( &priv->dp_port_lock );
+
+dbg( "digi_write_room: return room=%d", room );
+       return( room );
+
+}
+
+
+static int digi_chars_in_buffer( struct usb_serial_port *port )
+{
+
+       digi_private_t *priv = (digi_private_t *)(port->private);
+
+
+dbg( "digi_chars_in_buffer: TOP: port=%d", port->number );
+
+       if( port->write_urb->status == -EINPROGRESS ) {
+dbg( "digi_chars_in_buffer: return=%d", port->bulk_out_size );
+               return( port->bulk_out_size );
+       }
+       else {
+dbg( "digi_chars_in_buffer: return=%d", priv->dp_buf_len );
+               return( priv->dp_buf_len );
+       }
+
+}
+
+
+static int digi_open( struct usb_serial_port *port, struct file *filp )
+{
+
+       int ret;
+       digi_private_t *priv = (digi_private_t *)(port->private);
+
+
+dbg( "digi_open: TOP: port %d", port->number );
+
+       /* if port is already open, just return */
+       /* be sure exactly one open succeeds */
+       spin_lock( &priv->dp_port_lock );
+       if( port->active ) {
+               return( 0 );
+       }
+       port->active = 1;
+       spin_unlock( &priv->dp_port_lock );
+       /* start reading from the out-of-band port for the device */
+       /* be sure this happens exactly once */
+       spin_lock( &config_lock );
+       if( !oob_read_started ) {
+               if( (ret=usb_submit_urb(oob_port->read_urb)) != 0 ) {
+                       dbg( "digi_open: usb_submit_urb(read bulk) for oob failed, ret=%d",
+                               ret );
+                       spin_unlock( &config_lock );
+                       return( -ENXIO );
+               }
+               else {
+dbg( "digi_open: usb_submit_urb(read bulk) for oob succeeded" );
+                       oob_read_started = 1;
+               }
+       }
+       spin_unlock( &config_lock );
+
+       /* initialize port */
+dbg( "digi_open: init..." );
+       /* set 9600, 8N1, DTR, RTS, RX enable, no input or output flow control */
+       digi_setbaud( port, 9600 );
+       digi_send_cmd( "digi_open: wordsize", port, DIGI_CMD_SET_WORD_SIZE, 2, 3 );
+       digi_send_cmd( "digi_open: parity", port, DIGI_CMD_SET_PARITY, 2, 0 );
+       digi_send_cmd( "digi_open: stopbits", port, DIGI_CMD_SET_STOP_BITS, 2, 0 );
+       digi_send_cmd( "digi_open: DTR on", port, DIGI_CMD_SET_DTR_SIGNAL, 2, 1 );
+       digi_send_cmd( "digi_open: RTS on", port, DIGI_CMD_SET_RTS_SIGNAL, 2, 1 );
+       digi_send_cmd( "digi_open: RX enable on", port, DIGI_CMD_RECEIVE_ENABLE, 2,
+               1 );
+       digi_send_cmd( "digi_open: input flow control off", port,
+               DIGI_CMD_SET_INPUT_FLOW_CONTROL, 2, 0 );
+       digi_send_cmd( "digi_open: output flow control off", port,
+               DIGI_CMD_SET_OUTPUT_FLOW_CONTROL, 2, 0 );
+
+       /* start reading from the device */
+       if( (ret=usb_submit_urb(port->read_urb)) != 0 ) {
+               dbg( "digi_open: usb_submit_urb(read bulk) failed, ret=%d", ret );
+               return( -ENXIO );
+       }
+
+dbg( "digi_open: done" );
+       return( 0 );
+
+}
+
+
+static void digi_close( struct usb_serial_port *port, struct file *filp )
+{
+
+dbg( "digi_close: TOP: port %d", port->number );
+       
+       /* Need to change the control lines here */
+       /* TODO */
+dbg( "digi_close: wanna clear DTR and RTS..." );
+
+//digi_send_cmd( "digi_close DTR off", port, 6, 2, 0); // clear DTR
+//digi_send_cmd( "digi_close RTS off", port, 7, 2, 0); // clear RTS
+//digi_send_cmd( "digi_close RX disable", port, 10, 2, 0);     // Rx Disable
+
+digi_send_oob( "digi_close RTS off", DIGI_CMD_SET_RTS_SIGNAL,
+       port->number, 0, 0 );   // clear RTS
+digi_send_oob( "digi_close DTR off", DIGI_CMD_SET_DTR_SIGNAL,
+       port->number, 0, 0 );   // clear DTR
+
+       while( oob_port->write_urb->status == -EINPROGRESS ) {
+dbg ("digi_close: waiting for final writes to complete on oob port %d...", oob_port->number );
+               interruptible_sleep_on( &oob_port->write_wait );
+               if( signal_pending(current) ) {
+                       break;
+               }
+       }
+       
+       /* shutdown our bulk reads and writes */
+       usb_unlink_urb (port->write_urb);
+       usb_unlink_urb (port->read_urb);
+
+       port->active = 0;
+
+}
+
+
+static int digi_startup (struct usb_serial *serial)
+{
+
+       int i;
+       digi_private_t *priv;
+
+
+dbg( "digi_startup: TOP" );
+
+       /* initialize config lock */
+       spin_lock_init( &config_lock );
+
+       /* allocate the private data structures for all ports */
+       /* number of regular ports + 1 for the out-of-band port */
+       for( i=0; i<digi_acceleport_device.num_ports+1; i++ ) {
+
+               /* allocate private structure */
+               priv = serial->port[i].private =
+                       (digi_private_t *)kmalloc( sizeof(struct digi_private),
+                       GFP_KERNEL );
+               if( priv == (digi_private_t *)0 )
+                       return( 1 );                            /* error */
+
+               /* initialize private structure */
+               priv->dp_buf_len = 0;
+               spin_lock_init( &priv->dp_port_lock );
+
+               /* initialize write wait queue for this port */
+               init_waitqueue_head(&serial->port[i].write_wait);
+
+       }
+
+       /* initialize out of band port info */
+       oob_port_num = digi_acceleport_device.num_ports;
+       oob_port = &serial->port[oob_port_num];
+       oob_read_started = 0;
+
+       return( 0 );
+
+}
+
+
+static void digi_shutdown( struct usb_serial *serial )
+{
+
+       int i;
+
+
+dbg( "digi_shutdown: TOP" );
+
+       /* stop writing and reading from the out-of-band port */
+       usb_unlink_urb( oob_port->write_urb );
+       usb_unlink_urb( oob_port->read_urb );
+       oob_read_started = 0;
+
+       /* free the private data structures for all ports */
+       /* number of regular ports + 1 for the out-of-band port */
+       for( i=0; i<digi_acceleport_device.num_ports+1; i++ )
+               kfree( serial->port[i].private );
+
+}
+
+
+static void digi_read_bulk_callback( struct urb *urb )
+{
+
+       struct usb_serial_port *port = (struct usb_serial_port *)urb->context;
+       struct usb_serial *serial = port->serial;
+       struct tty_struct *tty = port->tty;
+       unsigned char *data = urb->transfer_buffer;
+       int ret,i;
+
+
+dbg( "digi_read_bulk_callback: TOP: port=%d", port->number );
+
+       /* handle oob callback */
+       if( port->number == oob_port_num ) {
+dbg( "digi_read_bulk_callback: oob_port callback, opcode=%d, line=%d, status=%d, ret=%d", data[0], data[1], data[2], data[3] );
+               if( urb->status ) {
+                       dbg( "digi_read_bulk_callback: nonzero read bulk status on oob: %d",
+                               urb->status );
+               }
+               if( (ret=usb_submit_urb(urb)) != 0 ) {
+                       dbg( "digi_read_bulk_callback: failed resubmitting oob urb, ret=%d",
+                               ret );
+               }
+               return;
+       }
+
+       /* sanity checks */
+       if( port_paranoia_check( port, "digi_read_bulk_callback" )
+       || serial_paranoia_check( serial, "digi_read_bulk_callback" ) ) {
+               return;
+       }
+
+       /* check status */
+       if( urb->status ) {
+               dbg( "digi_read_bulk_callback: nonzero read bulk status: %d",
+                       urb->status );
+               return;
+       }
+
+#ifdef DEBUG
+       if (urb->actual_length) {
+               printk( KERN_DEBUG __FILE__ ": digi_read_bulk_callback: length=%d, data=",
+                       urb->actual_length );
+               for( i=0; i<urb->actual_length; ++i ) {
+                       printk( "%.2x ", data[i] );
+               }
+               printk( "\n" );
+       }
+#endif
+
+       /* Digi read packets are:                                                                                                */
+       /* 0         1      2         3       4    ...     3+length-1 == 2+length*/
+       /* opcode, length, status, data[0], data[1]...data[length-2]                     */
+       if( urb->actual_length > 3 ) {
+               for( i=3; i<2+data[1]; ++i ) {
+                        tty_insert_flip_char(tty, data[i], 0);
+               }
+               tty_flip_buffer_push(tty);
+       }
+
+       /* Continue trying to read */
+       if( (ret=usb_submit_urb(urb)) != 0 )
+               dbg( "digi_read_bulk_callback: failed resubmitting read urb, ret=%d",
+                       ret );
+
+}
+
+#endif /* CONFIG_USB_SERIAL_DIGI_ACCELEPORT */
+
index 8991f4be9caea34f1afa86db6c7190a7d9f600b3..9a2f1089649f9bcea4393191ea49093609bb2dee 100644 (file)
@@ -123,6 +123,7 @@ extern struct usb_serial_device_type ftdi_sio_device;
 extern struct usb_serial_device_type keyspan_pda_fake_device;
 extern struct usb_serial_device_type keyspan_pda_device;
 extern struct usb_serial_device_type zyxel_omninet_device;
+extern struct usb_serial_device_type digi_acceleport_device;
 
 
 /* determine if we should include the EzUSB loader functions */
index 7b2bfb9d3ee235095e03ad95f67429eb636fcff9..ea9a2983866dc2a394d29606525ff70f24740289 100644 (file)
@@ -14,6 +14,9 @@
  *
  * See Documentation/usb/usb-serial.txt for more information on using this driver
  * 
+ * (05/03/2000) gkh
+ *     Added the Digi Acceleport driver from Al Borchers and Peter Berger.
+ *
  * (04/27/2000) Ryan VanderBijl
  *     Put calls to *_paranoia_checks into one function.
  * 
@@ -284,6 +287,9 @@ static struct usb_serial_device_type *usb_serial_devices[] = {
 #endif
 #ifdef CONFIG_USB_SERIAL_OMNINET
        &zyxel_omninet_device,
+#endif
+#ifdef CONFIG_USB_SERIAL_DIGI_ACCELEPORT
+       &digi_acceleport_device,
 #endif
        NULL
 };
index 563151dbe193927a6080704b9bef059e65915001..b8c01e7eba1a3b5d3afa6a346f966687f58ff050 100644 (file)
@@ -1889,7 +1889,7 @@ static int rh_submit_urb(struct urb *urb)
                        OK(len);
                case 0x03:      /* string descriptors */
                        len = usb_root_hub_string (wValue & 0xff,
-                               uhci->io_addr, "UHCI",
+                               uhci->io_addr, "UHCI-alt",
                                data, wLength);
                        if (len > 0) {
                                OK (min (leni, len));
index 213cd8180cd940d082aa03cd9db9e21be0844e3d..19c590029ab7a48ae4813d79caea4edfec67619e 100644 (file)
@@ -1206,10 +1206,10 @@ static int ascii2utf (char *ascii, __u8 *utf, int utfmax)
  */
 int usb_root_hub_string (int id, int serial, char *type, __u8 *data, int len)
 {
-       char buf [20];
+       char buf [30];
 
        // assert (len > (2 * (sizeof (buf) + 1)));
-       // assert (strlen (type) ~== 4);
+       // assert (strlen (type) <= 8);
 
        // language ids
        if (id == 0) {
index c4d398e94f547eb35f5269e42c41e2a49662e9a0..a882aaea572023181d62fcb202b693ffcd146d5d 100644 (file)
@@ -109,7 +109,6 @@ struct hdlcdrv_ioctl {
 #include <linux/spinlock.h>
 
 #define HDLCDRV_MAGIC      0x5ac6e778
-#define HDLCDRV_IFNAMELEN    6
 #define HDLCDRV_HDLCBUFFER  32 /* should be a power of 2 for speed reasons */
 #define HDLCDRV_BITBUFFER  256 /* should be a power of 2 for speed reasons */
 #undef HDLCDRV_LOOPBACK  /* define for HDLC debugging purposes */
@@ -182,8 +181,6 @@ struct hdlcdrv_ops {
 struct hdlcdrv_state {
        int magic;
 
-       char ifname[HDLCDRV_IFNAMELEN];
-
        const struct hdlcdrv_ops *ops;
 
        struct {
index 67cc761c849f07833a5158e1991703e89505be9d..af897c7541d81a28ef52e070398c4db77f35ae3d 100644 (file)
@@ -164,7 +164,6 @@ struct irlan_cb {
        queue_t q; /* Must be first */
 
        int    magic;
-       char   ifname[9];
        struct net_device dev;        /* Ethernet device structure*/
        struct enet_statistics stats;
 
index 1d353bf60348a7a4cf098434b6ff67f3c6a41168..eb3119dd3ef92fb4ecb870a528b0d6b7647d97e1 100644 (file)
@@ -246,7 +246,7 @@ int shrink_mmap(int priority, int gfp_mask, zone_t *zone)
        if (!zone)
                BUG();
 
-       count = nr_lru_pages >> priority;
+       count = (nr_lru_pages << 1) >> priority;
        if (!count)
                return ret;
 
index 0c2a983ae17659fcb84b39849d569048a4a3f7a2..0d0948457ecfb9647eba481fe85d6ff0cce23216 100644 (file)
@@ -60,6 +60,10 @@ static int try_to_swap_out(struct mm_struct * mm, struct vm_area_struct* vma, un
                goto out_failed;
        }
 
+       /* Don't look at this page if it's in a zone that we're not interested in.. */
+       if (!page->zone->zone_wake_kswapd)
+               goto out_failed;
+
        if (TryLockPage(page))
                goto out_failed;
 
@@ -355,7 +359,7 @@ int swap_out(unsigned int priority, int gfp_mask)
         * Think of swap_cnt as a "shadow rss" - it tells us which process
         * we want to page out (always try largest first).
         */
-       counter = nr_threads / (priority+1);
+       counter = (nr_threads << 1) >> (priority >> 1);
        if (counter < 1)
                counter = 1;
 
@@ -499,10 +503,7 @@ DECLARE_WAIT_QUEUE_HEAD(kswapd_wait);
  */
 int kswapd(void *unused)
 {
-       int i;
        struct task_struct *tsk = current;
-       pg_data_t *pgdat;
-       zone_t *zone;
 
        tsk->session = 1;
        tsk->pgrp = 1;
@@ -523,31 +524,30 @@ int kswapd(void *unused)
         */
        tsk->flags |= PF_MEMALLOC;
 
-       while (1) {
-               /*
-                * If we actually get into a low-memory situation,
-                * the processes needing more memory will wake us
-                * up on a more timely basis.
-                */
+       for (;;) {
+               pg_data_t *pgdat;
+               int something_to_do = 0;
+
                pgdat = pgdat_list;
-               while (pgdat) {
-                       for (i = 0; i < MAX_NR_ZONES; i++) {
-                               int count = SWAP_CLUSTER_MAX;
-                               zone = pgdat->node_zones + i;
-                               if ((!zone->size) || (!zone->zone_wake_kswapd))
+               do {
+                       int i;
+                       for(i = 0; i < MAX_NR_ZONES; i++) {
+                               zone_t *zone = pgdat->node_zones+ i;
+                               if (!zone->size || !zone->zone_wake_kswapd)
                                        continue;
-                               do {
-                                       if (tsk->need_resched)
-                                               schedule();
-                                       do_try_to_free_pages(GFP_KSWAPD, zone);
-                               } while (zone->free_pages < zone->pages_low &&
-                                          --count);
+                               something_to_do = 1;
+                               do_try_to_free_pages(GFP_KSWAPD, zone);
+                               if (tsk->need_resched)
+                                       schedule();
                        }
+                       run_task_queue(&tq_disk);
                        pgdat = pgdat->node_next;
+               } while (pgdat);
+
+               if (!something_to_do) {
+                       tsk->state = TASK_INTERRUPTIBLE;
+                       interruptible_sleep_on(&kswapd_wait);
                }
-               run_task_queue(&tq_disk);
-               tsk->state = TASK_INTERRUPTIBLE;
-               interruptible_sleep_on(&kswapd_wait);
        }
 }
 
index 1aa76359b3973bf6edb3d10e299fd98f12904fb3..08e1904569bfeabcf3fe068fe4cda2b166fa800d 100644 (file)
@@ -140,12 +140,12 @@ void ax25_stop_idletimer(ax25_cb *ax25)
 
 int ax25_t1timer_running(ax25_cb *ax25)
 {
-       return (ax25->t1timer.prev != NULL || ax25->t1timer.next != NULL);
+       return timer_pending(&ax25->t1timer);
 }
 
 unsigned long ax25_display_timer(struct timer_list *timer)
 {
-       if (timer->prev == NULL && timer->next == NULL)
+       if (!timer_pending(timer))
                return 0;
 
        return timer->expires - jiffies;
index dc77c5ffd49bacd201d78611cf292ebd1b365551..ef69b47fabdb96edace69207e0e0974cdaa8e589 100644 (file)
@@ -74,7 +74,7 @@ static struct net_bridge **__find_br(char *name)
 
        b = &bridge_list;
        while ((br = *b) != NULL) {
-               if (!strncmp(br->name, name, IFNAMSIZ))
+               if (!strncmp(br->dev.name, name, IFNAMSIZ))
                        return b;
 
                b = &(br->next);
@@ -102,9 +102,8 @@ static struct net_bridge *new_nb(char *name)
        memset(br, 0, sizeof(*br));
        dev = &br->dev;
 
-       strncpy(br->name, name, IFNAMSIZ);
+       strncpy(dev->name, name, IFNAMSIZ);
        dev->priv = br;
-       dev->name = br->name;
        ether_setup(dev);
        br_dev_setup(dev);
 
index 76c14be9ccf05598432f56f34772e9b308b41622..a1f9c2aba3f9d6ed33c14b54d6cf62ed3a2b67fa 100644 (file)
@@ -82,7 +82,6 @@ struct net_bridge
        struct net_bridge               *next;
        rwlock_t                        lock;
        struct net_bridge_port          *port_list;
-       char                            name[IFNAMSIZ];
        struct net_device               dev;
        struct net_device_stats         statistics;
        rwlock_t                        hash_lock;
index db5c18733d29e47f150b579dd726fd6234520ea9..cae6b419baf9267ea16e280af39086e6235d8d33 100644 (file)
@@ -292,7 +292,7 @@ static void br_topology_change_acknowledged(struct net_bridge *br)
 /* called under bridge lock */
 void br_topology_change_detection(struct net_bridge *br)
 {
-       printk(KERN_INFO "%s: topology change detected, ", br->name);
+       printk(KERN_INFO "%s: topology change detected, ", br->dev.name);
 
        if (br_is_root_bridge(br)) {
                printk("propagating\n");
@@ -357,7 +357,7 @@ static void br_make_blocking(struct net_bridge_port *p)
                        br_topology_change_detection(p->br);
 
                printk(KERN_INFO "%s: port %i(%s) entering %s state\n",
-                      p->br->name, p->port_no, p->dev->name, "blocking");
+                      p->br->dev.name, p->port_no, p->dev->name, "blocking");
 
                p->state = BR_STATE_BLOCKING;
                br_timer_clear(&p->forward_delay_timer);
@@ -369,7 +369,7 @@ static void br_make_forwarding(struct net_bridge_port *p)
 {
        if (p->state == BR_STATE_BLOCKING) {
                printk(KERN_INFO "%s: port %i(%s) entering %s state\n",
-                      p->br->name, p->port_no, p->dev->name, "listening");
+                      p->br->dev.name, p->port_no, p->dev->name, "listening");
 
                p->state = BR_STATE_LISTENING;
                br_timer_set(&p->forward_delay_timer, jiffies);
@@ -456,7 +456,7 @@ void br_received_tcn_bpdu(struct net_bridge_port *p)
        if (p->state != BR_STATE_DISABLED &&
            br_is_designated_port(p)) {
                printk(KERN_INFO "%s: received tcn bpdu on port %i(%s)\n",
-                      p->br->name, p->port_no, p->dev->name);
+                      p->br->dev.name, p->port_no, p->dev->name);
 
                br_topology_change_detection(p->br);
                br_topology_change_acknowledge(p);
index 263ac21af8ed3dd96e88445ddbba78d718896830..ecba3366c29531b8df8cc2e6dd301f00cd31c7e0 100644 (file)
@@ -103,7 +103,7 @@ void br_stp_disable_port(struct net_bridge_port *p)
 
        br = p->br;
        printk(KERN_INFO "%s: port %i(%s) entering %s state\n",
-              br->name, p->port_no, p->dev->name, "disabled");
+              br->dev.name, p->port_no, p->dev->name, "disabled");
 
        wasroot = br_is_root_bridge(br);
        br_become_designated_port(p);
index c530f14f8bc0df7e0aac82377f8591391757eadb..870270c035658f537f330c26806f9ee674a5615c 100644 (file)
@@ -58,7 +58,7 @@ static void br_message_age_timer_expired(struct net_bridge_port *p)
        int was_root;
 
        br = p->br;
-       printk(KERN_INFO "%s: ", br->name);
+       printk(KERN_INFO "%s: ", br->dev.name);
        printk("neighbour ");
        dump_bridge_id(&p->designated_bridge);
        printk(" lost on port %i(%s)\n", p->port_no, p->dev->name);
@@ -82,13 +82,13 @@ static void br_forward_delay_timer_expired(struct net_bridge_port *p)
 {
        if (p->state == BR_STATE_LISTENING) {
                printk(KERN_INFO "%s: port %i(%s) entering %s state\n",
-                      p->br->name, p->port_no, p->dev->name, "learning");
+                      p->br->dev.name, p->port_no, p->dev->name, "learning");
 
                p->state = BR_STATE_LEARNING;
                br_timer_set(&p->forward_delay_timer, jiffies);
        } else if (p->state == BR_STATE_LEARNING) {
                printk(KERN_INFO "%s: port %i(%s) entering %s state\n",
-                      p->br->name, p->port_no, p->dev->name, "forwarding");
+                      p->br->dev.name, p->port_no, p->dev->name, "forwarding");
 
                p->state = BR_STATE_FORWARDING;
                if (br_is_designated_for_some_port(p->br))
@@ -99,7 +99,7 @@ static void br_forward_delay_timer_expired(struct net_bridge_port *p)
 /* called under bridge lock */
 static void br_tcn_timer_expired(struct net_bridge *br)
 {
-       printk(KERN_INFO "%s: retransmitting tcn bpdu\n", br->name);
+       printk(KERN_INFO "%s: retransmitting tcn bpdu\n", br->dev.name);
        br_transmit_tcn(br);
        br_timer_set(&br->tcn_timer, jiffies);
 }
index 01a39b6e41021c3998c4ce93602366a5c345786b..50f09f1ec1e4e6225900f32c4f4fd242c96f0563 100644 (file)
@@ -118,11 +118,11 @@ static int ipgre_tunnel_init(struct net_device *dev);
 static int ipgre_fb_tunnel_init(struct net_device *dev);
 
 static struct net_device ipgre_fb_tunnel_dev = {
-       NULL, 0x0, 0x0, 0x0, 0x0, 0, 0, 0, 0, 0, NULL, ipgre_fb_tunnel_init,
+       "gre%d", 0x0, 0x0, 0x0, 0x0, 0, 0, 0, 0, 0, NULL, ipgre_fb_tunnel_init,
 };
 
 static struct ip_tunnel ipgre_fb_tunnel = {
-       NULL, &ipgre_fb_tunnel_dev, {0, }, 0, 0, 0, 0, 0, 0, 0, {"gre0", }
+       NULL, &ipgre_fb_tunnel_dev, {0, }, 0, 0, 0, 0, 0, 0, 0, {"gre%d", }
 };
 
 /* Tunnel hash table */
@@ -268,7 +268,7 @@ static struct ip_tunnel * ipgre_tunnel_locate(struct ip_tunnel_parm *parms, int
        dev->priv = (void*)(dev+1);
        nt = (struct ip_tunnel*)dev->priv;
        nt->dev = dev;
-       dev->name = nt->parms.name;
+       strcpy(dev->name, nt->parms.name);
        dev->init = ipgre_tunnel_init;
        dev->new_style = 1;
        memcpy(&nt->parms, parms, sizeof(*parms));
@@ -1226,7 +1226,6 @@ int __init ipgre_init(void)
        printk(KERN_INFO "GRE over IPv4 tunneling driver\n");
 
        ipgre_fb_tunnel_dev.priv = (void*)&ipgre_fb_tunnel;
-       ipgre_fb_tunnel_dev.name = ipgre_fb_tunnel.parms.name;
 #ifdef MODULE
        register_netdev(&ipgre_fb_tunnel_dev);
 #else
index c3f3b29f765d535db9dbd7d485859098872cf0c4..367db483a2d119f77e865cb0168ea1a18701596a 100644 (file)
@@ -121,11 +121,11 @@ static int ipip_fb_tunnel_init(struct net_device *dev);
 static int ipip_tunnel_init(struct net_device *dev);
 
 static struct net_device ipip_fb_tunnel_dev = {
-       NULL, 0x0, 0x0, 0x0, 0x0, 0, 0, 0, 0, 0, NULL, ipip_fb_tunnel_init,
+       "tunl%d", 0x0, 0x0, 0x0, 0x0, 0, 0, 0, 0, 0, NULL, ipip_fb_tunnel_init,
 };
 
 static struct ip_tunnel ipip_fb_tunnel = {
-       NULL, &ipip_fb_tunnel_dev, {0, }, 0, 0, 0, 0, 0, 0, 0, {"tunl0", }
+       NULL, &ipip_fb_tunnel_dev, {0, }, 0, 0, 0, 0, 0, 0, 0, {"tunl%d", }
 };
 
 static struct ip_tunnel *tunnels_r_l[HASH_SIZE];
@@ -237,7 +237,7 @@ struct ip_tunnel * ipip_tunnel_locate(struct ip_tunnel_parm *parms, int create)
        dev->priv = (void*)(dev+1);
        nt = (struct ip_tunnel*)dev->priv;
        nt->dev = dev;
-       dev->name = nt->parms.name;
+       strcpy(dev->name, nt->parms.name);
        dev->init = ipip_tunnel_init;
        dev->new_style = 1;
        memcpy(&nt->parms, parms, sizeof(*parms));
@@ -875,7 +875,6 @@ int __init ipip_init(void)
        printk(KERN_INFO "IPv4 over IPv4 tunneling driver\n");
 
        ipip_fb_tunnel_dev.priv = (void*)&ipip_fb_tunnel;
-       ipip_fb_tunnel_dev.name = ipip_fb_tunnel.parms.name;
 #ifdef MODULE
        register_netdev(&ipip_fb_tunnel_dev);
 #else
index e0b22111eea4ce80d0bc2d49209f547658515392..6d805eef0ba23a5d5d24bf1c9f8267eaa1162345 100644 (file)
@@ -189,7 +189,7 @@ struct net_device *ipmr_reg_vif(struct vifctl *v)
        struct in_device *in_dev;
        int size;
 
-       size = sizeof(*dev) + IFNAMSIZ + sizeof(struct net_device_stats);
+       size = sizeof(*dev) + sizeof(struct net_device_stats);
        dev = kmalloc(size, GFP_KERNEL);
        if (!dev)
                return NULL;
@@ -197,7 +197,6 @@ struct net_device *ipmr_reg_vif(struct vifctl *v)
        memset(dev, 0, size);
 
        dev->priv = dev + 1;
-       dev->name = dev->priv + sizeof(struct net_device_stats);
 
        strcpy(dev->name, "pimreg");
 
index 7e17cfe8bf1e91bc6359ff41fc91292e44d2d48a..7c2d5b94e549f5ac33d132d3b2c532502a2b9de3 100644 (file)
@@ -139,7 +139,7 @@ void irlan_client_wakeup(struct irlan_cb *self, __u32 saddr, __u32 daddr)
                 * down by the user
                 */
                mgr_event.event = EVENT_IRLAN_START;
-               sprintf(mgr_event.devname, "%s", self->ifname);
+               strcpy(mgr_event.devname, self->dev.name);
                irmanager_notify(&mgr_event);
                
                /* 
index a9c2cb90fd3f237dfb60dc0a84f162cce0e6d727..5975909fefb6206d9d9f2fae8c3cac152f8c0936 100644 (file)
@@ -124,7 +124,7 @@ void irlan_watchdog_timer_expired(void *data)
                IRDA_DEBUG(0, __FUNCTION__ 
                      "(), notifying irmanager to stop irlan!\n");
                mgr_event.event = EVENT_IRLAN_STOP;
-               sprintf(mgr_event.devname, "%s", self->ifname);
+               sprintf(mgr_event.devname, "%s", self->dev.name);
                irmanager_notify(&mgr_event);
 
                /*
@@ -234,10 +234,9 @@ int irlan_register_netdev(struct irlan_cb *self)
        if (!eth) {
                /* Get the first free irlan<x> name */
                do {
-                       sprintf(self->ifname, "%s%d", "irlan", i++);
-               } while (dev_get(self->ifname));
+                       sprintf(self->dev.name, "%s%d", "irlan", i++);
+               } while (dev_get(self->dev.name));
        }
-       self->dev.name = self->ifname;
        
        if (register_netdev(&self->dev) != 0) {
                IRDA_DEBUG(2, __FUNCTION__ "(), register_netdev() failed!\n");
@@ -276,7 +275,7 @@ struct irlan_cb *irlan_open(__u32 saddr, __u32 daddr, int netdev)
 
        ASSERT(irlan != NULL, return NULL;);
        
-       sprintf(self->ifname, "%s", "unknown");
+       sprintf(self->dev.name, "%s", "unknown");
 
        self->dev.priv = (void *) self;
        self->dev.next = NULL;
@@ -1173,7 +1172,7 @@ static int irlan_proc_read(char *buf, char **start, off_t offset, int len)
                /* Don't display the master server */
                if (self->master == 0) {
                        len += sprintf(buf+len, "ifname: %s,\n",
-                                      self->ifname);
+                                      self->dev.name);
                        len += sprintf(buf+len, "client state: %s, ",
                                       irlan_state[ self->client.state]);
                        len += sprintf(buf+len, "provider state: %s,\n",
index 32b09e25de43efc3e2000c21fc3b9f808aca2862..c0d9878f136c8db2b32bb30e11c1fb1e3d1d906f 100644 (file)
@@ -90,7 +90,7 @@ int irlan_eth_init(struct net_device *dev)
         * it, so it can be configured with network parameters
         */
        mgr_event.event = EVENT_IRLAN_START;
-       sprintf(mgr_event.devname, "%s", self->ifname);
+       sprintf(mgr_event.devname, "%s", self->dev.name);
        irmanager_notify(&mgr_event);
 
        /* 
index 75615ee3e6271a7617254de394a607e963342787..587304bca67a8a12b62db2ad25bbe1df3c5d3501 100644 (file)
@@ -196,12 +196,12 @@ int lapb_getparms(void *token, struct lapb_parms_struct *parms)
        parms->window  = lapb->window;
        parms->mode    = lapb->mode;
 
-       if (lapb->t1timer.prev == NULL && lapb->t1timer.next == NULL)
+       if (!timer_pending(&lapb->t1timer))
                parms->t1timer = 0;
        else
                parms->t1timer = (lapb->t1timer.expires - jiffies) / HZ;
 
-       if (lapb->t2timer.prev == NULL && lapb->t2timer.next == NULL)
+       if (!timer_pending(&lapb->t2timer))
                parms->t2timer = 0;
        else
                parms->t2timer = (lapb->t2timer.expires - jiffies) / HZ;
index 757fd10d94099020ce92d057f6d38c5a78da28d5..2b6b7dfb89da329e18eaa61c11e9a98f99bd04c0 100644 (file)
@@ -73,7 +73,7 @@ void lapb_stop_t2timer(lapb_cb *lapb)
 
 int lapb_t1timer_running(lapb_cb *lapb)
 {
-       return (lapb->t1timer.prev != NULL || lapb->t1timer.next != NULL);
+       return timer_pending(&lapb->t1timer);
 }
 
 static void lapb_t2timer_expiry(unsigned long param)
index 3aa133d02613b9a1dede21ed3cdb0ae4822d8ff3..d4e4802b9c2d6477827c1398ea08217cc4003683 100644 (file)
@@ -1281,12 +1281,6 @@ void __init nr_proto_init(struct net_proto *pro)
        memset(dev_nr, 0x00, nr_ndevs * sizeof(struct net_device));
 
        for (i = 0; i < nr_ndevs; i++) {
-               dev_nr[i].name = kmalloc(20, GFP_KERNEL);
-               if(dev_nr[i].name==NULL)
-               {
-                       printk(KERN_ERR "Netrom: unable to register devices.\n");
-                       break;
-               }
                sprintf(dev_nr[i].name, "nr%d", i);
                dev_nr[i].init = nr_init;
                register_netdev(&dev_nr[i]);
index af0e410f4cf634f9302eb7d36ef80aae1f6df215..fc0665de289ffbe2905bec8d026ee9d849a87411 100644 (file)
@@ -38,7 +38,7 @@ void nr_loopback_init(void)
 
 static int nr_loopback_running(void)
 {
-       return (loopback_timer.prev != NULL || loopback_timer.next != NULL);
+       return timer_pending(&loopback_timer);
 }
 
 int nr_loopback_queue(struct sk_buff *skb)
index b3fbd012ebac3efafde896c111e6ff776f2bf379..ac62ad54a2e944a13ad0ceeb5c354e4c4ea222ac 100644 (file)
@@ -129,8 +129,7 @@ void nr_stop_heartbeat(struct sock *sk)
 
 int nr_t1timer_running(struct sock *sk)
 {
-       return (sk->protinfo.nr->t1timer.prev != NULL ||
-               sk->protinfo.nr->t1timer.next != NULL);
+       return timer_pending(&sk->protinfo.nr->t1timer);
 }
 
 static void nr_heartbeat_expiry(unsigned long param)
index f91baa2ebe798027af82a4979799cdd1cfbb5b8f..1bf9f7ab633e09cf9c11cd23672112e65f8bc572 100644 (file)
@@ -1453,12 +1453,6 @@ void __init rose_proto_init(struct net_proto *pro)
        memset(dev_rose, 0x00, rose_ndevs * sizeof(struct net_device));
 
        for (i = 0; i < rose_ndevs; i++) {
-               dev_rose[i].name = kmalloc(20, GFP_KERNEL);
-               if(dev_rose[i].name == NULL)
-               {
-                       printk(KERN_ERR "Rose: unable to register ROSE devices.\n");
-                       break;
-               }
                sprintf(dev_rose[i].name, "rose%d", i);
                dev_rose[i].init = rose_init;
                register_netdev(&dev_rose[i]);
index 896a372e9e6e0de41d81ee591ff42f16427f5ecb..d9b5a4a1dd91862af1d574194422773d7df4b60e 100644 (file)
@@ -76,12 +76,12 @@ void rose_stop_t0timer(struct rose_neigh *neigh)
 
 int rose_ftimer_running(struct rose_neigh *neigh)
 {
-       return (neigh->ftimer.prev != NULL || neigh->ftimer.next != NULL);
+       return timer_pending(&neigh->ftimer);
 }
 
 int rose_t0timer_running(struct rose_neigh *neigh)
 {
-       return (neigh->t0timer.prev != NULL || neigh->t0timer.next != NULL);
+       return timer_pending(&neigh->t0timer);
 }
 
 static void rose_ftimer_expiry(unsigned long param)
index 2aebd4e008d7f5bcb734e1e888cd47a1eeee867b..2136fd601c2e819b68201163e10d121372692100 100644 (file)
@@ -37,7 +37,7 @@ void rose_loopback_init(void)
 
 static int rose_loopback_running(void)
 {
-       return (loopback_timer.prev != NULL || loopback_timer.next != NULL);
+       return timer_pending(&loopback_timer);
 }
 
 int rose_loopback_queue(struct sk_buff *skb, struct rose_neigh *neigh)
index f7fed6c84c86c38c7bde68325506f84564c5aabe..7ea61ce5cd86da457398ae2a6fe552f47c9408d0 100644 (file)
@@ -70,7 +70,6 @@ struct teql_master
        struct net_device dev;
        struct Qdisc *slaves;
        struct net_device_stats stats;
-       char name[IFNAMSIZ];
 };
 
 struct teql_sched_data
@@ -469,11 +468,10 @@ int __init teql_init(void)
        rtnl_lock();
 
        the_master.dev.priv = (void*)&the_master;
-       the_master.dev.name = (void*)&the_master.name;
        err = dev_alloc_name(&the_master.dev, "teql%d");
        if (err < 0)
                return err;
-       memcpy(the_master.qops.id, the_master.name, IFNAMSIZ);
+       memcpy(the_master.qops.id, the_master.dev.name, IFNAMSIZ);
        the_master.dev.init = teql_master_init;
 
        err = register_netdevice(&the_master.dev);
index 90b6513c93c2e528eb96beab6ecb83d7defa655a..20672419e623c54a16cda1bf2d330c5911fc7a9c 100644 (file)
@@ -111,8 +111,7 @@ void x25_stop_timer(struct sock *sk)
 
 unsigned long x25_display_timer(struct sock *sk)
 {
-       if (sk->protinfo.x25->timer.prev == NULL &&
-           sk->protinfo.x25->timer.next == NULL)
+       if (!timer_pending(&sk->protinfo.x25->timer))
                return 0;
 
        return sk->protinfo.x25->timer.expires - jiffies;