Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1603851 > unrolled thread

[PATCH 0/3] staging: speakup: Multiple checkpatch issues

Started byArushi Singhal <arushisinghal19971997@gmail.com>
First post2017-03-18 21:30 +0100
Last post2017-03-18 22:00 +0100
Articles 5 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 0/3] staging: speakup: Multiple checkpatch issues Arushi Singhal <arushisinghal19971997@gmail.com> - 2017-03-18 21:30 +0100
    [PATCH 2/3] staging: speakup: Remove multiple assignments Arushi Singhal <arushisinghal19971997@gmail.com> - 2017-03-18 21:40 +0100
    [PATCH 3/3] staging: speakup: Simplify "NULL" comparisons Arushi Singhal <arushisinghal19971997@gmail.com> - 2017-03-18 21:40 +0100
    Re: [Outreachy kernel] [PATCH 1/3] staging: speakup: Moved logical  to previous line. Julia Lawall <julia.lawall@lip6.fr> - 2017-03-18 21:40 +0100
    [PATCH 1/3] staging: speakup: Moved logical to previous line. Arushi Singhal <arushisinghal19971997@gmail.com> - 2017-03-18 22:00 +0100

#1603851 — [PATCH 0/3] staging: speakup: Multiple checkpatch issues

FromArushi Singhal <arushisinghal19971997@gmail.com>
Date2017-03-18 21:30 +0100
Subject[PATCH 0/3] staging: speakup: Multiple checkpatch issues
Message-ID<tmt97-3cH-3@gated-at.bofh.it>
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(-)

-- 
2.11.0

[toc] | [next] | [standalone]


#1603853 — [PATCH 2/3] staging: speakup: Remove multiple assignments

FromArushi Singhal <arushisinghal19971997@gmail.com>
Date2017-03-18 21:40 +0100
Subject[PATCH 2/3] staging: speakup: Remove multiple assignments
Message-ID<tmtiN-3iL-1@gated-at.bofh.it>
In reply to#1603851
This patch fixes the checkpatch.pl warning "multiple assignments
should be avoided."

Signed-off-by: Arushi Singhal <arushisinghal19971997@gmail.com>
---
 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

[toc] | [prev] | [next] | [standalone]


#1603854 — [PATCH 3/3] staging: speakup: Simplify "NULL" comparisons

FromArushi Singhal <arushisinghal19971997@gmail.com>
Date2017-03-18 21:40 +0100
Subject[PATCH 3/3] staging: speakup: Simplify "NULL" comparisons
Message-ID<tmtiO-3iL-5@gated-at.bofh.it>
In reply to#1603851
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>
---
 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

[toc] | [prev] | [next] | [standalone]


#1603856 — Re: [Outreachy kernel] [PATCH 1/3] staging: speakup: Moved logical to previous line.

FromJulia Lawall <julia.lawall@lip6.fr>
Date2017-03-18 21:40 +0100
SubjectRe: [Outreachy kernel] [PATCH 1/3] staging: speakup: Moved logical to previous line.
Message-ID<tmtiO-3iL-7@gated-at.bofh.it>
In reply to#1603851
The subject appears to be missing some words.  logical what?

On Sun, 19 Mar 2017, Arushi Singhal wrote:

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

All the instances appear to be && not ||

julia

> CHECK: Logical continuations should be on the previous line.
>
> Signed-off-by: Arushi Singhal <arushisinghal19971997@gmail.com>
> ---
>  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
>
> --
> 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 outreachy-kernel+unsubscribe@googlegroups.com.
> To post to this group, send email to outreachy-kernel@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20170318202559.10886-2-arushisinghal19971997%40gmail.com.
> For more options, visit https://groups.google.com/d/optout.
>

[toc] | [prev] | [next] | [standalone]


#1603859 — [PATCH 1/3] staging: speakup: Moved logical to previous line.

FromArushi Singhal <arushisinghal19971997@gmail.com>
Date2017-03-18 22:00 +0100
Subject[PATCH 1/3] staging: speakup: Moved logical to previous line.
Message-ID<tmtiO-3iL-9@gated-at.bofh.it>
In reply to#1603851
Moved logical OR 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>
---
 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

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web