Skip to contentSkip to conversation

Improve code readability

PATCH In review Arushi Singhal 3 participants 6 messages Mar 10, 2017 – Mar 16, 2017 Staging

lore
Share & tools
lore
#0 lore raw

cover Improve code readability

Improve readability by fixing multiple checkpatch.pl issues.

Arushi Singhal (2):
staging: speakup: Avoid multiple assignments on same line
staging: speakup: fixes braces {} should be used on all arms of this
statement

 drivers/staging/speakup/main.c           |  6 ++++--
 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, 20 insertions(+), 16 deletions(-)
Signature · 1 line
2.11.0
#1 lore raw

PATCH 1/2 staging: speakup: Avoid multiple assignments on same line

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 00335eb2ff20..3ecf2e41bf1f 100644
@@ -2093,7 +2093,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
#2 lore raw

PATCH 2/2 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           |  3 ++-
 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, 18 insertions(+), 15 deletions(-)
drivers/staging/speakup/main.c +2 -1
index 3ecf2e41bf1f..6786cfab7460 100644
@@ -405,8 +405,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));
 }
 
drivers/staging/speakup/speakup_decext.c +3 -3
index 34e03c6b1ae5..77a935658af5 100644
@@ -194,11 +194,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))
 				spk_serial_out(PROCSPEECH);
 			if (time_after_eq(jiffies, jiff_max)) {
drivers/staging/speakup/speakup_decpc.c +3 -3
index afe2da34a3f7..100c65b38860 100644
@@ -409,11 +409,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 e0f2d6121890..d7d5e0e6e297 100644
@@ -259,11 +259,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))
 				spk_serial_out(PROCSPEECH);
 			if (time_after_eq(jiffies, jiff_max)) {
drivers/staging/speakup/varhandlers.c +7 -5
index cc984196020f..066f8461f4d3 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
#3 lore raw
In reply to Arushi Singhal

Hi
This Patch series is not yet added to the kernel tree. Thanks
Arushi

Quoted 20 lines · Arushi Singhal

Improve readability by fixing multiple checkpatch.pl issues.

Arushi Singhal (2):
staging: speakup: Avoid multiple assignments on same line
staging: speakup: fixes braces {} should be used on all arms of this
statement

 drivers/staging/speakup/main.c           |  6 ++++-- 
 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, 20 insertions(+), 16 deletions(-) 
Signature · 1 line
2.11.0 
#4 lore raw
Quoted 1 line · Arushi Singhal

HiThis Patch series is not yet added to the kernel tree.

The normal process is to send it again, with RESEND inside the [PATCH] box.

julia

Quoted 34 lines

Thanks
Arushi

On Saturday, 11 March 2017 02:12:02 UTC+5:30, Arushi Singhal wrote:
Improve readability by fixing multiple checkpatch.pl issues.

Arushi Singhal (2):
  staging: speakup: Avoid multiple assignments on same line
  staging: speakup: fixes braces {} should be used on all arms of this
    statement

 drivers/staging/speakup/main.c           |  6 ++++-- 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, 20 insertions(+), 16 deletions(-)

--
2.11.0

--
You received this message because you are subscribed to the Google Groups
"outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visithttps://groups.google.com/d/msgid/outreachy-kernel/e3451e76-4119-4ea9-8bd0- 134de6504fd0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

maintainer
#5 lore raw
In reply to Arushi Singhal
Quoted 2 lines · Arushi Singhal

Hi
This Patch series is not yet added to the kernel tree.

I don't see these in my queue either. I think maybe they were rejected due to the incorrect subject: line that I think someone said needed to be fixed? I can't remember, sorry, please rebase and resend if they are still needed.

thanks,

greg k-h