[PATCH] drm/i915: Don't enable hwmon for selftests

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



There are no hwmon selftests so there is no need to enable hwmon for
selftests. So enable hwmon only for real driver load.

v2: Move the logic inside i915_hwmon.c
v3: Move is_i915_selftest definition to i915_selftest.h (Badal)
v4: s/is_i915_selftest/is_i915_selftest_module/

Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/10366
Signed-off-by: Ashutosh Dixit <ashutosh.dixit@xxxxxxxxx>
Reviewed-by: Badal Nilawar <badal.nilawar@xxxxxxxxx>
Reviewed-by: Andi Shyti <andi.shyti@xxxxxxxxxxxxxxx>
---
 drivers/gpu/drm/i915/i915_hwmon.c    | 3 ++-
 drivers/gpu/drm/i915/i915_selftest.h | 9 +++++++++
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/i915_hwmon.c b/drivers/gpu/drm/i915/i915_hwmon.c
index 8c3f443c8347..86d7cd1ef45e 100644
--- a/drivers/gpu/drm/i915/i915_hwmon.c
+++ b/drivers/gpu/drm/i915/i915_hwmon.c
@@ -10,6 +10,7 @@
 #include "i915_drv.h"
 #include "i915_hwmon.h"
 #include "i915_reg.h"
+#include "i915_selftest.h"
 #include "intel_mchbar_regs.h"
 #include "intel_pcode.h"
 #include "gt/intel_gt.h"
@@ -789,7 +790,7 @@ void i915_hwmon_register(struct drm_i915_private *i915)
 	int i;
 
 	/* hwmon is available only for dGfx */
-	if (!IS_DGFX(i915))
+	if (!IS_DGFX(i915) || is_i915_selftest_module())
 		return;
 
 	hwmon = devm_kzalloc(dev, sizeof(*hwmon), GFP_KERNEL);
diff --git a/drivers/gpu/drm/i915/i915_selftest.h b/drivers/gpu/drm/i915/i915_selftest.h
index bdf3e22c0a34..bba3fafaac8d 100644
--- a/drivers/gpu/drm/i915/i915_selftest.h
+++ b/drivers/gpu/drm/i915/i915_selftest.h
@@ -123,6 +123,15 @@ static inline int i915_perf_selftests(struct pci_dev *pdev) { return 0; }
 
 #endif
 
+static inline bool is_i915_selftest_module(void)
+{
+#if IS_ENABLED(CONFIG_DRM_I915_SELFTEST)
+	return i915_selftest.live || i915_selftest.perf || i915_selftest.mock;
+#else
+	return false;
+#endif
+}
+
 /* Using the i915_selftest_ prefix becomes a little unwieldy with the helpers.
  * Instead we use the igt_ shorthand, in reference to the intel-gpu-tools
  * suite of uabi test cases (which includes a test runner for our selftests).
-- 
2.41.0




[Index of Archives]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux