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 @@ -215,6 +215,7 @@ struct ffs_io_data {
215215
216216	struct  mm_struct  * mm ;
217217	struct  work_struct  work ;
218+ 	struct  work_struct  cancellation_work ;
218219
219220	struct  usb_ep  * ep ;
220221	struct  usb_request  * req ;
@@ -1072,22 +1073,31 @@ ffs_epfile_open(struct inode *inode, struct file *file)
10721073	return  0 ;
10731074}
10741075
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+ 
10751086static  int  ffs_aio_cancel (struct  kiocb  * kiocb )
10761087{
10771088	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 ;
10791090	int  value ;
10801091
10811092	ENTER ();
10821093
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  { 
10881099		value  =  - EINVAL ;
1089- 
1090- 	spin_unlock_irq (& epfile -> ffs -> eps_lock );
1100+ 	}
10911101
10921102	return  value ;
10931103}
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments