drm/i915: Unregister ACPI video driver when exiting
authorMatthew Garrett <mjg59@srcf.ucam.org>
Wed, 1 Apr 2009 18:52:29 +0000 (19:52 +0100)
committerEric Anholt <eric@anholt.net>
Fri, 17 Apr 2009 20:31:07 +0000 (13:31 -0700)
The i915 DRM triggers registration of the ACPI video driver on load. It
should unregister it at unload in order to avoid generating backtraces on
being reloaded.

Signed-off-by: Matthew Garrett <mjg@redhat.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
drivers/acpi/video.c
drivers/gpu/drm/i915/i915_dma.c
drivers/gpu/drm/i915/i915_drv.c
drivers/gpu/drm/i915/i915_drv.h
drivers/gpu/drm/i915/i915_opregion.c
include/acpi/video.h

index cd4fb75..8961e61 100644 (file)
@@ -2293,7 +2293,7 @@ static int __init acpi_video_init(void)
        return acpi_video_register();
 }
 
-static void __exit acpi_video_exit(void)
+void __exit acpi_video_exit(void)
 {
 
        acpi_bus_unregister_driver(&acpi_video_bus);
@@ -2302,6 +2302,7 @@ static void __exit acpi_video_exit(void)
 
        return;
 }
+EXPORT_SYMBOL(acpi_video_exit);
 
 module_init(acpi_video_init);
 module_exit(acpi_video_exit);
index a000cf0..2726143 100644 (file)
@@ -1232,7 +1232,7 @@ int i915_driver_unload(struct drm_device *dev)
        if (dev_priv->regs != NULL)
                iounmap(dev_priv->regs);
 
-       intel_opregion_free(dev);
+       intel_opregion_free(dev, 0);
 
        if (drm_core_check_feature(dev, DRIVER_MODESET)) {
                intel_modeset_cleanup(dev);
index 6503e22..98560e1 100644 (file)
@@ -77,7 +77,7 @@ static int i915_suspend(struct drm_device *dev, pm_message_t state)
                drm_irq_uninstall(dev);
        }
 
-       intel_opregion_free(dev);
+       intel_opregion_free(dev, 1);
 
        if (state.event == PM_EVENT_SUSPEND) {
                /* Shut down the device */
index 473a8f7..d7471fe 100644 (file)
@@ -674,12 +674,12 @@ extern int i915_restore_state(struct drm_device *dev);
 #ifdef CONFIG_ACPI
 /* i915_opregion.c */
 extern int intel_opregion_init(struct drm_device *dev, int resume);
-extern void intel_opregion_free(struct drm_device *dev);
+extern void intel_opregion_free(struct drm_device *dev, int suspend);
 extern void opregion_asle_intr(struct drm_device *dev);
 extern void opregion_enable_asle(struct drm_device *dev);
 #else
 static inline int intel_opregion_init(struct drm_device *dev, int resume) { return 0; }
-static inline void intel_opregion_free(struct drm_device *dev) { return; }
+static inline void intel_opregion_free(struct drm_device *dev, int suspend) { return; }
 static inline void opregion_asle_intr(struct drm_device *dev) { return; }
 static inline void opregion_enable_asle(struct drm_device *dev) { return; }
 #endif
index 8dc1fd3..3eceefe 100644 (file)
@@ -409,7 +409,7 @@ err_out:
        return err;
 }
 
-void intel_opregion_free(struct drm_device *dev)
+void intel_opregion_free(struct drm_device *dev, int suspend)
 {
        struct drm_i915_private *dev_priv = dev->dev_private;
        struct intel_opregion *opregion = &dev_priv->opregion;
@@ -417,6 +417,9 @@ void intel_opregion_free(struct drm_device *dev)
        if (!opregion->enabled)
                return;
 
+       if (!suspend)
+               acpi_video_exit();
+
        opregion->acpi->drdy = 0;
 
        system_opregion = NULL;
index f0275bb..af6fe95 100644 (file)
@@ -3,8 +3,10 @@
 
 #if (defined CONFIG_ACPI_VIDEO || defined CONFIG_ACPI_VIDEO_MODULE)
 extern int acpi_video_register(void);
+extern int acpi_video_exit(void);
 #else
 static inline int acpi_video_register(void) { return 0; }
+static inline void acpi_video_exit(void) { return; }
 #endif
 
 #endif