Lines Matching refs:io_data
796 static inline void *ffs_alloc_buffer(struct ffs_io_data *io_data, in ffs_alloc_buffer() argument
799 if (io_data->use_sg) in ffs_alloc_buffer()
800 return ffs_build_sg_list(&io_data->sgt, data_len); in ffs_alloc_buffer()
805 static inline void ffs_free_buffer(struct ffs_io_data *io_data) in ffs_free_buffer() argument
807 if (!io_data->buf) in ffs_free_buffer()
810 if (io_data->use_sg) { in ffs_free_buffer()
811 sg_free_table(&io_data->sgt); in ffs_free_buffer()
812 vfree(io_data->buf); in ffs_free_buffer()
814 kfree(io_data->buf); in ffs_free_buffer()
820 struct ffs_io_data *io_data = container_of(work, struct ffs_io_data, in ffs_user_copy_worker() local
822 int ret = io_data->req->status ? io_data->req->status : in ffs_user_copy_worker()
823 io_data->req->actual; in ffs_user_copy_worker()
824 bool kiocb_has_eventfd = io_data->kiocb->ki_flags & IOCB_EVENTFD; in ffs_user_copy_worker()
826 if (io_data->read && ret > 0) { in ffs_user_copy_worker()
827 kthread_use_mm(io_data->mm); in ffs_user_copy_worker()
828 ret = ffs_copy_to_iter(io_data->buf, ret, &io_data->data); in ffs_user_copy_worker()
829 kthread_unuse_mm(io_data->mm); in ffs_user_copy_worker()
832 io_data->kiocb->ki_complete(io_data->kiocb, ret, ret); in ffs_user_copy_worker()
834 if (io_data->ffs->ffs_eventfd && !kiocb_has_eventfd) in ffs_user_copy_worker()
835 eventfd_signal(io_data->ffs->ffs_eventfd, 1); in ffs_user_copy_worker()
837 usb_ep_free_request(io_data->ep, io_data->req); in ffs_user_copy_worker()
839 if (io_data->read) in ffs_user_copy_worker()
840 kfree(io_data->to_free); in ffs_user_copy_worker()
841 ffs_free_buffer(io_data); in ffs_user_copy_worker()
842 kfree(io_data); in ffs_user_copy_worker()
848 struct ffs_io_data *io_data = req->context; in ffs_epfile_async_io_complete() local
849 struct ffs_data *ffs = io_data->ffs; in ffs_epfile_async_io_complete()
853 INIT_WORK(&io_data->work, ffs_user_copy_worker); in ffs_epfile_async_io_complete()
854 queue_work(ffs->io_completion_wq, &io_data->work); in ffs_epfile_async_io_complete()
939 static ssize_t ffs_epfile_io(struct file *file, struct ffs_io_data *io_data) in ffs_epfile_io() argument
965 halt = (!io_data->read == !epfile->in); in ffs_epfile_io()
985 if (!io_data->aio && io_data->read) { in ffs_epfile_io()
986 ret = __ffs_epfile_read_buffered(epfile, &io_data->data); in ffs_epfile_io()
1004 data_len = iov_iter_count(&io_data->data); in ffs_epfile_io()
1009 if (io_data->read) in ffs_epfile_io()
1012 io_data->use_sg = gadget->sg_supported && data_len > PAGE_SIZE; in ffs_epfile_io()
1015 data = ffs_alloc_buffer(io_data, data_len); in ffs_epfile_io()
1020 if (!io_data->read && in ffs_epfile_io()
1021 !copy_from_iter_full(data, data_len, &io_data->data)) { in ffs_epfile_io()
1050 } else if (!io_data->aio) { in ffs_epfile_io()
1055 if (io_data->use_sg) { in ffs_epfile_io()
1057 req->sg = io_data->sgt.sgl; in ffs_epfile_io()
1058 req->num_sgs = io_data->sgt.nents; in ffs_epfile_io()
1065 io_data->buf = data; in ffs_epfile_io()
1090 else if (io_data->read && ep->status > 0) in ffs_epfile_io()
1092 &io_data->data); in ffs_epfile_io()
1099 if (io_data->use_sg) { in ffs_epfile_io()
1101 req->sg = io_data->sgt.sgl; in ffs_epfile_io()
1102 req->num_sgs = io_data->sgt.nents; in ffs_epfile_io()
1109 io_data->buf = data; in ffs_epfile_io()
1110 io_data->ep = ep->ep; in ffs_epfile_io()
1111 io_data->req = req; in ffs_epfile_io()
1112 io_data->ffs = epfile->ffs; in ffs_epfile_io()
1114 req->context = io_data; in ffs_epfile_io()
1119 io_data->req = NULL; in ffs_epfile_io()
1138 ffs_free_buffer(io_data); in ffs_epfile_io()
1160 struct ffs_io_data *io_data = kiocb->private; in ffs_aio_cancel() local
1169 if (likely(io_data && io_data->ep && io_data->req)) in ffs_aio_cancel()
1170 value = usb_ep_dequeue(io_data->ep, io_data->req); in ffs_aio_cancel()
1181 struct ffs_io_data io_data, *p = &io_data; in ffs_epfile_write_iter() local
1187 p = kzalloc(sizeof(io_data), GFP_KERNEL); in ffs_epfile_write_iter()
1218 struct ffs_io_data io_data, *p = &io_data; in ffs_epfile_read_iter() local
1224 p = kzalloc(sizeof(io_data), GFP_KERNEL); in ffs_epfile_read_iter()