out1: mca_set_adapter_procfn( ei_status.priv, NULL, NULL); free_irq(dev->irq, dev); 
static int __init ne2_probe1(struct net_device *dev, int slot){	int i, base_addr, irq, retval;	unsigned char POS;	unsigned char SA_prom[32];	const char *name = "NE/2";	int start_page, stop_page;	static unsigned version_printed;	if (ei_debug && version_printed++ == 0)		printk(version);	printk("NE/2 ethercard found in slot %d:", slot);	/* Read base IO and IRQ from the POS-registers */	POS = mca_read_stored_pos(slot, 2);	if(!(POS % 2)) {		printk(" disabled.\n");		return -ENODEV;	}	/* handle different POS register structure for D-Link card */	if (mca_read_stored_pos(slot, 0) == 0xea) {		base_addr = dlink_addresses[(POS >> 5) & 0x03];		irq = dlink_irqs[(POS >> 2) & 0x07];	}        else {		i = (POS & 0xE)>>1;		/* printk("Halleluja sdog, als er na de pijl een 1 staat is 1 - 1 == 0"	   	" en zou het moeten werken -> %d\n", i);	   	The above line was for remote testing, thanx to sdog ... */		base_addr = addresses[i - 1];		irq = irqs[(POS & 0x60)>>5];	}	if (!request_region(base_addr, NE_IO_EXTENT, DRV_NAME))		return -EBUSY;#ifdef DEBUG	printk("POS info : pos 2 = %#x ; base = %#x ; irq = %ld\n", POS,			base_addr, irq);#endif#ifndef CRYNWR_WAY	/* Reset the card the way they do it in the Crynwr packet driver */	for (i=0; i<8; i++) 		outb(0x0, base_addr + NE_RESET);	inb(base_addr + NE_RESET);	outb(0x21, base_addr + NE_CMD);	if (inb(base_addr + NE_CMD) != 0x21) {		printk("NE/2 adapter not responding\n");		retval = -ENODEV;		goto out;	}	/* In the crynwr sources they do a RAM-test here. I skip it. I suppose	   my RAM is okay.  Suppose your memory is broken.  Then this test	   should fail and you won't be able to use your card.  But if I do not	   test, you won't be able to use your card, neither.  So this test	   won't help you. */#else  /* _I_ never tested it this way .. Go ahead and try ...*/	/* Reset card. Who knows what dain-bramaged state it was left in. */	{ 		unsigned long reset_start_time = jiffies;		/* DON'T change these to inb_p/outb_p or reset will fail on 		   clones.. */		outb(inb(base_addr + NE_RESET), base_addr + NE_RESET);		while ((inb_p(base_addr + EN0_ISR) & ENISR_RESET) == 0)			if (jiffies - reset_start_time > 2*HZ/100) {				printk(" not found (no reset ack).\n");				retval = -ENODEV;				goto out;			}		outb_p(0xff, base_addr + EN0_ISR);         /* Ack all intr. */	}#endif	/* Read the 16 bytes of station address PROM.	   We must first initialize registers, similar to 	   NS8390_init(eifdev, 0).	   We can't reliably read the SAPROM address without this.	   (I learned the hard way!). */	{		struct { 			unsigned char value, offset; 		} program_seq[] = {						/* Select page 0 */			{E8390_NODMA+E8390_PAGE0+E8390_STOP, E8390_CMD}, 			{0x49,	EN0_DCFG},  /* Set WORD-wide (0x49) access. */			{0x00,	EN0_RCNTLO},  /* Clear the count regs. */			{0x00,	EN0_RCNTHI},			{0x00,	EN0_IMR},  /* Mask completion irq. */			{0xFF,	EN0_ISR},			{E8390_RXOFF, EN0_RXCR},  /* 0x20  Set to monitor */			{E8390_TXOFF, EN0_TXCR},  /* 0x02  and loopback mode. */			{32,	EN0_RCNTLO},			{0x00,	EN0_RCNTHI},			{0x00,	EN0_RSARLO},  /* DMA starting at 0x0000. */			{0x00,	EN0_RSARHI},			{E8390_RREAD+E8390_START, E8390_CMD},		};		for (i = 0; i < sizeof(program_seq)/sizeof(program_seq[0]); i++)			outb_p(program_seq[i].value, base_addr + 				program_seq[i].offset);	}	for(i = 0; i < 6 /*sizeof(SA_prom)*/; i+=1) {		SA_prom[i] = inb(base_addr + NE_DATAPORT);	}	/* I don't know whether the previous sequence includes the general           board reset procedure, so better don't omit it and just overwrite           the garbage read from a DE-320 with correct stuff. */	if (mca_read_stored_pos(slot, 0) == 0xea) {		unsigned int v;		for (i = 0; i < 3; i++) { 			v = dlink_get_eeprom(i, base_addr);			SA_prom[(i << 1)    ] = v & 0xff;			SA_prom[(i << 1) + 1] = (v >> 8) & 0xff;		}	}	start_page = NESM_START_PG;	stop_page = NESM_STOP_PG;	dev->irq=irq;	/* Snarf the interrupt now.  There's no point in waiting since we cannot	   share and the board will usually be enabled. */	retval = request_irq(dev->irq, ei_interrupt, 0, DRV_NAME, dev);	if (retval) {		printk (" unable to get IRQ %d (irqval=%d).\n", 				dev->irq, retval);		goto out;	}	dev->base_addr = base_addr;	for(i = 0; i < ETHER_ADDR_LEN; i++) {		printk(" %2.2x", SA_prom[i]);		dev->dev_addr[i] = SA_prom[i];	}	printk("\n%s: %s found at %#x, using IRQ %d.\n",			dev->name, name, base_addr, dev->irq);	mca_set_adapter_procfn(slot, (MCA_ProcFn) ne2_procinfo, dev);	ei_status.name = name;	ei_status.tx_start_page = start_page;	ei_status.stop_page = stop_page;	ei_status.word16 = (2 == 2);	ei_status.rx_start_page = start_page + TX_PAGES;#ifdef PACKETBUF_MEMSIZE	/* Allow the packet buffer size to be overridden by know-it-alls. */	ei_status.stop_page = ei_status.tx_start_page + PACKETBUF_MEMSIZE;#endif	ei_status.reset_8390 = &ne_reset_8390;	ei_status.block_input = &ne_block_input;	ei_status.block_output = &ne_block_output;	ei_status.get_8390_hdr = &ne_get_8390_hdr;		ei_status.priv = slot;		dev->open = &ne_open;	dev->stop = &ne_close;#ifdef CONFIG_NET_POLL_CONTROLLER	dev->poll_controller = ei_poll;#endif	NS8390_init(dev, 0);	return 0;out:	release_region(base_addr, NE_IO_EXTENT);	return retval;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/b1fc5505e0dbcc3fd7c75bfe6bee39ec50080963/ne2.c/clean/drivers/net/ne2.c