Skip to content

Commit

Permalink
drm/i915: Unregister ACPI video driver when exiting
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Eric Anholt <[email protected]>
  • Loading branch information
mjg59 authored and anholt committed Apr 17, 2009
1 parent d770e3c commit 3b1c1c1
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 6 deletions.
3 changes: 2 additions & 1 deletion drivers/acpi/video.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
2 changes: 1 addition & 1 deletion drivers/gpu/drm/i915/i915_dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpu/drm/i915/i915_drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
4 changes: 2 additions & 2 deletions drivers/gpu/drm/i915/i915_drv.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion drivers/gpu/drm/i915/i915_opregion.c
Original file line number Diff line number Diff line change
Expand Up @@ -409,14 +409,17 @@ 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;

if (!opregion->enabled)
return;

if (!suspend)
acpi_video_exit();

opregion->acpi->drdy = 0;

system_opregion = NULL;
Expand Down
2 changes: 2 additions & 0 deletions include/acpi/video.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 3b1c1c1

Please sign in to comment.