~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/linux/devm-helpers.h

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /include/linux/devm-helpers.h (Version linux-6.12-rc7) and /include/linux/devm-helpers.h (Version linux-5.11.22)


  1 /* SPDX-License-Identifier: GPL-2.0-only */         1 
  2 #ifndef __LINUX_DEVM_HELPERS_H                    
  3 #define __LINUX_DEVM_HELPERS_H                    
  4                                                   
  5 /*                                                
  6  * Functions which do automatically cancel ope    
  7  * driver detach.                                 
  8  *                                                
  9  * These should be helpful to avoid mixing the    
 10  * management which can be source of annoying,    
 11  * hard-to-reproduce bugs.                        
 12  *                                                
 13  * Please take into account that devm based ca    
 14  * time after the remove() is ran.                
 15  *                                                
 16  * Thus mixing devm and manual resource manage    
 17  * when unwinding operations with dependencies    
 18  * is typical example where IRQs are often dev    
 19  * cleaned at remove(). If IRQs are not manual    
 20  * often the case when we use devm for IRQs) w    
 21  * remove() - and before devm managed IRQs are    
 22  * and schedule a work item which won't be can    
 23  * already ran.                                   
 24  */                                               
 25                                                   
 26 #include <linux/device.h>                         
 27 #include <linux/workqueue.h>                      
 28                                                   
 29 static inline void devm_delayed_work_drop(void    
 30 {                                                 
 31         cancel_delayed_work_sync(res);            
 32 }                                                 
 33                                                   
 34 /**                                               
 35  * devm_delayed_work_autocancel - Resource-man    
 36  * @dev:        Device which lifetime work is     
 37  * @w:          Work item to be queued            
 38  * @worker:     Worker function                   
 39  *                                                
 40  * Initialize delayed work which is automatica    
 41  * detached. A few drivers need delayed work w    
 42  * driver is detached to avoid accessing remov    
 43  * devm_delayed_work_autocancel() can be used     
 44  * cancellation when driver is detached.          
 45  */                                               
 46 static inline int devm_delayed_work_autocancel    
 47                                                   
 48                                                   
 49 {                                                 
 50         INIT_DELAYED_WORK(w, worker);             
 51         return devm_add_action(dev, devm_delay    
 52 }                                                 
 53                                                   
 54 static inline void devm_work_drop(void *res)      
 55 {                                                 
 56         cancel_work_sync(res);                    
 57 }                                                 
 58                                                   
 59 /**                                               
 60  * devm_work_autocancel - Resource-managed wor    
 61  * @dev:        Device which lifetime work is     
 62  * @w:          Work to be added (and automati    
 63  * @worker:     Worker function                   
 64  *                                                
 65  * Initialize work which is automatically canc    
 66  * A few drivers need to queue work which must    
 67  * is detached to avoid accessing removed reso    
 68  * devm_work_autocancel() can be used to omit     
 69  * cancellation when driver is detached.          
 70  */                                               
 71 static inline int devm_work_autocancel(struct     
 72                                        struct     
 73                                        work_fu    
 74 {                                                 
 75         INIT_WORK(w, worker);                     
 76         return devm_add_action(dev, devm_work_    
 77 }                                                 
 78                                                   
 79 #endif                                            
 80                                                   

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php