dbg(KERN_DEBUG "read stats: result:%d this_read:%u partial:%u", 
dbg("read stats: result:%d this_read:%u partial:%u", 
read_rio(struct file *file, char __user *buffer, size_t count, loff_t * ppos){	DEFINE_WAIT(wait);	struct rio_usb_data *rio = &rio_instance;	ssize_t read_count;	unsigned int partial;	int this_read;	int result;	int maxretry = 10;	char *ibuf;	down(&(rio->lock));	/* Sanity check to make sure rio is connected, powered, etc */        if ( rio == NULL ||             rio->present == 0 ||             rio->rio_dev == NULL )	{		up(&(rio->lock));		return -ENODEV;	}	ibuf = rio->ibuf;	read_count = 0;	while (count > 0) {		if (signal_pending(current)) {			up(&(rio->lock));			return read_count ? read_count : -EINTR;		}		if (!rio->rio_dev) {			up(&(rio->lock));			return -ENODEV;		}		this_read = (count >= IBUF_SIZE) ? IBUF_SIZE : count;		result = usb_bulk_msg(rio->rio_dev,				      usb_rcvbulkpipe(rio->rio_dev, 1),				      ibuf, this_read, &partial,				      8000);		dbg(KERN_DEBUG "read stats: result:%d this_read:%u partial:%u",		       result, this_read, partial);		if (partial) {			count = this_read = partial;		} else if (result == -ETIMEDOUT || result == 15) {	/* FIXME: 15 ??? */			if (!maxretry--) {				up(&(rio->lock));				err("read_rio: maxretry timeout");				return -ETIME;			}			prepare_to_wait(&rio->wait_q, &wait, TASK_INTERRUPTIBLE);			schedule_timeout(NAK_TIMEOUT);			finish_wait(&rio->wait_q, &wait);			continue;		} else if (result != -EREMOTEIO) {			up(&(rio->lock));			err("Read Whoops - result:%u partial:%u this_read:%u",			     result, partial, this_read);			return -EIO;		} else {			up(&(rio->lock));			return (0);		}		if (this_read) {			if (copy_to_user(buffer, ibuf, this_read)) {				up(&(rio->lock));				return -EFAULT;			}			count -= this_read;			read_count += this_read;			buffer += this_read;		}	}	up(&(rio->lock));	return read_count;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/654f31189e550cd5924b786487a5d93d9feaada9/rio500.c/buggy/drivers/usb/misc/rio500.c