drm/i915: Move backlight unregistration to connector unregistration
authorChris Wilson <chris@chris-wilson.co.uk>
Fri, 17 Jun 2016 10:40:34 +0000 (11:40 +0100)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Sun, 19 Jun 2016 08:39:13 +0000 (10:39 +0200)
Currently the backlight is being unregistered in the unload phase (after
the display and its objects are unregistered). Move the backlight
unregistration into the analogous phase by performing it from the
connector unregistration, just prior to its deletion.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Jani Nikula <jani.nikula@linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1466160034-12173-3-git-send-email-chris@chris-wilson.co.uk
drivers/gpu/drm/i915/intel_display.c
drivers/gpu/drm/i915/intel_drv.h
drivers/gpu/drm/i915/intel_panel.c

index e79f87138f904fab707f824971e1a2f38a0526d2..b12085a8bfa6f1385bd76972287a7ae89e0230a9 100644 (file)
@@ -16221,6 +16221,9 @@ void intel_modeset_gem_init(struct drm_device *dev)
 
 void intel_connector_unregister(struct drm_connector *connector)
 {
+       struct intel_connector *intel_connector = to_intel_connector(connector);
+
+       intel_backlight_device_unregister(intel_connector);
        intel_panel_destroy_backlight(connector);
 }
 
@@ -16230,8 +16233,6 @@ void intel_modeset_cleanup(struct drm_device *dev)
 
        intel_disable_gt_powersave(dev_priv);
 
-       intel_backlight_unregister(dev);
-
        /*
         * Interrupts and polling as the first thing to avoid creating havoc.
         * Too much stuff here (turning of connectors, ...) would
index adb63cc1f624a301532bb5c33d053896591144e7..65e60ff3b5530962d17558bf67acec3096a7c542 100644 (file)
@@ -1488,7 +1488,14 @@ extern struct drm_display_mode *intel_find_panel_downclock(
                                struct drm_display_mode *fixed_mode,
                                struct drm_connector *connector);
 void intel_backlight_register(struct drm_device *dev);
-void intel_backlight_unregister(struct drm_device *dev);
+
+#if IS_ENABLED(CONFIG_BACKLIGHT_CLASS_DEVICE)
+void intel_backlight_device_unregister(struct intel_connector *connector);
+#else /* CONFIG_BACKLIGHT_CLASS_DEVICE */
+static inline void intel_backlight_device_unregister(struct intel_connector *connector)
+{
+}
+#endif /* CONFIG_BACKLIGHT_CLASS_DEVICE */
 
 
 /* intel_psr.c */
index f0b1602c32584a1a7bb15210d99d422fd1ecf3e2..bf721781c259d0e1ba716335680b46f92a28b7c1 100644 (file)
@@ -1216,7 +1216,7 @@ static int intel_backlight_device_register(struct intel_connector *connector)
        return 0;
 }
 
-static void intel_backlight_device_unregister(struct intel_connector *connector)
+void intel_backlight_device_unregister(struct intel_connector *connector)
 {
        struct intel_panel *panel = &connector->panel;
 
@@ -1230,9 +1230,6 @@ static int intel_backlight_device_register(struct intel_connector *connector)
 {
        return 0;
 }
-static void intel_backlight_device_unregister(struct intel_connector *connector)
-{
-}
 #endif /* CONFIG_BACKLIGHT_CLASS_DEVICE */
 
 /*
@@ -1820,11 +1817,3 @@ void intel_backlight_register(struct drm_device *dev)
        for_each_intel_connector(dev, connector)
                intel_backlight_device_register(connector);
 }
-
-void intel_backlight_unregister(struct drm_device *dev)
-{
-       struct intel_connector *connector;
-
-       for_each_intel_connector(dev, connector)
-               intel_backlight_device_unregister(connector);
-}