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