snd_printk("no playback buffer allocated - aborting measure ac97 clock\n"); 
snd_printk(KERN_WARNING "no playback buffer allocated - aborting measure ac97 clock\n"); 
static void __devinit intel8x0_measure_ac97_clock(intel8x0_t *chip){	snd_pcm_substream_t *subs;	ichdev_t *ichdev;	unsigned long port;	unsigned long pos, t;	struct timeval start_time, stop_time;	if (chip->ac97_bus->clock != 48000)		return; /* specified in module option */	subs = chip->pcm[0]->streams[0].substream;	if (! subs || subs->dma_buffer.bytes < INTEL8X0_TESTBUF_SIZE) {		snd_printk("no playback buffer allocated - aborting measure ac97 clock\n");		return;	}	ichdev = &chip->ichd[ICHD_PCMOUT];	ichdev->physbuf = subs->dma_buffer.addr;	ichdev->size = chip->ichd[ICHD_PCMOUT].fragsize = INTEL8X0_TESTBUF_SIZE;	ichdev->substream = NULL; /* don't process interrupts */	/* set rate */	if (snd_ac97_set_rate(chip->ac97[0], AC97_PCM_FRONT_DAC_RATE, 48000) < 0) {		snd_printk(KERN_ERR "cannot set ac97 rate: clock = %d\n", chip->ac97_bus->clock);		return;	}	snd_intel8x0_setup_periods(chip, ichdev);	port = ichdev->reg_offset;	spin_lock_irq(&chip->reg_lock);	chip->in_measurement = 1;	/* trigger */	if (chip->device_type != DEVICE_ALI)		iputbyte(chip, port + ICH_REG_OFF_CR, ICH_IOCE | ICH_STARTBM);	else {		iputbyte(chip, port + ICH_REG_OFF_CR, ICH_IOCE);		iputdword(chip, ICHREG(ALI_DMACR), 1 << ichdev->ali_slot);	}	do_gettimeofday(&start_time);	spin_unlock_irq(&chip->reg_lock);	msleep(50);	spin_lock_irq(&chip->reg_lock);	/* check the position */	pos = ichdev->fragsize1;	pos -= igetword(chip, ichdev->reg_offset + ichdev->roff_picb) << ichdev->pos_shift;	pos += ichdev->position;	chip->in_measurement = 0;	do_gettimeofday(&stop_time);	/* stop */	if (chip->device_type == DEVICE_ALI) {		iputdword(chip, ICHREG(ALI_DMACR), 1 << (ichdev->ali_slot + 8));		iputbyte(chip, port + ICH_REG_OFF_CR, 0);		while (igetbyte(chip, port + ICH_REG_OFF_CR))			;	} else {		iputbyte(chip, port + ICH_REG_OFF_CR, 0);		while (!(igetbyte(chip, port + ichdev->roff_sr) & ICH_DCH))			;	}	iputbyte(chip, port + ICH_REG_OFF_CR, ICH_RESETREGS);	spin_unlock_irq(&chip->reg_lock);	t = stop_time.tv_sec - start_time.tv_sec;	t *= 1000000;	t += stop_time.tv_usec - start_time.tv_usec;	printk(KERN_INFO "%s: measured %lu usecs\n", __FUNCTION__, t);	if (t == 0) {		snd_printk(KERN_ERR "?? calculation error..\n");		return;	}	pos = (pos / 4) * 1000;	pos = (pos / t) * 1000 + ((pos % t) * 1000) / t;	if (pos < 40000 || pos >= 60000) 		/* abnormal value. hw problem? */		printk(KERN_INFO "intel8x0: measured clock %ld rejected\n", pos);	else if (pos < 47500 || pos > 48500)		/* not 48000Hz, tuning the clock.. */		chip->ac97_bus->clock = (chip->ac97_bus->clock * 48000) / pos;	printk(KERN_INFO "intel8x0: clocking to %d\n", chip->ac97_bus->clock);}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/99b359ba10a582148c6725f428a33ba5356dd993/intel8x0.c/buggy/sound/pci/intel8x0.c