I especially experience problems compiling it on Fedora 16 kernel 3.2.7-1.fc16.i686 but as far as I can see, others people have the same issue on Fedora 15 and other distros too.
For the ones who does not know, this module is giving you an interface to the shock sensor which can be used from hdapsd to protect your HDD from shocks and also gives you some very cool features to control the charge/discharge of your battery and presents you some very useful information about the battery, which can be found in /proc and /sys
Now back to the problem.
When I try to compile the kernel module, version tp_smapi-0.40, I get the following error:
===================================================
make -C /lib/modules/3.2.7-1.fc16.i686/build M=/usr/src/tp_smapi-0.40 O=/lib/modules/3.2.7-1.fc16.i686/build modules make[1]: Entering directory `/usr/src/kernels/3.2.7-1.fc16.i686' CC [M] /usr/src/tp_smapi-0.40/thinkpad_ec.o /usr/src/tp_smapi-0.40/thinkpad_ec.c:91:8: warning: type defaults to ‘int’ in declaration of ‘DECLARE_MUTEX’ [-Wimplicit-int] /usr/src/tp_smapi-0.40/thinkpad_ec.c:91:1: warning: parameter names (without types) in function declaration [enabled by default] /usr/src/tp_smapi-0.40/thinkpad_ec.c: In function ‘thinkpad_ec_lock’: /usr/src/tp_smapi-0.40/thinkpad_ec.c:108:28: error: ‘thinkpad_ec_mutex’ undeclared (first use in this function) /usr/src/tp_smapi-0.40/thinkpad_ec.c:108:28: note: each undeclared identifier is reported only once for each function it appears in /usr/src/tp_smapi-0.40/thinkpad_ec.c: In function ‘thinkpad_ec_try_lock’: /usr/src/tp_smapi-0.40/thinkpad_ec.c:122:23: error: ‘thinkpad_ec_mutex’ undeclared (first use in this function) /usr/src/tp_smapi-0.40/thinkpad_ec.c: In function ‘thinkpad_ec_unlock’: /usr/src/tp_smapi-0.40/thinkpad_ec.c:134:6: error: ‘thinkpad_ec_mutex’ undeclared (first use in this function) /usr/src/tp_smapi-0.40/thinkpad_ec.c: At top level: /usr/src/tp_smapi-0.40/thinkpad_ec.c:91:8: warning: ‘DECLARE_MUTEX’ declared ‘static’ but never defined [-Wunused-function] /usr/src/tp_smapi-0.40/thinkpad_ec.c: In function ‘thinkpad_ec_try_lock’: /usr/src/tp_smapi-0.40/thinkpad_ec.c:123:1: warning: control reaches end of non-void function [-Wreturn-type] make[3]: *** [/usr/src/tp_smapi-0.40/thinkpad_ec.o] Error 1 make[2]: *** [_module_/usr/src/tp_smapi-0.40] Error 2 make[1]: *** [sub-make] Error 2 make[1]: Leaving directory `/usr/src/kernels/3.2.7-1.fc16.i686' make: *** [modules] Error 2===================================================
After some digging I found the solution in one forum thread, and the solution is:
Replace all the occurrences of DECLARE_MUTEX with DEFINE_SEMAPHORE, which, at the time I am writing this, are in files:
thinkpad_ec.c on line 91
tp_smapi.c on line 112
For those of you who want a patch:
------------- cut below this line -------------
--- thinkpad_ec.c.orig 2008-12-16 07:03:06.000000000 +0200 +++ thinkpad_ec.c 2012-03-04 22:58:10.409371153 +0200 @@ -88,7 +88,7 @@ #define TPC_PREFETCH_JUNK (INITIAL_JIFFIES+1) /* Ignore prefetch */ /* Locking: */ -static DECLARE_MUTEX(thinkpad_ec_mutex); +static DEFINE_SEMAPHORE(thinkpad_ec_mutex); /* 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? */ --- tp_smapi.c.orig 2008-12-16 07:03:06.000000000 +0200 +++ tp_smapi.c 2012-03-04 22:58:22.074334276 +0200 @@ -109,7 +109,7 @@ #define SMAPI_PORT2 0x4F /* fixed port, meaning unclear */ static unsigned short smapi_port; /* APM control port, normally 0xB2 */ -static DECLARE_MUTEX(smapi_mutex); +static DEFINE_SEMAPHORE(smapi_mutex); /** * find_smapi_port - read SMAPI port from NVRAM-------------- cut above this line ---------------
Get the text, place it in a file, save the file.
change the directory in the source dir:
cd tp_smapi-0.40
apply the patch
patch -p0 < /path/to/the/file/with/the/patch
you can try "make" now.
Load the module and happy shock protecting :)
No comments:
Post a Comment
Comment