All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anshuman Gupta <anshuman.gupta@intel.com>
To: intel-gfx@lists.freedesktop.org
Cc: jani.nikula@intel.com, lucas.demarchi@intel.com, rodrigo.vivi@intel.com
Subject: [Intel-gfx] [PATCH v4 4/6] drm/i915/opregion: Cond dgfx opregion func registration
Date: Mon, 18 Apr 2022 16:24:06 +0530	[thread overview]
Message-ID: <20220418105408.13444-5-anshuman.gupta@intel.com> (raw)
In-Reply-To: <20220418105408.13444-1-anshuman.gupta@intel.com>

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@intel.com>
Cc: Jani Nikula <jani.nikula@intel.com>
Cc: Uma Shankar <uma.shankar@intel.com>
Signed-off-by: Anshuman Gupta <anshuman.gupta@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


  parent reply	other threads:[~2022-04-18 10:54 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-18 10:54 [Intel-gfx] [PATCH v4 0/6] DGFX OpRegion Anshuman Gupta
2022-04-18 10:54 ` [Intel-gfx] [PATCH v4 1/6] drm/i915/opregion: Add intel_opregion_init() wrapper Anshuman Gupta
2022-04-18 10:54 ` [Intel-gfx] [PATCH v4 2/6] drm/i915/opregion: Abstract opregion function Anshuman Gupta
2022-04-18 10:54 ` [Intel-gfx] [PATCH v4 3/6] drm/i915/opregion: Add dgfx opregion func Anshuman Gupta
2022-04-18 10:54 ` Anshuman Gupta [this message]
2022-04-18 10:54 ` [Intel-gfx] [PATCH v4 5/6] drm/i915/dgfx: OPROM OpRegion Setup Anshuman Gupta
2022-04-18 14:49   ` kernel test robot
2022-04-18 10:54 ` [Intel-gfx] [PATCH v4 6/6] drm/i915/dgfx: Get VBT from rvda Anshuman Gupta
2022-04-18 11:41 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for DGFX OpRegion (rev4) Patchwork
2022-04-18 11:41 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2022-04-18 12:09 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2022-04-18 13:29 ` [Intel-gfx] ✓ Fi.CI.IGT: " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220418105408.13444-5-anshuman.gupta@intel.com \
    --to=anshuman.gupta@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jani.nikula@intel.com \
    --cc=lucas.demarchi@intel.com \
    --cc=rodrigo.vivi@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.