xref: /linux/drivers/gpu/drm/i915/display/intel_display_conversion.h (revision d53b8e36925256097a08d7cb749198d85cbf9b2b)
1 /* SPDX-License-Identifier: MIT */
2 /* Copyright © 2024 Intel Corporation */
3 
4 /*
5  * This header is for transitional struct intel_display conversion helpers only.
6  */
7 
8 #ifndef __INTEL_DISPLAY_CONVERSION__
9 #define __INTEL_DISPLAY_CONVERSION__
10 
11 /*
12  * Transitional macro to optionally convert struct drm_i915_private * to struct
13  * intel_display *, also accepting the latter.
14  */
15 #define __to_intel_display(p)						\
16 	_Generic(p,							\
17 		 const struct drm_i915_private *: (&((const struct drm_i915_private *)(p))->display), \
18 		 struct drm_i915_private *: (&((struct drm_i915_private *)(p))->display), \
19 		 const struct intel_display *: (p),			\
20 		 struct intel_display *: (p))
21 
22 #endif /* __INTEL_DISPLAY_CONVERSION__ */
23