summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2023-05-26 15:38:27 +1000
committerDave Airlie <airlied@redhat.com>2023-05-26 15:38:31 +1000
commit5502d1fab09df791a8b1208dea9defc418b9bbf7 (patch)
tree0c629a5d179ceb55b76be49b7b3558de07de0b54 /include
parent13aa38f86eea7f95eca4909c075b3b511dc3f500 (diff)
parente997c218ad736fd6f524d73a987bad9d94128d3d (diff)
Merge tag 'drm-misc-fixes-2023-05-24' of git://anongit.freedesktop.org/drm/drm-misc into drm-fixes
drm-misc-fixes for v6.4-rc4: - A few non-trivial fixes to qaic. - Fix drmm_mutex_init always using same lock class. - Fix pl111 fb depth. - Fix uninitialised gamma lut in mgag200. - Add Aya Neo Air Plus quirk. - Trivial null check removal in scheduler. Signed-off-by: Dave Airlie <airlied@redhat.com> From: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/d19f748c-2c5b-8140-5b05-a8282dfef73e@linux.intel.com
Diffstat (limited to 'include')
-rw-r--r--include/drm/drm_managed.h18
1 files changed, 17 insertions, 1 deletions
diff --git a/include/drm/drm_managed.h b/include/drm/drm_managed.h
index 359883942612..ad08f834af40 100644
--- a/include/drm/drm_managed.h
+++ b/include/drm/drm_managed.h
@@ -105,6 +105,22 @@ char *drmm_kstrdup(struct drm_device *dev, const char *s, gfp_t gfp);
void drmm_kfree(struct drm_device *dev, void *data);
-int drmm_mutex_init(struct drm_device *dev, struct mutex *lock);
+void __drmm_mutex_release(struct drm_device *dev, void *res);
+
+/**
+ * drmm_mutex_init - &drm_device-managed mutex_init()
+ * @dev: DRM device
+ * @lock: lock to be initialized
+ *
+ * Returns:
+ * 0 on success, or a negative errno code otherwise.
+ *
+ * This is a &drm_device-managed version of mutex_init(). The initialized
+ * lock is automatically destroyed on the final drm_dev_put().
+ */
+#define drmm_mutex_init(dev, lock) ({ \
+ mutex_init(lock); \
+ drmm_add_action_or_reset(dev, __drmm_mutex_release, lock); \
+}) \
#endif