Commit 98ebb7cf authored by Jani Nikula's avatar Jani Nikula

drm/i915: add generic __to_intel_display()

Add generic __to_intel_display() macro that accepts either struct
drm_i915_private * or struct intel_display *. This is to be used for
transitional stuff that eventually needs to be converted to use struct
intel_display *, and therefore is not part of to_intel_display().

Add new intel_display_conversion.h to host the helper to avoid
duplication between xe and i915 drivers.

v2: put it in the new header (Rodrigo)
Reviewed-by: default avatarRodrigo Vivi <rodrigo.vivi@intel.com>
Signed-off-by: default avatarJani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/a999ff8183659a4df68d439ebd31c19b5c56852a.1713358679.git.jani.nikula@intel.com
parent 8d7077f5
/* SPDX-License-Identifier: MIT */
/* Copyright © 2024 Intel Corporation */
/*
* This header is for transitional struct intel_display conversion helpers only.
*/
#ifndef __INTEL_DISPLAY_CONVERSION__
#define __INTEL_DISPLAY_CONVERSION__
/*
* Transitional macro to optionally convert struct drm_i915_private * to struct
* intel_display *, also accepting the latter.
*/
#define __to_intel_display(p) \
_Generic(p, \
const struct drm_i915_private *: (&((const struct drm_i915_private *)(p))->display), \
struct drm_i915_private *: (&((struct drm_i915_private *)(p))->display), \
const struct intel_display *: (p), \
struct intel_display *: (p))
#endif /* __INTEL_DISPLAY_CONVERSION__ */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment