]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/isdn/i4l/isdn_net.c
Merge master.kernel.org:/pub/scm/linux/kernel/git/torvalds/linux-2.6
[linux-2.6-omap-h63xx.git] / drivers / isdn / i4l / isdn_net.c
index 1f8d6ae66b41e47ac2be94ef6d44d25ffdc72b7b..7c9cb7e19f2e1c4fefd5db59a3d321f622ff522d 100644 (file)
@@ -77,7 +77,7 @@ static __inline__ int isdn_net_device_started(isdn_net_dev *n)
        if (lp->master) 
                dev = lp->master;
        else
-               dev = &n->dev;
+               dev = n->dev;
        return netif_running(dev);
 }
 
@@ -90,7 +90,7 @@ static __inline__ void isdn_net_device_wake_queue(isdn_net_local *lp)
        if (lp->master) 
                netif_wake_queue(lp->master);
        else
-               netif_wake_queue(&lp->netdev->dev);
+               netif_wake_queue(lp->netdev->dev);
 }
 
 /*
@@ -102,7 +102,7 @@ static __inline__ void isdn_net_device_stop_queue(isdn_net_local *lp)
        if (lp->master)
                netif_stop_queue(lp->master);
        else
-               netif_stop_queue(&lp->netdev->dev);
+               netif_stop_queue(lp->netdev->dev);
 }
 
 /*
@@ -287,7 +287,7 @@ isdn_net_unbind_channel(isdn_net_local * lp)
                   BEWARE! This chunk of code cannot be called from hardware
                   interrupt handler. I hope it is true. --ANK
                 */
-               qdisc_reset(lp->netdev->dev.qdisc);
+               qdisc_reset(lp->netdev->dev->qdisc);
        }
        lp->dialstate = 0;
        dev->rx_netdev[isdn_dc2minor(lp->isdn_device, lp->isdn_channel)] = NULL;
@@ -345,27 +345,27 @@ isdn_net_autohup(void)
                                                l->chargetime += l->chargeint;
                                        if (time_after(jiffies, l->chargetime + l->chargeint - 2 * HZ))
                                                if (l->outgoing || l->hupflags & ISDN_INHUP)
-                                                       isdn_net_hangup(&p->dev);
+                                                       isdn_net_hangup(p->dev);
                                } else if (l->outgoing) {
                                        if (l->hupflags & ISDN_CHARGEHUP) {
                                                if (l->hupflags & ISDN_WAITCHARGE) {
                                                        printk(KERN_DEBUG "isdn_net: Hupflags of %s are %X\n",
                                                               l->name, l->hupflags);
-                                                       isdn_net_hangup(&p->dev);
+                                                       isdn_net_hangup(p->dev);
                                                } else if (time_after(jiffies, l->chargetime + l->chargeint)) {
                                                        printk(KERN_DEBUG
                                                               "isdn_net: %s: chtime = %lu, chint = %d\n",
                                                               l->name, l->chargetime, l->chargeint);
-                                                       isdn_net_hangup(&p->dev);
+                                                       isdn_net_hangup(p->dev);
                                                }
                                        } else
-                                               isdn_net_hangup(&p->dev);
+                                               isdn_net_hangup(p->dev);
                                } else if (l->hupflags & ISDN_INHUP)
-                                       isdn_net_hangup(&p->dev);
+                                       isdn_net_hangup(p->dev);
                        }
 
                        if(dev->global_flags & ISDN_GLOBAL_STOPPED || (ISDN_NET_DIALMODE(*l) == ISDN_NET_DM_OFF)) {
-                               isdn_net_hangup(&p->dev);
+                               isdn_net_hangup(p->dev);
                                break;
                        }
                }
@@ -579,7 +579,7 @@ isdn_net_dial(void)
                                if (!lp->dial) {
                                        printk(KERN_WARNING "%s: phone number deleted?\n",
                                               lp->name);
-                                       isdn_net_hangup(&p->dev);
+                                       isdn_net_hangup(p->dev);
                                        break;
                                }
                                anymore = 1;
@@ -616,8 +616,8 @@ isdn_net_dial(void)
                                                s = "dial suppressed: isdn system stopped";
                                        else
                                                s = "dial suppressed: dialmode `off'";
-                                       isdn_net_unreachable(&p->dev, NULL, s);
-                                       isdn_net_hangup(&p->dev);
+                                       isdn_net_unreachable(p->dev, NULL, s);
+                                       isdn_net_hangup(p->dev);
                                        break;
                                }
                                cmd.driver = lp->isdn_device;
@@ -633,7 +633,7 @@ isdn_net_dial(void)
                                if (!lp->dial) {
                                        printk(KERN_WARNING "%s: phone number deleted?\n",
                                               lp->name);
-                                       isdn_net_hangup(&p->dev);
+                                       isdn_net_hangup(p->dev);
                                        break;
                                }
                                if (!strncmp(lp->dial->num, "LEASED", strlen("LEASED"))) {
@@ -644,8 +644,8 @@ isdn_net_dial(void)
                                                if (time_after(jiffies, lp->dialstarted + lp->dialtimeout)) {
                                                        lp->dialwait_timer = jiffies + lp->dialwait;
                                                        lp->dialstarted = 0;
-                                                       isdn_net_unreachable(&p->dev, NULL, "dial: timed out");
-                                                       isdn_net_hangup(&p->dev);
+                                                       isdn_net_unreachable(p->dev, NULL, "dial: timed out");
+                                                       isdn_net_hangup(p->dev);
                                                        break;
                                                }
 
@@ -674,9 +674,9 @@ isdn_net_dial(void)
                                                        if (lp->dialtimeout == 0) {
                                                                lp->dialwait_timer = jiffies + lp->dialwait;
                                                                lp->dialstarted = 0;
-                                                               isdn_net_unreachable(&p->dev, NULL, "dial: tried all numbers dialmax times");
+                                                               isdn_net_unreachable(p->dev, NULL, "dial: tried all numbers dialmax times");
                                                        }
-                                                       isdn_net_hangup(&p->dev);
+                                                       isdn_net_hangup(p->dev);
                                                        break;
                                                }
                                        }
@@ -758,7 +758,7 @@ isdn_net_dial(void)
                                cmd.arg = lp->isdn_channel + (lp->l3_proto << 8);
                                isdn_command(&cmd);
                                if (lp->dtimer++ > ISDN_TIMER_DTIMEOUT15)
-                                       isdn_net_hangup(&p->dev);
+                                       isdn_net_hangup(p->dev);
                                else {
                                        anymore = 1;
                                        lp->dialstate++;
@@ -781,7 +781,7 @@ isdn_net_dial(void)
                                printk(KERN_DEBUG "dialtimer4: %d\n", lp->dtimer);
 #endif
                                if (lp->dtimer++ > ISDN_TIMER_DTIMEOUT10)
-                                       isdn_net_hangup(&p->dev);
+                                       isdn_net_hangup(p->dev);
                                else
                                        anymore = 1;
                                break;
@@ -872,7 +872,8 @@ typedef struct {
 static void
 isdn_net_log_skb(struct sk_buff * skb, isdn_net_local * lp)
 {
-       u_char *p = skb->nh.raw; /* hopefully, this was set correctly */
+       /* hopefully, this was set correctly */
+       const u_char *p = skb_network_header(skb);
        unsigned short proto = ntohs(skb->protocol);
        int data_ofs;
        ip_ports *ipp;
@@ -880,7 +881,7 @@ isdn_net_log_skb(struct sk_buff * skb, isdn_net_local * lp)
 
        addinfo[0] = '\0';
        /* This check stolen from 2.1.72 dev_queue_xmit_nit() */
-       if (skb->nh.raw < skb->data || skb->nh.raw >= skb->tail) {
+       if (p < skb->data || skb->network_header >= skb->tail) {
                /* fall back to old isdn_net_log_packet method() */
                char * buf = skb->data;
 
@@ -984,9 +985,9 @@ void isdn_net_write_super(isdn_net_local *lp, struct sk_buff *skb)
 /*
  * called from tq_immediate
  */
-static void isdn_net_softint(void *private)
+static void isdn_net_softint(struct work_struct *work)
 {
-       isdn_net_local *lp = private;
+       isdn_net_local *lp = container_of(work, isdn_net_local, tqueue);
        struct sk_buff *skb;
 
        spin_lock_bh(&lp->xmit_lock);
@@ -1121,7 +1122,7 @@ isdn_net_adjust_hdr(struct sk_buff *skb, struct net_device *dev)
        if (!skb)
                return;
        if (lp->p_encap == ISDN_NET_ENCAP_ETHER) {
-               int pullsize = (ulong)skb->nh.raw - (ulong)skb->data - ETH_HLEN;
+               const int pullsize = skb_network_offset(skb) - ETH_HLEN;
                if (pullsize > 0) {
                        printk(KERN_DEBUG "isdn_net: Pull junk %d\n", pullsize);
                        skb_pull(skb, pullsize);
@@ -1366,7 +1367,7 @@ isdn_net_type_trans(struct sk_buff *skb, struct net_device *dev)
        struct ethhdr *eth;
        unsigned char *rawp;
 
-       skb->mac.raw = skb->data;
+       skb_reset_mac_header(skb);
        skb_pull(skb, ETH_HLEN);
        eth = eth_hdr(skb);
 
@@ -1617,7 +1618,7 @@ isdn_net_ciscohdlck_slarp_send_reply(isdn_net_local *lp)
        __be32 addr = 0;                /* local ipv4 address */
        __be32 mask = 0;                /* local netmask */
 
-       if ((in_dev = lp->netdev->dev.ip_ptr) != NULL) {
+       if ((in_dev = lp->netdev->dev->ip_ptr) != NULL) {
                /* take primary(first) address of interface */
                struct in_ifaddr *ifa = in_dev->ifa_list;
                if (ifa != NULL) {
@@ -1786,7 +1787,7 @@ isdn_net_receive(struct net_device *ndev, struct sk_buff *skb)
        }
        skb->dev = ndev;
        skb->pkt_type = PACKET_HOST;
-       skb->mac.raw = skb->data;
+       skb_reset_mac_header(skb);
 #ifdef ISDN_DEBUG_NET_DUMP
        isdn_dumppkt("R:", skb->data, skb->len, 40);
 #endif
@@ -1865,61 +1866,21 @@ isdn_net_rcv_skb(int idx, struct sk_buff *skb)
                isdn_net_local *lp = p->local;
                if ((lp->flags & ISDN_NET_CONNECTED) &&
                    (!lp->dialstate)) {
-                       isdn_net_receive(&p->dev, skb);
+                       isdn_net_receive(p->dev, skb);
                        return 1;
                }
        }
        return 0;
 }
 
-static int
-my_eth_header(struct sk_buff *skb, struct net_device *dev, unsigned short type,
-             void *daddr, void *saddr, unsigned len)
-{
-       struct ethhdr *eth = (struct ethhdr *) skb_push(skb, ETH_HLEN);
-
-       /*
-        * Set the protocol type. For a packet of type ETH_P_802_3 we
-        * put the length here instead. It is up to the 802.2 layer to
-        * carry protocol information.
-        */
-
-       if (type != ETH_P_802_3)
-               eth->h_proto = htons(type);
-       else
-               eth->h_proto = htons(len);
-
-       /*
-        * Set the source hardware address.
-        */
-       if (saddr)
-               memcpy(eth->h_source, saddr, dev->addr_len);
-       else
-               memcpy(eth->h_source, dev->dev_addr, dev->addr_len);
-
-       /*
-        * Anyway, the loopback-device should never use this function...
-        */
-
-       if (dev->flags & (IFF_LOOPBACK | IFF_NOARP)) {
-               memset(eth->h_dest, 0, dev->addr_len);
-               return ETH_HLEN /*(dev->hard_header_len)*/;
-       }
-       if (daddr) {
-               memcpy(eth->h_dest, daddr, dev->addr_len);
-               return ETH_HLEN /*dev->hard_header_len*/;
-       }
-       return -ETH_HLEN /*dev->hard_header_len*/;
-}
-
 /*
  *  build an header
  *  depends on encaps that is being used.
  */
 
-static int
-isdn_net_header(struct sk_buff *skb, struct net_device *dev, unsigned short type,
-               void *daddr, void *saddr, unsigned plen)
+static int isdn_net_header(struct sk_buff *skb, struct net_device *dev,
+                          unsigned short type,
+                          const void *daddr, const void *saddr, unsigned plen)
 {
        isdn_net_local *lp = dev->priv;
        unsigned char *p;
@@ -1927,7 +1888,7 @@ isdn_net_header(struct sk_buff *skb, struct net_device *dev, unsigned short type
 
        switch (lp->p_encap) {
                case ISDN_NET_ENCAP_ETHER:
-                       len = my_eth_header(skb, dev, type, daddr, saddr, plen);
+                       len = eth_header(skb, dev, type, daddr, saddr, plen);
                        break;
 #ifdef CONFIG_ISDN_PPP
                case ISDN_NET_ENCAP_SYNCPPP:
@@ -2004,6 +1965,32 @@ isdn_net_rebuild_header(struct sk_buff *skb)
        return ret;
 }
 
+static int isdn_header_cache(const struct neighbour *neigh, struct hh_cache *hh)
+{
+       const struct net_device *dev = neigh->dev;
+       isdn_net_local *lp = dev->priv;
+
+       if (lp->p_encap == ISDN_NET_ENCAP_ETHER)
+               return eth_header_cache(neigh, hh);
+       return -1;
+}
+
+static void isdn_header_cache_update(struct hh_cache *hh,
+                                    const struct net_device *dev,
+                                    const unsigned char *haddr)
+{
+       isdn_net_local *lp = dev->priv;
+       if (lp->p_encap == ISDN_NET_ENCAP_ETHER)
+               return eth_header_cache_update(hh, dev, haddr);
+}
+
+static const struct header_ops isdn_header_ops = {
+       .create = isdn_net_header,
+       .rebuild = isdn_net_rebuild_header,
+       .cache = isdn_header_cache,
+       .cache_update = isdn_header_cache_update,
+};
+
 /*
  * Interface-setup. (just after registering a new interface)
  */
@@ -2011,18 +1998,12 @@ static int
 isdn_net_init(struct net_device *ndev)
 {
        ushort max_hlhdr_len = 0;
-       isdn_net_local *lp = (isdn_net_local *) ndev->priv;
-       int drvidx, i;
+       int drvidx;
 
        ether_setup(ndev);
-       lp->org_hhc = ndev->hard_header_cache;
-       lp->org_hcu = ndev->header_cache_update;
+       ndev->header_ops = NULL;
 
        /* Setup the generic properties */
-
-       ndev->hard_header = NULL;
-       ndev->hard_header_cache = NULL;
-       ndev->header_cache_update = NULL;
        ndev->mtu = 1500;
        ndev->flags = IFF_NOARP|IFF_POINTOPOINT;
        ndev->type = ARPHRD_ETHER;
@@ -2031,9 +2012,6 @@ isdn_net_init(struct net_device *ndev)
        /* for clients with MPPP maybe higher values better */
        ndev->tx_queue_len = 30;
 
-       for (i = 0; i < ETH_ALEN; i++)
-               ndev->broadcast[i] = 0xff;
-
        /* The ISDN-specific entries in the device structure. */
        ndev->open = &isdn_net_open;
        ndev->hard_start_xmit = &isdn_net_start_xmit;
@@ -2051,7 +2029,6 @@ isdn_net_init(struct net_device *ndev)
        ndev->hard_header_len = ETH_HLEN + max_hlhdr_len;
        ndev->stop = &isdn_net_close;
        ndev->get_stats = &isdn_net_get_stats;
-       ndev->rebuild_header = &isdn_net_rebuild_header;
        ndev->do_ioctl = NULL;
        return 0;
 }
@@ -2529,6 +2506,42 @@ isdn_net_force_dial(char *name)
        return (isdn_net_force_dial_lp(p->local));
 }
 
+/*
+ * Helper for alloc_netdev()
+ */
+static void _isdn_setup(struct net_device *dev)
+{
+       isdn_net_local *lp = dev->priv;
+
+       dev->flags = IFF_NOARP | IFF_POINTOPOINT;
+       lp->p_encap = ISDN_NET_ENCAP_RAWIP;
+       lp->magic = ISDN_NET_MAGIC;
+       lp->last = lp;
+       lp->next = lp;
+       lp->isdn_device = -1;
+       lp->isdn_channel = -1;
+       lp->pre_device = -1;
+       lp->pre_channel = -1;
+       lp->exclusive = -1;
+       lp->ppp_slot = -1;
+       lp->pppbind = -1;
+       skb_queue_head_init(&lp->super_tx_queue);
+       lp->l2_proto = ISDN_PROTO_L2_X75I;
+       lp->l3_proto = ISDN_PROTO_L3_TRANS;
+       lp->triggercps = 6000;
+       lp->slavedelay = 10 * HZ;
+       lp->hupflags = ISDN_INHUP;      /* Do hangup even on incoming calls */
+       lp->onhtime = 10;       /* Default hangup-time for saving costs */
+       lp->dialmax = 1;
+       /* Hangup before Callback, manual dial */
+       lp->flags = ISDN_NET_CBHUP | ISDN_NET_DM_MANUAL;
+       lp->cbdelay = 25;       /* Wait 5 secs before Callback */
+       lp->dialtimeout = -1;  /* Infinite Dial-Timeout */
+       lp->dialwait = 5 * HZ; /* Wait 5 sec. after failed dial */
+       lp->dialstarted = 0;   /* Jiffies of last dial-start */
+       lp->dialwait_timer = 0;  /* Jiffies of earliest next dial-start */
+}
+
 /*
  * Allocate a new network-interface and initialize its data structures.
  */
@@ -2542,25 +2555,21 @@ isdn_net_new(char *name, struct net_device *master)
                printk(KERN_WARNING "isdn_net: interface %s already exists\n", name);
                return NULL;
        }
-       if (!(netdev = (isdn_net_dev *) kmalloc(sizeof(isdn_net_dev), GFP_KERNEL))) {
+       if (name == NULL)
+               name = "         ";
+       if (!(netdev = kzalloc(sizeof(isdn_net_dev), GFP_KERNEL))) {
                printk(KERN_WARNING "isdn_net: Could not allocate net-device\n");
                return NULL;
        }
-       memset(netdev, 0, sizeof(isdn_net_dev));
-       if (!(netdev->local = (isdn_net_local *) kmalloc(sizeof(isdn_net_local), GFP_KERNEL))) {
-               printk(KERN_WARNING "isdn_net: Could not allocate device locals\n");
+       netdev->dev = alloc_netdev(sizeof(isdn_net_local), name, _isdn_setup);
+       if (!netdev->dev) {
+               printk(KERN_WARNING "isdn_net: Could not allocate network device\n");
                kfree(netdev);
                return NULL;
        }
-       memset(netdev->local, 0, sizeof(isdn_net_local));
-       if (name == NULL)
-               strcpy(netdev->local->name, "         ");
-       else
-               strcpy(netdev->local->name, 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;
+       netdev->local = netdev->dev->priv;
+       strcpy(netdev->local->name, netdev->dev->name);
+       netdev->dev->init = isdn_net_init;
        if (master) {
                /* Device shall be a slave */
                struct net_device *p = (((isdn_net_local *) master->priv)->slave);
@@ -2572,60 +2581,33 @@ isdn_net_new(char *name, struct net_device *master)
                        q = p;
                        p = (((isdn_net_local *) p->priv)->slave);
                }
-               ((isdn_net_local *) q->priv)->slave = &(netdev->dev);
+               ((isdn_net_local *) q->priv)->slave = netdev->dev;
        } else {
                /* Device shall be a master */
                /*
                 * Watchdog timer (currently) for master only.
                 */
-               netdev->dev.tx_timeout = isdn_net_tx_timeout;
-               netdev->dev.watchdog_timeo = ISDN_NET_TX_TIMEOUT;
-               if (register_netdev(&netdev->dev) != 0) {
+               netdev->dev->tx_timeout = isdn_net_tx_timeout;
+               netdev->dev->watchdog_timeo = ISDN_NET_TX_TIMEOUT;
+               if (register_netdev(netdev->dev) != 0) {
                        printk(KERN_WARNING "isdn_net: Could not register net-device\n");
-                       kfree(netdev->local);
+                       free_netdev(netdev->dev);
                        kfree(netdev);
                        return NULL;
                }
        }
-       netdev->local->magic = ISDN_NET_MAGIC;
-
        netdev->queue = netdev->local;
        spin_lock_init(&netdev->queue_lock);
 
-       netdev->local->last = netdev->local;
        netdev->local->netdev = netdev;
-       netdev->local->next = netdev->local;
 
-       INIT_WORK(&netdev->local->tqueue, (void *)(void *) isdn_net_softint, netdev->local);
+       INIT_WORK(&netdev->local->tqueue, isdn_net_softint);
        spin_lock_init(&netdev->local->xmit_lock);
 
-       netdev->local->isdn_device = -1;
-       netdev->local->isdn_channel = -1;
-       netdev->local->pre_device = -1;
-       netdev->local->pre_channel = -1;
-       netdev->local->exclusive = -1;
-       netdev->local->ppp_slot = -1;
-       netdev->local->pppbind = -1;
-       skb_queue_head_init(&netdev->local->super_tx_queue);
-       netdev->local->l2_proto = ISDN_PROTO_L2_X75I;
-       netdev->local->l3_proto = ISDN_PROTO_L3_TRANS;
-       netdev->local->triggercps = 6000;
-       netdev->local->slavedelay = 10 * HZ;
-       netdev->local->hupflags = ISDN_INHUP;   /* Do hangup even on incoming calls */
-       netdev->local->onhtime = 10;    /* Default hangup-time for saving costs
-          of those who forget configuring this */
-       netdev->local->dialmax = 1;
-       netdev->local->flags = ISDN_NET_CBHUP | ISDN_NET_DM_MANUAL;     /* Hangup before Callback, manual dial */
-       netdev->local->cbdelay = 25;    /* Wait 5 secs before Callback */
-       netdev->local->dialtimeout = -1;  /* Infinite Dial-Timeout */
-       netdev->local->dialwait = 5 * HZ; /* Wait 5 sec. after failed dial */
-       netdev->local->dialstarted = 0;   /* Jiffies of last dial-start */
-       netdev->local->dialwait_timer = 0;  /* Jiffies of earliest next dial-start */
-
        /* Put into to netdev-chain */
        netdev->next = (void *) dev->netdev;
        dev->netdev = netdev;
-       return netdev->dev.name;
+       return netdev->dev->name;
 }
 
 char *
@@ -2650,7 +2632,7 @@ isdn_net_newslave(char *parm)
                /* Master must not be started yet */
                if (isdn_net_device_started(n)) 
                        return NULL;
-               return (isdn_net_new(newname, &(n->dev)));
+               return (isdn_net_new(newname, n->dev));
        }
        return NULL;
 }
@@ -2719,9 +2701,9 @@ isdn_net_setcfg(isdn_net_ioctl_cfg * cfg)
                               lp->name);
                        return -EINVAL;
 #else
-                       p->dev.type = ARPHRD_PPP;       /* change ARP type */
-                       p->dev.addr_len = 0;
-                       p->dev.do_ioctl = isdn_ppp_dev_ioctl;
+                       p->dev->type = ARPHRD_PPP;      /* change ARP type */
+                       p->dev->addr_len = 0;
+                       p->dev->do_ioctl = isdn_ppp_dev_ioctl;
 #endif
                        break;
                case ISDN_NET_ENCAP_X25IFACE:
@@ -2730,12 +2712,12 @@ isdn_net_setcfg(isdn_net_ioctl_cfg * cfg)
                               p->local->name);
                        return -EINVAL;
 #else
-                       p->dev.type = ARPHRD_X25;       /* change ARP type */
-                       p->dev.addr_len = 0;
+                       p->dev->type = ARPHRD_X25;      /* change ARP type */
+                       p->dev->addr_len = 0;
 #endif
                        break;
                case ISDN_NET_ENCAP_CISCOHDLCK:
-                       p->dev.do_ioctl = isdn_ciscohdlck_dev_ioctl;
+                       p->dev->do_ioctl = isdn_ciscohdlck_dev_ioctl;
                        break;
                default:
                        if( cfg->p_encap >= 0 &&
@@ -2862,21 +2844,14 @@ isdn_net_setcfg(isdn_net_ioctl_cfg * cfg)
                }
                if (cfg->p_encap != lp->p_encap) {
                        if (cfg->p_encap == ISDN_NET_ENCAP_RAWIP) {
-                               p->dev.hard_header = NULL;
-                               p->dev.hard_header_cache = NULL;
-                               p->dev.header_cache_update = NULL;
-                               p->dev.flags = IFF_NOARP|IFF_POINTOPOINT;
+                               p->dev->header_ops = NULL;
+                               p->dev->flags = IFF_NOARP|IFF_POINTOPOINT;
                        } else {
-                               p->dev.hard_header = isdn_net_header;
-                               if (cfg->p_encap == ISDN_NET_ENCAP_ETHER) {
-                                       p->dev.hard_header_cache = lp->org_hhc;
-                                       p->dev.header_cache_update = lp->org_hcu;
-                                       p->dev.flags = IFF_BROADCAST | IFF_MULTICAST;
-                               } else {
-                                       p->dev.hard_header_cache = NULL;
-                                       p->dev.header_cache_update = NULL;
-                                       p->dev.flags = IFF_NOARP|IFF_POINTOPOINT;
-                               }
+                               p->dev->header_ops = &isdn_header_ops;
+                               if (cfg->p_encap == ISDN_NET_ENCAP_ETHER)
+                                       p->dev->flags = IFF_BROADCAST | IFF_MULTICAST;
+                               else
+                                       p->dev->flags = IFF_NOARP|IFF_POINTOPOINT;
                        }
                }
                lp->p_encap = cfg->p_encap;
@@ -2950,7 +2925,7 @@ isdn_net_addphone(isdn_net_ioctl_phone * phone)
        isdn_net_phone *n;
 
        if (p) {
-               if (!(n = (isdn_net_phone *) kmalloc(sizeof(isdn_net_phone), GFP_KERNEL)))
+               if (!(n = kmalloc(sizeof(isdn_net_phone), GFP_KERNEL)))
                        return -ENOMEM;
                strcpy(n->num, phone->phone);
                n->next = p->local->phone[phone->outgoing & 1];
@@ -3096,7 +3071,7 @@ isdn_net_force_hangup(char *name)
                        isdn_net_hangup(q);
                        q = (((isdn_net_local *) q->priv)->slave);
                }
-               isdn_net_hangup(&p->dev);
+               isdn_net_hangup(p->dev);
                return 0;
        }
        return -ENODEV;
@@ -3124,13 +3099,11 @@ isdn_net_realrm(isdn_net_dev * p, isdn_net_dev * q)
                isdn_unexclusive_channel(p->local->pre_device, p->local->pre_channel);
        if (p->local->master) {
                /* It's a slave-device, so update master's slave-pointer if necessary */
-               if (((isdn_net_local *) (p->local->master->priv))->slave == &p->dev)
+               if (((isdn_net_local *) (p->local->master->priv))->slave == p->dev)
                        ((isdn_net_local *) (p->local->master->priv))->slave = p->local->slave;
        } else {
                /* Unregister only if it's a master-device */
-               p->dev.hard_header_cache = p->local->org_hhc;
-               p->dev.header_cache_update = p->local->org_hcu;
-               unregister_netdev(&p->dev);
+               unregister_netdev(p->dev);
        }
        /* Unlink device from chain */
        spin_lock_irqsave(&dev->lock, flags);
@@ -3158,7 +3131,7 @@ isdn_net_realrm(isdn_net_dev * p, isdn_net_dev * q)
        /* If no more net-devices remain, disable auto-hangup timer */
        if (dev->netdev == NULL)
                isdn_timer_ctrl(ISDN_TIMER_NETHANGUP, 0);
-       kfree(p->local);
+       free_netdev(p->dev);
        kfree(p);
 
        return 0;