[Intel-gfx] [PATCH v4 4/6] drm/i915/opregion: Cond dgfx opregion func registration
Anshuman Gupta
anshuman.gupta at intel.com
Mon Apr 18 10:54:06 UTC 2022
DGFX ASLS and OPROM OpRegion are only supported on the GFX Cards,
which supports Display Engine. Register opregion function accordingly
using the HAS_DISPLAY(). And early return intel_opregion_setup()
if no opregion func to avoid NULL pointer oops.
v2:
- Change the commit log.
v3:
- Use nested condition for IS_DGFX() and HAS_DISPLAY(). [Jani]
Cc: Badal Nilawar <badal.nilawar at intel.com>
Cc: Jani Nikula <jani.nikula at intel.com>
Cc: Uma Shankar <uma.shankar at intel.com>
Signed-off-by: Anshuman Gupta <anshuman.gupta at intel.com>
---
drivers/gpu/drm/i915/display/intel_opregion.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/i915/display/intel_opregion.c b/drivers/gpu/drm/i915/display/intel_opregion.c
index 6bba0e2cff72..8e5960ec30de 100644
--- a/drivers/gpu/drm/i915/display/intel_opregion.c
+++ b/drivers/gpu/drm/i915/display/intel_opregion.c
@@ -894,6 +894,9 @@ static int intel_opregion_setup(struct drm_i915_private *dev_priv)
BUILD_BUG_ON(sizeof(struct opregion_asle) != 0x100);
BUILD_BUG_ON(sizeof(struct opregion_asle_ext) != 0x400);
+ if (!opregion->opregion_func)
+ return 0;
+
INIT_WORK(&opregion->asle_work, asle_work);
base = opregion->opregion_func->alloc_opregion(dev_priv);
@@ -1348,10 +1351,12 @@ int intel_opregion_init(struct drm_i915_private *i915)
{
struct intel_opregion *opregion = &i915->opregion;
- if (IS_DGFX(i915))
- opregion->opregion_func = &dgfx_opregion_func;
- else
+ if (IS_DGFX(i915)) {
+ if (HAS_DISPLAY(i915))
+ opregion->opregion_func = &dgfx_opregion_func;
+ } else {
opregion->opregion_func = &igfx_opregion_func;
+ }
return intel_opregion_setup(i915);
}
--
2.26.2
More information about the Intel-gfx
mailing list