X-Git-Url: http://ftp.safe.ca/?a=blobdiff_plain;f=drivers%2Fnet%2Fhp100.c;h=1d3429a415e6b646f90b49e9aad317ab1a3b0271;hb=bb1567491e43df4113ec8b088ff0ebc22f568bc5;hp=247c8ca86033693bfe99b01680ede5a54a3fe5f2;hpb=70c07e02625ec46d0ffbfce1acef42d660803528;p=safe%2Fjmp%2Flinux-2.6 diff --git a/drivers/net/hp100.c b/drivers/net/hp100.c index 247c8ca..1d3429a 100644 --- a/drivers/net/hp100.c +++ b/drivers/net/hp100.c @@ -1,24 +1,24 @@ /* -** hp100.c +** hp100.c ** HP CASCADE Architecture Driver for 100VG-AnyLan Network Adapters ** ** $Id: hp100.c,v 1.58 2001/09/24 18:03:01 perex Exp perex $ ** ** Based on the HP100 driver written by Jaroslav Kysela -** Extended for new busmaster capable chipsets by +** Extended for new busmaster capable chipsets by ** Siegfried "Frieder" Loeffler (dg1sek) ** -** Maintained by: Jaroslav Kysela -** +** Maintained by: Jaroslav Kysela +** ** This driver has only been tested with ** -- HP J2585B 10/100 Mbit/s PCI Busmaster -** -- HP J2585A 10/100 Mbit/s PCI +** -- HP J2585A 10/100 Mbit/s PCI ** -- HP J2970A 10 Mbit/s PCI Combo 10base-T/BNC ** -- HP J2973A 10 Mbit/s PCI 10base-T ** -- HP J2573 10/100 ISA ** -- Compex ReadyLink ENET100-VG4 10/100 Mbit/s PCI / EISA ** -- Compex FreedomLine 100/VG 10/100 Mbit/s ISA / EISA / PCI -** +** ** but it should also work with the other CASCADE based adapters. ** ** TODO: @@ -65,7 +65,7 @@ ** - timing changes in xmit routines, relogin to 100VG hub added when ** driver does reset ** - included fix for Compex FreedomLine PCI adapter -** +** ** 1.54 -> 1.55 ** - fixed bad initialization in init_module ** - added Compex FreedomLine adapter @@ -73,10 +73,10 @@ ** ** 1.53 -> 1.54 ** - added hardware multicast filter support (doesn't work) -** - little changes in hp100_sense_lan routine +** - little changes in hp100_sense_lan routine ** - added support for Coax and AUI (J2970) ** - fix for multiple cards and hp100_mode parameter (insmod) -** - fix for shared IRQ +** - fix for shared IRQ ** ** 1.52 -> 1.53 ** - fixed bug in multicast support @@ -111,7 +111,6 @@ #include #include #include -#include /* for CONFIG_PCI */ #include #include #include @@ -189,10 +188,12 @@ struct hp100_private { /* * variables */ +#ifdef CONFIG_ISA static const char *hp100_isa_tbl[] = { "HWPF150", /* HP J2573 rev A */ "HWP1950", /* HP J2573 */ }; +#endif #ifdef CONFIG_EISA static struct eisa_device_id hp100_eisa_tbl[] = { @@ -248,7 +249,7 @@ static void hp100_misc_interrupt(struct net_device *dev); static void hp100_update_stats(struct net_device *dev); static void hp100_clear_stats(struct hp100_private *lp, int ioaddr); static void hp100_set_multicast_list(struct net_device *dev); -static irqreturn_t hp100_interrupt(int irq, void *dev_id, struct pt_regs *regs); +static irqreturn_t hp100_interrupt(int irq, void *dev_id); static void hp100_start_interface(struct net_device *dev); static void hp100_stop_interface(struct net_device *dev); static void hp100_load_eeprom(struct net_device *dev, u_short ioaddr); @@ -287,7 +288,7 @@ static inline dma_addr_t virt_to_whatever(struct net_device *dev, u32 * ptr) static inline u_int pdl_map_data(struct hp100_private *lp, void *data) { - return pci_map_single(lp->pci_dev, data, + return pci_map_single(lp->pci_dev, data, MAX_ETHER_SIZE, PCI_DMA_FROMDEVICE); } @@ -334,6 +335,7 @@ static __devinit const char *hp100_read_id(int ioaddr) return str; } +#ifdef CONFIG_ISA static __init int hp100_isa_probe1(struct net_device *dev, int ioaddr) { const char *sig; @@ -354,7 +356,7 @@ static __init int hp100_isa_probe1(struct net_device *dev, int ioaddr) goto err; for (i = 0; i < ARRAY_SIZE(hp100_isa_tbl); i++) { - if (!strcmp(hp100_isa_tbl[i], sig)) + if (!strcmp(hp100_isa_tbl[i], sig)) break; } @@ -374,11 +376,11 @@ static int __init hp100_isa_probe(struct net_device *dev, int addr) { int err = -ENODEV; - /* Probe for a specific ISA address */ + /* Probe for a specific ISA address */ if (addr > 0xff && addr < 0x400) err = hp100_isa_probe1(dev, addr); - else if (addr != 0) + else if (addr != 0) err = -ENXIO; else { @@ -391,9 +393,9 @@ static int __init hp100_isa_probe(struct net_device *dev, int addr) } return err; } +#endif /* CONFIG_ISA */ - -#ifndef MODULE +#if !defined(MODULE) && defined(CONFIG_ISA) struct net_device * __init hp100_probe(int unit) { struct net_device *dev = alloc_etherdev(sizeof(struct hp100_private)); @@ -402,8 +404,6 @@ struct net_device * __init hp100_probe(int unit) if (!dev) return ERR_PTR(-ENODEV); - SET_MODULE_OWNER(dev); - #ifdef HP100_DEBUG_B hp100_outw(0x4200, TRACE); printk("hp100: %s: probe\n", dev->name); @@ -423,7 +423,29 @@ struct net_device * __init hp100_probe(int unit) free_netdev(dev); return ERR_PTR(err); } -#endif +#endif /* !MODULE && CONFIG_ISA */ + +static const struct net_device_ops hp100_bm_netdev_ops = { + .ndo_open = hp100_open, + .ndo_stop = hp100_close, + .ndo_start_xmit = hp100_start_xmit_bm, + .ndo_get_stats = hp100_get_stats, + .ndo_set_multicast_list = hp100_set_multicast_list, + .ndo_change_mtu = eth_change_mtu, + .ndo_set_mac_address = eth_mac_addr, + .ndo_validate_addr = eth_validate_addr, +}; + +static const struct net_device_ops hp100_netdev_ops = { + .ndo_open = hp100_open, + .ndo_stop = hp100_close, + .ndo_start_xmit = hp100_start_xmit, + .ndo_get_stats = hp100_get_stats, + .ndo_set_multicast_list = hp100_set_multicast_list, + .ndo_change_mtu = eth_change_mtu, + .ndo_set_mac_address = eth_mac_addr, + .ndo_validate_addr = eth_validate_addr, +}; static int __devinit hp100_probe1(struct net_device *dev, int ioaddr, u_char bus, struct pci_dev *pci_dev) @@ -449,7 +471,7 @@ static int __devinit hp100_probe1(struct net_device *dev, int ioaddr, if (!request_region(ioaddr, HP100_REGION_SIZE, "hp100")) goto out1; - if (hp100_inw(HW_ID) != HP100_HW_ID_CASCADE) + if (hp100_inw(HW_ID) != HP100_HW_ID_CASCADE) goto out2; chip = hp100_inw(PAGING) & HP100_CHIPID_MASK; @@ -492,7 +514,7 @@ static int __devinit hp100_probe1(struct net_device *dev, int ioaddr, * Use the variable "hp100_mode" upon insmod or as kernel parameter to * force driver modes: * hp100_mode=1 -> default, use busmaster mode if configured. - * hp100_mode=2 -> enable shared memory mode + * hp100_mode=2 -> enable shared memory mode * hp100_mode=3 -> force use of i/o mapped mode. * hp100_mode=4 -> same as 1, but re-set the enable bit on the card. */ @@ -558,7 +580,7 @@ static int __devinit hp100_probe1(struct net_device *dev, int ioaddr, * Also, we can have EISA Busmaster cards (not tested), * so beware !!! - Jean II */ if((bus == HP100_BUS_PCI) && - (pci_set_dma_mask(pci_dev, DMA_32BIT_MASK))) { + (pci_set_dma_mask(pci_dev, DMA_BIT_MASK(32)))) { /* Gracefully fallback to shared memory */ goto busmasterfail; } @@ -657,16 +679,10 @@ static int __devinit hp100_probe1(struct net_device *dev, int ioaddr, lp->virt_memory_size = virt_memory_size; lp->rx_ratio = hp100_rx_ratio; /* can be conf'd with insmod */ - dev->open = hp100_open; - dev->stop = hp100_close; - if (lp->mode == 1) /* busmaster */ - dev->hard_start_xmit = hp100_start_xmit_bm; + dev->netdev_ops = &hp100_bm_netdev_ops; else - dev->hard_start_xmit = hp100_start_xmit; - - dev->get_stats = hp100_get_stats; - dev->set_multicast_list = &hp100_set_multicast_list; + dev->netdev_ops = &hp100_netdev_ops; /* Ask the card for which IRQ line it is configured */ if (bus == HP100_BUS_PCI) { @@ -690,9 +706,9 @@ static int __devinit hp100_probe1(struct net_device *dev, int ioaddr, hp100_clear_stats(lp, ioaddr); /* If busmaster mode is wanted, a dma-capable memory area is needed for - * the rx and tx PDLs + * the rx and tx PDLs * PCI cards can access the whole PC memory. Therefore GFP_DMA is not - * needed for the allocation of the memory area. + * needed for the allocation of the memory area. */ /* TODO: We do not need this with old cards, where PDLs are stored @@ -719,7 +735,7 @@ static int __devinit hp100_probe1(struct net_device *dev, int ioaddr, } /* Initialise the card. */ - /* (I'm not really sure if it's a good idea to do this during probing, but + /* (I'm not really sure if it's a good idea to do this during probing, but * like this it's assured that the lan connection type can be sensed * correctly) */ @@ -779,8 +795,8 @@ static int __devinit hp100_probe1(struct net_device *dev, int ioaddr, return 0; out3: if (local_mode == 1) - pci_free_consistent(lp->pci_dev, MAX_RINGSIZE + 0x0f, - lp->page_vaddr_algn, + pci_free_consistent(lp->pci_dev, MAX_RINGSIZE + 0x0f, + lp->page_vaddr_algn, virt_to_whatever(dev, lp->page_vaddr_algn)); if (mem_ptr_virt) iounmap(mem_ptr_virt); @@ -861,7 +877,7 @@ static void hp100_hwinit(struct net_device *dev) /* Next comes code from mmuinit procedure of SCO BM driver which is * called from HWconfigure in the SCO driver. */ - /* Initialise MMU, eventually switch on Busmaster Mode, initialise + /* Initialise MMU, eventually switch on Busmaster Mode, initialise * multicast filter... */ hp100_mmuinit(dev); @@ -879,11 +895,11 @@ static void hp100_hwinit(struct net_device *dev) hp100_login_to_vg_hub(dev, 0); /* relogin */ } - -/* + +/* * mmuinit - Reinitialise Cascade MMU and MAC settings. - * Note: Must already be in reset and leaves card in reset. + * Note: Must already be in reset and leaves card in reset. */ static void hp100_mmuinit(struct net_device *dev) { @@ -909,7 +925,7 @@ static void hp100_mmuinit(struct net_device *dev) hp100_outw(0xffff, IRQ_STATUS); /* ack IRQ */ /* - * Enable Hardware + * Enable Hardware * - Clear Debug En, Rx Hdr Pipe, EE En, I/O En, Fake Int and Intr En * - Set Tri-State Int, Bus Master Rd/Wr, and Mem Map Disable * - Clear Priority, Advance Pkt and Xmit Cmd @@ -984,7 +1000,7 @@ static void hp100_mmuinit(struct net_device *dev) * 4 bytes for header). We will leave NUM_RXPDLS * 508 (rounded * to the next higher 1k boundary) bytes for the rx-pdl's * Note: For non-etr chips the transmit stop register must be - * programmed on a 1k boundary, i.e. bits 9:0 must be zero. + * programmed on a 1k boundary, i.e. bits 9:0 must be zero. */ pdl_stop = lp->memory_size; xmit_stop = (pdl_stop - 508 * (MAX_RX_PDL) - 16) & ~(0x03ff); @@ -1079,7 +1095,7 @@ static int hp100_open(struct net_device *dev) /* New: if bus is PCI or EISA, interrupts might be shared interrupts */ if (request_irq(dev->irq, hp100_interrupt, lp->bus == HP100_BUS_PCI || lp->bus == - HP100_BUS_EISA ? SA_SHIRQ : SA_INTERRUPT, + HP100_BUS_EISA ? IRQF_SHARED : IRQF_DISABLED, "hp100", dev)) { printk("hp100: %s: unable to get IRQ %d\n", dev->name, dev->irq); return -EAGAIN; @@ -1132,10 +1148,10 @@ static int hp100_close(struct net_device *dev) return 0; } - + /* - * Configure the PDL Rx rings and LAN + * Configure the PDL Rx rings and LAN */ static void hp100_init_pdls(struct net_device *dev) { @@ -1153,7 +1169,7 @@ static void hp100_init_pdls(struct net_device *dev) printk("hp100: %s: init pdls\n", dev->name); #endif - if (0 == lp->page_vaddr_algn) + if (!lp->page_vaddr_algn) printk("hp100: %s: Warning: lp->page_vaddr_algn not initialised!\n", dev->name); else { /* pageptr shall point into the DMA accessible memory region */ @@ -1183,7 +1199,7 @@ static void hp100_init_pdls(struct net_device *dev) } } } - + /* These functions "format" the entries in the pdl structure */ /* They return how much memory the fragments need. */ @@ -1201,10 +1217,10 @@ static int hp100_init_rxpdl(struct net_device *dev, ringptr->pdl_paddr = virt_to_whatever(dev, pdlptr + 1); ringptr->skb = (void *) NULL; - /* + /* * Write address and length of first PDL Fragment (which is used for * storing the RX-Header - * We use the 4 bytes _before_ the PDH in the pdl memory area to + * We use the 4 bytes _before_ the PDH in the pdl memory area to * store this information. (PDH is at offset 0x04) */ /* Note that pdlptr+1 and not pdlptr is the pointer to the PDH */ @@ -1212,7 +1228,7 @@ static int hp100_init_rxpdl(struct net_device *dev, *(pdlptr + 2) = (u_int) virt_to_whatever(dev, pdlptr); /* Address Frag 1 */ *(pdlptr + 3) = 4; /* Length Frag 1 */ - return ((((MAX_RX_FRAG * 2 + 2) + 3) / 4) * 4); + return roundup(MAX_RX_FRAG * 2 + 2, 4); } @@ -1227,13 +1243,13 @@ static int hp100_init_txpdl(struct net_device *dev, ringptr->pdl_paddr = virt_to_whatever(dev, pdlptr); /* +1 */ ringptr->skb = (void *) NULL; - return ((((MAX_TX_FRAG * 2 + 2) + 3) / 4) * 4); + return roundup(MAX_TX_FRAG * 2 + 2, 4); } /* - * hp100_build_rx_pdl allocates an skb_buff of maximum size plus two bytes + * hp100_build_rx_pdl allocates an skb_buff of maximum size plus two bytes * for possible odd word alignment rounding up to next dword and set PDL - * address for fragment#2 + * address for fragment#2 * Returns: 0 if unable to allocate skb_buff * 1 if successful */ @@ -1253,13 +1269,13 @@ static int hp100_build_rx_pdl(hp100_ring_t * ringptr, #endif /* Allocate skb buffer of maximum size */ - /* Note: This depends on the alloc_skb functions allocating more + /* Note: This depends on the alloc_skb functions allocating more * space than requested, i.e. aligning to 16bytes */ - ringptr->skb = dev_alloc_skb(((MAX_ETHER_SIZE + 2 + 3) / 4) * 4); + ringptr->skb = dev_alloc_skb(roundup(MAX_ETHER_SIZE + 2, 4)); if (NULL != ringptr->skb) { - /* + /* * Reserve 2 bytes at the head of the buffer to land the IP header * on a long word boundary (According to the Network Driver section * in the Linux KHG, this should help to increase performance.) @@ -1271,22 +1287,22 @@ static int hp100_build_rx_pdl(hp100_ring_t * ringptr, /* ringptr->pdl points to the beginning of the PDL, i.e. the PDH */ /* Note: 1st Fragment is used for the 4 byte packet status - * (receive header). Its PDL entries are set up by init_rxpdl. So + * (receive header). Its PDL entries are set up by init_rxpdl. So * here we only have to set up the PDL fragment entries for the data - * part. Those 4 bytes will be stored in the DMA memory region - * directly before the PDL. + * part. Those 4 bytes will be stored in the DMA memory region + * directly before the PDL. */ #ifdef HP100_DEBUG_BM printk("hp100: %s: build_rx_pdl: PDH@0x%x, skb->data (len %d) at 0x%x\n", dev->name, (u_int) ringptr->pdl, - ((MAX_ETHER_SIZE + 2 + 3) / 4) * 4, + roundup(MAX_ETHER_SIZE + 2, 4), (unsigned int) ringptr->skb->data); #endif /* Conversion to new PCI API : map skbuf data to PCI bus. * Doc says it's OK for EISA as well - Jean II */ ringptr->pdl[0] = 0x00020000; /* Write PDH */ - ringptr->pdl[3] = pdl_map_data(netdev_priv(dev), + ringptr->pdl[3] = pdl_map_data(netdev_priv(dev), ringptr->skb->data); ringptr->pdl[4] = MAX_ETHER_SIZE; /* Length of Data */ @@ -1407,7 +1423,7 @@ static void hp100_BM_shutdown(struct net_device *dev) } } else { /* Shasta or Rainier Shutdown/Reset */ /* To ensure all bus master inloading activity has ceased, - * wait for no Rx PDAs or no Rx packets on card. + * wait for no Rx PDAs or no Rx packets on card. */ hp100_page(PERFORMANCE); /* 100 ms timeout */ @@ -1423,7 +1439,7 @@ static void hp100_BM_shutdown(struct net_device *dev) /* To ensure all bus master outloading activity has ceased, * wait until the Tx PDA count goes to zero or no more Tx space - * available in the Tx region of the card. + * available in the Tx region of the card. */ /* 100 ms timeout */ for (time = 0; time < 10000; time++) { @@ -1462,7 +1478,7 @@ static int hp100_check_lan(struct net_device *dev) return 0; } -/* +/* * transmit functions */ @@ -1479,19 +1495,11 @@ static int hp100_start_xmit_bm(struct sk_buff *skb, struct net_device *dev) hp100_outw(0x4210, TRACE); printk("hp100: %s: start_xmit_bm\n", dev->name); #endif - - if (skb == NULL) { - return 0; - } - if (skb->len <= 0) + goto drop; + + if (lp->chip == HP100_CHIPID_SHASTA && skb_padto(skb, ETH_ZLEN)) return 0; - - if (skb->len < ETH_ZLEN && lp->chip == HP100_CHIPID_SHASTA) { - skb = skb_padto(skb, ETH_ZLEN); - if (skb == NULL) - return 0; - } /* Get Tx ring tail pointer */ if (lp->txrtail->next == lp->txrhead) { @@ -1501,10 +1509,10 @@ static int hp100_start_xmit_bm(struct sk_buff *skb, struct net_device *dev) #endif /* not waited long enough since last tx? */ if (time_before(jiffies, dev->trans_start + HZ)) - return -EAGAIN; + goto drop; if (hp100_check_lan(dev)) - return -EIO; + goto drop; if (lp->lan_type == HP100_LAN_100 && lp->hub_status < 0) { /* we have a 100Mb/s adapter but it isn't connected to hub */ @@ -1538,7 +1546,7 @@ static int hp100_start_xmit_bm(struct sk_buff *skb, struct net_device *dev) } dev->trans_start = jiffies; - return -EAGAIN; + goto drop; } /* @@ -1578,15 +1586,19 @@ static int hp100_start_xmit_bm(struct sk_buff *skb, struct net_device *dev) dev->trans_start = jiffies; return 0; + +drop: + dev_kfree_skb(skb); + return NETDEV_TX_OK; } - + /* clean_txring checks if packets have been sent by the card by reading * the TX_PDL register from the performance page and comparing it to the * number of commited packets. It then frees the skb's of the packets that * obviously have been sent to the network. * - * Needs the PERFORMANCE page selected. + * Needs the PERFORMANCE page selected. */ static void hp100_clean_txring(struct net_device *dev) { @@ -1635,16 +1647,11 @@ static int hp100_start_xmit(struct sk_buff *skb, struct net_device *dev) hp100_outw(0x4212, TRACE); printk("hp100: %s: start_xmit\n", dev->name); #endif - - if (skb == NULL) { - return 0; - } - if (skb->len <= 0) - return 0; + goto drop; if (hp100_check_lan(dev)) - return -EIO; + goto drop; /* If there is not enough free memory on the card... */ i = hp100_inl(TX_MEM_FREE) & 0x7fffffff; @@ -1658,7 +1665,7 @@ static int hp100_start_xmit(struct sk_buff *skb, struct net_device *dev) printk("hp100: %s: trans_start timing problem\n", dev->name); #endif - return -EAGAIN; + goto drop; } if (lp->lan_type == HP100_LAN_100 && lp->hub_status < 0) { /* we have a 100Mb/s adapter but it isn't connected to hub */ @@ -1692,7 +1699,7 @@ static int hp100_start_xmit(struct sk_buff *skb, struct net_device *dev) } } dev->trans_start = jiffies; - return -EAGAIN; + goto drop; } for (i = 0; i < 6000 && (hp100_inb(OPTION_MSW) & HP100_TX_CMD); i++) { @@ -1746,16 +1753,21 @@ static int hp100_start_xmit(struct sk_buff *skb, struct net_device *dev) #endif return 0; + +drop: + dev_kfree_skb(skb); + return NETDEV_TX_OK; + } - + /* * Receive Function (Non-Busmaster mode) - * Called when an "Receive Packet" interrupt occurs, i.e. the receive + * Called when an "Receive Packet" interrupt occurs, i.e. the receive * packet counter is non-zero. * For non-busmaster, this function does the whole work of transfering * the packet to the host memory and then up to higher layers via skb - * and netif_rx. + * and netif_rx. */ static void hp100_rx(struct net_device *dev) @@ -1817,7 +1829,6 @@ static void hp100_rx(struct net_device *dev) u_char *ptr; skb_reserve(skb,2); - skb->dev = dev; /* ptr to start of the sk_buff data area */ skb_put(skb, pkt_len); @@ -1838,7 +1849,6 @@ static void hp100_rx(struct net_device *dev) ptr[9], ptr[10], ptr[11]); #endif netif_rx(skb); - dev->last_rx = jiffies; lp->stats.rx_packets++; lp->stats.rx_bytes += pkt_len; } @@ -1858,7 +1868,7 @@ static void hp100_rx(struct net_device *dev) #endif } -/* +/* * Receive Function for Busmaster Mode */ static void hp100_rx_bm(struct net_device *dev) @@ -1879,7 +1889,7 @@ static void hp100_rx_bm(struct net_device *dev) printk("hp100: %s: rx_bm called although no PDLs were committed to adapter?\n", dev->name); return; } else - /* RX_PKT_CNT states how many PDLs are currently formatted and available to + /* RX_PKT_CNT states how many PDLs are currently formatted and available to * the cards BM engine */ if ((hp100_inw(RX_PKT_CNT) & 0x00ff) >= lp->rxrcommit) { printk("hp100: %s: More packets received than commited? RX_PKT_CNT=0x%x, commit=0x%x\n", @@ -1892,7 +1902,7 @@ static void hp100_rx_bm(struct net_device *dev) while ((lp->rxrcommit > hp100_inb(RX_PDL))) { /* * The packet was received into the pdl pointed to by lp->rxrhead ( - * the oldest pdl in the ring + * the oldest pdl in the ring */ /* First we get the header, which contains information about the */ @@ -1929,7 +1939,6 @@ static void hp100_rx_bm(struct net_device *dev) netif_rx(ptr->skb); /* Up and away... */ - dev->last_rx = jiffies; lp->stats.rx_packets++; lp->stats.rx_bytes += pkt_len; } @@ -2047,7 +2056,7 @@ static void hp100_clear_stats(struct hp100_private *lp, int ioaddr) hp100_page(PERFORMANCE); spin_unlock_irqrestore(&lp->lock, flags); } - + /* * multicast setup @@ -2097,9 +2106,8 @@ static void hp100_set_multicast_list(struct net_device *dev) addrs = dmi->dmi_addr; if ((*addrs & 0x01) == 0x01) { /* multicast address? */ #ifdef HP100_DEBUG - printk("hp100: %s: multicast = %02x:%02x:%02x:%02x:%02x:%02x, ", - dev->name, addrs[0], addrs[1], addrs[2], - addrs[3], addrs[4], addrs[5]); + printk("hp100: %s: multicast = %pM, ", + dev->name, addrs); #endif for (j = idx = 0; j < 6; j++) { idx ^= *addrs++ & 0x3f; @@ -2188,7 +2196,7 @@ static void hp100_set_multicast_list(struct net_device *dev) * hardware interrupt handling */ -static irqreturn_t hp100_interrupt(int irq, void *dev_id, struct pt_regs *regs) +static irqreturn_t hp100_interrupt(int irq, void *dev_id) { struct net_device *dev = (struct net_device *) dev_id; struct hp100_private *lp = netdev_priv(dev); @@ -2224,9 +2232,9 @@ static irqreturn_t hp100_interrupt(int irq, void *dev_id, struct pt_regs *regs) /* We're only interested in those interrupts we really enabled. */ /* val &= hp100_inw( IRQ_MASK ); */ - /* - * RX_PDL_FILL_COMPL is set whenever a RX_PDL has been executed. A RX_PDL - * is considered executed whenever the RX_PDL data structure is no longer + /* + * RX_PDL_FILL_COMPL is set whenever a RX_PDL has been executed. A RX_PDL + * is considered executed whenever the RX_PDL data structure is no longer * needed. */ if (val & HP100_RX_PDL_FILL_COMPL) { @@ -2237,7 +2245,7 @@ static irqreturn_t hp100_interrupt(int irq, void *dev_id, struct pt_regs *regs) } } - /* + /* * The RX_PACKET interrupt is set, when the receive packet counter is * non zero. We use this interrupt for receiving in slave mode. In * busmaster mode, we use it to make sure we did not miss any rx_pdl_fill @@ -2263,10 +2271,10 @@ static irqreturn_t hp100_interrupt(int irq, void *dev_id, struct pt_regs *regs) hp100_outw(val, IRQ_STATUS); /* - * RX_ERROR is set when a packet is dropped due to no memory resources on - * the card or when a RCV_ERR occurs. - * TX_ERROR is set when a TX_ABORT condition occurs in the MAC->exists - * only in the 802.3 MAC and happens when 16 collisions occur during a TX + * RX_ERROR is set when a packet is dropped due to no memory resources on + * the card or when a RCV_ERR occurs. + * TX_ERROR is set when a TX_ABORT condition occurs in the MAC->exists + * only in the 802.3 MAC and happens when 16 collisions occur during a TX */ if (val & (HP100_TX_ERROR | HP100_RX_ERROR)) { #ifdef HP100_DEBUG_IRQ @@ -2279,20 +2287,20 @@ static irqreturn_t hp100_interrupt(int irq, void *dev_id, struct pt_regs *regs) } } - /* - * RX_PDA_ZERO is set when the PDA count goes from non-zero to zero. + /* + * RX_PDA_ZERO is set when the PDA count goes from non-zero to zero. */ if ((lp->mode == 1) && (val & (HP100_RX_PDA_ZERO))) hp100_rxfill(dev); - /* - * HP100_TX_COMPLETE interrupt occurs when packet transmitted on wire - * is completed + /* + * HP100_TX_COMPLETE interrupt occurs when packet transmitted on wire + * is completed */ if ((lp->mode == 1) && (val & (HP100_TX_COMPLETE))) hp100_clean_txring(dev); - /* + /* * MISC_ERROR is set when either the LAN link goes down or a detected * bus error occurs. */ @@ -2475,12 +2483,12 @@ static int hp100_sense_lan(struct net_device *dev) /* Those cards don't have a 100 Mbit connector */ if ( !strcmp(lp->id, "HWP1920") || - (lp->pci_dev && - lp->pci_dev->vendor == PCI_VENDOR_ID && + (lp->pci_dev && + lp->pci_dev->vendor == PCI_VENDOR_ID && (lp->pci_dev->device == PCI_DEVICE_ID_HP_J2970A || lp->pci_dev->device == PCI_DEVICE_ID_HP_J2973A))) return HP100_LAN_ERR; - + if (val_VG & HP100_LINK_CABLE_ST) /* Can hear the HUBs tone. */ return HP100_LAN_100; return HP100_LAN_ERR; @@ -2826,8 +2834,8 @@ static void cleanup_dev(struct net_device *d) release_region(d->base_addr, HP100_REGION_SIZE); if (p->mode == 1) /* busmaster */ - pci_free_consistent(p->pci_dev, MAX_RINGSIZE + 0x0f, - p->page_vaddr_algn, + pci_free_consistent(p->pci_dev, MAX_RINGSIZE + 0x0f, + p->page_vaddr_algn, virt_to_whatever(d, p->page_vaddr_algn)); if (p->mem_ptr_virt) iounmap(p->mem_ptr_virt); @@ -2845,7 +2853,6 @@ static int __init hp100_eisa_probe (struct device *gendev) if (!dev) return -ENOMEM; - SET_MODULE_OWNER(dev); SET_NETDEV_DEV(dev, &edev->dev); err = hp100_probe1(dev, edev->base_addr + 0xC38, HP100_BUS_EISA, NULL); @@ -2853,10 +2860,10 @@ static int __init hp100_eisa_probe (struct device *gendev) goto out1; #ifdef HP100_DEBUG - printk("hp100: %s: EISA adapter found at 0x%x\n", dev->name, + printk("hp100: %s: EISA adapter found at 0x%x\n", dev->name, dev->base_addr); #endif - gendev->driver_data = dev; + dev_set_drvdata(gendev, dev); return 0; out1: free_netdev(dev); @@ -2865,7 +2872,7 @@ static int __init hp100_eisa_probe (struct device *gendev) static int __devexit hp100_eisa_remove (struct device *gendev) { - struct net_device *dev = gendev->driver_data; + struct net_device *dev = dev_get_drvdata(gendev); cleanup_dev(dev); return 0; } @@ -2898,7 +2905,6 @@ static int __devinit hp100_pci_probe (struct pci_dev *pdev, goto out0; } - SET_MODULE_OWNER(dev); SET_NETDEV_DEV(dev, &pdev->dev); pci_read_config_word(pdev, PCI_COMMAND, &pci_command); @@ -2917,12 +2923,12 @@ static int __devinit hp100_pci_probe (struct pci_dev *pdev, pci_command |= PCI_COMMAND_MASTER; pci_write_config_word(pdev, PCI_COMMAND, pci_command); } - + ioaddr = pci_resource_start(pdev, 0); err = hp100_probe1(dev, ioaddr, HP100_BUS_PCI, pdev); - if (err) + if (err) goto out1; - + #ifdef HP100_DEBUG printk("hp100: %s: PCI adapter found at 0x%x\n", dev->name, ioaddr); #endif @@ -2957,7 +2963,7 @@ static struct pci_driver hp100_pci_driver = { */ MODULE_LICENSE("GPL"); -MODULE_AUTHOR("Jaroslav Kysela , " +MODULE_AUTHOR("Jaroslav Kysela , " "Siegfried \"Frieder\" Loeffler (dg1sek) "); MODULE_DESCRIPTION("HP CASCADE Architecture Driver for 100VG-AnyLan Network Adapters"); @@ -2995,7 +3001,6 @@ static int __init hp100_isa_init(void) return -ENOMEM; } - SET_MODULE_OWNER(dev); err = hp100_isa_probe(dev, hp100_port[i]); if (!err) @@ -3007,7 +3012,7 @@ static int __init hp100_isa_init(void) return cards > 0 ? 0 : -ENODEV; } -static void __exit hp100_isa_cleanup(void) +static void hp100_isa_cleanup(void) { int i; @@ -3031,12 +3036,12 @@ static int __init hp100_module_init(void) goto out; #ifdef CONFIG_EISA err = eisa_driver_register(&hp100_eisa_driver); - if (err && err != -ENODEV) + if (err && err != -ENODEV) goto out2; #endif #ifdef CONFIG_PCI - err = pci_module_init(&hp100_pci_driver); - if (err && err != -ENODEV) + err = pci_register_driver(&hp100_pci_driver); + if (err && err != -ENODEV) goto out3; #endif out: @@ -3064,12 +3069,3 @@ static void __exit hp100_module_exit(void) module_init(hp100_module_init) module_exit(hp100_module_exit) - - -/* - * Local variables: - * compile-command: "gcc -D__KERNEL__ -I/usr/src/linux/net/inet -Wall -Wstrict-prototypes -O6 -m486 -c hp100.c" - * c-indent-level: 2 - * tab-width: 8 - * End: - */