@@ -1285,8 +1285,22 @@ static int intel_backlight_device_update_status(struct backlight_device *bd)
struct intel_connector *connector = bl_get_data(bd);
struct intel_panel *panel = &connector->panel;
struct drm_device *dev = connector->base.dev;
+ int value;
+
+ /*
+ * Before we attempt to grab the connection mutex, cache the incoming
+ * brightness value. If we're in the middle of a modeset,
+ * intel_panel_enable_backlight will be called and could pave over
+ * props.brightness. This is still racey, but the race window should be
+ * significantly smaller and reflects the inherent raceyness of the
+ * updating props.brightness outside of bd->op_lock.
+ */
+ value = bd->props.brightness;
drm_modeset_lock(&dev->mode_config.connection_mutex, NULL);
+
+ bd->props.brightness = value;
+
DRM_DEBUG_KMS("updating intel_backlight, brightness=%d/%d\n",
bd->props.brightness, bd->props.max_brightness);
intel_panel_set_backlight(connector->base.state, bd->props.brightness,