Lines Matching refs:epfile

855 static void __ffs_epfile_read_buffer_free(struct ffs_epfile *epfile)  in __ffs_epfile_read_buffer_free()  argument
861 struct ffs_buffer *buf = xchg(&epfile->read_buffer, READ_BUFFER_DROP); in __ffs_epfile_read_buffer_free()
867 static ssize_t __ffs_epfile_read_buffered(struct ffs_epfile *epfile, in __ffs_epfile_read_buffered() argument
875 struct ffs_buffer *buf = xchg(&epfile->read_buffer, NULL); in __ffs_epfile_read_buffered()
893 if (cmpxchg(&epfile->read_buffer, NULL, buf)) in __ffs_epfile_read_buffered()
900 static ssize_t __ffs_epfile_read_data(struct ffs_epfile *epfile, in __ffs_epfile_read_data() argument
931 if (cmpxchg(&epfile->read_buffer, NULL, buf)) in __ffs_epfile_read_data()
939 struct ffs_epfile *epfile = file->private_data; in ffs_epfile_io() local
947 if (WARN_ON(epfile->ffs->state != FFS_ACTIVE)) in ffs_epfile_io()
951 ep = epfile->ep; in ffs_epfile_io()
957 epfile->ffs->wait, (ep = epfile->ep)); in ffs_epfile_io()
963 halt = (!io_data->read == !epfile->in); in ffs_epfile_io()
964 if (halt && epfile->isoc) in ffs_epfile_io()
968 ret = ffs_mutex_lock(&epfile->mutex, file->f_flags & O_NONBLOCK); in ffs_epfile_io()
984 ret = __ffs_epfile_read_buffered(epfile, &io_data->data); in ffs_epfile_io()
994 gadget = epfile->ffs->gadget; in ffs_epfile_io()
996 spin_lock_irq(&epfile->ffs->eps_lock); in ffs_epfile_io()
998 if (epfile->ep != ep) { in ffs_epfile_io()
1011 spin_unlock_irq(&epfile->ffs->eps_lock); in ffs_epfile_io()
1025 spin_lock_irq(&epfile->ffs->eps_lock); in ffs_epfile_io()
1027 if (epfile->ep != ep) { in ffs_epfile_io()
1072 spin_unlock_irq(&epfile->ffs->eps_lock); in ffs_epfile_io()
1075 spin_lock_irq(&epfile->ffs->eps_lock); in ffs_epfile_io()
1076 if (epfile->ep != ep) { in ffs_epfile_io()
1087 spin_unlock_irq(&epfile->ffs->eps_lock); in ffs_epfile_io()
1095 ret = __ffs_epfile_read_data(epfile, data, io_data->status, in ffs_epfile_io()
1116 io_data->ffs = epfile->ffs; in ffs_epfile_io()
1137 spin_unlock_irq(&epfile->ffs->eps_lock); in ffs_epfile_io()
1139 mutex_unlock(&epfile->mutex); in ffs_epfile_io()
1149 struct ffs_epfile *epfile = inode->i_private; in ffs_epfile_open() local
1151 if (WARN_ON(epfile->ffs->state != FFS_ACTIVE)) in ffs_epfile_open()
1154 file->private_data = epfile; in ffs_epfile_open()
1155 ffs_data_opened(epfile->ffs); in ffs_epfile_open()
1163 struct ffs_epfile *epfile = kiocb->ki_filp->private_data; in ffs_aio_cancel() local
1167 spin_lock_irqsave(&epfile->ffs->eps_lock, flags); in ffs_aio_cancel()
1174 spin_unlock_irqrestore(&epfile->ffs->eps_lock, flags); in ffs_aio_cancel()
1264 struct ffs_epfile *epfile = inode->i_private; in ffs_epfile_release() local
1266 __ffs_epfile_read_buffer_free(epfile); in ffs_epfile_release()
1267 ffs_data_closed(epfile->ffs); in ffs_epfile_release()
1275 struct ffs_epfile *epfile = file->private_data; in ffs_epfile_ioctl() local
1279 if (WARN_ON(epfile->ffs->state != FFS_ACTIVE)) in ffs_epfile_ioctl()
1283 ep = epfile->ep; in ffs_epfile_ioctl()
1289 epfile->ffs->wait, (ep = epfile->ep)); in ffs_epfile_ioctl()
1294 spin_lock_irq(&epfile->ffs->eps_lock); in ffs_epfile_ioctl()
1297 if (epfile->ep != ep) { in ffs_epfile_ioctl()
1298 spin_unlock_irq(&epfile->ffs->eps_lock); in ffs_epfile_ioctl()
1304 ret = usb_ep_fifo_status(epfile->ep->ep); in ffs_epfile_ioctl()
1307 usb_ep_fifo_flush(epfile->ep->ep); in ffs_epfile_ioctl()
1311 ret = usb_ep_clear_halt(epfile->ep->ep); in ffs_epfile_ioctl()
1314 ret = epfile->ep->num; in ffs_epfile_ioctl()
1321 switch (epfile->ffs->gadget->speed) { in ffs_epfile_ioctl()
1333 desc = epfile->ep->descs[desc_idx]; in ffs_epfile_ioctl()
1336 spin_unlock_irq(&epfile->ffs->eps_lock); in ffs_epfile_ioctl()
1345 spin_unlock_irq(&epfile->ffs->eps_lock); in ffs_epfile_ioctl()
1854 struct ffs_epfile *epfile, *epfiles; in ffs_epfiles_create() local
1862 epfile = epfiles; in ffs_epfiles_create()
1863 for (i = 1; i <= count; ++i, ++epfile) { in ffs_epfiles_create()
1864 epfile->ffs = ffs; in ffs_epfiles_create()
1865 mutex_init(&epfile->mutex); in ffs_epfiles_create()
1867 sprintf(epfile->name, "ep%02x", ffs->eps_addrmap[i]); in ffs_epfiles_create()
1869 sprintf(epfile->name, "ep%u", i); in ffs_epfiles_create()
1870 epfile->dentry = ffs_sb_create_file(ffs->sb, epfile->name, in ffs_epfiles_create()
1871 epfile, in ffs_epfiles_create()
1873 if (!epfile->dentry) { in ffs_epfiles_create()
1885 struct ffs_epfile *epfile = epfiles; in ffs_epfiles_destroy() local
1887 for (; count; --count, ++epfile) { in ffs_epfiles_destroy()
1888 BUG_ON(mutex_is_locked(&epfile->mutex)); in ffs_epfiles_destroy()
1889 if (epfile->dentry) { in ffs_epfiles_destroy()
1890 d_delete(epfile->dentry); in ffs_epfiles_destroy()
1891 dput(epfile->dentry); in ffs_epfiles_destroy()
1892 epfile->dentry = NULL; in ffs_epfiles_destroy()
1902 struct ffs_epfile *epfile; in ffs_func_eps_disable() local
1908 epfile = func->ffs->epfiles; in ffs_func_eps_disable()
1916 if (epfile) { in ffs_func_eps_disable()
1917 epfile->ep = NULL; in ffs_func_eps_disable()
1918 __ffs_epfile_read_buffer_free(epfile); in ffs_func_eps_disable()
1919 ++epfile; in ffs_func_eps_disable()
1929 struct ffs_epfile *epfile; in ffs_func_eps_enable() local
1937 epfile = ffs->epfiles; in ffs_func_eps_enable()
1951 epfile->ep = ep; in ffs_func_eps_enable()
1952 epfile->in = usb_endpoint_dir_in(ep->ep->desc); in ffs_func_eps_enable()
1953 epfile->isoc = usb_endpoint_xfer_isoc(ep->ep->desc); in ffs_func_eps_enable()
1959 ++epfile; in ffs_func_eps_enable()