staging: speakup: Checkpatch issues.
cover staging: speakup: Checkpatch issues.
Improve readability by fixing multiple checkpatch.pl issues in speakup driver.
Arushi Singhal (4):
staging: speakup: Removed Unnecessary parentheses.
staging: speakup: Simplify the NULL comparisons
staging: speakup: Match alignment with open parenthesis.
staging: speakup: Fix alignment with parenthesis.
drivers/staging/speakup/fakekey.c | 2 +- drivers/staging/speakup/kobjects.c | 2 +- drivers/staging/speakup/main.c | 34 ++++++++++++++++---------------- drivers/staging/speakup/selection.c | 2 +- drivers/staging/speakup/serialio.c | 2 +- drivers/staging/speakup/speakup_acntpc.c | 6 +++--- drivers/staging/speakup/speakup_apollo.c | 2 +- drivers/staging/speakup/speakup_decext.c | 4 ++-- 8 files changed, 27 insertions(+), 27 deletions(-)
Signature · 1 line
2.11.0
PATCH 1/4 staging: speakup: Removed Unnecessary parentheses.
Unnecessary parentheses are removed to improve readability.
--- drivers/staging/speakup/kobjects.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/speakup/kobjects.c +1 -1
@@ -392,7 +392,7 @@ static ssize_t synth_store(struct kobject *kobj, struct kobj_attribute *attr, len--; new_synth_name[len] ='\0' ;spk_strlwr (new_synth_name); -if (synth && (!strcmp (new_synth_name, synth->name))) { +if (synth && !strcmp (new_synth_name, synth->name)) {pr_warn ("%s already in use\n" , new_synth_name); }else if (synth_init (new_synth_name) !=0 ) {pr_warn ("failed to init synth %s\n" , new_synth_name);
Signature · 1 line
2.11.0
PATCH 2/4 staging: speakup: Simplify the 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'.
--- drivers/staging/speakup/fakekey.c | 2 +- drivers/staging/speakup/main.c | 32 ++++++++++++++++---------------- 2 files changed, 17 insertions(+), 17 deletions(-)
drivers/staging/speakup/fakekey.c +1 -1
@@ -56,7 +56,7 @@ int speakup_add_virtual_keyboard(void)void speakup_remove_virtual_keyboard (void ) { -if (virt_keyboard !=NULL ) { +if (virt_keyboard) {input_unregister_device (virt_keyboard); virt_keyboard =NULL ; }
drivers/staging/speakup/main.c +16 -16
@@ -304,7 +304,7 @@ static void speakup_shut_up(struct vc_data *vc) spk_shut_up |=0x01 ; spk_parked &=0xfe ;speakup_date (vc); -if (synth !=NULL ) +if (synth)spk_do_flush (); }
@@ -449,7 +449,7 @@ static void speak_char(u16 ch) } cp = spk_characters[ch]; -if (cp ==NULL ) { +if (!cp) {pr_info ("speak_char: cp == NULL!\n" );return ; }
@@ -1177,7 +1177,7 @@ static void do_handle_shift(struct vc_data *vc, u_char value, char up_flag) {unsigned long flags; -if (synth ==NULL || up_flag || spk_killed) +if (!synth || up_flag || spk_killed)return ;spin_lock_irqsave (&speakup_info.spinlock, flags);if (cursor_track == read_all_mode) {
@@ -1215,7 +1215,7 @@ static void do_handle_latin(struct vc_data *vc, u_char value, char up_flag)spin_unlock_irqrestore (&speakup_info.spinlock, flags);return ; } -if (synth ==NULL || spk_killed) { +if (!synth || spk_killed) {spin_unlock_irqrestore (&speakup_info.spinlock, flags);return ; }
@@ -1341,7 +1341,7 @@ static int speakup_allocate(struct vc_data *vc)int vc_num; vc_num = vc->vc_num; -if (speakup_console[vc_num] ==NULL ) { +if (!speakup_console[vc_num]) { speakup_console[vc_num] =kzalloc (sizeof (*speakup_console[0 ]),GFP_ATOMIC );if (!speakup_console[vc_num])
@@ -1394,7 +1394,7 @@ static void kbd_fakekey2(struct vc_data *vc, int command)static void read_all_doc (struct vc_data *vc) { -if ((vc->vc_num != fg_console) || synth ==NULL || spk_shut_up) +if ((vc->vc_num != fg_console) || !synth || spk_shut_up)return ;if (!synth_supports_indexing ())return ;
@@ -1509,7 +1509,7 @@ static int pre_handle_cursor(struct vc_data *vc, u_char value, char up_flag)spin_lock_irqsave (&speakup_info.spinlock, flags);if (cursor_track == read_all_mode) { spk_parked &=0xfe ; -if (synth ==NULL || up_flag || spk_shut_up) { +if (!synth || up_flag || spk_shut_up) {spin_unlock_irqrestore (&speakup_info.spinlock, flags);return NOTIFY_STOP ; }
@@ -1531,7 +1531,7 @@ static void do_handle_cursor(struct vc_data *vc, u_char value, char up_flag)spin_lock_irqsave (&speakup_info.spinlock, flags); spk_parked &=0xfe ; -if (synth ==NULL || up_flag || spk_shut_up || cursor_track == CT_Off) { +if (!synth || up_flag || spk_shut_up || cursor_track == CT_Off) {spin_unlock_irqrestore (&speakup_info.spinlock, flags);return ; }
@@ -1730,7 +1730,7 @@ static void speakup_bs(struct vc_data *vc)return ;if (!spk_parked)speakup_date (vc); -if (spk_shut_up || synth ==NULL ) { +if (spk_shut_up || !synth) {spin_unlock_irqrestore (&speakup_info.spinlock, flags);return ; }
@@ -1747,7 +1747,7 @@ static void speakup_con_write(struct vc_data *vc, u16 *str, int len) {unsigned long flags; -if ((vc->vc_num != fg_console) || spk_shut_up || synth ==NULL ) +if ((vc->vc_num != fg_console) || spk_shut_up || !synth)return ;if (!spin_trylock_irqsave (&speakup_info.spinlock, flags))/* Speakup output, discard */
@@ -1776,7 +1776,7 @@ static void speakup_con_update(struct vc_data *vc) {unsigned long flags; -if (speakup_console[vc->vc_num] ==NULL || spk_parked) +if (!speakup_console[vc->vc_num] || spk_parked)return ;if (!spin_trylock_irqsave (&speakup_info.spinlock, flags))/* Speakup output, discard */
@@ -1791,7 +1791,7 @@ static void do_handle_spec(struct vc_data *vc, u_char value, char up_flag)int on_off =2 ;char *label; -if (synth ==NULL || up_flag || spk_killed) +if (!synth || up_flag || spk_killed)return ;spin_lock_irqsave (&speakup_info.spinlock, flags); spk_shut_up &=0xfe ;
@@ -1835,7 +1835,7 @@ static int inc_dec_var(u_char value) var_id = var_id /2 +FIRST_SET_VAR ; p_header =spk_get_var_header (var_id); -if (p_header ==NULL ) +if (!p_header)return -1 ;if (p_header->var_type !=VAR_NUM )return -1 ;
@@ -1918,7 +1918,7 @@ static void speakup_bits(struct vc_data *vc) {int val = this_speakup_key - (FIRST_EDIT_BITS -1 ); -if (spk_special_handler !=NULL || val <1 || val >6 ) { +if (spk_special_handler || val <1 || val >6 ) {synth_printf ("%s\n" ,spk_msg_get (MSG_ERROR ));return ; }
@@ -2012,7 +2012,7 @@ static int handle_goto(struct vc_data *vc, u_char type, u_char ch, u_short key)static void speakup_goto (struct vc_data *vc) { -if (spk_special_handler !=NULL ) { +if (spk_special_handler) {synth_printf ("%s\n" ,spk_msg_get (MSG_ERROR ));return ; }
@@ -2164,7 +2164,7 @@ speakup_key(struct vc_data *vc, int shift_state, int keycode, u_short keysym, } } no_map: -if (type ==KT_SPKUP && spk_special_handler ==NULL ) { +if (type ==KT_SPKUP && !spk_special_handler) {do_spkup (vc, new_key); spk_close_press =0 ; ret =1 ;
Signature · 1 line
2.11.0
PATCH 3/4 staging: speakup: Match alignment with open parenthesis.
In reply to Arushi SinghalFix checkpatch issues: "CHECK: Alignment should match open parenthesis".
--- drivers/staging/speakup/main.c | 2 +- drivers/staging/speakup/selection.c | 2 +- drivers/staging/speakup/serialio.c | 2 +- drivers/staging/speakup/speakup_acntpc.c | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-)
drivers/staging/speakup/main.c +1 -1
@@ -1160,7 +1160,7 @@ static void spkup_write(const u16 *in_buf, int count)if (last_type &CH_RPT ) {synth_printf (" " );synth_printf (spk_msg_get (MSG_REPEAT_DESC2 ), - ++rep_count); + ++rep_count);synth_printf (" " ); } rep_count =0 ;
drivers/staging/speakup/selection.c +1 -1
@@ -75,7 +75,7 @@ int speakup_set_selection(struct tty_struct *tty)speakup_clear_selection (); spk_sel_cons = vc_cons[fg_console].d;dev_warn (tty->dev, -"Selection: mark console not the same as cut\n" ); +"Selection: mark console not the same as cut\n" );return -EINVAL ; }
drivers/staging/speakup/serialio.c +1 -1
@@ -125,7 +125,7 @@ static void start_serial_interrupt(int irq)pr_err ("Unable to request Speakup serial I R Q\n" );/* Set MCR */ outb (UART_MCR_DTR |UART_MCR_RTS |UART_MCR_OUT2 , - speakup_info.port_tts +UART_MCR ); + speakup_info.port_tts +UART_MCR );/* Turn on Interrupts */ outb (UART_IER_MSI |UART_IER_RLSI |UART_IER_RDI , speakup_info.port_tts +UART_IER );
drivers/staging/speakup/speakup_acntpc.c +3 -3
@@ -261,9 +261,9 @@ static int synth_probe(struct spk_synth *synth)if (port_forced) { speakup_info.port_tts = port_forced;pr_info ("probe forced to %x by kernel command line\n" , - speakup_info.port_tts); + speakup_info.port_tts);if (synth_request_region (speakup_info.port_tts -1 , -SYNTH_IO_EXTENT )) { +SYNTH_IO_EXTENT )) {pr_warn ("sorry, port already reserved\n" );return -EBUSY ; }
@@ -272,7 +272,7 @@ static int synth_probe(struct spk_synth *synth) }else {for (i =0 ; synth_portlist[i]; i++) {if (synth_request_region (synth_portlist[i], -SYNTH_IO_EXTENT )) { +SYNTH_IO_EXTENT )) {pr_warn ("request_region: failed with 0x%x, %d\n" , synth_portlist[i],SYNTH_IO_EXTENT );
Signature · 1 line
2.11.0
PATCH 4/4 staging: speakup: Fix alignment with parenthesis.
In reply to Arushi SinghalThis patch fixes the warnings reported by checkpatch.pl for please use a blank line after function/struct/union/enum declarations.
--- drivers/staging/speakup/speakup_apollo.c | 2 +- drivers/staging/speakup/speakup_decext.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/staging/speakup/speakup_apollo.c +1 -1
@@ -173,7 +173,7 @@ static void do_catch_up(struct spk_synth *synth)if (!synth->io_ops->synth_out (synth, ch)) {outb (UART_MCR_DTR , speakup_info.port_tts +UART_MCR );outb (UART_MCR_DTR |UART_MCR_RTS , - speakup_info.port_tts +UART_MCR ); + speakup_info.port_tts +UART_MCR );schedule_timeout (msecs_to_jiffies (full_time_val));continue ; }
drivers/staging/speakup/speakup_decext.c +2 -2
@@ -206,11 +206,11 @@ static void do_catch_up(struct spk_synth *synth)if (!in_escape) synth->io_ops->synth_out (synth,PROCSPEECH );spin_lock_irqsave (&speakup_info.spinlock, - flags); + flags); jiffy_delta_val = jiffy_delta->u.n.value; delay_time_val = delay_time->u.n.value;spin_unlock_irqrestore (&speakup_info.spinlock, - flags); + flags);schedule_timeout (msecs_to_jiffies (delay_time_val)); jiff_max = jiffies + jiffy_delta_val;
Signature · 1 line
2.11.0