X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=drivers%2Fnet%2F3c523.c;h=8f734d74b513f66b33e3c89b7c8779125e832246;hb=c1889bfe687c22f74d1333913ffe8f8da173d601;hp=e2ce41d3828ed47e90b31c7e09d7cb29649a1373;hpb=b73b636e8987f8728c6c700377615757691b9a55;p=deliverable%2Flinux.git diff --git a/drivers/net/3c523.c b/drivers/net/3c523.c index e2ce41d3828e..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); @@ -383,7 +383,6 @@ static int elmc_getinfo(char *buf, int slot, void *d) { int len = 0; struct net_device *dev = d; - DECLARE_MAC_BUF(mac); if (dev == NULL) return len; @@ -398,12 +397,26 @@ static int elmc_getinfo(char *buf, int slot, void *d) len += sprintf(buf + len, "Transceiver: %s\n", dev->if_port ? "External" : "Internal"); len += sprintf(buf + len, "Device: %s\n", dev->name); - len += sprintf(buf + len, "Hardware Address: %s\n", - print_mac(mac, dev->dev_addr)); + len += sprintf(buf + len, "Hardware Address: %pM\n", + dev->dev_addr); 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) @@ -416,8 +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; - DECLARE_MAC_BUF(mac); + struct priv *pr = netdev_priv(dev); if (MCA_bus == 0) { return -ENODEV; @@ -543,20 +555,11 @@ static int __init do_elmc_probe(struct net_device *dev) for (i = 0; i < 6; i++) dev->dev_addr[i] = inb(dev->base_addr + i); - printk(KERN_INFO "%s: hardware address %s\n", - dev->name, print_mac(mac, dev->dev_addr)); + 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. @@ -578,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)); @@ -616,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; @@ -852,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; @@ -913,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)) { @@ -969,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); @@ -985,7 +989,6 @@ static void elmc_rcv_int(struct net_device *dev) skb_copy_to_linear_data(skb, (char *) p->base+(unsigned long) rbd->buffer,totlen); skb->protocol = eth_type_trans(skb, dev); netif_rx(skb); - dev->last_rx = jiffies; dev->stats.rx_packets++; dev->stats.rx_bytes += totlen; } else { @@ -1013,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++; @@ -1036,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)) { @@ -1079,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; @@ -1093,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 @@ -1129,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); @@ -1200,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 */