[PATCH] keyboard.c: fix some problems found by checkpatch.pl

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



keyboard.c: fix some problems found by checkpatch.pl

fix some problems found by checkpatch.pl:
- remove ctrl_alt_del prototype (linux/reboot.h: included 2 lines above)
- wrap lines longer than 80 characters
- change spaces to tabs
- add spaces after commas
- remove unneeded variable initializations
- remove assignement from if condition

Signed-off-by: Marcin Ślusarz <marcin.slusarz@xxxxxxxxx>

diff --git a/drivers/char/keyboard.c b/drivers/char/keyboard.c
index fc54d23..e473b56 100644
--- a/drivers/char/keyboard.c
+++ b/drivers/char/keyboard.c
@@ -44,8 +44,6 @@
 #include <linux/reboot.h>
 #include <linux/notifier.h>

-extern void ctrl_alt_del(void);
-
 /*
  * Exported functions/variables
  */
@@ -55,11 +53,12 @@ extern void ctrl_alt_del(void);
 /*
  * 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.
+ * of PARISC machines however there is no NumLock key and everyone expects
+ * the keypad to be used for numbers.
  */

-#if defined(CONFIG_PARISC) && (defined(CONFIG_KEYBOARD_HIL) || defined(CONFIG_KEYBOARD_HIL_OLD))
+#if defined(CONFIG_PARISC) && \
+    (defined(CONFIG_KEYBOARD_HIL) || defined(CONFIG_KEYBOARD_HIL_OLD))
 #define KBD_DEFLEDS (1 << VC_NUMLOCK)
 #else
 #define KBD_DEFLEDS 0
@@ -122,21 +121,21 @@ struct vt_spawn_console vt_spawn_con = {
  * Variables exported for vt.c
  */

-int shift_state = 0;
+int shift_state;

 /*
  * Internal Data.
  */

 static struct input_handler kbd_handler;
-static unsigned long key_down[BITS_TO_LONGS(KEY_CNT)];	/* keyboard key bitmap */
-static unsigned char shift_down[NR_SHIFT];		/* shift state counters.. */
+static unsigned long key_down[BITS_TO_LONGS(KEY_CNT)]; /* keyboard key bitmap */
+static unsigned char shift_down[NR_SHIFT];          /* shift state counters.. */
 static int dead_key_next;
-static int npadch = -1;					/* -1 or number assembled on pad */
+static int npadch = -1;                      /* -1 or number assembled on pad */
 static unsigned int diacr;
-static char rep;					/* flag telling character repeat */
+static char rep;                             /* flag telling character repeat */

-static unsigned char ledstate = 0xff;			/* undefined */
+static unsigned char ledstate = 0xff;                            /* undefined */
 static unsigned char ledioctl;

 static struct ledptr {
@@ -149,13 +148,13 @@ static struct ledptr {

 #ifdef CONFIG_MAGIC_SYSRQ
 unsigned char kbd_sysrq_xlate[KEY_MAX + 1] =
-        "\000\0331234567890-=\177\t"                    /* 0x00 - 0x0f */
-        "qwertyuiop[]\r\000as"                          /* 0x10 - 0x1f */
-        "dfghjkl;'`\000\\zxcv"                          /* 0x20 - 0x2f */
-        "bnm,./\000*\000 \000\201\202\203\204\205"      /* 0x30 - 0x3f */
-        "\206\207\210\211\212\000\000789-456+1"         /* 0x40 - 0x4f */
-        "230\177\000\000\213\214\000\000\000\000\000\000\000\000\000\000" /* 0x50 - 0x5f */
-        "\r\000/";                                      /* 0x60 - 0x6f */
+	"\000\0331234567890-=\177\t"                    /* 0x00 - 0x0f */
+	"qwertyuiop[]\r\000as"                          /* 0x10 - 0x1f */
+	"dfghjkl;'`\000\\zxcv"                          /* 0x20 - 0x2f */
+	"bnm,./\000*\000 \000\201\202\203\204\205"      /* 0x30 - 0x3f */
+	"\206\207\210\211\212\000\000789-456+1"         /* 0x40 - 0x4f */
+	"230\177\000\000\213\214\000\000\000\000\000\000\000\000\000\000" /* 0x50 - 0x5f */
+	"\r\000/";                                      /* 0x60 - 0x6f */
 static int sysrq_down;
 static int sysrq_alt_use;
 #endif
@@ -340,8 +339,8 @@ static void to_utf8(struct vc_data *vc, uint c)
 		/* 110***** 10****** */
 		put_queue(vc, 0xc0 | (c >> 6));
 		put_queue(vc, 0x80 | (c & 0x3f));
-    	} else if (c < 0x10000) {
-	       	if (c >= 0xD800 && c < 0xE000)
+	} else if (c < 0x10000) {
+		if (c >= 0xD800 && c < 0xE000)
 			return;
 		if (c == 0xFFFF)
 			return;
@@ -349,7 +348,7 @@ static void to_utf8(struct vc_data *vc, uint c)
 		put_queue(vc, 0xe0 | (c >> 12));
 		put_queue(vc, 0x80 | ((c >> 6) & 0x3f));
 		put_queue(vc, 0x80 | (c & 0x3f));
-    	} else if (c < 0x110000) {
+	} else if (c < 0x110000) {
 		/* 11110*** 10****** 10****** 10****** */
 		put_queue(vc, 0xf0 | (c >> 18));
 		put_queue(vc, 0x80 | ((c >> 12) & 0x3f));
@@ -415,7 +414,8 @@ static unsigned int handle_diacr(struct vc_data *vc, unsigned int ch)
 			return d | ch;
 	} else {
 		for (i = 0; i < accent_table_size; i++)
-			if (accent_table[i].diacr == d && accent_table[i].base == ch)
+			if (accent_table[i].diacr == d &&
+			    accent_table[i].base == ch)
 				return accent_table[i].result;
 	}

@@ -494,7 +494,7 @@ static void fn_hold(struct vc_data *vc)

 static void fn_num(struct vc_data *vc)
 {
-	if (vc_kbd_mode(kbd,VC_APPLIC))
+	if (vc_kbd_mode(kbd, VC_APPLIC))
 		applkey(vc, 'P', 1);
 	else
 		fn_bare_num(vc);
@@ -693,7 +693,8 @@ static void k_dead2(struct vc_data *vc, unsigned char value, char up_flag)
  */
 static void k_dead(struct vc_data *vc, unsigned char value, char up_flag)
 {
-	static const unsigned char ret_diacr[NR_DEAD] = {'`', '\'', '^', '~', '"', ',' };
+	static const unsigned char ret_diacr[NR_DEAD] =
+		{'`', '\'', '^', '~', '"', ','};
 	value = ret_diacr[value];
 	k_deadunicode(vc, value, up_flag);
 }
@@ -882,11 +883,13 @@ static void k_slock(struct vc_data *vc, unsigned char value, char up_flag)

 /* by default, 300ms interval for combination release */
 static unsigned brl_timeout = 300;
-MODULE_PARM_DESC(brl_timeout, "Braille keys release delay in ms (0 for commit on first key release)");
+MODULE_PARM_DESC(brl_timeout,
+	"Braille keys release delay in ms (0 for commit on first key release)");
 module_param(brl_timeout, uint, 0644);

 static unsigned brl_nbchords = 1;
-MODULE_PARM_DESC(brl_nbchords, "Number of chords that produce a braille pattern (0 for dead chords)");
+MODULE_PARM_DESC(brl_nbchords,
+	"Number of chords that produce a braille pattern (0 for dead chords)");
 module_param(brl_nbchords, uint, 0644);

 static void k_brlcommit(struct vc_data *vc, unsigned int pattern, char up_flag)
@@ -909,7 +912,7 @@ static void k_brlcommit(struct vc_data *vc, unsigned int pattern, char up_flag)

 static void k_brl(struct vc_data *vc, unsigned char value, char up_flag)
 {
-	static unsigned pressed,committing;
+	static unsigned pressed, committing;
 	static unsigned long releasestart;

 	if (kbd->kbdmode != VC_UNICODE) {
@@ -1036,8 +1039,11 @@ DECLARE_TASKLET_DISABLED(keyboard_tasklet, kbd_bh, 0);
     defined(CONFIG_PARISC) || defined(CONFIG_SUPERH) ||\
     (defined(CONFIG_ARM) && defined(CONFIG_KEYBOARD_ATKBD) && !defined(CONFIG_ARCH_RPC))

-#define HW_RAW(dev) (test_bit(EV_MSC, dev->evbit) && test_bit(MSC_RAW, dev->mscbit) &&\
-			((dev)->id.bustype == BUS_I8042) && ((dev)->id.vendor == 0x0001) && ((dev)->id.product == 0x0001))
+#define HW_RAW(dev) (test_bit(EV_MSC, dev->evbit) && \
+		     test_bit(MSC_RAW, dev->mscbit) && \
+		     ((dev)->id.bustype == BUS_I8042) && \
+		     ((dev)->id.vendor == 0x0001) && \
+		     ((dev)->id.product == 0x0001))

 static const unsigned short x86_keycodes[256] =
 	{ 0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15,
@@ -1057,7 +1063,7 @@ static const unsigned short x86_keycodes[256] =
 	332,340,365,342,343,344,345,346,356,270,341,368,369,370,371,372 };

 #ifdef CONFIG_SPARC
-static int sparc_l1_a_state = 0;
+static int sparc_l1_a_state;
 extern void sun_do_break(void);
 #endif

@@ -1124,7 +1130,8 @@ static int emulate_raw(struct vc_data *vc, unsigned int keycode,

 #warning "Cannot generate rawmode keyboard for your architecture yet."

-static int emulate_raw(struct vc_data *vc, unsigned int keycode, unsigned char up_flag)
+static int emulate_raw(struct vc_data *vc, unsigned int keycode,
+			unsigned char up_flag)
 {
 	if (keycode > 127)
 		return -1;
@@ -1174,7 +1181,8 @@ static void kbd_keycode(unsigned int keycode, int down, int hw_raw)
 		return;
 #endif /* CONFIG_MAC_EMUMOUSEBTN */

-	if ((raw_mode = (kbd->kbdmode == VC_RAW)) && !hw_raw)
+	raw_mode = (kbd->kbdmode == VC_RAW);
+	if (raw_mode && !hw_raw)
 		if (emulate_raw(vc, keycode, !down << 7))
 			if (keycode < BTN_MISC && printk_ratelimit())
 				printk(KERN_WARNING "keyboard.c: can't emulate rawmode for keycode %d\n", keycode);
@@ -1376,14 +1384,14 @@ static void kbd_start(struct input_handle *handle)

 static const struct input_device_id kbd_ids[] = {
 	{
-                .flags = INPUT_DEVICE_ID_MATCH_EVBIT,
-                .evbit = { BIT_MASK(EV_KEY) },
-        },
+		.flags = INPUT_DEVICE_ID_MATCH_EVBIT,
+		.evbit = { BIT_MASK(EV_KEY) },
+	},

 	{
-                .flags = INPUT_DEVICE_ID_MATCH_EVBIT,
-                .evbit = { BIT_MASK(EV_SND) },
-        },
+		.flags = INPUT_DEVICE_ID_MATCH_EVBIT,
+		.evbit = { BIT_MASK(EV_SND) },
+	},

 	{ },    /* Terminating entry */
 };
@@ -1404,7 +1412,7 @@ int __init kbd_init(void)
 	int i;
 	int error;

-        for (i = 0; i < MAX_NR_CONSOLES; i++) {
+	for (i = 0; i < MAX_NR_CONSOLES; i++) {
 		kbd_table[i].ledflagstate = KBD_DEFLEDS;
 		kbd_table[i].default_ledflagstate = KBD_DEFLEDS;
 		kbd_table[i].ledmode = LED_SHOW_FLAGS;
-
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux