X-Git-Url: http://ftp.safe.ca/?a=blobdiff_plain;f=drivers%2Fisdn%2Fi4l%2Fisdn_net.c;h=507e13d9a57c1579ac1b29d1548949847ff4fcf5;hb=06fe9fb4182177fb046e6d934f80254dd90956ea;hp=ad17a47ecc060d832a4cab896e94ce653f484925;hpb=198d6ba4d7f48c94f990f4604f0b3d73925e0ded;p=safe%2Fjmp%2Flinux-2.6 diff --git a/drivers/isdn/i4l/isdn_net.c b/drivers/isdn/i4l/isdn_net.c index ad17a47..507e13d 100644 --- a/drivers/isdn/i4l/isdn_net.c +++ b/drivers/isdn/i4l/isdn_net.c @@ -120,7 +120,7 @@ static __inline__ int isdn_net_device_busy(isdn_net_local *lp) return 0; if (lp->master) - nd = ((isdn_net_local *) lp->master->priv)->netdev; + nd = ISDN_MASTER_PRIV(lp)->netdev; else nd = lp->netdev; @@ -176,7 +176,8 @@ static __inline__ void isdn_net_zero_frame_cnt(isdn_net_local *lp) /* Prototypes */ static int isdn_net_force_dial_lp(isdn_net_local *); -static int isdn_net_start_xmit(struct sk_buff *, struct net_device *); +static netdev_tx_t isdn_net_start_xmit(struct sk_buff *, + struct net_device *); static void isdn_net_ciscohdlck_connected(isdn_net_local *lp); static void isdn_net_ciscohdlck_disconnected(isdn_net_local *lp); @@ -213,9 +214,9 @@ isdn_net_reset(struct net_device *dev) { #ifdef CONFIG_ISDN_X25 struct concap_device_ops * dops = - ( (isdn_net_local *) dev->priv ) -> dops; + ((isdn_net_local *) netdev_priv(dev))->dops; struct concap_proto * cprot = - ( (isdn_net_local *) dev->priv ) -> netdev -> cprot; + ((isdn_net_local *) netdev_priv(dev))->netdev->cprot; #endif #ifdef CONFIG_ISDN_X25 if( cprot && cprot -> pops && dops ) @@ -250,11 +251,11 @@ isdn_net_open(struct net_device *dev) } /* If this interface has slaves, start them also */ - - if ((p = (((isdn_net_local *) dev->priv)->slave))) { + p = MASTER_TO_SLAVE(dev); + if (p) { while (p) { isdn_net_reset(p); - p = (((isdn_net_local *) p->priv)->slave); + p = MASTER_TO_SLAVE(p); } } isdn_lock_drivers(); @@ -292,7 +293,9 @@ isdn_net_unbind_channel(isdn_net_local * lp) lp->dialstate = 0; dev->rx_netdev[isdn_dc2minor(lp->isdn_device, lp->isdn_channel)] = NULL; dev->st_netdev[isdn_dc2minor(lp->isdn_device, lp->isdn_channel)] = NULL; - isdn_free_channel(lp->isdn_device, lp->isdn_channel, ISDN_USAGE_NET); + if (lp->isdn_device != -1 && lp->isdn_channel != -1) + isdn_free_channel(lp->isdn_device, lp->isdn_channel, + ISDN_USAGE_NET); lp->flags &= ~ISDN_NET_CONNECTED; lp->isdn_device = -1; lp->isdn_channel = -1; @@ -483,7 +486,7 @@ isdn_net_stat_callback(int idx, isdn_ctrl *c) isdn_net_ciscohdlck_connected(lp); if (lp->p_encap != ISDN_NET_ENCAP_SYNCPPP) { if (lp->master) { /* is lp a slave? */ - isdn_net_dev *nd = ((isdn_net_local *)lp->master->priv)->netdev; + isdn_net_dev *nd = ISDN_MASTER_PRIV(lp)->netdev; isdn_net_add_to_bundle(nd, lp); } } @@ -823,7 +826,7 @@ isdn_net_dial(void) void isdn_net_hangup(struct net_device *d) { - isdn_net_local *lp = (isdn_net_local *) d->priv; + isdn_net_local *lp = (isdn_net_local *) netdev_priv(d); isdn_ctrl cmd; #ifdef CONFIG_ISDN_X25 struct concap_proto *cprot = lp->netdev->cprot; @@ -832,7 +835,7 @@ isdn_net_hangup(struct net_device *d) if (lp->flags & ISDN_NET_CONNECTED) { if (lp->slave != NULL) { - isdn_net_local *slp = (isdn_net_local *)lp->slave->priv; + isdn_net_local *slp = ISDN_SLAVE_PRIV(lp); if (slp->flags & ISDN_NET_CONNECTED) { printk(KERN_INFO "isdn_net: hang up slave %s before %s\n", @@ -865,8 +868,8 @@ isdn_net_hangup(struct net_device *d) } typedef struct { - unsigned short source; - unsigned short dest; + __be16 source; + __be16 dest; } ip_ports; static void @@ -1048,13 +1051,13 @@ isdn_net_xmit(struct net_device *ndev, struct sk_buff *skb) { isdn_net_dev *nd; isdn_net_local *slp; - isdn_net_local *lp = (isdn_net_local *) ndev->priv; - int retv = 0; + isdn_net_local *lp = (isdn_net_local *) netdev_priv(ndev); + int retv = NETDEV_TX_OK; - if (((isdn_net_local *) (ndev->priv))->master) { + if (((isdn_net_local *) netdev_priv(ndev))->master) { printk("isdn BUG at %s:%d!\n", __FILE__, __LINE__); dev_kfree_skb(skb); - return 0; + return NETDEV_TX_OK; } /* For the other encaps the header has already been built */ @@ -1063,11 +1066,11 @@ isdn_net_xmit(struct net_device *ndev, struct sk_buff *skb) return isdn_ppp_xmit(skb, ndev); } #endif - nd = ((isdn_net_local *) ndev->priv)->netdev; + nd = ((isdn_net_local *) netdev_priv(ndev))->netdev; lp = isdn_net_get_locked_lp(nd); if (!lp) { printk(KERN_WARNING "%s: all channels busy - requeuing!\n", ndev->name); - return 1; + return NETDEV_TX_BUSY; } /* we have our lp locked from now on */ @@ -1090,9 +1093,9 @@ isdn_net_xmit(struct net_device *ndev, struct sk_buff *skb) } else { /* subsequent overload: if slavedelay exceeded, start dialing */ if (time_after(jiffies, lp->sqfull_stamp + lp->slavedelay)) { - slp = lp->slave->priv; + slp = ISDN_SLAVE_PRIV(lp); if (!(slp->flags & ISDN_NET_CONNECTED)) { - isdn_net_force_dial_lp((isdn_net_local *) lp->slave->priv); + isdn_net_force_dial_lp(ISDN_SLAVE_PRIV(lp)); } } } @@ -1112,7 +1115,7 @@ isdn_net_xmit(struct net_device *ndev, struct sk_buff *skb) static void isdn_net_adjust_hdr(struct sk_buff *skb, struct net_device *dev) { - isdn_net_local *lp = (isdn_net_local *) dev->priv; + isdn_net_local *lp = (isdn_net_local *) netdev_priv(dev); if (!skb) return; if (lp->p_encap == ISDN_NET_ENCAP_ETHER) { @@ -1127,7 +1130,7 @@ isdn_net_adjust_hdr(struct sk_buff *skb, struct net_device *dev) static void isdn_net_tx_timeout(struct net_device * ndev) { - isdn_net_local *lp = (isdn_net_local *) ndev->priv; + isdn_net_local *lp = (isdn_net_local *) netdev_priv(ndev); printk(KERN_WARNING "isdn_tx_timeout dev %s dialstate %d\n", ndev->name, lp->dialstate); if (!lp->dialstate){ @@ -1158,10 +1161,10 @@ static void isdn_net_tx_timeout(struct net_device * ndev) * If this interface isn't connected to a ISDN-Channel, find a free channel, * and start dialing. */ -static int +static netdev_tx_t isdn_net_start_xmit(struct sk_buff *skb, struct net_device *ndev) { - isdn_net_local *lp = (isdn_net_local *) ndev->priv; + isdn_net_local *lp = (isdn_net_local *) netdev_priv(ndev); #ifdef CONFIG_ISDN_X25 struct concap_proto * cprot = lp -> netdev -> cprot; /* At this point hard_start_xmit() passes control to the encapsulation @@ -1200,7 +1203,7 @@ isdn_net_start_xmit(struct sk_buff *skb, struct net_device *ndev) if (!(ISDN_NET_DIALMODE(*lp) == ISDN_NET_DM_AUTO)) { isdn_net_unreachable(ndev, skb, "dial rejected: interface not in dialmode `auto'"); dev_kfree_skb(skb); - return 0; + return NETDEV_TX_OK; } if (lp->phone[1]) { ulong flags; @@ -1213,7 +1216,7 @@ isdn_net_start_xmit(struct sk_buff *skb, struct net_device *ndev) if(time_before(jiffies, lp->dialwait_timer)) { isdn_net_unreachable(ndev, skb, "dial rejected: retry-time not reached"); dev_kfree_skb(skb); - return 0; + return NETDEV_TX_OK; } else lp->dialwait_timer = 0; } @@ -1241,7 +1244,7 @@ isdn_net_start_xmit(struct sk_buff *skb, struct net_device *ndev) isdn_net_unreachable(ndev, skb, "No channel"); dev_kfree_skb(skb); - return 0; + return NETDEV_TX_OK; } /* Log packet, which triggered dialing */ if (dev->net_verbose) @@ -1256,7 +1259,7 @@ isdn_net_start_xmit(struct sk_buff *skb, struct net_device *ndev) dev_kfree_skb(skb); isdn_net_unbind_channel(lp); spin_unlock_irqrestore(&dev->lock, flags); - return 0; /* STN (skb to nirvana) ;) */ + return NETDEV_TX_OK; /* STN (skb to nirvana) ;) */ } #ifdef CONFIG_IPPP_FILTER if (isdn_ppp_autodial_filter(skb, lp)) { @@ -1265,25 +1268,25 @@ isdn_net_start_xmit(struct sk_buff *skb, struct net_device *ndev) spin_unlock_irqrestore(&dev->lock, flags); isdn_net_unreachable(ndev, skb, "dial rejected: packet filtered"); dev_kfree_skb(skb); - return 0; + return NETDEV_TX_OK; } #endif spin_unlock_irqrestore(&dev->lock, flags); isdn_net_dial(); /* Initiate dialing */ netif_stop_queue(ndev); - return 1; /* let upper layer requeue skb packet */ + return NETDEV_TX_BUSY; /* let upper layer requeue skb packet */ } #endif /* Initiate dialing */ spin_unlock_irqrestore(&dev->lock, flags); isdn_net_dial(); isdn_net_device_stop_queue(lp); - return 1; + return NETDEV_TX_BUSY; } else { isdn_net_unreachable(ndev, skb, "No phone number"); dev_kfree_skb(skb); - return 0; + return NETDEV_TX_OK; } } else { /* Device is connected to an ISDN channel */ @@ -1298,7 +1301,7 @@ isdn_net_start_xmit(struct sk_buff *skb, struct net_device *ndev) netif_stop_queue(ndev); } } - return 1; + return NETDEV_TX_BUSY; } /* @@ -1310,7 +1313,7 @@ isdn_net_close(struct net_device *dev) struct net_device *p; #ifdef CONFIG_ISDN_X25 struct concap_proto * cprot = - ( (isdn_net_local *) dev->priv ) -> netdev -> cprot; + ((isdn_net_local *) netdev_priv(dev))->netdev->cprot; /* printk(KERN_DEBUG "isdn_net_close %s\n" , dev-> name ); */ #endif @@ -1318,17 +1321,18 @@ isdn_net_close(struct net_device *dev) if( cprot && cprot -> pops ) cprot -> pops -> close( cprot ); #endif netif_stop_queue(dev); - if ((p = (((isdn_net_local *) dev->priv)->slave))) { + p = MASTER_TO_SLAVE(dev); + if (p) { /* If this interface has slaves, stop them also */ while (p) { #ifdef CONFIG_ISDN_X25 - cprot = ( (isdn_net_local *) p->priv ) + cprot = ((isdn_net_local *) netdev_priv(p)) -> netdev -> cprot; if( cprot && cprot -> pops ) cprot -> pops -> close( cprot ); #endif isdn_net_hangup(p); - p = (((isdn_net_local *) p->priv)->slave); + p = MASTER_TO_SLAVE(p); } } isdn_net_hangup(dev); @@ -1342,7 +1346,7 @@ isdn_net_close(struct net_device *dev) static struct net_device_stats * isdn_net_get_stats(struct net_device *dev) { - isdn_net_local *lp = (isdn_net_local *) dev->priv; + isdn_net_local *lp = (isdn_net_local *) netdev_priv(dev); return &lp->stats; } @@ -1355,7 +1359,7 @@ isdn_net_get_stats(struct net_device *dev) * This is normal practice and works for any 'now in use' protocol. */ -static unsigned short +static __be16 isdn_net_type_trans(struct sk_buff *skb, struct net_device *dev) { struct ethhdr *eth; @@ -1421,7 +1425,7 @@ isdn_net_ciscohdlck_alloc_skb(isdn_net_local *lp, int len) static int isdn_ciscohdlck_dev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) { - isdn_net_local *lp = (isdn_net_local *) dev->priv; + isdn_net_local *lp = (isdn_net_local *) netdev_priv(dev); unsigned long len = 0; unsigned long expires = 0; int tmp = 0; @@ -1484,6 +1488,24 @@ isdn_ciscohdlck_dev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) return (rc); } + +static int isdn_net_ioctl(struct net_device *dev, + struct ifreq *ifr, int cmd) +{ + isdn_net_local *lp = (isdn_net_local *) netdev_priv(dev); + + switch (lp->p_encap) { +#ifdef CONFIG_ISDN_PPP + case ISDN_NET_ENCAP_SYNCPPP: + return isdn_ppp_dev_ioctl(dev, ifr, cmd); +#endif + case ISDN_NET_ENCAP_CISCOHDLCK: + return isdn_ciscohdlck_dev_ioctl(dev, ifr, cmd); + default: + return -EINVAL; + } +} + /* called via cisco_timer.function */ static void isdn_net_ciscohdlck_slarp_send_keepalive(unsigned long data) @@ -1541,7 +1563,7 @@ isdn_net_ciscohdlck_slarp_send_keepalive(unsigned long data) *(__be32 *)(p + 4) = cpu_to_be32(CISCO_SLARP_KEEPALIVE); *(__be32 *)(p + 8) = cpu_to_be32(lp->cisco_myseq); *(__be32 *)(p + 12) = cpu_to_be32(lp->cisco_yourseq); - *(__be16 *)(p + 16) = cpu_to_be16(0xffff); // reliablity, always 0xffff + *(__be16 *)(p + 16) = cpu_to_be16(0xffff); // reliability, always 0xffff p += 18; isdn_net_write_super(lp, skb); @@ -1763,7 +1785,7 @@ isdn_net_ciscohdlck_receive(isdn_net_local *lp, struct sk_buff *skb) static void isdn_net_receive(struct net_device *ndev, struct sk_buff *skb) { - isdn_net_local *lp = (isdn_net_local *) ndev->priv; + isdn_net_local *lp = (isdn_net_local *) netdev_priv(ndev); isdn_net_local *olp = lp; /* original 'lp' */ #ifdef CONFIG_ISDN_X25 struct concap_proto *cprot = lp -> netdev -> cprot; @@ -1777,7 +1799,7 @@ isdn_net_receive(struct net_device *ndev, struct sk_buff *skb) * handle master's statistics and hangup-timeout */ ndev = lp->master; - lp = (isdn_net_local *) ndev->priv; + lp = (isdn_net_local *) netdev_priv(ndev); lp->stats.rx_packets++; lp->stats.rx_bytes += skb->len; } @@ -1817,7 +1839,7 @@ isdn_net_receive(struct net_device *ndev, struct sk_buff *skb) /* IP with type field */ olp->huptimer = 0; lp->huptimer = 0; - skb->protocol = *(unsigned short *) &(skb->data[0]); + skb->protocol = *(__be16 *)&(skb->data[0]); skb_pull(skb, 2); if (*(unsigned short *) skb->data == 0xFFFF) skb->protocol = htons(ETH_P_802_3); @@ -1878,7 +1900,7 @@ 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; + isdn_net_local *lp = netdev_priv(dev); unsigned char *p; ushort len = 0; @@ -1899,12 +1921,12 @@ static int isdn_net_header(struct sk_buff *skb, struct net_device *dev, break; case ISDN_NET_ENCAP_IPTYP: /* ethernet type field */ - *((ushort *) skb_push(skb, 2)) = htons(type); + *((__be16 *)skb_push(skb, 2)) = htons(type); len = 2; break; case ISDN_NET_ENCAP_UIHDLC: /* HDLC with UI-Frames (for ispa with -h1 option) */ - *((ushort *) skb_push(skb, 2)) = htons(0x0103); + *((__be16 *)skb_push(skb, 2)) = htons(0x0103); len = 2; break; case ISDN_NET_ENCAP_CISCOHDLC: @@ -1935,7 +1957,7 @@ static int isdn_net_rebuild_header(struct sk_buff *skb) { struct net_device *dev = skb->dev; - isdn_net_local *lp = dev->priv; + isdn_net_local *lp = netdev_priv(dev); int ret = 0; if (lp->p_encap == ISDN_NET_ENCAP_ETHER) { @@ -1965,7 +1987,7 @@ isdn_net_rebuild_header(struct sk_buff *skb) 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; + isdn_net_local *lp = netdev_priv(dev); if (lp->p_encap == ISDN_NET_ENCAP_ETHER) return eth_header_cache(neigh, hh); @@ -1976,9 +1998,9 @@ 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; + isdn_net_local *lp = netdev_priv(dev); if (lp->p_encap == ISDN_NET_ENCAP_ETHER) - return eth_header_cache_update(hh, dev, haddr); + eth_header_cache_update(hh, dev, haddr); } static const struct header_ops isdn_header_ops = { @@ -1997,23 +2019,6 @@ isdn_net_init(struct net_device *ndev) ushort max_hlhdr_len = 0; int drvidx; - ether_setup(ndev); - ndev->header_ops = NULL; - - /* Setup the generic properties */ - ndev->mtu = 1500; - ndev->flags = IFF_NOARP|IFF_POINTOPOINT; - ndev->type = ARPHRD_ETHER; - ndev->addr_len = ETH_ALEN; - ndev->validate_addr = NULL; - - /* for clients with MPPP maybe higher values better */ - ndev->tx_queue_len = 30; - - /* The ISDN-specific entries in the device structure. */ - ndev->open = &isdn_net_open; - ndev->hard_start_xmit = &isdn_net_start_xmit; - /* * up till binding we ask the protocol layer to reserve as much * as we might need for HL layer @@ -2025,9 +2030,6 @@ isdn_net_init(struct net_device *ndev) max_hlhdr_len = dev->drv[drvidx]->interface->hl_hdrlen; ndev->hard_header_len = ETH_HLEN + max_hlhdr_len; - ndev->stop = &isdn_net_close; - ndev->get_stats = &isdn_net_get_stats; - ndev->do_ioctl = NULL; return 0; } @@ -2291,16 +2293,16 @@ isdn_net_find_icall(int di, int ch, int idx, setup_parm *setup) * it's master and parent slave is online. If not, reject the call. */ if (lp->master) { - isdn_net_local *mlp = (isdn_net_local *) lp->master->priv; + isdn_net_local *mlp = ISDN_MASTER_PRIV(lp); printk(KERN_DEBUG "ICALLslv: %s\n", p->dev->name); printk(KERN_DEBUG "master=%s\n", lp->master->name); if (mlp->flags & ISDN_NET_CONNECTED) { printk(KERN_DEBUG "master online\n"); /* Master is online, find parent-slave (master if first slave) */ while (mlp->slave) { - if ((isdn_net_local *) mlp->slave->priv == lp) + if (ISDN_SLAVE_PRIV(mlp) == lp) break; - mlp = (isdn_net_local *) mlp->slave->priv; + mlp = ISDN_SLAVE_PRIV(mlp); } } else printk(KERN_DEBUG "master offline\n"); @@ -2507,14 +2509,35 @@ isdn_net_force_dial(char *name) return (isdn_net_force_dial_lp(p->local)); } +/* The ISDN-specific entries in the device structure. */ +static const struct net_device_ops isdn_netdev_ops = { + .ndo_init = isdn_net_init, + .ndo_open = isdn_net_open, + .ndo_stop = isdn_net_close, + .ndo_do_ioctl = isdn_net_ioctl, + + .ndo_start_xmit = isdn_net_start_xmit, + .ndo_get_stats = isdn_net_get_stats, + .ndo_tx_timeout = isdn_net_tx_timeout, +}; + /* * Helper for alloc_netdev() */ static void _isdn_setup(struct net_device *dev) { - isdn_net_local *lp = dev->priv; + isdn_net_local *lp = netdev_priv(dev); + + ether_setup(dev); + + /* Setup the generic properties */ + dev->flags = IFF_NOARP|IFF_POINTOPOINT; + dev->header_ops = NULL; + dev->netdev_ops = &isdn_netdev_ops; + + /* for clients with MPPP maybe higher values better */ + dev->tx_queue_len = 30; - dev->flags = IFF_NOARP | IFF_POINTOPOINT; lp->p_encap = ISDN_NET_ENCAP_RAWIP; lp->magic = ISDN_NET_MAGIC; lp->last = lp; @@ -2568,26 +2591,25 @@ isdn_net_new(char *name, struct net_device *master) kfree(netdev); return NULL; } - netdev->local = netdev->dev->priv; - netdev->dev->init = isdn_net_init; + netdev->local = netdev_priv(netdev->dev); + if (master) { /* Device shall be a slave */ - struct net_device *p = (((isdn_net_local *) master->priv)->slave); + struct net_device *p = MASTER_TO_SLAVE(master); struct net_device *q = master; netdev->local->master = master; /* Put device at end of slave-chain */ while (p) { q = p; - p = (((isdn_net_local *) p->priv)->slave); + p = MASTER_TO_SLAVE(p); } - ((isdn_net_local *) q->priv)->slave = netdev->dev; + MASTER_TO_SLAVE(q) = 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) { printk(KERN_WARNING "isdn_net: Could not register net-device\n"); @@ -2703,7 +2725,6 @@ isdn_net_setcfg(isdn_net_ioctl_cfg * cfg) #else 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: @@ -2717,7 +2738,6 @@ isdn_net_setcfg(isdn_net_ioctl_cfg * cfg) #endif break; case ISDN_NET_ENCAP_CISCOHDLCK: - p->dev->do_ioctl = isdn_ciscohdlck_dev_ioctl; break; default: if( cfg->p_encap >= 0 && @@ -3079,7 +3099,7 @@ isdn_net_force_hangup(char *name) /* If this interface has slaves, do a hangup for them also. */ while (q) { isdn_net_hangup(q); - q = (((isdn_net_local *) q->priv)->slave); + q = MASTER_TO_SLAVE(q); } isdn_net_hangup(p->dev); return 0; @@ -3109,8 +3129,10 @@ 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) - ((isdn_net_local *) (p->local->master->priv))->slave = p->local->slave; + if (((isdn_net_local *) ISDN_MASTER_PRIV(p->local))->slave == + p->dev) + ((isdn_net_local *)ISDN_MASTER_PRIV(p->local))->slave = + p->local->slave; } else { /* Unregister only if it's a master-device */ unregister_netdev(p->dev);