Commit 0d6ff616 authored by Arushi Singhal's avatar Arushi Singhal Committed by Greg Kroah-Hartman

staging: speakup: Remove the explicit NULL comparison

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: default avatarArushi Singhal <arushisinghal19971997@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent f239d3db
...@@ -56,7 +56,7 @@ int speakup_add_virtual_keyboard(void) ...@@ -56,7 +56,7 @@ int speakup_add_virtual_keyboard(void)
void speakup_remove_virtual_keyboard(void) void speakup_remove_virtual_keyboard(void)
{ {
if (virt_keyboard != NULL) { if (virt_keyboard) {
input_unregister_device(virt_keyboard); input_unregister_device(virt_keyboard);
virt_keyboard = NULL; virt_keyboard = NULL;
} }
......
...@@ -301,7 +301,7 @@ static void speakup_shut_up(struct vc_data *vc) ...@@ -301,7 +301,7 @@ static void speakup_shut_up(struct vc_data *vc)
spk_shut_up |= 0x01; spk_shut_up |= 0x01;
spk_parked &= 0xfe; spk_parked &= 0xfe;
speakup_date(vc); speakup_date(vc);
if (synth != NULL) if (synth)
spk_do_flush(); spk_do_flush();
} }
...@@ -446,7 +446,7 @@ static void speak_char(u16 ch) ...@@ -446,7 +446,7 @@ static void speak_char(u16 ch)
} }
cp = spk_characters[ch]; cp = spk_characters[ch];
if (cp == NULL) { if (!cp) {
pr_info("speak_char: cp == NULL!\n"); pr_info("speak_char: cp == NULL!\n");
return; return;
} }
...@@ -1171,7 +1171,7 @@ static void do_handle_shift(struct vc_data *vc, u_char value, char up_flag) ...@@ -1171,7 +1171,7 @@ static void do_handle_shift(struct vc_data *vc, u_char value, char up_flag)
{ {
unsigned long flags; unsigned long flags;
if (synth == NULL || up_flag || spk_killed) if (!synth || up_flag || spk_killed)
return; return;
spin_lock_irqsave(&speakup_info.spinlock, flags); spin_lock_irqsave(&speakup_info.spinlock, flags);
if (cursor_track == read_all_mode) { if (cursor_track == read_all_mode) {
...@@ -1209,7 +1209,7 @@ static void do_handle_latin(struct vc_data *vc, u_char value, char up_flag) ...@@ -1209,7 +1209,7 @@ static void do_handle_latin(struct vc_data *vc, u_char value, char up_flag)
spin_unlock_irqrestore(&speakup_info.spinlock, flags); spin_unlock_irqrestore(&speakup_info.spinlock, flags);
return; return;
} }
if (synth == NULL || spk_killed) { if (!synth || spk_killed) {
spin_unlock_irqrestore(&speakup_info.spinlock, flags); spin_unlock_irqrestore(&speakup_info.spinlock, flags);
return; return;
} }
...@@ -1346,7 +1346,7 @@ static int speakup_allocate(struct vc_data *vc, gfp_t gfp_flags) ...@@ -1346,7 +1346,7 @@ static int speakup_allocate(struct vc_data *vc, gfp_t gfp_flags)
int vc_num; int vc_num;
vc_num = vc->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]), speakup_console[vc_num] = kzalloc(sizeof(*speakup_console[0]),
gfp_flags); gfp_flags);
if (!speakup_console[vc_num]) if (!speakup_console[vc_num])
...@@ -1399,7 +1399,7 @@ static void kbd_fakekey2(struct vc_data *vc, int command) ...@@ -1399,7 +1399,7 @@ static void kbd_fakekey2(struct vc_data *vc, int command)
static void read_all_doc(struct vc_data *vc) 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; return;
if (!synth_supports_indexing()) if (!synth_supports_indexing())
return; return;
...@@ -1514,7 +1514,7 @@ static int pre_handle_cursor(struct vc_data *vc, u_char value, char up_flag) ...@@ -1514,7 +1514,7 @@ static int pre_handle_cursor(struct vc_data *vc, u_char value, char up_flag)
spin_lock_irqsave(&speakup_info.spinlock, flags); spin_lock_irqsave(&speakup_info.spinlock, flags);
if (cursor_track == read_all_mode) { if (cursor_track == read_all_mode) {
spk_parked &= 0xfe; 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); spin_unlock_irqrestore(&speakup_info.spinlock, flags);
return NOTIFY_STOP; return NOTIFY_STOP;
} }
...@@ -1536,7 +1536,7 @@ static void do_handle_cursor(struct vc_data *vc, u_char value, char up_flag) ...@@ -1536,7 +1536,7 @@ static void do_handle_cursor(struct vc_data *vc, u_char value, char up_flag)
spin_lock_irqsave(&speakup_info.spinlock, flags); spin_lock_irqsave(&speakup_info.spinlock, flags);
spk_parked &= 0xfe; 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); spin_unlock_irqrestore(&speakup_info.spinlock, flags);
return; return;
} }
...@@ -1732,7 +1732,7 @@ static void speakup_bs(struct vc_data *vc) ...@@ -1732,7 +1732,7 @@ static void speakup_bs(struct vc_data *vc)
return; return;
if (!spk_parked) if (!spk_parked)
speakup_date(vc); speakup_date(vc);
if (spk_shut_up || synth == NULL) { if (spk_shut_up || !synth) {
spin_unlock_irqrestore(&speakup_info.spinlock, flags); spin_unlock_irqrestore(&speakup_info.spinlock, flags);
return; return;
} }
...@@ -1749,7 +1749,7 @@ static void speakup_con_write(struct vc_data *vc, u16 *str, int len) ...@@ -1749,7 +1749,7 @@ static void speakup_con_write(struct vc_data *vc, u16 *str, int len)
{ {
unsigned long flags; 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; return;
if (!spin_trylock_irqsave(&speakup_info.spinlock, flags)) if (!spin_trylock_irqsave(&speakup_info.spinlock, flags))
/* Speakup output, discard */ /* Speakup output, discard */
...@@ -1778,7 +1778,7 @@ static void speakup_con_update(struct vc_data *vc) ...@@ -1778,7 +1778,7 @@ static void speakup_con_update(struct vc_data *vc)
{ {
unsigned long flags; unsigned long flags;
if (speakup_console[vc->vc_num] == NULL || spk_parked) if (!speakup_console[vc->vc_num] || spk_parked)
return; return;
if (!spin_trylock_irqsave(&speakup_info.spinlock, flags)) if (!spin_trylock_irqsave(&speakup_info.spinlock, flags))
/* Speakup output, discard */ /* Speakup output, discard */
...@@ -1793,7 +1793,7 @@ static void do_handle_spec(struct vc_data *vc, u_char value, char up_flag) ...@@ -1793,7 +1793,7 @@ static void do_handle_spec(struct vc_data *vc, u_char value, char up_flag)
int on_off = 2; int on_off = 2;
char *label; char *label;
if (synth == NULL || up_flag || spk_killed) if (!synth || up_flag || spk_killed)
return; return;
spin_lock_irqsave(&speakup_info.spinlock, flags); spin_lock_irqsave(&speakup_info.spinlock, flags);
spk_shut_up &= 0xfe; spk_shut_up &= 0xfe;
...@@ -1837,7 +1837,7 @@ static int inc_dec_var(u_char value) ...@@ -1837,7 +1837,7 @@ static int inc_dec_var(u_char value)
var_id = var_id / 2 + FIRST_SET_VAR; var_id = var_id / 2 + FIRST_SET_VAR;
p_header = spk_get_var_header(var_id); p_header = spk_get_var_header(var_id);
if (p_header == NULL) if (!p_header)
return -1; return -1;
if (p_header->var_type != VAR_NUM) if (p_header->var_type != VAR_NUM)
return -1; return -1;
...@@ -1920,7 +1920,7 @@ static void speakup_bits(struct vc_data *vc) ...@@ -1920,7 +1920,7 @@ static void speakup_bits(struct vc_data *vc)
{ {
int val = this_speakup_key - (FIRST_EDIT_BITS - 1); 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)); synth_printf("%s\n", spk_msg_get(MSG_ERROR));
return; return;
} }
...@@ -2014,7 +2014,7 @@ static int handle_goto(struct vc_data *vc, u_char type, u_char ch, u_short key) ...@@ -2014,7 +2014,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) 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)); synth_printf("%s\n", spk_msg_get(MSG_ERROR));
return; return;
} }
...@@ -2165,7 +2165,7 @@ speakup_key(struct vc_data *vc, int shift_state, int keycode, u_short keysym, ...@@ -2165,7 +2165,7 @@ speakup_key(struct vc_data *vc, int shift_state, int keycode, u_short keysym,
} }
} }
no_map: no_map:
if (type == KT_SPKUP && spk_special_handler == NULL) { if (type == KT_SPKUP && !spk_special_handler) {
do_spkup(vc, new_key); do_spkup(vc, new_key);
spk_close_press = 0; spk_close_press = 0;
ret = 1; ret = 1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment