+- add patches.fixes/linux-post-2.6.3-20040220
[linux-flexiantxendom0-3.2.10.git] / drivers / net / wan / pc300_tty.c
index 07a3038..d8e3f53 100644 (file)
@@ -155,7 +155,7 @@ static void cpc_tty_signal_off(pc300dev_t *pc300dev, unsigned char signal)
        unsigned long flags; 
 
        CPC_TTY_DBG("%s-tty: Clear signal %x\n",
-               ((struct net_device*)(pc300dev->hdlc))->name, signal);
+               pc300dev->dev->name, signal);
        CPC_TTY_LOCK(card, flags); 
        cpc_writeb(card->hw.scabase + M_REG(CTL,ch), 
                cpc_readb(card->hw.scabase+M_REG(CTL,ch))& signal);
@@ -173,7 +173,7 @@ static void cpc_tty_signal_on(pc300dev_t *pc300dev, unsigned char signal)
        unsigned long flags; 
 
        CPC_TTY_DBG("%s-tty: Set signal %x\n",
-               ((struct net_device*)(pc300dev->hdlc))->name, signal);
+               pc300dev->dev->name, signal);
        CPC_TTY_LOCK(card, flags); 
        cpc_writeb(card->hw.scabase + M_REG(CTL,ch), 
                cpc_readb(card->hw.scabase+M_REG(CTL,ch))& ~signal);
@@ -196,17 +196,17 @@ void cpc_tty_init(pc300dev_t *pc300dev)
        st_cpc_tty_area * cpc_tty;
 
        /* hdlcX - X=interface number */
-       port = ((struct net_device*)(pc300dev->hdlc))->name[4] - '0';
+       port = pc300dev->dev->name[4] - '0';
        if (port >= CPC_TTY_NPORTS) {
                printk("%s-tty: invalid interface selected (0-%i): %i", 
-                       ((struct net_device*)(pc300dev->hdlc))->name,
+                       pc300dev->dev->name,
                        CPC_TTY_NPORTS-1,port);
                return;
        }
 
        if (cpc_tty_cnt == 0) { /* first TTY connection -> register driver */
                CPC_TTY_DBG("%s-tty: driver init, major:%i, minor range:%i=%i\n",
-                       ((struct net_device*)(pc300dev->hdlc))->name,
+                       pc300dev->dev->name,
                        CPC_TTY_MAJOR, CPC_TTY_MINOR_START,
                        CPC_TTY_MINOR_START+CPC_TTY_NPORTS);
                /* initialize tty driver struct */
@@ -239,7 +239,7 @@ void cpc_tty_init(pc300dev_t *pc300dev)
                /* register the TTY driver */
                if (tty_register_driver(&serial_drv)) { 
                        printk("%s-tty: Failed to register serial driver! ",
-                               ((struct net_device*)(pc300dev->hdlc))->name);
+                               pc300dev->dev->name);
                        return;
                } 
 
@@ -251,7 +251,7 @@ void cpc_tty_init(pc300dev_t *pc300dev)
        
        if (cpc_tty->state != CPC_TTY_ST_IDLE) {
                CPC_TTY_DBG("%s-tty: TTY port %i, already in use.\n",
-                                       ((struct net_device*)(pc300dev->hdlc))->name,port);
+                               pc300dev->dev->name, port);
                return;
        }
 
@@ -268,11 +268,11 @@ void cpc_tty_init(pc300dev_t *pc300dev)
 
        pc300dev->cpc_tty = (void *)cpc_tty; 
        
-       aux = strlen(((struct net_device*)(pc300dev->hdlc))->name);
-       memcpy(cpc_tty->name,((struct net_device*)(pc300dev->hdlc))->name,aux);
+       aux = strlen(pc300dev->dev->name);
+       memcpy(cpc_tty->name, pc300dev->dev->name, aux);
        memcpy(&cpc_tty->name[aux], "-tty", 5);
        
-       cpc_open((struct net_device *)pc300dev->hdlc);
+       cpc_open(pc300dev->dev);
        cpc_tty_signal_off(pc300dev, CTL_DTR);
 
        CPC_TTY_DBG("%s: Initializing TTY Sync Driver, tty major#%d minor#%i\n",
@@ -457,7 +457,7 @@ static int cpc_tty_write(struct tty_struct *tty, int from_user,
                (from_user)?"from user" : "from kernel",count);
        
        pc300chan = (pc300ch_t *)((pc300dev_t*)cpc_tty->pc300dev)->chan; 
-       stats = &((pc300dev_t*)cpc_tty->pc300dev)->hdlc->stats;
+       stats = hdlc_stats(((pc300dev_t*)cpc_tty->pc300dev)->dev);
        card = (pc300_t *) pc300chan->card;
        ch = pc300chan->channel; 
 
@@ -756,7 +756,7 @@ void cpc_tty_receive(pc300dev_t *pc300dev)
        pc300_t *card = (pc300_t *)pc300chan->card; 
        int ch = pc300chan->channel; 
        volatile pcsca_bd_t * ptdescr; 
-       struct net_device_stats *stats = &pc300dev->hdlc->stats; 
+       struct net_device_stats *stats = hdlc_stats(pc300dev->dev);
        int rx_len, rx_aux; 
        volatile unsigned char status; 
        unsigned short first_bd = pc300chan->rx_first_bd;
@@ -932,7 +932,7 @@ static int cpc_tty_send_to_card(pc300dev_t *dev,void* buf, int len)
        pc300ch_t *chan = (pc300ch_t *)dev->chan; 
        pc300_t *card = (pc300_t *)chan->card; 
        int ch = chan->channel; 
-       struct net_device_stats *stats = &dev->hdlc->stats; 
+       struct net_device_stats *stats = hdlc_stats(dev->dev);
        unsigned long flags; 
        volatile pcsca_bd_t * ptdescr; 
        int i, nchar;
@@ -1016,19 +1016,18 @@ static void cpc_tty_trace(pc300dev_t *dev, char* buf, int len, char rxtx)
 
        if ((skb = dev_alloc_skb(10 + len)) == NULL) { 
                /* out of memory */ 
-               CPC_TTY_DBG("%s: tty_trace - out of memory\n",
-                       ((struct net_device *)(dev->hdlc))->name);
+               CPC_TTY_DBG("%s: tty_trace - out of memory\n", dev->dev->name);
                return; 
        }
 
        skb_put (skb, 10 + len); 
-       skb->dev = (struct net_device *) dev->hdlc; 
+       skb->dev = dev->dev; 
        skb->protocol = htons(ETH_P_CUST); 
        skb->mac.raw = skb->data; 
        skb->pkt_type = PACKET_HOST; 
        skb->len = 10 + len; 
 
-       memcpy(skb->data,((struct net_device *)(dev->hdlc))->name,5);
+       memcpy(skb->data,dev->dev->name,5);
        skb->data[5] = '['; 
        skb->data[6] = rxtx; 
        skb->data[7] = ']'; 
@@ -1050,15 +1049,14 @@ void cpc_tty_unregister_service(pc300dev_t *pc300dev)
        int res;
 
        if ((cpc_tty= (st_cpc_tty_area *) pc300dev->cpc_tty) == 0) { 
-               CPC_TTY_DBG("%s: interface is not TTY\n",
-                       ((struct net_device *)(pc300dev->hdlc))->name);
+               CPC_TTY_DBG("%s: interface is not TTY\n", pc300dev->dev->name);
                return; 
        }
        CPC_TTY_DBG("%s: cpc_tty_unregister_service", cpc_tty->name);
 
        if (cpc_tty->pc300dev != pc300dev) { 
                CPC_TTY_DBG("%s: invalid tty ptr=%s\n", 
-               ((struct net_device *)(pc300dev->hdlc))->name, cpc_tty->name);
+               pc300dev->dev->name, cpc_tty->name);
                return; 
        }