[Intel-gfx] [PATCH 5/5] drm/i915: Convert hotplug irq worker into a tasklet

Chris Wilson chris at chris-wilson.co.uk
Thu May 19 07:48:34 UTC 2016


Using a tasklet for an irq bottom-half is the preferred form as it
should ensure minimal latency from the irq to execution of the tasklet.

Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen at linux.intel.com>
---
 drivers/gpu/drm/i915/i915_drv.h      |  2 +-
 drivers/gpu/drm/i915/intel_hotplug.c | 16 +++++++++-------
 2 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index fdb19e2610eb..5e541b4dbfb9 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -262,7 +262,7 @@ enum hpd_pin {
 	for ((__pin) = (HPD_NONE + 1); (__pin) < HPD_NUM_PINS; (__pin)++)
 
 struct i915_hotplug {
-	struct work_struct hotplug_work;
+	struct tasklet_struct hpd_task;
 
 	struct {
 		unsigned long last_jiffies;
diff --git a/drivers/gpu/drm/i915/intel_hotplug.c b/drivers/gpu/drm/i915/intel_hotplug.c
index 3c74c2b944cf..1ab6fd298f51 100644
--- a/drivers/gpu/drm/i915/intel_hotplug.c
+++ b/drivers/gpu/drm/i915/intel_hotplug.c
@@ -290,17 +290,17 @@ static void i915_digport_task(unsigned long data)
 		spin_lock_irq(&dev_priv->irq_lock);
 		dev_priv->hotplug.event_bits |= old_bits;
 		spin_unlock_irq(&dev_priv->irq_lock);
-		schedule_work(&dev_priv->hotplug.hotplug_work);
+
+		tasklet_schedule(&dev_priv->hotplug.hpd_task);
 	}
 }
 
 /*
  * Handle hotplug events outside the interrupt handler proper.
  */
-static void i915_hotplug_work_func(struct work_struct *work)
+static void i915_hotplug_task(unsigned long data)
 {
-	struct drm_i915_private *dev_priv =
-		container_of(work, struct drm_i915_private, hotplug.hotplug_work);
+	struct drm_i915_private *dev_priv = (struct drm_i915_private *)data;
 	struct drm_device *dev = dev_priv->dev;
 	struct drm_mode_config *mode_config = &dev->mode_config;
 	struct intel_connector *intel_connector;
@@ -437,7 +437,7 @@ void intel_hpd_irq_handler(struct drm_i915_private *dev_priv,
 	if (queue_dig)
 		tasklet_schedule(&dev_priv->hotplug.dig_port_task);
 	if (queue_hp)
-		schedule_work(&dev_priv->hotplug.hotplug_work);
+		tasklet_schedule(&dev_priv->hotplug.hpd_task);
 }
 
 /**
@@ -489,7 +489,9 @@ void intel_hpd_init(struct drm_i915_private *dev_priv)
 
 void intel_hpd_init_work(struct drm_i915_private *dev_priv)
 {
-	INIT_WORK(&dev_priv->hotplug.hotplug_work, i915_hotplug_work_func);
+	tasklet_init(&dev_priv->hotplug.hpd_task,
+		     i915_hotplug_task,
+		     (unsigned long)dev_priv);
 	tasklet_init(&dev_priv->hotplug.dig_port_task,
 		     i915_digport_task,
 		     (unsigned long)dev_priv);
@@ -508,6 +510,6 @@ void intel_hpd_cancel_work(struct drm_i915_private *dev_priv)
 	spin_unlock_irq(&dev_priv->irq_lock);
 
 	tasklet_kill(&dev_priv->hotplug.dig_port_task);
-	cancel_work_sync(&dev_priv->hotplug.hotplug_work);
+	tasklet_kill(&dev_priv->hotplug.hpd_task);
 	cancel_delayed_work_sync(&dev_priv->hotplug.reenable_work);
 }
-- 
2.8.1



More information about the Intel-gfx mailing list