blob: 89e6fce9f689466edc743ee4b42083b26033f75f [file] [log] [blame]
Daniel Vetterc6603c72020-03-24 13:45:40 +01001// 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
9struct drm_device;
10
11typedef 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
16int __must_check __drmm_add_action(struct drm_device *dev,
17 drmres_release_t action,
18 void *data, const char *name);
19
20void drmm_add_final_kfree(struct drm_device *dev, void *parent);
21
22void *drmm_kmalloc(struct drm_device *dev, size_t size, gfp_t gfp) __malloc;
23static 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 Vettera5c71fd2020-03-23 15:49:19 +010027char *drmm_kstrdup(struct drm_device *dev, const char *s, gfp_t gfp);
Daniel Vetterc6603c72020-03-24 13:45:40 +010028
29void drmm_kfree(struct drm_device *dev, void *data);
30
31#endif