Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Revert "drm/probe-helpers: Drop locking from poll_enable"

This reverts commit 3846fd9b86001bea171943cc3bb9222cb6da6b42.

There were some precursor commits missing for this around connector
locking, we should probably merge Lyude's nouveau avoid the problem patch.

+34 -22
+31 -20
drivers/gpu/drm/drm_probe_helper.c
··· 115 115 116 116 #define DRM_OUTPUT_POLL_PERIOD (10*HZ) 117 117 /** 118 - * drm_kms_helper_poll_enable - re-enable output polling. 118 + * drm_kms_helper_poll_enable_locked - re-enable output polling. 119 119 * @dev: drm_device 120 120 * 121 - * This function re-enables the output polling work, after it has been 122 - * temporarily disabled using drm_kms_helper_poll_disable(), for example over 123 - * suspend/resume. 121 + * This function re-enables the output polling work without 122 + * locking the mode_config mutex. 124 123 * 125 - * Drivers can call this helper from their device resume implementation. It is 126 - * an error to call this when the output polling support has not yet been set 127 - * up. 128 - * 129 - * Note that calls to enable and disable polling must be strictly ordered, which 130 - * is automatically the case when they're only call from suspend/resume 131 - * callbacks. 124 + * This is like drm_kms_helper_poll_enable() however it is to be 125 + * called from a context where the mode_config mutex is locked 126 + * already. 132 127 */ 133 - void drm_kms_helper_poll_enable(struct drm_device *dev) 128 + void drm_kms_helper_poll_enable_locked(struct drm_device *dev) 134 129 { 135 130 bool poll = false; 136 131 struct drm_connector *connector; 137 132 unsigned long delay = DRM_OUTPUT_POLL_PERIOD; 133 + 134 + WARN_ON(!mutex_is_locked(&dev->mode_config.mutex)); 138 135 139 136 if (!dev->mode_config.poll_enabled || !drm_kms_helper_poll) 140 137 return; ··· 160 163 if (poll) 161 164 schedule_delayed_work(&dev->mode_config.output_poll_work, delay); 162 165 } 163 - EXPORT_SYMBOL(drm_kms_helper_poll_enable); 166 + EXPORT_SYMBOL(drm_kms_helper_poll_enable_locked); 164 167 165 168 static enum drm_connector_status 166 169 drm_connector_detect(struct drm_connector *connector, bool force) ··· 287 290 288 291 /* Re-enable polling in case the global poll config changed. */ 289 292 if (drm_kms_helper_poll != dev->mode_config.poll_running) 290 - drm_kms_helper_poll_enable(dev); 293 + drm_kms_helper_poll_enable_locked(dev); 291 294 292 295 dev->mode_config.poll_running = drm_kms_helper_poll; 293 296 ··· 479 482 * This function disables the output polling work. 480 483 * 481 484 * Drivers can call this helper from their device suspend implementation. It is 482 - * not an error to call this even when output polling isn't enabled or already 483 - * disabled. Polling is re-enabled by calling drm_kms_helper_poll_enable(). 484 - * 485 - * Note that calls to enable and disable polling must be strictly ordered, which 486 - * is automatically the case when they're only call from suspend/resume 487 - * callbacks. 485 + * not an error to call this even when output polling isn't enabled or arlready 486 + * disabled. 488 487 */ 489 488 void drm_kms_helper_poll_disable(struct drm_device *dev) 490 489 { ··· 489 496 cancel_delayed_work_sync(&dev->mode_config.output_poll_work); 490 497 } 491 498 EXPORT_SYMBOL(drm_kms_helper_poll_disable); 499 + 500 + /** 501 + * drm_kms_helper_poll_enable - re-enable output polling. 502 + * @dev: drm_device 503 + * 504 + * This function re-enables the output polling work. 505 + * 506 + * Drivers can call this helper from their device resume implementation. It is 507 + * an error to call this when the output polling support has not yet been set 508 + * up. 509 + */ 510 + void drm_kms_helper_poll_enable(struct drm_device *dev) 511 + { 512 + mutex_lock(&dev->mode_config.mutex); 513 + drm_kms_helper_poll_enable_locked(dev); 514 + mutex_unlock(&dev->mode_config.mutex); 515 + } 516 + EXPORT_SYMBOL(drm_kms_helper_poll_enable); 492 517 493 518 /** 494 519 * drm_kms_helper_poll_init - initialize and enable output polling
+2 -2
drivers/gpu/drm/i915/intel_hotplug.c
··· 180 180 181 181 /* Enable polling and queue hotplug re-enabling. */ 182 182 if (hpd_disabled) { 183 - drm_kms_helper_poll_enable(dev); 183 + drm_kms_helper_poll_enable_locked(dev); 184 184 mod_delayed_work(system_wq, &dev_priv->hotplug.reenable_work, 185 185 msecs_to_jiffies(HPD_STORM_REENABLE_DELAY)); 186 186 } ··· 511 511 } 512 512 513 513 if (enabled) 514 - drm_kms_helper_poll_enable(dev); 514 + drm_kms_helper_poll_enable_locked(dev); 515 515 516 516 mutex_unlock(&dev->mode_config.mutex); 517 517
+1
include/drm/drm_crtc_helper.h
··· 73 73 74 74 extern void drm_kms_helper_poll_disable(struct drm_device *dev); 75 75 extern void drm_kms_helper_poll_enable(struct drm_device *dev); 76 + extern void drm_kms_helper_poll_enable_locked(struct drm_device *dev); 76 77 77 78 #endif