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 } 27 28 void drmm_kfree(struct drm_device *dev, void *data); 29 30 #endif 31