X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=drivers%2Fnet%2F3c523.c;h=8f734d74b513f66b33e3c89b7c8779125e832246;hb=c1889bfe687c22f74d1333913ffe8f8da173d601;hp=0885aeeac98ac9ed4a684f59713c4b75df6363bd;hpb=7e452baf6b96b5aeba097afd91501d33d390cc97;p=deliverable%2Flinux.git diff --git a/drivers/net/3c523.c b/drivers/net/3c523.c index 0885aeeac98a..8f734d74b513 100644 --- a/drivers/net/3c523.c +++ b/drivers/net/3c523.c @@ -308,7 +308,7 @@ static int elmc_open(struct net_device *dev) static int __init check586(struct net_device *dev, unsigned long where, unsigned size) { - struct priv *p = (struct priv *) dev->priv; + struct priv *p = netdev_priv(dev); char *iscp_addrs[2]; int i = 0; @@ -347,9 +347,9 @@ static int __init check586(struct net_device *dev, unsigned long where, unsigned * set iscp at the right place, called by elmc_probe and open586. */ -void alloc586(struct net_device *dev) +static void alloc586(struct net_device *dev) { - struct priv *p = (struct priv *) dev->priv; + struct priv *p = netdev_priv(dev); elmc_id_reset586(); DELAY(2); @@ -403,6 +403,20 @@ static int elmc_getinfo(char *buf, int slot, void *d) return len; } /* elmc_getinfo() */ +static const struct net_device_ops netdev_ops = { + .ndo_open = elmc_open, + .ndo_stop = elmc_close, + .ndo_get_stats = elmc_get_stats, + .ndo_start_xmit = elmc_send_packet, + .ndo_tx_timeout = elmc_timeout, +#ifdef ELMC_MULTICAST + .ndo_set_multicast_list = set_multicast_list, +#endif + .ndo_change_mtu = eth_change_mtu, + .ndo_set_mac_address = eth_mac_addr, + .ndo_validate_addr = eth_validate_addr, +}; + /*****************************************************************/ static int __init do_elmc_probe(struct net_device *dev) @@ -415,7 +429,7 @@ static int __init do_elmc_probe(struct net_device *dev) int i = 0; unsigned int size = 0; int retval; - struct priv *pr = dev->priv; + struct priv *pr = netdev_priv(dev); if (MCA_bus == 0) { return -ENODEV; @@ -544,17 +558,8 @@ static int __init do_elmc_probe(struct net_device *dev) printk(KERN_INFO "%s: hardware address %pM\n", dev->name, dev->dev_addr); - dev->open = &elmc_open; - dev->stop = &elmc_close; - dev->get_stats = &elmc_get_stats; - dev->hard_start_xmit = &elmc_send_packet; - dev->tx_timeout = &elmc_timeout; + dev->netdev_ops = &netdev_ops; dev->watchdog_timeo = HZ; -#ifdef ELMC_MULTICAST - dev->set_multicast_list = &set_multicast_list; -#else - dev->set_multicast_list = NULL; -#endif dev->ethtool_ops = &netdev_ethtool_ops; /* note that we haven't actually requested the IRQ from the kernel. @@ -576,13 +581,14 @@ err_out: return retval; } +#ifdef MODULE static void cleanup_card(struct net_device *dev) { - mca_set_adapter_procfn(((struct priv *) (dev->priv))->slot, NULL, NULL); + mca_set_adapter_procfn(((struct priv *)netdev_priv(dev))->slot, + NULL, NULL); release_region(dev->base_addr, ELMC_IO_EXTENT); } - -#ifndef MODULE +#else struct net_device * __init elmc_probe(int unit) { struct net_device *dev = alloc_etherdev(sizeof(struct priv)); @@ -614,7 +620,7 @@ static int init586(struct net_device *dev) void *ptr; unsigned long s; int i, result = 0; - struct priv *p = (struct priv *) dev->priv; + struct priv *p = netdev_priv(dev); volatile struct configure_cmd_struct *cfg_cmd; volatile struct iasetup_cmd_struct *ias_cmd; volatile struct tdr_cmd_struct *tdr_cmd; @@ -850,7 +856,7 @@ static void *alloc_rfa(struct net_device *dev, void *ptr) volatile struct rfd_struct *rfd = (struct rfd_struct *) ptr; volatile struct rbd_struct *rbd; int i; - struct priv *p = (struct priv *) dev->priv; + struct priv *p = netdev_priv(dev); memset((char *) rfd, 0, sizeof(struct rfd_struct) * p->num_recv_buffs); p->rfd_first = rfd; @@ -911,7 +917,7 @@ elmc_interrupt(int irq, void *dev_id) } /* reading ELMC_CTRL also clears the INT bit. */ - p = (struct priv *) dev->priv; + p = netdev_priv(dev); while ((stat = p->scb->status & STAT_MASK)) { @@ -967,7 +973,7 @@ static void elmc_rcv_int(struct net_device *dev) unsigned short totlen; struct sk_buff *skb; struct rbd_struct *rbd; - struct priv *p = (struct priv *) dev->priv; + struct priv *p = netdev_priv(dev); for (; (status = p->rfd_top->status) & STAT_COMPL;) { rbd = (struct rbd_struct *) make32(p->rfd_top->rbd_offset); @@ -1010,7 +1016,7 @@ static void elmc_rcv_int(struct net_device *dev) static void elmc_rnr_int(struct net_device *dev) { - struct priv *p = (struct priv *) dev->priv; + struct priv *p = netdev_priv(dev); dev->stats.rx_errors++; @@ -1033,7 +1039,7 @@ static void elmc_rnr_int(struct net_device *dev) static void elmc_xmt_int(struct net_device *dev) { int status; - struct priv *p = (struct priv *) dev->priv; + struct priv *p = netdev_priv(dev); status = p->xmit_cmds[p->xmit_last]->cmd_status; if (!(status & STAT_COMPL)) { @@ -1076,7 +1082,7 @@ static void elmc_xmt_int(struct net_device *dev) static void startrecv586(struct net_device *dev) { - struct priv *p = (struct priv *) dev->priv; + struct priv *p = netdev_priv(dev); p->scb->rfa_offset = make16(p->rfd_first); p->scb->cmd = RUC_START; @@ -1090,7 +1096,7 @@ static void startrecv586(struct net_device *dev) static void elmc_timeout(struct net_device *dev) { - struct priv *p = (struct priv *) dev->priv; + struct priv *p = netdev_priv(dev); /* COMMAND-UNIT active? */ if (p->scb->status & CU_ACTIVE) { #ifdef DEBUG @@ -1126,7 +1132,7 @@ static int elmc_send_packet(struct sk_buff *skb, struct net_device *dev) #ifndef NO_NOPCOMMANDS int next_nop; #endif - struct priv *p = (struct priv *) dev->priv; + struct priv *p = netdev_priv(dev); netif_stop_queue(dev); @@ -1197,7 +1203,7 @@ static int elmc_send_packet(struct sk_buff *skb, struct net_device *dev) static struct net_device_stats *elmc_get_stats(struct net_device *dev) { - struct priv *p = (struct priv *) dev->priv; + struct priv *p = netdev_priv(dev); unsigned short crc, aln, rsc, ovrn; crc = p->scb->crc_errs; /* get error-statistic from the ni82586 */