Skip to content

Commit 88555f7

Browse files
committed
drm/i915/display: add struct drm_device to struct intel_display conversion function
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
1 parent 399f7b6 commit 88555f7

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

drivers/gpu/drm/i915/display/intel_display_conversion.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,8 @@ struct intel_display *__i915_to_display(struct drm_i915_private *i915)
77
{
88
return &i915->display;
99
}
10+
11+
struct intel_display *__drm_to_display(struct drm_device *drm)
12+
{
13+
return __i915_to_display(to_i915(drm));
14+
}

drivers/gpu/drm/i915/display/intel_display_conversion.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,12 @@
88
#ifndef __INTEL_DISPLAY_CONVERSION__
99
#define __INTEL_DISPLAY_CONVERSION__
1010

11+
struct drm_device;
1112
struct drm_i915_private;
1213
struct intel_display;
1314

1415
struct intel_display *__i915_to_display(struct drm_i915_private *i915);
15-
16+
struct intel_display *__drm_to_display(struct drm_device *drm);
1617
/*
1718
* Transitional macro to optionally convert struct drm_i915_private * to struct
1819
* intel_display *, also accepting the latter.

drivers/gpu/drm/i915/display/intel_display_types.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
#include "i915_vma_types.h"
4646
#include "intel_bios.h"
4747
#include "intel_display.h"
48+
#include "intel_display_conversion.h"
4849
#include "intel_display_limits.h"
4950
#include "intel_display_power.h"
5051
#include "intel_dpll_mgr.h"
@@ -2107,7 +2108,7 @@ to_intel_frontbuffer(struct drm_framebuffer *fb)
21072108
* intel_display pointer.
21082109
*/
21092110
#define __drm_device_to_intel_display(p) \
2110-
((p) ? &to_i915(p)->display : NULL)
2111+
((p) ? __drm_to_display(p) : NULL)
21112112
#define __device_to_intel_display(p) \
21122113
__drm_device_to_intel_display(dev_get_drvdata(p))
21132114
#define __pci_dev_to_intel_display(p) \

0 commit comments

Comments
 (0)