viadev->lastpos = res; /* remember the last position */ if (res >= viadev->bufsize) res -= viadev->bufsize; 
static inline unsigned int calc_linear_pos(viadev_t *viadev, unsigned int idx, unsigned int count){	unsigned int size, base, res;	size = viadev->idx_table[idx].size;	base = viadev->idx_table[idx].offset;	res = base + size - count;	/* check the validity of the calculated position */	if (size < count) {		snd_printd(KERN_ERR "invalid via82xx_cur_ptr (size = %d, count = %d)\n", (int)size, (int)count);		res = viadev->lastpos;	} else {		if (! count) {			/* Some mobos report count = 0 on the DMA boundary,			 * i.e. count = size indeed.			 * Let's check whether this step is above the expected size.			 */			int delta = res - viadev->lastpos;			if (delta < 0)				delta += viadev->bufsize;			if ((unsigned int)delta > viadev->fragsize)				res = base;		}		if (check_invalid_pos(viadev, res)) {#ifdef POINTER_DEBUG			printk(KERN_DEBUG "fail: idx = %i/%i, lastpos = 0x%x, bufsize2 = 0x%x, offsize = 0x%x, size = 0x%x, count = 0x%x\n", idx, viadev->tbl_entries, viadev->lastpos, viadev->bufsize2, viadev->idx_table[idx].offset, viadev->idx_table[idx].size, count);#endif			/* count register returns full size when end of buffer is reached */			res = base + size;			if (check_invalid_pos(viadev, res)) {				snd_printd(KERN_ERR "invalid via82xx_cur_ptr (2), using last valid pointer\n");				res = viadev->lastpos;			}		}	}	viadev->lastpos = res; /* remember the last position */	if (res >= viadev->bufsize)		res -= viadev->bufsize;	return res;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/4f550df58f4758ea023704b409830ad9c3b47771/via82xx.c/clean/sound/pci/via82xx.c