mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-05 16:54:27 +00:00

Add a __drm_to_display() conversion function to hide the to_i915() usage and the implicit dependency on i915_drv.h from intel_display_types.h. The goal is for this implementation to be a transitional helper only. One idea I've floated around in the past would be to require a struct intel_display pointer member to be placed right after struct drm_device member in struct drm_i915_private and struct xe_device [1][2]. [1] https://lore.kernel.org/r/7777ff70e2be0663de4398aa6f75f0c54146cbfc.1709727127.git.jani.nikula@intel.com [2] https://lore.kernel.org/r/0b9459da6c8cba0f74bf2781d69182fa6801cd97.1709727127.git.jani.nikula@intel.com Reviewed-by: Luca Coelho <luciano.coelho@intel.com> Signed-off-by: Jani Nikula <jani.nikula@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/cbbf26fa58ef662946303c972b1a1ff1547ddcfe.1732104170.git.jani.nikula@intel.com
28 lines
926 B
C
28 lines
926 B
C
/* 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__
|
|
|
|
struct drm_device;
|
|
struct drm_i915_private;
|
|
struct intel_display;
|
|
|
|
struct intel_display *__i915_to_display(struct drm_i915_private *i915);
|
|
struct intel_display *__drm_to_display(struct drm_device *drm);
|
|
/*
|
|
* 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 *: __i915_to_display((struct drm_i915_private *)(p)), \
|
|
struct drm_i915_private *: __i915_to_display((struct drm_i915_private *)(p)), \
|
|
const struct intel_display *: (p), \
|
|
struct intel_display *: (p))
|
|
|
|
#endif /* __INTEL_DISPLAY_CONVERSION__ */
|