tp-smapi (0.40-9) 03_2.6.37-compatibility.patch

Summary

 thinkpad_ec.c |    4 ++++
 tp_smapi.c    |    4 ++++
 2 files changed, 8 insertions(+)

    
download this patch

Patch contents

From: Tanaka Watanabe <hellhound.kerberos@gmail.com>
Date: Thu, 4 Nov 2010 18:06:39 +0900
Subject: use DEFINE_SEMAPHORE in 2.6.37+
License: GPL-2+
Bug-Debian: http://bugs.debian.org/602367

Building tp_smapi against 2.6.37 fails because 'DECLARE_MUTEX'
has been removed in 4882720b267b7b1d1b0ce08334b205f0329d4615
in torvalds/linux-2.6.git. Use DEFINE_SEMAPHORE instead.

diff --git a/thinkpad_ec.c b/thinkpad_ec.c
--- a/thinkpad_ec.c
+++ b/thinkpad_ec.c
@@ -88,7 +88,11 @@ static u64 prefetch_jiffies;
 #define TPC_PREFETCH_JUNK   (INITIAL_JIFFIES+1)   /*   Ignore prefetch */

 /* Locking: */
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,37)
 static DECLARE_MUTEX(thinkpad_ec_mutex);
+#else
+static DEFINE_SEMAPHORE(thinkpad_ec_mutex);
+#endif

 /* Kludge in case the ACPI DSDT reserves the ports we need. */
 static int force_io;    /* Willing to do IO to ports we couldn't reserve? */
diff --git a/tp_smapi.c b/tp_smapi.c
--- a/tp_smapi.c
+++ b/tp_smapi.c
@@ -109,7 +109,11 @@ static struct { u8 rc; char *msg; int re
 #define SMAPI_PORT2 0x4F           /* fixed port, meaning unclear */
 static unsigned short smapi_port;  /* APM control port, normally 0xB2 */

+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,37)
 static DECLARE_MUTEX(smapi_mutex);
+#else
+static DEFINE_SEMAPHORE(smapi_mutex);
+#endif

 /**
  * find_smapi_port - read SMAPI port from NVRAM