Re: [PATCH v2 2/3] usb: gadget: f_fs: add poll for endpoint 0

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Jan 17 2014, Robert Baldyga wrote:
> @@ -558,6 +560,45 @@ static long ffs_ep0_ioctl(struct file *file, unsigned code, unsigned long value)
>  	return ret;
>  }
>  
> +static unsigned int ffs_ep0_poll(struct file *file, poll_table *wait)
> +{
> +	struct ffs_data *ffs = file->private_data;
> +	unsigned int mask = POLLWRNORM;
> +	int ret;
> +
> +	ret = ffs_mutex_lock(&ffs->mutex, file->f_flags & O_NONBLOCK);
> +	if (unlikely(ret < 0))
> +		return mask;
> +
> +	switch (ffs->state) {
> +	case FFS_READ_DESCRIPTORS:
> +	case FFS_READ_STRINGS:
> +		mask |= POLLOUT;
> +		break;
> +
> +	case FFS_ACTIVE:
> +		switch (FFS_SETUP_STATE(ffs)) {

One more thing, this should not be FFS_SETUP_STATE but simply
ffs->setup_state.  This is because FFS_SETUP_STATE changes value of
ffs->setup_state and we don't want that to happen here.

> +		case FFS_NO_SETUP:
> +			if (ffs->ev.count)
> +				mask |= POLLIN;
> +			break;
> +
> +		case FFS_SETUP_PENDING:
> +			mask |= (POLLIN | POLLOUT);
> +			break;
> +
> +		case FFS_SETUP_CANCELED:
> +			break;
> +		}
> +	case FFS_CLOSING:
> +		break;
> +	}
> +
> +	mutex_unlock(&ffs->mutex);
> +
> +	return mask;
> +}
> +
>  static const struct file_operations ffs_ep0_operations = {
>  	.llseek =	no_llseek,
>  

-- 
Best regards,                                         _     _
.o. | Liege of Serenely Enlightened Majesty of      o' \,=./ `o
..o | Computer Science,  Michał “mina86” Nazarewicz    (o o)
ooo +--<mpn@xxxxxxxxxx>--<xmpp:mina86@xxxxxxxxxx>--ooO--(_)--Ooo--

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux