Re: [RESUBMIT] [PATCH] Use BIOS Keyboard variable to set Numlock

From: H. Peter Anvin
Date: Thu Mar 01 2012 - 15:55:40 EST


On 03/01/2012 11:42 AM, Joshua C. wrote:
diff --git a/arch/x86/include/asm/kbdleds.h b/arch/x86/include/asm/kbdleds.h
new file mode 100644
index 0000000..1446a65
--- /dev/null
+++ b/arch/x86/include/asm/kbdleds.h
@@ -0,0 +1,41 @@
+#ifndef _ASM_X86_KBDLEDS_H
+#define _ASM_X86_KBDLEDS_H
+
+/*
+ * Some laptops take the 789uiojklm,. keys as number pad when NumLock is on.
+ * This seems a good reason to start with NumLock off. On HIL keyboards
+ * of PARISC machines however there is no NumLock key and everyone expects
+ * the keypad to be used for numbers. That's why on X86 we ask the bios for
+ * the correct state.
+ */
+
+#ifdef CONFIG_X86
+
+#include<asm/setup.h>
+
+static inline int kbd_defleds(void)
+{
+ return boot_params.kbd_status& 0x20 ? (1<< VC_NUMLOCK) : 0;
+}
+
+#elif defined(CONFIG_PARISC)
^^^^^^^^^^^^^

Sorry, you can't put non-x86 code in arch/x86. There are two way to distribute this kind of stuff into arch directories:

1. You can define an ARCH_ symbol which indicates that <asm/kbdleds.h> is available; otherwise use the fallback routine;

2. You can define it in a .c file as an actual function in the affected architectures (x86 and parisc here) and then define it as a weak symbol (grep for __weak) in the common code.

If you don't want to bite off this distribution I can understand it (although it's not up to me, technically, since I'm not the maintainer of the vt subsystem) but if so leave this as an inline in a common place.

-hpa
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/