Skip to contentSkip to conversation

staging:speakup: Multiple Checkpatch issues.

PATCH RESEND In review Arushi Singhal 2 participants 18 messages Mar 21, 2017 – Mar 23, 2017 Staging

lore
Share & tools
lore
#0 lore raw

cover staging:speakup: Multiple Checkpatch issues.

Improve readability by fixing multiple checkpatch.pl issues in speakup driver.

Arushi Singhal (11):
staging: speakup: Moved logical to previous line.
staging: speakup: Remove multiple assignments
staging: speakup: Simplify "NULL" comparisons
staging: speakup: fixes braces {} should be used on all arms of this
statement
staging: speakup: Remove multiple assignments
staging: speakup: Moved OR operator to previous line.
staging: speakup: spaces preferred around operator
staging: speakup: Removed Unnecessary parentheses.
staging: speakup: Simplify the NULL comparisons
staging: speakup: Match alignment with open parenthesis.
staging: speakup: Fix alignment with parenthesis.

 drivers/staging/speakup/fakekey.c        |   2 +-
 drivers/staging/speakup/kobjects.c       |   2 +-
 drivers/staging/speakup/main.c           | 110 +++++++++++++++++--------------
 drivers/staging/speakup/selection.c      |   4 +-
 drivers/staging/speakup/serialio.c       |   2 +-
 drivers/staging/speakup/speakup.h        |  12 ++--
 drivers/staging/speakup/speakup_acntpc.c |   8 +--
 drivers/staging/speakup/speakup_apollo.c |   2 +-
 drivers/staging/speakup/speakup_decext.c |  10 +--
 drivers/staging/speakup/speakup_decpc.c  |  26 ++++----
 drivers/staging/speakup/speakup_dectlk.c |   6 +-
 drivers/staging/speakup/speakup_dtlk.c   |   2 +-
 drivers/staging/speakup/speakup_keypc.c  |   6 +-
 drivers/staging/speakup/speakup_ltlk.c   |   2 +-
 drivers/staging/speakup/varhandlers.c    |  18 ++---
 15 files changed, 114 insertions(+), 98 deletions(-)
Signature · 1 line
2.11.0
#1 lore raw

PATCH 1/11 staging: speakup: Moved logical to previous line.

Moved logical operator to previous line to fix the following checkpatch issue:

CHECK: Logical continuations should be on the previous line.

---
 drivers/staging/speakup/main.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/staging/speakup/main.c +6 -6
index f280e22d7e15..f71206878363 100644
@@ -905,8 +905,8 @@ static int get_sentence_buf(struct vc_data *vc, int read_punc)
 	while (start < end) {
 		sentbuf[bn][i] = get_char(vc, (u_short *)start, &tmp);
 		if (i > 0) {
-			if (sentbuf[bn][i] == SPACE && sentbuf[bn][i - 1] == '.'
-			    && numsentences[bn] < 9) {
+			if (sentbuf[bn][i] == SPACE && sentbuf[bn][i - 1] == '.' &&
+			    numsentences[bn] < 9) {
 				/* Sentence Marker */
 				numsentences[bn]++;
 				sentmarks[bn][numsentences[bn]] =
@@ -1292,8 +1292,8 @@ void spk_reset_default_chars(void)
 
 	/* First, free any non-default */
 	for (i = 0; i < 256; i++) {
-		if ((spk_characters[i] != NULL)
-		    && (spk_characters[i] != spk_default_chars[i]))
+		if (spk_characters[i] &&
+		    (spk_characters[i] != spk_default_chars[i]))
 			kfree(spk_characters[i]);
 	}
 
@@ -2088,8 +2088,8 @@ speakup_key(struct vc_data *vc, int shift_state, int keycode, u_short keysym,
 	tty = vc->port.tty;
 	if (type >= 0xf0)
 		type -= 0xf0;
-	if (type == KT_PAD
-		&& (vt_get_leds(fg_console, VC_NUMLOCK))) {
+	if (type == KT_PAD &&
+	    (vt_get_leds(fg_console, VC_NUMLOCK))) {
 		if (up_flag) {
 			spk_keydown = 0;
 			goto out;
Signature · 1 line
2.11.0
#2 lore raw

PATCH 2/11 staging: speakup: Remove multiple assignments

In reply to Arushi Singhal

This patch fixes the checkpatch.pl warning "multiple assignments should be avoided."

---
 drivers/staging/speakup/main.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)
drivers/staging/speakup/main.c +12 -6
index f71206878363..f8fccc8bf6b2 100644
@@ -270,9 +270,12 @@ static unsigned char get_attributes(struct vc_data *vc, u16 *pos)
 
 static void speakup_date(struct vc_data *vc)
 {
-	spk_x = spk_cx = vc->vc_x;
-	spk_y = spk_cy = vc->vc_y;
-	spk_pos = spk_cp = vc->vc_pos;
+	spk_x = vc->vc_x;
+	spk_cx = spk_x;
+	spk_y = vc->vc_y;
+	spk_cy = spk_y;
+	spk_pos = vc->vc_pos;
+	spk_cp = spk_pos;
 	spk_old_attr = spk_attr;
 	spk_attr = get_attributes(vc, (u_short *)spk_pos);
 }
@@ -1655,9 +1658,12 @@ static int speak_highlight(struct vc_data *vc)
 		spk_do_flush();
 		spkup_write(speakup_console[vc_num]->ht.highbuf[hc],
 			    speakup_console[vc_num]->ht.highsize[hc]);
-		spk_pos = spk_cp = speakup_console[vc_num]->ht.rpos[hc];
-		spk_x = spk_cx = speakup_console[vc_num]->ht.rx[hc];
-		spk_y = spk_cy = speakup_console[vc_num]->ht.ry[hc];
+		spk_pos = speakup_console[vc_num]->ht.rpos[hc];
+		spk_cp = spk_pos;
+		spk_x = speakup_console[vc_num]->ht.rx[hc];
+		spk_cx = spk_x;
+		spk_y = speakup_console[vc_num]->ht.ry[hc];
+		spk_cy = spk_y;
 		return 1;
 	}
 	return 0;
Signature · 1 line
2.11.0
maintainer
#3 lore raw

Re: [PATCH 02/11] staging: speakup: Remove multiple assignments

Quoted 15 lines · Arushi Singhal

This patch fixes the checkpatch.pl warning "multiple assignments should be avoided."

---
 drivers/staging/speakup/main.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)
drivers/staging/speakup/main.c +0 -0
index f71206878363..f8fccc8bf6b2 100644
@@ -270,9 +270,12 @@ static unsigned char get_attributes(struct vc_data *vc, u16 *pos)
 
 static void speakup_date(struct vc_data *vc)

drivers/staging/speakup/main.c static unsigned char get_attributes(struct vc_data *vc, u16 *pos) · line 278

Quoted 10 lines
drivers/staging/speakup/main.c +6 -3
 {
-	spk_x = spk_cx = vc->vc_x;
-	spk_y = spk_cy = vc->vc_y;
-	spk_pos = spk_cp = vc->vc_pos;
+	spk_x = vc->vc_x;
+	spk_cx = spk_x;
+	spk_y = vc->vc_y;
+	spk_cy = spk_y;
+	spk_pos = vc->vc_pos;
+	spk_cp = spk_pos;

Ick, this is harder to read now, don't you think?

not good.

greg k-h

#4 lore raw

PATCH 3/11 staging: speakup: Simplify "NULL" comparisons

In reply to Arushi Singhal

Fixed coding style for null comparisons in speakup driver to be more consistant with the rest of the kernel coding style. Replaced 'x != NULL' with 'x' and 'x = NULL' with '!x'.

---
 drivers/staging/speakup/selection.c   | 2 +-
 drivers/staging/speakup/varhandlers.c | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/staging/speakup/selection.c +1 -1
index afd9a446a06f..4417c00e68a7 100644
@@ -175,7 +175,7 @@ static struct speakup_paste_work speakup_paste_work = {
 
 int speakup_paste_selection(struct tty_struct *tty)
 {
-	if (cmpxchg(&speakup_paste_work.tty, NULL, tty) != NULL)
+	if (cmpxchg(&speakup_paste_work.tty, NULL, tty))
 		return -EBUSY;
 
 	tty_kref_get(tty);
drivers/staging/speakup/varhandlers.c +3 -3
index cc984196020f..5910fe0b1365 100644
@@ -98,7 +98,7 @@ void speakup_register_var(struct var_t *var)
 		}
 	}
 	p_header = var_ptrs[var->var_id];
-	if (p_header->data != NULL)
+	if (p_header->data)
 		return;
 	p_header->data = var;
 	switch (p_header->var_type) {
@@ -210,11 +210,11 @@ int spk_set_num_var(int input, struct st_var_header *var, int how)
 		return -ERANGE;
 
 	var_data->u.n.value = val;
-	if (var->var_type == VAR_TIME && p_val != NULL) {
+	if (var->var_type == VAR_TIME && p_val) {
 		*p_val = msecs_to_jiffies(val);
 		return 0;
 	}
-	if (p_val != NULL)
+	if (p_val)
 		*p_val = val;
 	if (var->var_id == PUNC_LEVEL) {
 		spk_punc_mask = spk_punc_masks[val];
Signature · 1 line
2.11.0
#5 lore raw

PATCH 4/11 staging: speakup: fixes braces {} should be used on all arms of this statement

In reply to Arushi Singhal

This patch fixes the checks reported by checkpatch.pl for braces {} should be used on all arms of this statement.

---
 drivers/staging/speakup/main.c           | 35 +++++++++++++++++++-------------
 drivers/staging/speakup/speakup_decext.c |  6 +++---
 drivers/staging/speakup/speakup_decpc.c  |  6 +++---
 drivers/staging/speakup/speakup_dectlk.c |  6 +++---
 drivers/staging/speakup/varhandlers.c    | 12 ++++++-----
 5 files changed, 37 insertions(+), 28 deletions(-)
drivers/staging/speakup/main.c +21 -14
index f8fccc8bf6b2..21e76b031449 100644
@@ -409,8 +409,9 @@ static void say_attributes(struct vc_data *vc)
 	if (bg > 7) {
 		synth_printf(" %s ", spk_msg_get(MSG_ON_BLINKING));
 		bg -= 8;
-	} else
+	} else {
 		synth_printf(" %s ", spk_msg_get(MSG_ON));
+	}
 	synth_printf("%s\n", spk_msg_get(MSG_COLORS_START + bg));
 }
 
@@ -643,8 +644,9 @@ static void say_prev_word(struct vc_data *vc)
 				break;
 			spk_y--;
 			spk_x = vc->vc_cols - 1;
-		} else
+		} else {
 			spk_x--;
+		}
 		spk_pos -= 2;
 		ch = get_char(vc, (u_short *)spk_pos, &temp);
 		if (ch == SPACE || ch == 0)
@@ -697,8 +699,9 @@ static void say_next_word(struct vc_data *vc)
 			spk_y++;
 			spk_x = 0;
 			edge_said = edge_right;
-		} else
+		} else {
 			spk_x++;
+		}
 		spk_pos += 2;
 		last_state = state;
 	}
@@ -729,8 +732,9 @@ static void spell_word(struct vc_data *vc)
 				spk_pitch_shift++;
 			else	/* synth has no pitch */
 				last_cap = spk_str_caps_stop;
-		} else
+		} else {
 			str_cap = spk_str_caps_stop;
+		}
 		if (str_cap != last_cap) {
 			synth_printf("%s", str_cap);
 			last_cap = str_cap;
@@ -1343,8 +1347,9 @@ static int speakup_allocate(struct vc_data *vc)
 		if (!speakup_console[vc_num])
 			return -ENOMEM;
 		speakup_date(vc);
-	} else if (!spk_parked)
+	} else if (!spk_parked) {
 		speakup_date(vc);
+	}
 
 	return 0;
 }
@@ -1397,9 +1402,9 @@ static void read_all_doc(struct vc_data *vc)
 		prev_cursor_track = cursor_track;
 	cursor_track = read_all_mode;
 	spk_reset_index_count(0);
-	if (get_sentence_buf(vc, 0) == -1)
+	if (get_sentence_buf(vc, 0) == -1) {
 		kbd_fakekey2(vc, RA_DOWN_ARROW);
-	else {
+	} else {
 		say_sentence_num(0, 0);
 		synth_insert_next_index(0);
 		start_read_all_timer(vc, RA_TIMER);
@@ -1446,8 +1451,9 @@ static void handle_cursor_read_all(struct vc_data *vc, int command)
 			if (!say_sentence_num(sentcount + 1, 1)) {
 				sn = 1;
 				spk_reset_index_count(sn);
-			} else
+			} else {
 				synth_insert_next_index(0);
+			}
 			if (!say_sentence_num(sn, 0)) {
 				kbd_fakekey2(vc, RA_FIND_NEXT_SENT);
 				return;
@@ -1476,9 +1482,9 @@ static void handle_cursor_read_all(struct vc_data *vc, int command)
 		rv = get_sentence_buf(vc, 0);
 		if (rv == -1)
 			read_all_doc(vc);
-		if (rv == 0)
+		if (rv == 0) {
 			kbd_fakekey2(vc, RA_FIND_NEXT_SENT);
-		else {
+		} else {
 			say_sentence_num(1, 0);
 			synth_insert_next_index(0);
 			start_read_all_timer(vc, RA_TIMER);
@@ -2177,10 +2183,11 @@ speakup_key(struct vc_data *vc, int shift_state, int keycode, u_short keysym,
 		if (type == KT_SPEC && value == 1) {
 			value = '\n';
 			type = KT_LATIN;
-		} else if (type == KT_LETTER)
+		} else if (type == KT_LETTER) {
 			type = KT_LATIN;
-		else if (value == 0x7f)
+		} else if (value == 0x7f) {
 			value = 8;	/* make del = backspace */
+		}
 		ret = (*spk_special_handler) (vc, type, value, keycode);
 		spk_close_press = 0;
 		if (ret < 0)
@@ -2274,9 +2281,9 @@ static int vt_notifier_call(struct notifier_block *nb,
 		speakup_deallocate(vc);
 		break;
 	case VT_WRITE:
-		if (param->c == '\b')
+		if (param->c == '\b') {
 			speakup_bs(vc);
-		else {
+		} else {
 			u16 d = param->c;
 			speakup_con_write(vc, &d, 1);
 		}
drivers/staging/speakup/speakup_decext.c +3 -3
index fdbf330cae4e..929a28d618dc 100644
@@ -195,11 +195,11 @@ static void do_catch_up(struct spk_synth *synth)
 		spin_lock_irqsave(&speakup_info.spinlock, flags);
 		synth_buffer_getc();
 		spin_unlock_irqrestore(&speakup_info.spinlock, flags);
-		if (ch == '[')
+		if (ch == '[') {
 			in_escape = 1;
-		else if (ch == ']')
+		} else if (ch == ']') {
 			in_escape = 0;
-		else if (ch <= SPACE) {
+		} else if (ch <= SPACE) {
 			if (!in_escape && strchr(",.!?;:", last))
 				synth->io_ops->synth_out(synth, PROCSPEECH);
 			if (time_after_eq(jiffies, jiff_max)) {
drivers/staging/speakup/speakup_decpc.c +3 -3
index 2a738be19789..5e35d7e11361 100644
@@ -410,11 +410,11 @@ static void do_catch_up(struct spk_synth *synth)
 		spin_lock_irqsave(&speakup_info.spinlock, flags);
 		synth_buffer_getc();
 		spin_unlock_irqrestore(&speakup_info.spinlock, flags);
-		if (ch == '[')
+		if (ch == '[') {
 			in_escape = 1;
-		else if (ch == ']')
+		} else if (ch == ']') {
 			in_escape = 0;
-		else if (ch <= SPACE) {
+		} else if (ch <= SPACE) {
 			if (!in_escape && strchr(",.!?;:", last))
 				dt_sendchar(PROCSPEECH);
 			if (time_after_eq(jiffies, jiff_max)) {
drivers/staging/speakup/speakup_dectlk.c +3 -3
index 386ac9d87af6..0cdbd5e9b36b 100644
@@ -260,11 +260,11 @@ static void do_catch_up(struct spk_synth *synth)
 		spin_lock_irqsave(&speakup_info.spinlock, flags);
 		synth_buffer_getc();
 		spin_unlock_irqrestore(&speakup_info.spinlock, flags);
-		if (ch == '[')
+		if (ch == '[') {
 			in_escape = 1;
-		else if (ch == ']')
+		} else if (ch == ']') {
 			in_escape = 0;
-		else if (ch <= SPACE) {
+		} else if (ch <= SPACE) {
 			if (!in_escape && strchr(",.!?;:", last))
 				synth->io_ops->synth_out(synth, PROCSPEECH);
 			if (time_after_eq(jiffies, jiff_max)) {
drivers/staging/speakup/varhandlers.c +7 -5
index 5910fe0b1365..d37d24e26641 100644
@@ -258,10 +258,11 @@ int spk_set_string_var(const char *page, struct st_var_header *var, int len)
 		if (var->p_val != var_data->u.s.default_val)
 			strcpy((char *)var->p_val, var_data->u.s.default_val);
 		return -ERESTART;
-	} else if (var->p_val)
+	} else if (var->p_val) {
 		strcpy((char *)var->p_val, page);
-	else
+	} else {
 		return -E2BIG;
+	}
 	return 0;
 }
 
@@ -281,17 +282,18 @@ int spk_set_mask_bits(const char *input, const int which, const int how)
 			spk_chartab[*cp] &= ~mask;
 	}
 	cp = (u_char *)input;
-	if (!cp)
+	if (!cp) {
 		cp = spk_punc_info[which].value;
-	else {
+	} else {
 		for (; *cp; cp++) {
 			if (*cp < SPACE)
 				break;
 			if (mask < PUNC) {
 				if (!(spk_chartab[*cp] & PUNC))
 					break;
-			} else if (spk_chartab[*cp] & B_NUM)
+			} else if (spk_chartab[*cp] & B_NUM) {
 				break;
+			}
 		}
 		if (*cp)
 			return -EINVAL;
Signature · 1 line
2.11.0
#6 lore raw

PATCH 5/11 staging: speakup: Remove multiple assignments

In reply to Arushi Singhal

This patch fixes the checkpatch.pl warning "multiple assignments should be avoided."

---
 drivers/staging/speakup/main.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/staging/speakup/main.c +2 -1
index 21e76b031449..c10445624e92 100644
@@ -2106,7 +2106,8 @@ speakup_key(struct vc_data *vc, int shift_state, int keycode, u_short keysym,
 			spk_keydown = 0;
 			goto out;
 		}
-		value = spk_lastkey = pad_chars[value];
+		value = pad_chars[value];
+		spk_lastkey = value;
 		spk_keydown++;
 		spk_parked &= 0xfe;
 		goto no_map;
Signature · 1 line
2.11.0
maintainer
#7 lore raw

Re: [PATCH 05/11] staging: speakup: Remove multiple assignments

Quoted 13 lines · Arushi Singhal

This patch fixes the checkpatch.pl warning "multiple assignments should be avoided."

---
 drivers/staging/speakup/main.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/staging/speakup/main.c +0 -0
index 21e76b031449..c10445624e92 100644

drivers/staging/speakup/main.c speakup_key(struct vc_data *vc, int shift_state, int keycode, u_short keysym, · line 2110

Quoted 6 lines
drivers/staging/speakup/main.c +2 -1
@@ -2106,7 +2106,8 @@ speakup_key(struct vc_data *vc, int shift_state, int keycode, u_short keysym,
 			spk_keydown = 0;
 			goto out;
 		}
-		value = spk_lastkey = pad_chars[value];
+		value = pad_chars[value];
+		spk_lastkey = value;

Also harder to read now :(

#8 lore raw

PATCH 6/11 staging: speakup: Moved OR operator to previous line.

In reply to Arushi Singhal

Moved logical OR operator to previous line to fix the following checkpatch issue:

CHECK: Logical continuations should be on the previous line.

---
 drivers/staging/speakup/main.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/staging/speakup/main.c +4 -4
index c10445624e92..def1a36da9dd 100644
@@ -2173,10 +2173,10 @@ speakup_key(struct vc_data *vc, int shift_state, int keycode, u_short keysym,
 	if (up_flag || spk_killed || type == KT_SHIFT)
 		goto out;
 	spk_shut_up &= 0xfe;
-	kh = (value == KVAL(K_DOWN))
-	    || (value == KVAL(K_UP))
-	    || (value == KVAL(K_LEFT))
-	    || (value == KVAL(K_RIGHT));
+	kh = (value == KVAL(K_DOWN)) ||
+	    (value == KVAL(K_UP)) ||
+	    (value == KVAL(K_LEFT)) ||
+	    (value == KVAL(K_RIGHT));
 	if ((cursor_track != read_all_mode) || !kh)
 		if (!spk_no_intr)
 			spk_do_flush();
Signature · 1 line
2.11.0
#9 lore raw

PATCH 7/11 staging: speakup: spaces preferred around operator

In reply to Arushi Singhal

Fixed the checkpatch.pl issues like:
CHECK: spaces preferred around that '&' (ctx:VxV)
CHECK: spaces preferred around that '|' (ctx:VxV)
CHECK: spaces preferred around that '-' (ctx:VxV)
CHECK: spaces preferred around that '+' (ctx:VxV) etc.

---
 drivers/staging/speakup/speakup.h        | 12 ++++++------
 drivers/staging/speakup/speakup_acntpc.c |  2 +-
 drivers/staging/speakup/speakup_decpc.c  | 20 ++++++++++----------
 drivers/staging/speakup/speakup_dtlk.c   |  2 +-
 drivers/staging/speakup/speakup_keypc.c  |  6 +++---
 drivers/staging/speakup/speakup_ltlk.c   |  2 +-
 6 files changed, 22 insertions(+), 22 deletions(-)
drivers/staging/speakup/speakup.h +6 -6
index 0bc8d6afadfa..a654334c98b9 100644
@@ -20,7 +20,7 @@
 #define A_CAP 0x0007
 #define B_NUM 0x0008
 #define NUM 0x0009
-#define ALPHANUM (B_ALPHA|B_NUM)
+#define ALPHANUM (B_ALPHA | B_NUM)
 #define SOME 0x0010
 #define MOST 0x0020
 #define PUNC 0x0040
@@ -30,14 +30,14 @@
 #define B_EXNUM 0x0100
 #define CH_RPT 0x0200
 #define B_CTL 0x0400
-#define A_CTL (B_CTL+SYNTH_OK)
+#define A_CTL (B_CTL + SYNTH_OK)
 #define B_SYM 0x0800
-#define B_CAPSYM (B_CAP|B_SYM)
+#define B_CAPSYM (B_CAP | B_SYM)
 
 /* FIXME: u16 */
-#define IS_WDLM(x) (spk_chartab[((u_char)x)]&B_WDLM)
-#define IS_CHAR(x, type) (spk_chartab[((u_char)x)]&type)
-#define IS_TYPE(x, type) ((spk_chartab[((u_char)x)]&type) == type)
+#define IS_WDLM(x) (spk_chartab[((u_char)x)] & B_WDLM)
+#define IS_CHAR(x, type) (spk_chartab[((u_char)x)] & type)
+#define IS_TYPE(x, type) ((spk_chartab[((u_char)x)] & type) == type)
 
 int speakup_thread(void *data);
 void spk_reset_default_chars(void);
drivers/staging/speakup/speakup_acntpc.c +1 -1
index c5beb5602c42..b4058bd82e42 100644
@@ -282,7 +282,7 @@ static int synth_probe(struct spk_synth *synth)
 			if (port_val == 0x53fc) {
 				/* 'S' and out&input bits */
 				synth_port_control = synth_portlist[i];
-				speakup_info.port_tts = synth_port_control+1;
+				speakup_info.port_tts = synth_port_control + 1;
 				break;
 			}
 		}
drivers/staging/speakup/speakup_decpc.c +10 -10
index 5e35d7e11361..5d22c3b7edd4 100644
@@ -250,7 +250,7 @@ static int dt_getstatus(void)
 static void dt_sendcmd(u_int cmd)
 {
 	outb_p(cmd & 0xFF, speakup_info.port_tts);
-	outb_p((cmd >> 8) & 0xFF, speakup_info.port_tts+1);
+	outb_p((cmd >> 8) & 0xFF, speakup_info.port_tts + 1);
 }
 
 static int dt_waitbit(int bit)
@@ -286,11 +286,11 @@ static int dt_ctrl(u_int cmd)
 
 	if (!dt_waitbit(STAT_cmd_ready))
 		return -1;
-	outb_p(0, speakup_info.port_tts+2);
-	outb_p(0, speakup_info.port_tts+3);
+	outb_p(0, speakup_info.port_tts + 2);
+	outb_p(0, speakup_info.port_tts + 3);
 	dt_getstatus();
-	dt_sendcmd(CMD_control|cmd);
-	outb_p(0, speakup_info.port_tts+6);
+	dt_sendcmd(CMD_control | cmd);
+	outb_p(0, speakup_info.port_tts + 6);
 	while (dt_getstatus() & STAT_cmd_ready) {
 		udelay(20);
 		if (--timeout == 0)
@@ -318,8 +318,8 @@ udelay(50);
 			break;
 udelay(50);
 	}
-	outb_p(DMA_sync, speakup_info.port_tts+4);
-	outb_p(0, speakup_info.port_tts+4);
+	outb_p(DMA_sync, speakup_info.port_tts + 4);
+	outb_p(0, speakup_info.port_tts + 4);
 	udelay(100);
 	for (timeout = 0; timeout < 10; timeout++) {
 		if (!(dt_getstatus() & STAT_flushing))
@@ -337,8 +337,8 @@ static int dt_sendchar(char ch)
 		return -1;
 	if (!(dt_stat & STAT_rr_char))
 		return -2;
-	outb_p(DMA_single_in, speakup_info.port_tts+4);
-	outb_p(ch, speakup_info.port_tts+4);
+	outb_p(DMA_single_in, speakup_info.port_tts + 4);
+	outb_p(ch, speakup_info.port_tts + 4);
 	dma_state ^= STAT_dma_state;
 	return 0;
 }
@@ -354,7 +354,7 @@ static int testkernel(void)
 	dt_sendcmd(CMD_sync);
 	if (!dt_waitbit(STAT_cmd_ready))
 		status = -2;
-	else if (dt_stat&0x8000)
+	else if (dt_stat & 0x8000)
 		return 0;
 	else if (dt_stat == 0x0dec)
 		pr_warn("dec_pc at 0x%x, software not loaded\n",
drivers/staging/speakup/speakup_dtlk.c +1 -1
index 693fac4365c3..5973acc0a006 100644
@@ -300,7 +300,7 @@ static struct synth_settings *synth_interrogate(struct spk_synth *synth)
 	t += 2;
 	for (i = 0; *t != '\r'; t++) {
 		status.rom_version[i] = *t;
-		if (i < sizeof(status.rom_version)-1)
+		if (i < sizeof(status.rom_version) - 1)
 			i++;
 	}
 	status.rom_version[i] = 0;
drivers/staging/speakup/speakup_keypc.c +3 -3
index 6649fa4c0ad2..ba7901178e0b 100644
@@ -142,9 +142,9 @@ static char *oops(void)
 	int s1, s2, s3, s4;
 
 	s1 = inb_p(synth_port);
-	s2 = inb_p(synth_port+1);
-	s3 = inb_p(synth_port+2);
-	s4 = inb_p(synth_port+3);
+	s2 = inb_p(synth_port + 1);
+	s3 = inb_p(synth_port + 2);
+	s4 = inb_p(synth_port + 3);
 	pr_warn("synth timeout %d %d %d %d\n", s1, s2, s3, s4);
 	return NULL;
 }
drivers/staging/speakup/speakup_ltlk.c +1 -1
index cb4f2958c318..11275f49bea4 100644
@@ -145,7 +145,7 @@ static void synth_interrogate(struct spk_synth *synth)
 		if (i > 2 && buf[i] == 0x7f)
 			break;
 	}
-	t = buf+2;
+	t = buf + 2;
 	for (i = 0; *t != '\r'; t++) {
 		rom_v[i] = *t;
 		if (++i >= 19)
Signature · 1 line
2.11.0
#10 lore raw

PATCH 8/11 staging: speakup: Removed Unnecessary parentheses.

In reply to Arushi Singhal

Unnecessary parentheses are removed to improve readability.

---
 drivers/staging/speakup/kobjects.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/speakup/kobjects.c +1 -1
index afb61e153592..ca85476e3ff7 100644
@@ -392,7 +392,7 @@ static ssize_t synth_store(struct kobject *kobj, struct kobj_attribute *attr,
 		len--;
 	new_synth_name[len] = '\0';
 	spk_strlwr(new_synth_name);
-	if (synth && (!strcmp(new_synth_name, synth->name))) {
+	if (synth && !strcmp(new_synth_name, synth->name)) {
 		pr_warn("%s already in use\n", new_synth_name);
 	} else if (synth_init(new_synth_name) != 0) {
 		pr_warn("failed to init synth %s\n", new_synth_name);
Signature · 1 line
2.11.0
#11 lore raw

PATCH 9/11 staging: speakup: Simplify the NULL comparisons

In reply to Arushi Singhal

Fixed coding style for null comparisons in speakup driver to be more consistant with the rest of the kernel coding style. Replaced 'x != NULL' with 'x' and 'x = NULL' with '!x'.

---
 drivers/staging/speakup/fakekey.c |  2 +-
 drivers/staging/speakup/main.c    | 32 ++++++++++++++++----------------
 2 files changed, 17 insertions(+), 17 deletions(-)
drivers/staging/speakup/fakekey.c +1 -1
index d76da0a1382c..294c74b47224 100644
@@ -56,7 +56,7 @@ int speakup_add_virtual_keyboard(void)
 
 void speakup_remove_virtual_keyboard(void)
 {
-	if (virt_keyboard != NULL) {
+	if (virt_keyboard) {
 		input_unregister_device(virt_keyboard);
 		virt_keyboard = NULL;
 	}
drivers/staging/speakup/main.c +16 -16
index def1a36da9dd..7568e8149613 100644
@@ -304,7 +304,7 @@ static void speakup_shut_up(struct vc_data *vc)
 	spk_shut_up |= 0x01;
 	spk_parked &= 0xfe;
 	speakup_date(vc);
-	if (synth != NULL)
+	if (synth)
 		spk_do_flush();
 }
 
@@ -449,7 +449,7 @@ static void speak_char(u16 ch)
 	}
 
 	cp = spk_characters[ch];
-	if (cp == NULL) {
+	if (!cp) {
 		pr_info("speak_char: cp == NULL!\n");
 		return;
 	}
@@ -1177,7 +1177,7 @@ static void do_handle_shift(struct vc_data *vc, u_char value, char up_flag)
 {
 	unsigned long flags;
 
-	if (synth == NULL || up_flag || spk_killed)
+	if (!synth || up_flag || spk_killed)
 		return;
 	spin_lock_irqsave(&speakup_info.spinlock, flags);
 	if (cursor_track == read_all_mode) {
@@ -1215,7 +1215,7 @@ static void do_handle_latin(struct vc_data *vc, u_char value, char up_flag)
 		spin_unlock_irqrestore(&speakup_info.spinlock, flags);
 		return;
 	}
-	if (synth == NULL || spk_killed) {
+	if (!synth || spk_killed) {
 		spin_unlock_irqrestore(&speakup_info.spinlock, flags);
 		return;
 	}
@@ -1341,7 +1341,7 @@ static int speakup_allocate(struct vc_data *vc)
 	int vc_num;
 
 	vc_num = vc->vc_num;
-	if (speakup_console[vc_num] == NULL) {
+	if (!speakup_console[vc_num]) {
 		speakup_console[vc_num] = kzalloc(sizeof(*speakup_console[0]),
 						  GFP_ATOMIC);
 		if (!speakup_console[vc_num])
@@ -1394,7 +1394,7 @@ static void kbd_fakekey2(struct vc_data *vc, int command)
 
 static void read_all_doc(struct vc_data *vc)
 {
-	if ((vc->vc_num != fg_console) || synth == NULL || spk_shut_up)
+	if ((vc->vc_num != fg_console) || !synth || spk_shut_up)
 		return;
 	if (!synth_supports_indexing())
 		return;
@@ -1509,7 +1509,7 @@ static int pre_handle_cursor(struct vc_data *vc, u_char value, char up_flag)
 	spin_lock_irqsave(&speakup_info.spinlock, flags);
 	if (cursor_track == read_all_mode) {
 		spk_parked &= 0xfe;
-		if (synth == NULL || up_flag || spk_shut_up) {
+		if (!synth || up_flag || spk_shut_up) {
 			spin_unlock_irqrestore(&speakup_info.spinlock, flags);
 			return NOTIFY_STOP;
 		}
@@ -1531,7 +1531,7 @@ static void do_handle_cursor(struct vc_data *vc, u_char value, char up_flag)
 
 	spin_lock_irqsave(&speakup_info.spinlock, flags);
 	spk_parked &= 0xfe;
-	if (synth == NULL || up_flag || spk_shut_up || cursor_track == CT_Off) {
+	if (!synth || up_flag || spk_shut_up || cursor_track == CT_Off) {
 		spin_unlock_irqrestore(&speakup_info.spinlock, flags);
 		return;
 	}
@@ -1730,7 +1730,7 @@ static void speakup_bs(struct vc_data *vc)
 		return;
 	if (!spk_parked)
 		speakup_date(vc);
-	if (spk_shut_up || synth == NULL) {
+	if (spk_shut_up || !synth) {
 		spin_unlock_irqrestore(&speakup_info.spinlock, flags);
 		return;
 	}
@@ -1747,7 +1747,7 @@ static void speakup_con_write(struct vc_data *vc, u16 *str, int len)
 {
 	unsigned long flags;
 
-	if ((vc->vc_num != fg_console) || spk_shut_up || synth == NULL)
+	if ((vc->vc_num != fg_console) || spk_shut_up || !synth)
 		return;
 	if (!spin_trylock_irqsave(&speakup_info.spinlock, flags))
 		/* Speakup output, discard */
@@ -1776,7 +1776,7 @@ static void speakup_con_update(struct vc_data *vc)
 {
 	unsigned long flags;
 
-	if (speakup_console[vc->vc_num] == NULL || spk_parked)
+	if (!speakup_console[vc->vc_num] || spk_parked)
 		return;
 	if (!spin_trylock_irqsave(&speakup_info.spinlock, flags))
 		/* Speakup output, discard */
@@ -1791,7 +1791,7 @@ static void do_handle_spec(struct vc_data *vc, u_char value, char up_flag)
 	int on_off = 2;
 	char *label;
 
-	if (synth == NULL || up_flag || spk_killed)
+	if (!synth || up_flag || spk_killed)
 		return;
 	spin_lock_irqsave(&speakup_info.spinlock, flags);
 	spk_shut_up &= 0xfe;
@@ -1835,7 +1835,7 @@ static int inc_dec_var(u_char value)
 
 	var_id = var_id / 2 + FIRST_SET_VAR;
 	p_header = spk_get_var_header(var_id);
-	if (p_header == NULL)
+	if (!p_header)
 		return -1;
 	if (p_header->var_type != VAR_NUM)
 		return -1;
@@ -1918,7 +1918,7 @@ static void speakup_bits(struct vc_data *vc)
 {
 	int val = this_speakup_key - (FIRST_EDIT_BITS - 1);
 
-	if (spk_special_handler != NULL || val < 1 || val > 6) {
+	if (spk_special_handler || val < 1 || val > 6) {
 		synth_printf("%s\n", spk_msg_get(MSG_ERROR));
 		return;
 	}
@@ -2012,7 +2012,7 @@ static int handle_goto(struct vc_data *vc, u_char type, u_char ch, u_short key)
 
 static void speakup_goto(struct vc_data *vc)
 {
-	if (spk_special_handler != NULL) {
+	if (spk_special_handler) {
 		synth_printf("%s\n", spk_msg_get(MSG_ERROR));
 		return;
 	}
@@ -2164,7 +2164,7 @@ speakup_key(struct vc_data *vc, int shift_state, int keycode, u_short keysym,
 		}
 	}
 no_map:
-	if (type == KT_SPKUP && spk_special_handler == NULL) {
+	if (type == KT_SPKUP && !spk_special_handler) {
 		do_spkup(vc, new_key);
 		spk_close_press = 0;
 		ret = 1;
Signature · 1 line
2.11.0
maintainer
#12 lore raw

Re: [PATCH 09/11] staging: speakup: Simplify the NULL comparisons

Quoted 9 lines · Arushi Singhal

Fixed coding style for null comparisons in speakup driver to be more consistant with the rest of the kernel coding style. Replaced 'x != NULL' with 'x' and 'x = NULL' with '!x'.

---
 drivers/staging/speakup/fakekey.c |  2 +-
 drivers/staging/speakup/main.c    | 32 ++++++++++++++++----------------
 2 files changed, 17 insertions(+), 17 deletions(-)

You used this same subject line in this series, not good :(

greg k-h

#13 lore raw

PATCH 10/11 staging: speakup: Match alignment with open parenthesis.

In reply to Arushi Singhal

Fix checkpatch issues: "CHECK: Alignment should match open parenthesis".

---
 drivers/staging/speakup/main.c           | 2 +-
 drivers/staging/speakup/selection.c      | 2 +-
 drivers/staging/speakup/serialio.c       | 2 +-
 drivers/staging/speakup/speakup_acntpc.c | 6 +++---
 4 files changed, 6 insertions(+), 6 deletions(-)
drivers/staging/speakup/main.c +1 -1
index 7568e8149613..55bf7af1d6ea 100644
@@ -1160,7 +1160,7 @@ static void spkup_write(const u16 *in_buf, int count)
 		if (last_type & CH_RPT) {
 			synth_printf(" ");
 			synth_printf(spk_msg_get(MSG_REPEAT_DESC2),
-					++rep_count);
+				     ++rep_count);
 			synth_printf(" ");
 		}
 		rep_count = 0;
drivers/staging/speakup/selection.c +1 -1
index 4417c00e68a7..08f68fc2864e 100644
@@ -75,7 +75,7 @@ int speakup_set_selection(struct tty_struct *tty)
 		speakup_clear_selection();
 		spk_sel_cons = vc_cons[fg_console].d;
 		dev_warn(tty->dev,
-			"Selection: mark console not the same as cut\n");
+			 "Selection: mark console not the same as cut\n");
 		return -EINVAL;
 	}
 
drivers/staging/speakup/serialio.c +1 -1
index e860e48818a4..5e31acac19de 100644
@@ -125,7 +125,7 @@ static void start_serial_interrupt(int irq)
 		pr_err("Unable to request Speakup serial I R Q\n");
 	/* Set MCR */
 	outb(UART_MCR_DTR | UART_MCR_RTS | UART_MCR_OUT2,
-			speakup_info.port_tts + UART_MCR);
+	     speakup_info.port_tts + UART_MCR);
 	/* Turn on Interrupts */
 	outb(UART_IER_MSI|UART_IER_RLSI|UART_IER_RDI,
 			speakup_info.port_tts + UART_IER);
drivers/staging/speakup/speakup_acntpc.c +3 -3
index b4058bd82e42..ad72f8e883fc 100644
@@ -261,9 +261,9 @@ static int synth_probe(struct spk_synth *synth)
 	if (port_forced) {
 		speakup_info.port_tts = port_forced;
 		pr_info("probe forced to %x by kernel command line\n",
-				speakup_info.port_tts);
+			speakup_info.port_tts);
 		if (synth_request_region(speakup_info.port_tts - 1,
-					SYNTH_IO_EXTENT)) {
+					 SYNTH_IO_EXTENT)) {
 			pr_warn("sorry, port already reserved\n");
 			return -EBUSY;
 		}
@@ -272,7 +272,7 @@ static int synth_probe(struct spk_synth *synth)
 	} else {
 		for (i = 0; synth_portlist[i]; i++) {
 			if (synth_request_region(synth_portlist[i],
-						SYNTH_IO_EXTENT)) {
+						 SYNTH_IO_EXTENT)) {
 				pr_warn
 				    ("request_region: failed with 0x%x, %d\n",
 				     synth_portlist[i], SYNTH_IO_EXTENT);
Signature · 1 line
2.11.0
#14 lore raw

PATCH 11/11 staging: speakup: Fix alignment with parenthesis.

In reply to Arushi Singhal

This patch fixes the warnings reported by checkpatch.pl for please use a blank line after function/struct/union/enum declarations.

---
 drivers/staging/speakup/speakup_apollo.c | 2 +-
 drivers/staging/speakup/speakup_decext.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/staging/speakup/speakup_apollo.c +1 -1
index 9cfdbbfb9742..6ad83dc642c4 100644
@@ -173,7 +173,7 @@ static void do_catch_up(struct spk_synth *synth)
 		if (!synth->io_ops->synth_out(synth, ch)) {
 			outb(UART_MCR_DTR, speakup_info.port_tts + UART_MCR);
 			outb(UART_MCR_DTR | UART_MCR_RTS,
-					speakup_info.port_tts + UART_MCR);
+			     speakup_info.port_tts + UART_MCR);
 			schedule_timeout(msecs_to_jiffies(full_time_val));
 			continue;
 		}
drivers/staging/speakup/speakup_decext.c +2 -2
index 929a28d618dc..c564bf8e1531 100644
@@ -206,11 +206,11 @@ static void do_catch_up(struct spk_synth *synth)
 				if (!in_escape)
 					synth->io_ops->synth_out(synth, PROCSPEECH);
 				spin_lock_irqsave(&speakup_info.spinlock,
-							flags);
+						  flags);
 				jiffy_delta_val = jiffy_delta->u.n.value;
 				delay_time_val = delay_time->u.n.value;
 				spin_unlock_irqrestore(&speakup_info.spinlock,
-							flags);
+						       flags);
 				schedule_timeout(msecs_to_jiffies
 						 (delay_time_val));
 				jiff_max = jiffies + jiffy_delta_val;
Signature · 1 line
2.11.0
maintainer
#15 lore raw

Re: [PATCH 11/11] staging: speakup: Fix alignment with parenthesis.

Quoted 3 lines · Arushi Singhal

This patch fixes the warnings reported by checkpatch.pl for please use a blank line after function/struct/union/enum declarations.

That's not what this patch does at all!

Please be more careful.

greg k-h

#16 lore raw
In reply to Arushi Singhal
Quoted 36 lines · Arushi Singhal

Improve readability by fixing multiple checkpatch.pl issues in speakup driver.

Arushi Singhal (11):
staging: speakup: Moved logical to previous line.
staging: speakup: Remove multiple assignments
staging: speakup: Simplify "NULL" comparisons
staging: speakup: fixes braces {} should be used on all arms of this
statement
staging: speakup: Remove multiple assignments
staging: speakup: Moved OR operator to previous line.
staging: speakup: spaces preferred around operator
staging: speakup: Removed Unnecessary parentheses.
staging: speakup: Simplify the NULL comparisons
staging: speakup: Match alignment with open parenthesis.
staging: speakup: Fix alignment with parenthesis.

 drivers/staging/speakup/fakekey.c        |   2 +- 
 drivers/staging/speakup/kobjects.c       |   2 +- 
 drivers/staging/speakup/main.c           | 110 
+++++++++++++++++-------------- 
 drivers/staging/speakup/selection.c      |   4 +- 
 drivers/staging/speakup/serialio.c       |   2 +- 
 drivers/staging/speakup/speakup.h        |  12 ++-- 
 drivers/staging/speakup/speakup_acntpc.c |   8 +-- 
 drivers/staging/speakup/speakup_apollo.c |   2 +- 
 drivers/staging/speakup/speakup_decext.c |  10 +-- 
 drivers/staging/speakup/speakup_decpc.c  |  26 ++++---- 
 drivers/staging/speakup/speakup_dectlk.c |   6 +- 
 drivers/staging/speakup/speakup_dtlk.c   |   2 +- 
 drivers/staging/speakup/speakup_keypc.c  |   6 +- 
 drivers/staging/speakup/speakup_ltlk.c   |   2 +- 
 drivers/staging/speakup/varhandlers.c    |  18 ++--- 
 15 files changed, 114 insertions(+), 98 deletions(-) 
Quoted 1 line

Hi

Any update on these patches?
If something needs to be change or to improve.
Thanks
Arushi

Quoted 4 lines
Signature · 1 line
2.11.0 
maintainer
#17 lore raw
Quoted 38 lines · Arushi Singhal

On Tuesday, March 21, 2017 at 5:12:41 PM UTC+5:30, Arushi Singhal wrote:

Improve readability by fixing multiple checkpatch.pl issues in speakup driver.

Arushi Singhal (11):
� staging: speakup: Moved logical to previous line.
� staging: speakup: Remove multiple assignments
� staging: speakup: Simplify "NULL" comparisons
� staging: speakup: fixes braces {} should be used on all arms of this � � statement
� staging: speakup: Remove multiple assignments
� staging: speakup: Moved OR operator to previous line. � staging: speakup: spaces preferred around operator
� staging: speakup: Removed Unnecessary parentheses.
� staging: speakup: Simplify the NULL comparisons
� staging: speakup: Match alignment with open parenthesis. � staging: speakup: Fix alignment with parenthesis.

�drivers/staging/speakup/fakekey.c � � � �| � 2 +- �drivers/staging/speakup/kobjects.c � � � | � 2 +- �drivers/staging/speakup/main.c � � � � � | 110
+++++++++++++++++--------------
�drivers/staging/speakup/selection.c � � �| � 4 +- �drivers/staging/speakup/serialio.c � � � | � 2 +- �drivers/staging/speakup/speakup.h � � � �| �12 ++-- �drivers/staging/speakup/speakup_acntpc.c | � 8 +-- �drivers/staging/speakup/speakup_apollo.c | � 2 +- �drivers/staging/speakup/speakup_decext.c | �10 +-- �drivers/staging/speakup/speakup_decpc.c �| �26 ++++---- �drivers/staging/speakup/speakup_dectlk.c | � 6 +- �drivers/staging/speakup/speakup_dtlk.c � | � 2 +- �drivers/staging/speakup/speakup_keypc.c �| � 6 +- �drivers/staging/speakup/speakup_ltlk.c � | � 2 +- �drivers/staging/speakup/varhandlers.c � �| �18 ++--- �15 files changed, 114 insertions(+), 98 deletions(-)

Quoted 2 lines

Hi
Any update on these patches?

One day? Please give us a chance, realize that it's normally a 2 week timeframe to get a patch reviewed...

thanks,

greg k-h