Talk:Tpctl

From ThinkWiki
Revision as of 22:03, 12 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 2.6.14.3 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()
#else

-#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()

#endif

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.

ccb