File tree Expand file tree Collapse file tree 1 file changed +18
-8
lines changed
drivers/usb/gadget/function Expand file tree Collapse file tree 1 file changed +18
-8
lines changed Original file line number Diff line number Diff line change @@ -219,6 +219,7 @@ struct ffs_io_data {
219
219
220
220
struct mm_struct * mm ;
221
221
struct work_struct work ;
222
+ struct work_struct cancellation_work ;
222
223
223
224
struct usb_ep * ep ;
224
225
struct usb_request * req ;
@@ -1073,22 +1074,31 @@ ffs_epfile_open(struct inode *inode, struct file *file)
1073
1074
return 0 ;
1074
1075
}
1075
1076
1077
+ static void ffs_aio_cancel_worker (struct work_struct * work )
1078
+ {
1079
+ struct ffs_io_data * io_data = container_of (work , struct ffs_io_data ,
1080
+ cancellation_work );
1081
+
1082
+ ENTER ();
1083
+
1084
+ usb_ep_dequeue (io_data -> ep , io_data -> req );
1085
+ }
1086
+
1076
1087
static int ffs_aio_cancel (struct kiocb * kiocb )
1077
1088
{
1078
1089
struct ffs_io_data * io_data = kiocb -> private ;
1079
- struct ffs_epfile * epfile = kiocb -> ki_filp -> private_data ;
1090
+ struct ffs_data * ffs = io_data -> ffs ;
1080
1091
int value ;
1081
1092
1082
1093
ENTER ();
1083
1094
1084
- spin_lock_irq ( & epfile -> ffs -> eps_lock );
1085
-
1086
- if ( likely ( io_data && io_data -> ep && io_data -> req ))
1087
- value = usb_ep_dequeue ( io_data -> ep , io_data -> req ) ;
1088
- else
1095
+ if ( likely ( io_data && io_data -> ep && io_data -> req )) {
1096
+ INIT_WORK ( & io_data -> cancellation_work , ffs_aio_cancel_worker );
1097
+ queue_work ( ffs -> io_completion_wq , & io_data -> cancellation_work );
1098
+ value = - EINPROGRESS ;
1099
+ } else {
1089
1100
value = - EINVAL ;
1090
-
1091
- spin_unlock_irq (& epfile -> ffs -> eps_lock );
1101
+ }
1092
1102
1093
1103
return value ;
1094
1104
}
You can’t perform that action at this time.
0 commit comments