Commit 3b1c1c11 authored by Matthew Garrett's avatar Matthew Garrett Committed by Eric Anholt

drm/i915: Unregister ACPI video driver when exiting

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: default avatarMatthew Garrett <mjg@redhat.com>
Signed-off-by: default avatarEric Anholt <eric@anholt.net>
parent d770e3cf
......@@ -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);
......@@ -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);
......
......@@ -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 */
......
......@@ -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
......
......@@ -409,7 +409,7 @@ int intel_opregion_init(struct drm_device *dev, int resume)
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;
......
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment