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