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

TOMOYO Linux Cross Reference
Linux/include/drm/drm_managed.h

Version: ~ [ linux-6.11-rc3 ] ~ [ linux-6.10.4 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.45 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.104 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.164 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.223 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.281 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.319 ] ~ [ 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.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /include/drm/drm_managed.h (Version linux-6.11-rc3) and /include/drm/drm_managed.h (Version linux-5.15.164)


  1 // SPDX-License-Identifier: GPL-2.0                 1 // SPDX-License-Identifier: GPL-2.0
  2                                                     2 
  3 #ifndef _DRM_MANAGED_H_                             3 #ifndef _DRM_MANAGED_H_
  4 #define _DRM_MANAGED_H_                             4 #define _DRM_MANAGED_H_
  5                                                     5 
  6 #include <linux/gfp.h>                              6 #include <linux/gfp.h>
  7 #include <linux/overflow.h>                         7 #include <linux/overflow.h>
  8 #include <linux/types.h>                            8 #include <linux/types.h>
  9                                                     9 
 10 struct drm_device;                                 10 struct drm_device;
 11 struct mutex;                                  << 
 12                                                    11 
 13 typedef void (*drmres_release_t)(struct drm_de     12 typedef void (*drmres_release_t)(struct drm_device *dev, void *res);
 14                                                    13 
 15 /**                                                14 /**
 16  * drmm_add_action - add a managed release act     15  * drmm_add_action - add a managed release action to a &drm_device
 17  * @dev: DRM device                                16  * @dev: DRM device
 18  * @action: function which should be called wh     17  * @action: function which should be called when @dev is released
 19  * @data: opaque pointer, passed to @action        18  * @data: opaque pointer, passed to @action
 20  *                                                 19  *
 21  * This function adds the @release action with     20  * This function adds the @release action with optional parameter @data to the
 22  * list of cleanup actions for @dev. The clean     21  * list of cleanup actions for @dev. The cleanup actions will be run in reverse
 23  * order in the final drm_dev_put() call for @     22  * order in the final drm_dev_put() call for @dev.
 24  */                                                23  */
 25 #define drmm_add_action(dev, action, data) \       24 #define drmm_add_action(dev, action, data) \
 26         __drmm_add_action(dev, action, data, #     25         __drmm_add_action(dev, action, data, #action)
 27                                                    26 
 28 int __must_check __drmm_add_action(struct drm_     27 int __must_check __drmm_add_action(struct drm_device *dev,
 29                                    drmres_rele     28                                    drmres_release_t action,
 30                                    void *data,     29                                    void *data, const char *name);
 31                                                    30 
 32 /**                                                31 /**
 33  * drmm_add_action_or_reset - add a managed re     32  * drmm_add_action_or_reset - add a managed release action to a &drm_device
 34  * @dev: DRM device                                33  * @dev: DRM device
 35  * @action: function which should be called wh     34  * @action: function which should be called when @dev is released
 36  * @data: opaque pointer, passed to @action        35  * @data: opaque pointer, passed to @action
 37  *                                                 36  *
 38  * Similar to drmm_add_action(), with the only     37  * Similar to drmm_add_action(), with the only difference that upon failure
 39  * @action is directly called for any cleanup      38  * @action is directly called for any cleanup work necessary on failures.
 40  */                                                39  */
 41 #define drmm_add_action_or_reset(dev, action,      40 #define drmm_add_action_or_reset(dev, action, data) \
 42         __drmm_add_action_or_reset(dev, action     41         __drmm_add_action_or_reset(dev, action, data, #action)
 43                                                    42 
 44 int __must_check __drmm_add_action_or_reset(st     43 int __must_check __drmm_add_action_or_reset(struct drm_device *dev,
 45                                             dr     44                                             drmres_release_t action,
 46                                             vo     45                                             void *data, const char *name);
 47                                                    46 
 48 void drmm_release_action(struct drm_device *de << 
 49                          drmres_release_t acti << 
 50                          void *data);          << 
 51                                                << 
 52 void *drmm_kmalloc(struct drm_device *dev, siz     47 void *drmm_kmalloc(struct drm_device *dev, size_t size, gfp_t gfp) __malloc;
 53                                                    48 
 54 /**                                                49 /**
 55  * drmm_kzalloc - &drm_device managed kzalloc(     50  * drmm_kzalloc - &drm_device managed kzalloc()
 56  * @dev: DRM device                                51  * @dev: DRM device
 57  * @size: size of the memory allocation            52  * @size: size of the memory allocation
 58  * @gfp: GFP allocation flags                      53  * @gfp: GFP allocation flags
 59  *                                                 54  *
 60  * This is a &drm_device managed version of kz     55  * This is a &drm_device managed version of kzalloc(). The allocated memory is
 61  * automatically freed on the final drm_dev_pu     56  * automatically freed on the final drm_dev_put(). Memory can also be freed
 62  * before the final drm_dev_put() by calling d     57  * before the final drm_dev_put() by calling drmm_kfree().
 63  */                                                58  */
 64 static inline void *drmm_kzalloc(struct drm_de     59 static inline void *drmm_kzalloc(struct drm_device *dev, size_t size, gfp_t gfp)
 65 {                                                  60 {
 66         return drmm_kmalloc(dev, size, gfp | _     61         return drmm_kmalloc(dev, size, gfp | __GFP_ZERO);
 67 }                                                  62 }
 68                                                    63 
 69 /**                                                64 /**
 70  * drmm_kmalloc_array - &drm_device managed km     65  * drmm_kmalloc_array - &drm_device managed kmalloc_array()
 71  * @dev: DRM device                                66  * @dev: DRM device
 72  * @n: number of array elements to allocate        67  * @n: number of array elements to allocate
 73  * @size: size of array member                     68  * @size: size of array member
 74  * @flags: GFP allocation flags                    69  * @flags: GFP allocation flags
 75  *                                                 70  *
 76  * This is a &drm_device managed version of km     71  * This is a &drm_device managed version of kmalloc_array(). The allocated
 77  * memory is automatically freed on the final      72  * memory is automatically freed on the final drm_dev_put() and works exactly
 78  * like a memory allocation obtained by drmm_k     73  * like a memory allocation obtained by drmm_kmalloc().
 79  */                                                74  */
 80 static inline void *drmm_kmalloc_array(struct      75 static inline void *drmm_kmalloc_array(struct drm_device *dev,
 81                                        size_t      76                                        size_t n, size_t size, gfp_t flags)
 82 {                                                  77 {
 83         size_t bytes;                              78         size_t bytes;
 84                                                    79 
 85         if (unlikely(check_mul_overflow(n, siz     80         if (unlikely(check_mul_overflow(n, size, &bytes)))
 86                 return NULL;                       81                 return NULL;
 87                                                    82 
 88         return drmm_kmalloc(dev, bytes, flags)     83         return drmm_kmalloc(dev, bytes, flags);
 89 }                                                  84 }
 90                                                    85 
 91 /**                                                86 /**
 92  * drmm_kcalloc - &drm_device managed kcalloc(     87  * drmm_kcalloc - &drm_device managed kcalloc()
 93  * @dev: DRM device                                88  * @dev: DRM device
 94  * @n: number of array elements to allocate        89  * @n: number of array elements to allocate
 95  * @size: size of array member                     90  * @size: size of array member
 96  * @flags: GFP allocation flags                    91  * @flags: GFP allocation flags
 97  *                                                 92  *
 98  * This is a &drm_device managed version of kc     93  * This is a &drm_device managed version of kcalloc(). The allocated memory is
 99  * automatically freed on the final drm_dev_pu     94  * automatically freed on the final drm_dev_put() and works exactly like a
100  * memory allocation obtained by drmm_kmalloc(     95  * memory allocation obtained by drmm_kmalloc().
101  */                                                96  */
102 static inline void *drmm_kcalloc(struct drm_de     97 static inline void *drmm_kcalloc(struct drm_device *dev,
103                                  size_t n, siz     98                                  size_t n, size_t size, gfp_t flags)
104 {                                                  99 {
105         return drmm_kmalloc_array(dev, n, size    100         return drmm_kmalloc_array(dev, n, size, flags | __GFP_ZERO);
106 }                                                 101 }
107                                                   102 
108 char *drmm_kstrdup(struct drm_device *dev, con    103 char *drmm_kstrdup(struct drm_device *dev, const char *s, gfp_t gfp);
109                                                   104 
110 void drmm_kfree(struct drm_device *dev, void *    105 void drmm_kfree(struct drm_device *dev, void *data);
111                                                << 
112 void __drmm_mutex_release(struct drm_device *d << 
113                                                << 
114 /**                                            << 
115  * drmm_mutex_init - &drm_device-managed mutex << 
116  * @dev: DRM device                            << 
117  * @lock: lock to be initialized               << 
118  *                                             << 
119  * Returns:                                    << 
120  * 0 on success, or a negative errno code othe << 
121  *                                             << 
122  * This is a &drm_device-managed version of mu << 
123  * lock is automatically destroyed on the fina << 
124  */                                            << 
125 #define drmm_mutex_init(dev, lock) ({          << 
126         mutex_init(lock);                      << 
127         drmm_add_action_or_reset(dev, __drmm_m << 
128 })                                             << 
129                                                   106 
130 #endif                                            107 #endif
131                                                   108 

~ [ 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