staging: speakup: Multiple checkpatch issues
v2 cover staging: speakup: Multiple checkpatch issues
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(-)
Signature · 3 lines
changes in v2 -change the commit message of [patch 1/3] as was wrong 2.11.0
PATCH v2 1/3 staging: speakup: Moved logical to previous line.
Moved logical AND operator to previous line to fix the following checkpatch issue:
CHECK: Logical continuations should be on the previous line.
---
changes in v2
- Change the commit message.
drivers/staging/speakup/main.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/staging/speakup/main.c +6 -6
@@ -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
PATCH v2 2/3 staging: speakup: Remove multiple assignments
In reply to Arushi SinghalThis patch fixes the checkpatch.pl warning "multiple assignments should be avoided."
---
changes in v2
- no change.
drivers/staging/speakup/main.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-)
drivers/staging/speakup/main.c +12 -6
@@ -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
PATCH v2 3/3 staging: speakup: Simplify "NULL" comparisons
In reply to Arushi SinghalFixed 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'.
---
changes in v2
- no change
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
@@ -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
@@ -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