static ssize_t hiddev_read(struct file * file, char __user * buffer, size_t count, loff_t *ppos){	DECLARE_WAITQUEUE(wait, current);	struct hiddev_list *list = file->private_data;	int event_size;	int retval = 0;	event_size = ((list->flags & HIDDEV_FLAG_UREF) != 0) ?		sizeof(struct hiddev_usage_ref) : sizeof(struct hiddev_event);	if (count < event_size)		return 0;	while (retval == 0) {		if (list->head == list->tail) {			add_wait_queue(&list->hiddev->wait, &wait);			set_current_state(TASK_INTERRUPTIBLE);						while (list->head == list->tail) {				if (file->f_flags & O_NONBLOCK) {					retval = -EAGAIN;					break;				}				if (signal_pending(current)) {					retval = -ERESTARTSYS;					break;				}				if (!list->hiddev->exist) {					retval = -EIO;					break;				}								schedule();			}			set_current_state(TASK_RUNNING);			remove_wait_queue(&list->hiddev->wait, &wait);		}		if (retval)			return retval;		while (list->head != list->tail && 		       retval + event_size <= count) {			if ((list->flags & HIDDEV_FLAG_UREF) == 0) {				if (list->buffer[list->tail].field_index !=				    HID_FIELD_INDEX_NONE) {					struct hiddev_event event;					event.hid = list->buffer[list->tail].usage_code;					event.value = list->buffer[list->tail].value;					if (copy_to_user(buffer + retval, &event, sizeof(struct hiddev_event)))						return -EFAULT;					retval += sizeof(struct hiddev_event);				}			} else {				if (list->buffer[list->tail].field_index != HID_FIELD_INDEX_NONE ||				    (list->flags & HIDDEV_FLAG_REPORT) != 0) {					if (copy_to_user(buffer + retval, list->buffer + list->tail, sizeof(struct hiddev_usage_ref)))						return -EFAULT;					retval += sizeof(struct hiddev_usage_ref);				}			}			list->tail = (list->tail + 1) & (HIDDEV_BUFFER_SIZE - 1);		}	}	return retval;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/05f091ab4c8c1f12f8dd38ee789489904fea327d/hiddev.c/clean/drivers/usb/input/hiddev.c