From: Geert.Uytterhoeven@thomas.kotnet.org
Date: Thu, 22 May 1997 20:49:52 +0200 (MET DST)
To: Linux/m68k <linux-m68k@phil.uni-sb.de>
Subject: L68K: Keyboard cleanup: waste less precious memory
Sender: owner-linux-m68k@phil.uni-sb.de
Reply-To: Geert Uytterhoeven <Geert.Uytterhoeven@cs.kuleuven.ac.be>


We can save another 256 bytes by releasing {ami,ata}plain_map[] after having
copied it to plain_map[].

--- linux-2.1.39/arch/m68k/amiga/amikeyb.c.orig	Mon May 19 12:50:58 1997
+++ linux-2.1.39/arch/m68k/amiga/amikeyb.c	Thu May 22 20:12:40 1997
@@ -36,7 +36,7 @@
 #define BREAK_MASK	(0x80)
 #define RESET_WARNING	(0xf0)	/* before rotation */
 
-static u_short amiplain_map[NR_KEYS] = {
+static u_short amiplain_map[NR_KEYS] __initdata = {
 	0xf060, 0xf031, 0xf032, 0xf033, 0xf034, 0xf035, 0xf036, 0xf037,
 	0xf038, 0xf039, 0xf030, 0xf02d, 0xf03d, 0xf05c, 0xf200, 0xf300,
 	0xfb71, 0xfb77, 0xfb65, 0xfb72, 0xfb74, 0xfb79, 0xfb75, 0xfb69,
@@ -303,14 +303,13 @@
         return -EIO;
 
     /* setup key map */
-    key_maps[0]  = amiplain_map;
+    memcpy(plain_map, amiplain_map, sizeof(plain_map));
     key_maps[1]  = amishift_map;
     key_maps[2]  = amialtgr_map;
     key_maps[4]  = amictrl_map;
     key_maps[5]  = amishift_ctrl_map;
     key_maps[8]  = amialt_map;
     key_maps[12] = amictrl_alt_map;
-    memcpy(plain_map, amiplain_map, sizeof(plain_map));
     keymap_count = 7;
 
     /*
--- linux-2.1.39/arch/m68k/atari/atakeyb.c.orig	Sun May 18 23:08:54 1997
+++ linux-2.1.39/arch/m68k/atari/atakeyb.c	Thu May 22 20:14:07 1997
@@ -99,7 +99,7 @@
  *  - Keypad Left/Right Parenthesis mapped to new K_PPAREN[LR]
  */
 
-static u_short ataplain_map[NR_KEYS] = {
+static u_short ataplain_map[NR_KEYS] = __initdata {
 	0xf200, 0xf01b, 0xf031, 0xf032, 0xf033, 0xf034, 0xf035, 0xf036,
 	0xf037, 0xf038, 0xf039, 0xf030, 0xf02d, 0xf03d, 0xf008, 0xf009,
 	0xfb71, 0xfb77, 0xfb65, 0xfb72, 0xfb74, 0xfb79, 0xfb75, 0xfb69,
@@ -420,11 +420,11 @@
 		     * make codes instead. Therefore, simply ignore
 		     * break_flag...
 		     * */
-		    int keyval = ataplain_map[scancode], keytyp;
+		    int keyval = plain_map[scancode], keytyp;
 		    
 		    set_bit( scancode, broken_keys );
 		    self_test_last_rcv = jiffies;
-		    keyval = ataplain_map[scancode];
+		    keyval = plain_map[scancode];
 		    keytyp = KTYP(keyval) - 0xf0;
 		    keyval = KVAL(keyval);
 		    
@@ -808,7 +808,7 @@
 __initfunc(int atari_keyb_init(void))
 {
     /* setup key map */
-    key_maps[0]  = ataplain_map;
+    memcpy (plain_map, ataplain_map, sizeof(plain_map));
     key_maps[1]  = atashift_map;
     key_maps[2]  = 0; /* ataaltgr_map */
     key_maps[4]  = atactrl_map;
@@ -817,7 +817,6 @@
     key_maps[9]  = atashift_alt_map;
     key_maps[12] = atactrl_alt_map;
     key_maps[13] = atashift_ctrl_alt_map;
-    memcpy (plain_map, ataplain_map, sizeof(plain_map));
     keymap_count = 8;
 
     /* say that we don't have an AltGr key */


Greetings,

						Geert

--
Geert Uytterhoeven                   Geert.Uytterhoeven@thomas.kotnet.org
Linux/m68k on Amiga, Wavelets        http://www.cs.kuleuven.ac.be/~geert/
KotNET@Thomas Network Administration -- Make you bed part of Cyberspace!!


