All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/3] staging: speakup: Multiple checkpatch issues
@ 2017-03-19  5:19 Arushi Singhal
  2017-03-19  5:19 ` [PATCH v2 1/3] staging: speakup: Moved logical to previous line Arushi Singhal
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Arushi Singhal @ 2017-03-19  5:19 UTC (permalink / raw)
  To: w.d.hubbs
  Cc: chris, outreachy-kernel, kirk, samuel.thibault, gregkh, speakup,
	devel, linux-kernel, Arushi Singhal

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

Arushi Singhal (3):
  staging: speakup: Moved logical to previous line.
  staging: speakup: Remove multiple assignments
  staging: speakup: Simplify "NULL" comparisons

 drivers/staging/speakup/main.c        | 30 ++++++++++++++++++------------
 drivers/staging/speakup/selection.c   |  2 +-
 drivers/staging/speakup/varhandlers.c |  6 +++---
 3 files changed, 22 insertions(+), 16 deletions(-)

-- 
changes in v2
 -change the commit message of [patch 1/3] as was wrong
2.11.0



^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v2 1/3] staging: speakup: Moved logical to previous line.
  2017-03-19  5:19 [PATCH v2 0/3] staging: speakup: Multiple checkpatch issues Arushi Singhal
@ 2017-03-19  5:19 ` Arushi Singhal
  2017-03-19  5:19 ` [PATCH v2 2/3] staging: speakup: Remove multiple assignments Arushi Singhal
  2017-03-19  5:19 ` [PATCH v2 3/3] staging: speakup: Simplify "NULL" comparisons Arushi Singhal
  2 siblings, 0 replies; 4+ messages in thread
From: Arushi Singhal @ 2017-03-19  5:19 UTC (permalink / raw)
  To: w.d.hubbs
  Cc: chris, outreachy-kernel, kirk, samuel.thibault, gregkh, speakup,
	devel, linux-kernel, Arushi Singhal

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

CHECK: Logical continuations should be on the previous line.

Signed-off-by: Arushi Singhal <arushisinghal19971997@gmail.com>
---
changes in v2
 - Change the commit message.

 drivers/staging/speakup/main.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/speakup/main.c b/drivers/staging/speakup/main.c
index f280e22d7e15..f71206878363 100644
--- a/drivers/staging/speakup/main.c
+++ b/drivers/staging/speakup/main.c
@@ -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;
-- 
2.11.0



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH v2 2/3] staging: speakup: Remove multiple assignments
  2017-03-19  5:19 [PATCH v2 0/3] staging: speakup: Multiple checkpatch issues Arushi Singhal
  2017-03-19  5:19 ` [PATCH v2 1/3] staging: speakup: Moved logical to previous line Arushi Singhal
@ 2017-03-19  5:19 ` Arushi Singhal
  2017-03-19  5:19 ` [PATCH v2 3/3] staging: speakup: Simplify "NULL" comparisons Arushi Singhal
  2 siblings, 0 replies; 4+ messages in thread
From: Arushi Singhal @ 2017-03-19  5:19 UTC (permalink / raw)
  To: w.d.hubbs
  Cc: chris, outreachy-kernel, kirk, samuel.thibault, gregkh, speakup,
	devel, linux-kernel, Arushi Singhal

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

Signed-off-by: Arushi Singhal <arushisinghal19971997@gmail.com>
---
changes in v2
 - no change.

 drivers/staging/speakup/main.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/speakup/main.c b/drivers/staging/speakup/main.c
index f71206878363..f8fccc8bf6b2 100644
--- a/drivers/staging/speakup/main.c
+++ b/drivers/staging/speakup/main.c
@@ -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;
-- 
2.11.0



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH v2 3/3] staging: speakup: Simplify "NULL" comparisons
  2017-03-19  5:19 [PATCH v2 0/3] staging: speakup: Multiple checkpatch issues Arushi Singhal
  2017-03-19  5:19 ` [PATCH v2 1/3] staging: speakup: Moved logical to previous line Arushi Singhal
  2017-03-19  5:19 ` [PATCH v2 2/3] staging: speakup: Remove multiple assignments Arushi Singhal
@ 2017-03-19  5:19 ` Arushi Singhal
  2 siblings, 0 replies; 4+ messages in thread
From: Arushi Singhal @ 2017-03-19  5:19 UTC (permalink / raw)
  To: w.d.hubbs
  Cc: chris, outreachy-kernel, kirk, samuel.thibault, gregkh, speakup,
	devel, linux-kernel, 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'.

Signed-off-by: Arushi Singhal <arushisinghal19971997@gmail.com>
---
changes in v2
 - no change

 drivers/staging/speakup/selection.c   | 2 +-
 drivers/staging/speakup/varhandlers.c | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/speakup/selection.c b/drivers/staging/speakup/selection.c
index afd9a446a06f..4417c00e68a7 100644
--- a/drivers/staging/speakup/selection.c
+++ b/drivers/staging/speakup/selection.c
@@ -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);
diff --git a/drivers/staging/speakup/varhandlers.c b/drivers/staging/speakup/varhandlers.c
index cc984196020f..5910fe0b1365 100644
--- a/drivers/staging/speakup/varhandlers.c
+++ b/drivers/staging/speakup/varhandlers.c
@@ -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];
-- 
2.11.0



^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-03-19  5:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-19  5:19 [PATCH v2 0/3] staging: speakup: Multiple checkpatch issues Arushi Singhal
2017-03-19  5:19 ` [PATCH v2 1/3] staging: speakup: Moved logical to previous line Arushi Singhal
2017-03-19  5:19 ` [PATCH v2 2/3] staging: speakup: Remove multiple assignments Arushi Singhal
2017-03-19  5:19 ` [PATCH v2 3/3] staging: speakup: Simplify "NULL" comparisons Arushi Singhal

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.