Skip to content

Commit 4b812d4

Browse files
Tanaka Watanabeevgeni
authored andcommitted
use DEFINE_SEMAPHORE in 2.6.37+
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.
1 parent ecd90e2 commit 4b812d4

2 files changed

Lines changed: 8 additions & 0 deletions

File tree

thinkpad_ec.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,11 @@ static u64 prefetch_jiffies; /* time of prefetch, or: */
8888
#define TPC_PREFETCH_JUNK (INITIAL_JIFFIES+1) /* Ignore prefetch */
8989

9090
/* Locking: */
91+
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,37)
9192
static DECLARE_MUTEX(thinkpad_ec_mutex);
93+
#else
94+
static DEFINE_SEMAPHORE(thinkpad_ec_mutex);
95+
#endif
9296

9397
/* Kludge in case the ACPI DSDT reserves the ports we need. */
9498
static int force_io; /* Willing to do IO to ports we couldn't reserve? */

tp_smapi.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,11 @@ static struct { u8 rc; char *msg; int ret; } smapi_retcode[] =
109109
#define SMAPI_PORT2 0x4F /* fixed port, meaning unclear */
110110
static unsigned short smapi_port; /* APM control port, normally 0xB2 */
111111

112+
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,37)
112113
static DECLARE_MUTEX(smapi_mutex);
114+
#else
115+
static DEFINE_SEMAPHORE(smapi_mutex);
116+
#endif
113117

114118
/**
115119
* find_smapi_port - read SMAPI port from NVRAM

0 commit comments

Comments
 (0)