retval = register_netdev(dev); if (retval) goto err_out;  
static int __init do_elmc_probe(struct net_device *dev){	static int slot;	int base_addr = dev->base_addr;	int irq = dev->irq;	u_char status = 0;	u_char revision = 0;	int i = 0;	unsigned int size = 0;	int retval;	struct priv *pr = dev->priv;	SET_MODULE_OWNER(dev);	if (MCA_bus == 0) {		return -ENODEV;	}	/* search through the slots for the 3c523. */	slot = mca_find_adapter(ELMC_MCA_ID, 0);	while (slot != -1) {		status = mca_read_stored_pos(slot, 2);		dev->irq=irq_table[(status & ELMC_STATUS_IRQ_SELECT) >> 6];		dev->base_addr=csr_table[(status & ELMC_STATUS_CSR_SELECT) >> 1];				/*		   If we're trying to match a specified irq or IO address,		   we'll reject a match unless it's what we're looking for.		   Also reject it if the card is already in use.		 */		if ((irq && irq != dev->irq) || 		    (base_addr && base_addr != dev->base_addr)) {			slot = mca_find_adapter(ELMC_MCA_ID, slot + 1);			continue;		}		if (!request_region(dev->base_addr, ELMC_IO_EXTENT, DRV_NAME)) {			slot = mca_find_adapter(ELMC_MCA_ID, slot + 1);			continue;		}		/* found what we're looking for... */		break;	}	/* we didn't find any 3c523 in the slots we checked for */	if (slot == MCA_NOTFOUND)		return ((base_addr || irq) ? -ENXIO : -ENODEV);	mca_set_adapter_name(slot, "3Com 3c523 Etherlink/MC");	mca_set_adapter_procfn(slot, (MCA_ProcFn) elmc_getinfo, dev);	/* if we get this far, adapter has been found - carry on */	printk(KERN_INFO "%s: 3c523 adapter found in slot %d\n", dev->name, slot + 1);	/* Now we extract configuration info from the card.	   The 3c523 provides information in two of the POS registers, but	   the second one is only needed if we want to tell the card what IRQ	   to use.  I suspect that whoever sets the thing up initially would	   prefer we don't screw with those things.	   Note that we read the status info when we found the card...	   See 3c523.h for more details.	 */	/* revision is stored in the first 4 bits of the revision register */	revision = inb(dev->base_addr + ELMC_REVISION) & 0xf;	/* according to docs, we read the interrupt and write it back to	   the IRQ select register, since the POST might not configure the IRQ	   properly. */	switch (dev->irq) {	case 3:		mca_write_pos(slot, 3, 0x04);		break;	case 7:		mca_write_pos(slot, 3, 0x02);		break;	case 9:		mca_write_pos(slot, 3, 0x08);		break;	case 12:		mca_write_pos(slot, 3, 0x01);		break;	}	memset(pr, 0, sizeof(struct priv));	pr->slot = slot;	printk(KERN_INFO "%s: 3Com 3c523 Rev 0x%x at %#lx\n", dev->name, (int) revision,	       dev->base_addr);	/* Determine if we're using the on-board transceiver (i.e. coax) or	   an external one.  The information is pretty much useless, but I	   guess it's worth brownie points. */	dev->if_port = (status & ELMC_STATUS_DISABLE_THIN);	/* The 3c523 has a 24K chunk of memory.  The first 16K is the	   shared memory, while the last 8K is for the EtherStart BIOS ROM.	   Which we don't care much about here.  We'll just tell Linux that	   we're using 16K.  MCA won't permit address space conflicts caused	   by not mapping the other 8K. */	dev->mem_start = shm_table[(status & ELMC_STATUS_MEMORY_SELECT) >> 3];	/* We're using MCA, so it's a given that the information about memory	   size is correct.  The Crynwr drivers do something like this. */	elmc_id_reset586();	/* seems like a good idea before checking it... */	size = 0x4000;		/* check for 16K mem */	if (!check586(dev, dev->mem_start, size)) {		printk(KERN_ERR "%s: memprobe, Can't find memory at 0x%lx!\n", dev->name,		       dev->mem_start);		retval = -ENODEV;		goto err_out;	}	dev->mem_end = dev->mem_start + size;	/* set mem_end showed by 'ifconfig' */	pr->memtop = isa_bus_to_virt(dev->mem_start) + size;	pr->base = (unsigned long) isa_bus_to_virt(dev->mem_start) + size - 0x01000000;	alloc586(dev);	elmc_id_reset586();	/* make sure it doesn't generate spurious ints */	/* set number of receive-buffs according to memsize */	pr->num_recv_buffs = NUM_RECV_BUFFS_16;	/* dump all the assorted information */	printk(KERN_INFO "%s: IRQ %d, %sternal xcvr, memory %#lx-%#lx.\n", dev->name,	       dev->irq, dev->if_port ? "ex" : "in", 	       dev->mem_start, dev->mem_end - 1);	/* The hardware address for the 3c523 is stored in the first six	   bytes of the IO address. */	printk(KERN_INFO "%s: hardware address ", dev->name);	for (i = 0; i < 6; i++) {		dev->dev_addr[i] = inb(dev->base_addr + i);		printk(" %02x", dev->dev_addr[i]);	}	printk("\n");	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->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.	   That gets done in elmc_open().  I'm not sure that's such a good idea,	   but it works, so I'll go with it. */#ifndef ELMC_MULTICAST        dev->flags&=~IFF_MULTICAST;     /* Multicast doesn't work */#endif	return 0;err_out:	mca_set_adapter_procfn(slot, NULL, NULL);	release_region(dev->base_addr, ELMC_IO_EXTENT);	return retval;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/b1fc5505e0dbcc3fd7c75bfe6bee39ec50080963/3c523.c/clean/drivers/net/3c523.c