summaryrefslogtreecommitdiff
path: root/sys/dev/pci
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2013-07-04 09:55:02 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2013-07-04 09:55:02 +0000
commit9cd505ec97dc090540c41b04ea6088cddaeba855 (patch)
tree0431272ce04250c04d348026b5d4ac8a122a4fe2 /sys/dev/pci
parent8036e62f7023b3199685ab39a2c74c222a02fca9 (diff)
ensure single initialization and cleanup of backlight device
from linux 3.8.13
Diffstat (limited to 'sys/dev/pci')
-rw-r--r--sys/dev/pci/drm/i915/intel_display.c5
-rw-r--r--sys/dev/pci/drm/i915/intel_dp.c7
-rw-r--r--sys/dev/pci/drm/i915/intel_lvds.c3
-rw-r--r--sys/dev/pci/drm/i915/intel_panel.c9
4 files changed, 14 insertions, 10 deletions
diff --git a/sys/dev/pci/drm/i915/intel_display.c b/sys/dev/pci/drm/i915/intel_display.c
index 3011e1e0b7b..aa98338629a 100644
--- a/sys/dev/pci/drm/i915/intel_display.c
+++ b/sys/dev/pci/drm/i915/intel_display.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: intel_display.c,v 1.5 2013/04/17 20:04:04 kettenis Exp $ */
+/* $OpenBSD: intel_display.c,v 1.6 2013/07/04 09:55:01 jsg Exp $ */
/*
* Copyright © 2006-2007 Intel Corporation
*
@@ -10027,6 +10027,9 @@ intel_modeset_cleanup(struct drm_device *dev)
flush_scheduled_work();
#endif
+ /* destroy backlight, if any, before the connectors */
+ intel_panel_destroy_backlight(dev);
+
drm_mode_config_cleanup(dev);
}
diff --git a/sys/dev/pci/drm/i915/intel_dp.c b/sys/dev/pci/drm/i915/intel_dp.c
index d8adf2807df..3b3ab3bf108 100644
--- a/sys/dev/pci/drm/i915/intel_dp.c
+++ b/sys/dev/pci/drm/i915/intel_dp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: intel_dp.c,v 1.4 2013/04/08 05:46:12 jsg Exp $ */
+/* $OpenBSD: intel_dp.c,v 1.5 2013/07/04 09:55:01 jsg Exp $ */
/*
* Copyright © 2008 Intel Corporation
*
@@ -2635,17 +2635,14 @@ done:
void
intel_dp_destroy(struct drm_connector *connector)
{
- struct drm_device *dev = connector->dev;
struct intel_dp *intel_dp = intel_attached_dp(connector);
struct intel_connector *intel_connector = to_intel_connector(connector);
if (!IS_ERR_OR_NULL(intel_connector->edid))
free(intel_connector->edid, M_DRM);
- if (is_edp(intel_dp)) {
- intel_panel_destroy_backlight(dev);
+ if (is_edp(intel_dp))
intel_panel_fini(&intel_connector->panel);
- }
#ifdef notyet
drm_sysfs_connector_remove(connector);
diff --git a/sys/dev/pci/drm/i915/intel_lvds.c b/sys/dev/pci/drm/i915/intel_lvds.c
index f598c46d9cf..90e642208db 100644
--- a/sys/dev/pci/drm/i915/intel_lvds.c
+++ b/sys/dev/pci/drm/i915/intel_lvds.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: intel_lvds.c,v 1.2 2013/07/04 09:42:46 jsg Exp $ */
+/* $OpenBSD: intel_lvds.c,v 1.3 2013/07/04 09:55:01 jsg Exp $ */
/*
* Copyright © 2006-2007 Intel Corporation
* Copyright (c) 2006 Dave Airlie <airlied@linux.ie>
@@ -615,7 +615,6 @@ intel_lvds_destroy(struct drm_connector *connector)
if (!IS_ERR_OR_NULL(lvds_connector->base.edid))
free(lvds_connector->base.edid, M_DRM);
- intel_panel_destroy_backlight(connector->dev);
intel_panel_fini(&lvds_connector->base.panel);
#if 0
diff --git a/sys/dev/pci/drm/i915/intel_panel.c b/sys/dev/pci/drm/i915/intel_panel.c
index 07e53e328bd..b386c817a5e 100644
--- a/sys/dev/pci/drm/i915/intel_panel.c
+++ b/sys/dev/pci/drm/i915/intel_panel.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: intel_panel.c,v 1.1 2013/03/18 12:36:52 jsg Exp $ */
+/* $OpenBSD: intel_panel.c,v 1.2 2013/07/04 09:55:01 jsg Exp $ */
/*
* Copyright © 2006-2010 Intel Corporation
* Copyright (c) 2006 Dave Airlie <airlied@linux.ie>
@@ -452,6 +452,9 @@ intel_panel_setup_backlight(struct drm_connector *connector)
intel_panel_init_backlight(dev);
+ if (WARN_ON(dev_priv->backlight))
+ return -ENODEV;
+
memset(&props, 0, sizeof(props));
props.type = BACKLIGHT_RAW;
props.max_brightness = _intel_panel_get_max_backlight(dev);
@@ -478,8 +481,10 @@ void
intel_panel_destroy_backlight(struct drm_device *dev)
{
struct inteldrm_softc *dev_priv = dev->dev_private;
- if (dev_priv->backlight)
+ if (dev_priv->backlight) {
backlight_device_unregister(dev_priv->backlight);
+ dev_priv->backlight = NULL;
+ }
}
#else
int