OSDN Git Service

drm: drop error code for drm_helper_resume_force_mode
authorDaniel Vetter <daniel.vetter@ffwll.ch>
Thu, 23 Jan 2014 21:28:30 +0000 (22:28 +0100)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Thu, 13 Mar 2014 11:48:48 +0000 (12:48 +0100)
No driver cares, and it should generally work. Add a big comment
when drivers can't use this for recompense.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
drivers/gpu/drm/drm_crtc_helper.c
include/drm/drm_crtc_helper.h

index 44d50f5..0f60150 100644 (file)
@@ -941,13 +941,25 @@ EXPORT_SYMBOL(drm_helper_mode_fill_fb_struct);
  * force-restore the mode setting configuration e.g. on resume or when something
  * else might have trampled over the hw state (like some overzealous old BIOSen
  * tended to do).
+ *
+ * This helper doesn't provide a error return value since restoring the old
+ * config should never fail due to resource allocation issues since the driver
+ * has successfully set the restored configuration already. Hence this should
+ * boil down to the equivalent of a few dpms on calls, which also don't provide
+ * an error code.
+ *
+ * Drivers where simply restoring an old configuration again might fail (e.g.
+ * due to slight differences in allocating shared resources when the
+ * configuration is restored in a different order than when userspace set it up)
+ * need to use their own restore logic.
  */
-int drm_helper_resume_force_mode(struct drm_device *dev)
+void drm_helper_resume_force_mode(struct drm_device *dev)
 {
        struct drm_crtc *crtc;
        struct drm_encoder *encoder;
        struct drm_crtc_helper_funcs *crtc_funcs;
-       int ret, encoder_dpms;
+       int encoder_dpms;
+       bool ret;
 
        list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
 
@@ -957,6 +969,7 @@ int drm_helper_resume_force_mode(struct drm_device *dev)
                ret = drm_crtc_helper_set_mode(crtc, &crtc->mode,
                                               crtc->x, crtc->y, crtc->fb);
 
+               /* Restoring the old config should never fail! */
                if (ret == false)
                        DRM_ERROR("failed to set mode on crtc %p\n", crtc);
 
@@ -979,9 +992,9 @@ int drm_helper_resume_force_mode(struct drm_device *dev)
                                                     drm_helper_choose_crtc_dpms(crtc));
                }
        }
+
        /* disable the unused connectors while restoring the modesetting */
        drm_helper_disable_unused_functions(dev);
-       return 0;
 }
 EXPORT_SYMBOL(drm_helper_resume_force_mode);
 
index b6c1798..0bb34ca 100644 (file)
@@ -160,7 +160,7 @@ static inline void drm_connector_helper_add(struct drm_connector *connector,
        connector->helper_private = (void *)funcs;
 }
 
-extern int drm_helper_resume_force_mode(struct drm_device *dev);
+extern void drm_helper_resume_force_mode(struct drm_device *dev);
 extern void drm_kms_helper_poll_init(struct drm_device *dev);
 extern void drm_kms_helper_poll_fini(struct drm_device *dev);
 extern bool drm_helper_hpd_irq_event(struct drm_device *dev);