[Intel-gfx] [RFC 1/2] drm/i915: Keep a list of probed devices

Tvrtko Ursulin tursulin at ursulin.net
Mon Jun 25 17:32:36 UTC 2018


From: Tvrtko Ursulin <tvrtko.ursulin at intel.com>

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
---
 drivers/gpu/drm/i915/i915_drv.c | 12 ++++++++++++
 drivers/gpu/drm/i915/i915_drv.h |  5 +++++
 2 files changed, 17 insertions(+)

diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index 0db3c83cce29..8a3ea18d8416 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -1207,6 +1207,9 @@ static void i915_driver_cleanup_hw(struct drm_i915_private *dev_priv)
 	i915_ggtt_cleanup_hw(dev_priv);
 }
 
+DEFINE_MUTEX(i915_driver_list_lock);
+LIST_HEAD(i915_driver_list);
+
 /**
  * i915_driver_register - register the driver with the rest of the system
  * @dev_priv: device private
@@ -1264,6 +1267,11 @@ static void i915_driver_register(struct drm_i915_private *dev_priv)
 	 */
 	if (INTEL_INFO(dev_priv)->num_pipes)
 		drm_kms_helper_poll_init(dev);
+
+	INIT_LIST_HEAD(&dev_priv->driver_list_link);
+	mutex_lock(&i915_driver_list_lock);
+	list_add_tail(&dev_priv->driver_list_link, &i915_driver_list);
+	mutex_unlock(&i915_driver_list_lock);
 }
 
 /**
@@ -1275,6 +1283,10 @@ static void i915_driver_unregister(struct drm_i915_private *dev_priv)
 	intel_fbdev_unregister(dev_priv);
 	intel_audio_deinit(dev_priv);
 
+	mutex_lock(&i915_driver_list_lock);
+	list_del(&dev_priv->driver_list_link);
+	mutex_unlock(&i915_driver_list_lock);
+
 	/*
 	 * After flushing the fbdev (incl. a late async config which will
 	 * have delayed queuing of a hotplug event), then flush the hotplug
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 6f08ab310118..685bfdca3a72 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -2142,12 +2142,17 @@ struct drm_i915_private {
 
 	struct i915_pmu pmu;
 
+	struct list_head driver_list_link;
+
 	/*
 	 * NOTE: This is the dri1/ums dungeon, don't add stuff here. Your patch
 	 * will be rejected. Instead look for a better place.
 	 */
 };
 
+extern struct mutex i915_driver_list_lock;
+extern struct list_head i915_driver_list;
+
 static inline struct drm_i915_private *to_i915(const struct drm_device *dev)
 {
 	return container_of(dev, struct drm_i915_private, drm);
-- 
2.17.1



More information about the Intel-gfx mailing list