Commit 2e932b9c authored by Jani Nikula's avatar Jani Nikula

drm/i915/opregion: move acpi notifier to dev_priv

Get rid of the silly static variable.
Reviewed-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: default avatarJani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180613113927.30033-1-jani.nikula@intel.com
parent 6ebb6d8e
...@@ -608,16 +608,16 @@ void intel_opregion_asle_intr(struct drm_i915_private *dev_priv) ...@@ -608,16 +608,16 @@ void intel_opregion_asle_intr(struct drm_i915_private *dev_priv)
#define ACPI_EV_LID (1<<1) #define ACPI_EV_LID (1<<1)
#define ACPI_EV_DOCK (1<<2) #define ACPI_EV_DOCK (1<<2)
static struct intel_opregion *system_opregion; /*
* The only video events relevant to opregion are 0x80. These indicate either a
* docking event, lid switch or display switch request. In Linux, these are
* handled by the dock, button and video drivers.
*/
static int intel_opregion_video_event(struct notifier_block *nb, static int intel_opregion_video_event(struct notifier_block *nb,
unsigned long val, void *data) unsigned long val, void *data)
{ {
/* The only video events relevant to opregion are 0x80. These indicate struct intel_opregion *opregion = container_of(nb, struct intel_opregion,
either a docking event, lid switch or display switch request. In acpi_notifier);
Linux, these are handled by the dock, button and video drivers.
*/
struct acpi_bus_event *event = data; struct acpi_bus_event *event = data;
struct opregion_acpi *acpi; struct opregion_acpi *acpi;
int ret = NOTIFY_OK; int ret = NOTIFY_OK;
...@@ -625,10 +625,7 @@ static int intel_opregion_video_event(struct notifier_block *nb, ...@@ -625,10 +625,7 @@ static int intel_opregion_video_event(struct notifier_block *nb,
if (strcmp(event->device_class, ACPI_VIDEO_CLASS) != 0) if (strcmp(event->device_class, ACPI_VIDEO_CLASS) != 0)
return NOTIFY_DONE; return NOTIFY_DONE;
if (!system_opregion) acpi = opregion->acpi;
return NOTIFY_DONE;
acpi = system_opregion->acpi;
if (event->type == 0x80 && ((acpi->cevt & 1) == 0)) if (event->type == 0x80 && ((acpi->cevt & 1) == 0))
ret = NOTIFY_BAD; ret = NOTIFY_BAD;
...@@ -638,10 +635,6 @@ static int intel_opregion_video_event(struct notifier_block *nb, ...@@ -638,10 +635,6 @@ static int intel_opregion_video_event(struct notifier_block *nb,
return ret; return ret;
} }
static struct notifier_block intel_opregion_notifier = {
.notifier_call = intel_opregion_video_event,
};
/* /*
* Initialise the DIDL field in opregion. This passes a list of devices to * Initialise the DIDL field in opregion. This passes a list of devices to
* the firmware. Values are defined by section B.4.2 of the ACPI specification * the firmware. Values are defined by section B.4.2 of the ACPI specification
...@@ -797,8 +790,8 @@ void intel_opregion_register(struct drm_i915_private *dev_priv) ...@@ -797,8 +790,8 @@ void intel_opregion_register(struct drm_i915_private *dev_priv)
opregion->acpi->csts = 0; opregion->acpi->csts = 0;
opregion->acpi->drdy = 1; opregion->acpi->drdy = 1;
system_opregion = opregion; opregion->acpi_notifier.notifier_call = intel_opregion_video_event;
register_acpi_notifier(&intel_opregion_notifier); register_acpi_notifier(&opregion->acpi_notifier);
} }
if (opregion->asle) { if (opregion->asle) {
...@@ -822,8 +815,8 @@ void intel_opregion_unregister(struct drm_i915_private *dev_priv) ...@@ -822,8 +815,8 @@ void intel_opregion_unregister(struct drm_i915_private *dev_priv)
if (opregion->acpi) { if (opregion->acpi) {
opregion->acpi->drdy = 0; opregion->acpi->drdy = 0;
system_opregion = NULL; unregister_acpi_notifier(&opregion->acpi_notifier);
unregister_acpi_notifier(&intel_opregion_notifier); opregion->acpi_notifier.notifier_call = NULL;
} }
/* just clear all opregion memory pointers now */ /* just clear all opregion memory pointers now */
......
...@@ -49,6 +49,7 @@ struct intel_opregion { ...@@ -49,6 +49,7 @@ struct intel_opregion {
u32 vbt_size; u32 vbt_size;
u32 *lid_state; u32 *lid_state;
struct work_struct asle_work; struct work_struct asle_work;
struct notifier_block acpi_notifier;
}; };
#define OPREGION_SIZE (8 * 1024) #define OPREGION_SIZE (8 * 1024)
......
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