if (check_region(0x388, 4))	/* Not free */ 
if (!request_region(0x388, 4, "FM"))	/* Not free */ 
static int __init probe_cs4232(struct address_info *hw_config, int isapnp_configured){	int i, n;	int base = hw_config->io_base, irq = hw_config->irq;	int dma1 = hw_config->dma, dma2 = hw_config->dma2;	struct resource *ports;	if (base == -1 || irq == -1 || dma1 == -1) {		printk(KERN_ERR "cs4232: dma, irq and io must be set.\n");		return 0;	}	/*	 * Verify that the I/O port range is free.	 */	ports = request_region(base, 4, "ad1848");	if (!ports) {		printk(KERN_ERR "cs4232.c: I/O port 0x%03x not free\n", base);		return 0;	}	if (ad1848_detect(ports, NULL, hw_config->osp)) {		goto got_it;	/* The card is already active */	}	if (isapnp_configured) {		printk(KERN_ERR "cs4232.c: ISA PnP configured, but not detected?\n");		goto fail;	}	/*	 * This version of the driver doesn't use the PnP method when configuring	 * the card but a simplified method defined by Crystal. This means that	 * just one CS4232 compatible device can exist on the system. Also this	 * method conflicts with possible PnP support in the OS. For this reason 	 * driver is just a temporary kludge.	 *	 * Also the Cirrus/Crystal method doesn't always work. Try ISA PnP first ;)	 */	/*	 * Repeat initialization few times since it doesn't always succeed in	 * first time.	 */	for (n = 0; n < 4; n++)	{			/*		 *	Wake up the card by sending a 32 byte Crystal key to the key port.		 */				for (i = 0; i < 32; i++)			CS_OUT(crystal_key[i]);		sleep(HZ / 10);		/*		 *	Now set the CSN (Card Select Number).		 */		CS_OUT2(0x06, CSN_NUM);		/*		 *	Then set some config bytes. First logical device 0 		 */		CS_OUT2(0x15, 0x00);	/* Select logical device 0 (WSS/SB/FM) */		CS_OUT3(0x47, (base >> 8) & 0xff, base & 0xff);	/* WSS base */		if (check_region(0x388, 4))	/* Not free */			CS_OUT3(0x48, 0x00, 0x00)	/* FM base off */		else			CS_OUT3(0x48, 0x03, 0x88);	/* FM base 0x388 */		CS_OUT3(0x42, 0x00, 0x00);	/* SB base off */		CS_OUT2(0x22, irq);		/* SB+WSS IRQ */		CS_OUT2(0x2a, dma1);		/* SB+WSS DMA */		if (dma2 != -1)			CS_OUT2(0x25, dma2)	/* WSS DMA2 */		else			CS_OUT2(0x25, 4);	/* No WSS DMA2 */		CS_OUT2(0x33, 0x01);	/* Activate logical dev 0 */		sleep(HZ / 10);		/*		 * Initialize logical device 3 (MPU)		 */		if (mpu_base != 0 && mpu_irq != 0)		{			CS_OUT2(0x15, 0x03);	/* Select logical device 3 (MPU) */			CS_OUT3(0x47, (mpu_base >> 8) & 0xff, mpu_base & 0xff);	/* MPU base */			CS_OUT2(0x22, mpu_irq);	/* MPU IRQ */			CS_OUT2(0x33, 0x01);	/* Activate logical dev 3 */		}		if(synth_base != 0)		{		    CS_OUT2 (0x15, 0x04);	        /* logical device 4 (WaveFront) */		    CS_OUT3 (0x47, (synth_base >> 8) & 0xff,			     synth_base & 0xff);	/* base */		    CS_OUT2 (0x22, synth_irq);     	/* IRQ */		    CS_OUT2 (0x33, 0x01);	        /* Activate logical dev 4 */		}		/*		 * Finally activate the chip		 */				CS_OUT(0x79);		sleep(HZ / 5);		/*		 * Then try to detect the codec part of the chip		 */		if (ad1848_detect(ports, NULL, hw_config->osp))			goto got_it;				sleep(HZ);	}fail:	release_region(base, 4);	return 0;got_it:	if (dma2 == -1)		dma2 = dma1;	hw_config->slots[0] = ad1848_init("Crystal audio controller", ports,					  irq,					  dma1,		/* Playback DMA */					  dma2,		/* Capture DMA */					  0,					  hw_config->osp,					  THIS_MODULE);	if (hw_config->slots[0] != -1 &&		audio_devs[hw_config->slots[0]]->mixer_dev!=-1)	{			/* Assume the mixer map is as suggested in the CS4232 databook */		AD1848_REROUTE(SOUND_MIXER_LINE1, SOUND_MIXER_LINE);		AD1848_REROUTE(SOUND_MIXER_LINE2, SOUND_MIXER_CD);		AD1848_REROUTE(SOUND_MIXER_LINE3, SOUND_MIXER_SYNTH);		/* FM synth */	}	if (mpu_base != 0 && mpu_irq != 0)	{		static struct address_info hw_config2 = {			0		};		/* Ensure it's initialized */		hw_config2.io_base = mpu_base;		hw_config2.irq = mpu_irq;		hw_config2.dma = -1;		hw_config2.dma2 = -1;		hw_config2.always_detect = 0;		hw_config2.name = NULL;		hw_config2.driver_use_1 = 0;		hw_config2.driver_use_2 = 0;		hw_config2.card_subtype = 0;		if (probe_uart401(&hw_config2, THIS_MODULE))		{			mpu_detected = 1;		}		else		{			mpu_base = mpu_irq = 0;		}		hw_config->slots[1] = hw_config2.slots[1];	}		if (bss)        	enable_xctrl(base);	return 1;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/d61780c0d384939ef31c46b47442854d5def4623/cs4232.c/buggy/sound/oss/cs4232.c