forked from Minki/linux
drm/fbdev-helper: Grab mode_config.mutex in drm_fb_helper_single_add_all_connectors
This is now truly only duct-tape to keep locking checks happy since calling this function when hpd or polling are already enabled is a bug. The fbdev helper can't cope with hotplug changes yet at this point, only after that. Otoh a bit more robustness in this function can't hurt, and with this fbdev can actually cope with hotplug changes. And it's also more consistent with the connector hotadd/remove dp mst needs to do. Therefore document this as new official behavior. Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
This commit is contained in:
parent
8c4ccc4ab6
commit
169faecadd
@ -89,8 +89,9 @@ static LIST_HEAD(kernel_fb_helper_list);
|
|||||||
* connectors to the fbdev, e.g. if some are reserved for special purposes or
|
* connectors to the fbdev, e.g. if some are reserved for special purposes or
|
||||||
* not adequate to be used for the fbcon.
|
* not adequate to be used for the fbcon.
|
||||||
*
|
*
|
||||||
* Since this is part of the initial setup before the fbdev is published, no
|
* This function is protected against concurrent connector hotadds/removals
|
||||||
* locking is required.
|
* using drm_fb_helper_add_one_connector() and
|
||||||
|
* drm_fb_helper_remove_one_connector().
|
||||||
*/
|
*/
|
||||||
int drm_fb_helper_single_add_all_connectors(struct drm_fb_helper *fb_helper)
|
int drm_fb_helper_single_add_all_connectors(struct drm_fb_helper *fb_helper)
|
||||||
{
|
{
|
||||||
@ -98,6 +99,7 @@ int drm_fb_helper_single_add_all_connectors(struct drm_fb_helper *fb_helper)
|
|||||||
struct drm_connector *connector;
|
struct drm_connector *connector;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
mutex_lock(&dev->mode_config.mutex);
|
||||||
drm_for_each_connector(connector, dev) {
|
drm_for_each_connector(connector, dev) {
|
||||||
struct drm_fb_helper_connector *fb_helper_connector;
|
struct drm_fb_helper_connector *fb_helper_connector;
|
||||||
|
|
||||||
@ -108,6 +110,7 @@ int drm_fb_helper_single_add_all_connectors(struct drm_fb_helper *fb_helper)
|
|||||||
fb_helper_connector->connector = connector;
|
fb_helper_connector->connector = connector;
|
||||||
fb_helper->connector_info[fb_helper->connector_count++] = fb_helper_connector;
|
fb_helper->connector_info[fb_helper->connector_count++] = fb_helper_connector;
|
||||||
}
|
}
|
||||||
|
mutex_unlock(&dev->mode_config.mutex);
|
||||||
return 0;
|
return 0;
|
||||||
fail:
|
fail:
|
||||||
for (i = 0; i < fb_helper->connector_count; i++) {
|
for (i = 0; i < fb_helper->connector_count; i++) {
|
||||||
@ -115,6 +118,8 @@ fail:
|
|||||||
fb_helper->connector_info[i] = NULL;
|
fb_helper->connector_info[i] = NULL;
|
||||||
}
|
}
|
||||||
fb_helper->connector_count = 0;
|
fb_helper->connector_count = 0;
|
||||||
|
mutex_unlock(&dev->mode_config.mutex);
|
||||||
|
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(drm_fb_helper_single_add_all_connectors);
|
EXPORT_SYMBOL(drm_fb_helper_single_add_all_connectors);
|
||||||
|
Loading…
Reference in New Issue
Block a user