@@ -115,27 +115,24 @@ static int drm_helper_probe_add_cmdline_mode(struct drm_connector *connector)
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 ;
138
133
134
+ WARN_ON (!mutex_is_locked (& dev -> mode_config .mutex ));
135
+
139
136
if (!dev -> mode_config .poll_enabled || !drm_kms_helper_poll )
140
137
return ;
141
138
@@ -163,7 +160,7 @@ void drm_kms_helper_poll_enable(struct drm_device *dev)
163
160
if (poll )
164
161
schedule_delayed_work (& dev -> mode_config .output_poll_work , delay );
165
162
}
166
- EXPORT_SYMBOL (drm_kms_helper_poll_enable );
163
+ EXPORT_SYMBOL (drm_kms_helper_poll_enable_locked );
167
164
168
165
static enum drm_connector_status
169
166
drm_connector_detect (struct drm_connector * connector , bool force )
@@ -290,7 +287,7 @@ int drm_helper_probe_single_connector_modes(struct drm_connector *connector,
290
287
291
288
/* Re-enable polling in case the global poll config changed. */
292
289
if (drm_kms_helper_poll != dev -> mode_config .poll_running )
293
- drm_kms_helper_poll_enable (dev );
290
+ drm_kms_helper_poll_enable_locked (dev );
294
291
295
292
dev -> mode_config .poll_running = drm_kms_helper_poll ;
296
293
@@ -482,12 +479,8 @@ static void output_poll_execute(struct work_struct *work)
482
479
* This function disables the output polling work.
483
480
*
484
481
* Drivers can call this helper from their device suspend implementation. It is
485
- * not an error to call this even when output polling isn't enabled or already
486
- * disabled. Polling is re-enabled by calling drm_kms_helper_poll_enable().
487
- *
488
- * Note that calls to enable and disable polling must be strictly ordered, which
489
- * is automatically the case when they're only call from suspend/resume
490
- * callbacks.
482
+ * not an error to call this even when output polling isn't enabled or arlready
483
+ * disabled.
491
484
*/
492
485
void drm_kms_helper_poll_disable (struct drm_device * dev )
493
486
{
@@ -497,6 +490,24 @@ void drm_kms_helper_poll_disable(struct drm_device *dev)
497
490
}
498
491
EXPORT_SYMBOL (drm_kms_helper_poll_disable );
499
492
493
+ /**
494
+ * drm_kms_helper_poll_enable - re-enable output polling.
495
+ * @dev: drm_device
496
+ *
497
+ * This function re-enables the output polling work.
498
+ *
499
+ * Drivers can call this helper from their device resume implementation. It is
500
+ * an error to call this when the output polling support has not yet been set
501
+ * up.
502
+ */
503
+ void drm_kms_helper_poll_enable (struct drm_device * dev )
504
+ {
505
+ mutex_lock (& dev -> mode_config .mutex );
506
+ drm_kms_helper_poll_enable_locked (dev );
507
+ mutex_unlock (& dev -> mode_config .mutex );
508
+ }
509
+ EXPORT_SYMBOL (drm_kms_helper_poll_enable );
510
+
500
511
/**
501
512
* drm_kms_helper_poll_init - initialize and enable output polling
502
513
* @dev: drm_device
0 commit comments