dev->oss.read_count  -= bytes; dev->oss.read_offset += bytes; if (dev->oss.read_offset == dev->oss.bufsize) dev->oss.read_offset = 0; 
dev->dmasound.read_count  -= bytes; dev->dmasound.read_offset += bytes; if (dev->dmasound.read_offset == dev->dmasound.bufsize) dev->dmasound.read_offset = 0; 
static ssize_t dsp_read(struct file *file, char __user *buffer,			size_t count, loff_t *ppos){	struct saa7134_dev *dev = file->private_data;	DECLARE_WAITQUEUE(wait, current);	unsigned int bytes;	unsigned long flags;	int err,ret = 0;	add_wait_queue(&dev->oss.wq, &wait);	down(&dev->oss.lock);	while (count > 0) {		/* wait for data if needed */		if (0 == dev->oss.read_count) {			if (!dev->oss.recording_on) {				err = dsp_rec_start(dev);				if (err < 0) {					if (0 == ret)						ret = err;					break;				}			}			if (dev->oss.recording_on &&			    !dev->oss.dma_running) {				/* recover from overruns */				spin_lock_irqsave(&dev->slock,flags);				dsp_dma_start(dev);				spin_unlock_irqrestore(&dev->slock,flags);			}			if (file->f_flags & O_NONBLOCK) {				if (0 == ret)					ret = -EAGAIN;				break;			}			up(&dev->oss.lock);			set_current_state(TASK_INTERRUPTIBLE);			if (0 == dev->oss.read_count)				schedule();			set_current_state(TASK_RUNNING);			down(&dev->oss.lock);			if (signal_pending(current)) {				if (0 == ret)					ret = -EINTR;				break;			}		}		/* copy data to userspace */		bytes = count;		if (bytes > dev->oss.read_count)			bytes = dev->oss.read_count;		if (bytes > dev->oss.bufsize - dev->oss.read_offset)			bytes = dev->oss.bufsize - dev->oss.read_offset;		if (copy_to_user(buffer + ret,				 dev->oss.dma.vmalloc + dev->oss.read_offset,				 bytes)) {			if (0 == ret)				ret = -EFAULT;			break;		}		ret   += bytes;		count -= bytes;		dev->oss.read_count  -= bytes;		dev->oss.read_offset += bytes;		if (dev->oss.read_offset == dev->oss.bufsize)			dev->oss.read_offset = 0;	}	up(&dev->oss.lock);	remove_wait_queue(&dev->oss.wq, &wait);	return ret;}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/b54134be53be720da423692665ec215eb14a678b/saa7134-oss.c/buggy/drivers/media/video/saa7134/saa7134-oss.c