Daniel Vetter | c6603c7 | 2020-03-24 13:45:40 +0100 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0 |
| 2 | |
| 3 | #ifndef _DRM_MANAGED_H_ |
| 4 | #define _DRM_MANAGED_H_ |
| 5 | |
| 6 | #include <linux/gfp.h> |
| 7 | #include <linux/types.h> |
| 8 | |
| 9 | struct drm_device; |
| 10 | |
| 11 | typedef void (*drmres_release_t)(struct drm_device *dev, void *res); |
| 12 | |
| 13 | #define drmm_add_action(dev, action, data) \ |
| 14 | __drmm_add_action(dev, action, data, #action) |
| 15 | |
| 16 | int __must_check __drmm_add_action(struct drm_device *dev, |
| 17 | drmres_release_t action, |
| 18 | void *data, const char *name); |
| 19 | |
| 20 | void drmm_add_final_kfree(struct drm_device *dev, void *parent); |
| 21 | |
| 22 | void *drmm_kmalloc(struct drm_device *dev, size_t size, gfp_t gfp) __malloc; |
| 23 | static inline void *drmm_kzalloc(struct drm_device *dev, size_t size, gfp_t gfp) |
| 24 | { |
| 25 | return drmm_kmalloc(dev, size, gfp | __GFP_ZERO); |
| 26 | } |
Daniel Vetter | a5c71fd | 2020-03-23 15:49:19 +0100 | [diff] [blame^] | 27 | char *drmm_kstrdup(struct drm_device *dev, const char *s, gfp_t gfp); |
Daniel Vetter | c6603c7 | 2020-03-24 13:45:40 +0100 | [diff] [blame] | 28 | |
| 29 | void drmm_kfree(struct drm_device *dev, void *data); |
| 30 | |
| 31 | #endif |