Signed-off-by: Francisco Jerez <currojerez at riseup.net>
---
 drivers/gpu/drm/drm_fb_helper.c |   14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index 6a5e403..4d608b7 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -1449,6 +1449,8 @@ bool drm_fb_helper_initial_config(struct drm_fb_helper 
*fb_helper, int bpp_sel)
        struct drm_device *dev = fb_helper->dev;
        int count = 0;

+       mutex_lock(&dev->mode_config.mutex);
+
        /* disable all the possible outputs/crtcs before entering KMS mode */
        drm_helper_disable_unused_functions(fb_helper->dev);

@@ -1465,19 +1467,23 @@ bool drm_fb_helper_initial_config(struct drm_fb_helper 
*fb_helper, int bpp_sel)
        }
        drm_setup_crtcs(fb_helper);

+       mutex_unlock(&dev->mode_config.mutex);
+
        return drm_fb_helper_single_fb_probe(fb_helper, bpp_sel);
 }
 EXPORT_SYMBOL(drm_fb_helper_initial_config);

 bool drm_fb_helper_hotplug_event(struct drm_fb_helper *fb_helper)
 {
+       struct drm_device *dev = fb_helper->dev;
        int count = 0;
        u32 max_width, max_height, bpp_sel;
        bool bound = false, crtcs_bound = false;
        struct drm_crtc *crtc;

+       mutex_lock(&dev->mode_config.mutex);
        if (!fb_helper->fb)
-               return false;
+               goto fail;

        list_for_each_entry(crtc, &fb_helper->dev->mode_config.crtc_list, head) 
{
                if (crtc->fb)
@@ -1488,7 +1494,7 @@ bool drm_fb_helper_hotplug_event(struct drm_fb_helper 
*fb_helper)

        if (!bound && crtcs_bound) {
                fb_helper->delayed_hotplug = true;
-               return false;
+               goto fail;
        }
        DRM_DEBUG_KMS("\n");

@@ -1500,7 +1506,11 @@ bool drm_fb_helper_hotplug_event(struct drm_fb_helper 
*fb_helper)
                                                    max_height);
        drm_setup_crtcs(fb_helper);

+       mutex_unlock(&dev->mode_config.mutex);
        return drm_fb_helper_single_fb_probe(fb_helper, bpp_sel);
+fail:
+       mutex_unlock(&dev->mode_config.mutex);
+       return false;
 }
 EXPORT_SYMBOL(drm_fb_helper_hotplug_event);

-- 
1.6.4.4

Reply via email to