From ThinkWiki
Revision as of 01:05, 13 February 2006 by Ccb (Talk | contribs) ("thinkpad" module kernel compatibility)
Jump to: navigation, search

"thinkpad" module kernel compatibility

Ajunge, how do you compile the "thinkpad" module compile on kernel >=2.6.9? The latest thinkpad version (5.8) still uses "get_cpu_ptr" and "set_cpu_ptr", which were removed in 2.6.9.

--Thinker 13:53, 10 Dec 2005 (CET)

The Debian thinkpad-source package in unstable (version 5.8-4) works just fine; I'm compiling it with 2.6.14 without any problems. And get_cpu_ptr is present; it's defined in include/linux/percpu.h.

--TedTso 18:56, 17 Dec 2005 (EDT)

Stock thinkpad_5.8.tar.gz doesn't #include percpu.h anyway, and doesn't compile on vanilla or 2.6.15-rc5. Maybe Debian patched it? In that case the article page should ref the patch.

--Thinker 11:50, 18 Dec 2005 (CET)

Oops, my mistake. I forgot that I had patched my copy of thinkpadpm.c. I replaced the use of get_cpu_ptr and set_cpu_ptr with get_cpu_val() and set_cpu_val(). I just double checked, and it tpctl is working for me on 2.6.15-rc5.

--TedTso 14:45, 19 Dec 2005 (EDT)

Care to send a patch? It would be useful on the article page, and maybe we can get it into upstream.

--Thinker 23:11, 19 Dec 2005 (CET)

This is the patch I'd been using up to 2.6.15:

[root@ccb-thinkpad thinkpad-5.8]# more thinkpad-2.6-per_cpu.patch --- 2.6/drivers/thinkpadpm.c.ccb 2005-07-02 01:02:47.000000000 -0400 +++ 2.6/drivers/thinkpadpm.c 2005-07-02 01:13:20.000000000 -0400 @@ -171,8 +171,8 @@

#define get_gdt_table()        (cpu_gdt_table[get_cpu()])
#define put_gdt_table()        put_cpu()

-#define get_gdt_table() (get_cpu_ptr(cpu_gdt_table)) -#define put_gdt_table() put_cpu_ptr(cpu_gdt_table) +#define get_gdt_table() per_cpu(cpu_gdt_table, smp_processor_id()) +#define put_gdt_table() put_cpu()


Sounds like TedTso took a slightly different approach.

As it stands, it won't compile since the release of 2.6.15 because the once global pm_active variable in the kernel is no longer visible.


--- Sorry for the ugliness of that patch. Do a wiki edit on the page and you'll see it on all of it's Courier10 glory.

For 2.6.15: some of the definitions have been split off into a new header file. You'll have to edit thinkpadpm.c and add "#include <linux/pm_legacy.h>" right after the include for pm.h to get it to compile.