From 4243c0cee4ed36b04dfecdeb7763399ef1cf4bf3 Mon Sep 17 00:00:00 2001
From: Alberto Milone <alberto.milone@canonical.com>
Date: Tue, 7 Jan 2014 15:30:30 +0100
Subject: [PATCH 1/1] nv-acpi.c: add support for Linux 3.13

There's no need to call acpi_os_wait_events_complete() (or its
NVIDIA equivalent) as, in 3.13, acpi_remove_notify_handler() waits
for events to finish.

Furthermore use ACPI_HANDLE() if DEVICE_ACPI_HANDLE() is not
available as per commit 3a83f992490f8235661b768e53bd5f14915420ac
---
 nv-acpi.c |    8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/nv-acpi.c b/nv-acpi.c
index b0138cd..1ee05bd 100644
--- a/nv-acpi.c
+++ b/nv-acpi.c
@@ -48,6 +48,12 @@ static const struct acpi_device_id nv_video_device_ids[] = {
 };
 #endif
 
+#ifndef DEVICE_ACPI_HANDLE
+#ifdef ACPI_HANDLE
+#define DEVICE_ACPI_HANDLE ACPI_HANDLE
+#endif
+#endif
+
 static struct acpi_driver *nv_acpi_driver;
 static acpi_handle nvif_handle = NULL;
 static acpi_handle nvif_parent_gpu_handle  = NULL;
@@ -303,7 +309,9 @@ static int nv_acpi_remove(struct acpi_device *device, int type)
 
     if (pNvAcpiObject->notify_handler_installed)
     {
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 13, 0)
         NV_ACPI_OS_WAIT_EVENTS_COMPLETE();
+#endif
 
         // remove event notifier
         status = acpi_remove_notify_handler(device->handle, ACPI_DEVICE_NOTIFY, nv_acpi_event);
-- 
1.7.9.5

