Discussion:
[PATCH 3/3] Staging: speakup: Add space around that " "
s***@gmail.com
2015-12-27 14:40:40 UTC
Permalink
From: Shraddha Barke <***@gmail.com>

According to kernel coding style, add space around "+","-" and "&"
Warning detected using checkpatch.

Signed-off-by: Shraddha Barke <***@gmail.com>
---
drivers/staging/speakup/keyhelp.c | 18 +++++-----
drivers/staging/speakup/kobjects.c | 56 ++++++++++++++++----------------
drivers/staging/speakup/selection.c | 2 +-
drivers/staging/speakup/serialio.c | 14 ++++----
drivers/staging/speakup/speakup_acntpc.c | 32 +++++++++---------
5 files changed, 61 insertions(+), 61 deletions(-)

diff --git a/drivers/staging/speakup/keyhelp.c b/drivers/staging/speakup/keyhelp.c
index 237e0d0..ce94cb1 100644
--- a/drivers/staging/speakup/keyhelp.c
+++ b/drivers/staging/speakup/keyhelp.c
@@ -70,7 +70,7 @@ static void build_key_data(void)
for (i = 0; i < nstates; i++, kp++) {
if (!*kp)
continue;
- if ((state_tbl[i]&16) != 0 && *kp == SPK_KEY)
+ if ((state_tbl[i] & 16) != 0 && *kp == SPK_KEY)
continue;
counters[*kp]++;
}
@@ -79,7 +79,7 @@ static void build_key_data(void)
if (counters[i] == 0)
continue;
key_offsets[i] = offset;
- offset += (counters[i]+1);
+ offset += (counters[i] + 1);
if (offset >= MAXKEYS)
break;
}
@@ -93,7 +93,7 @@ static void build_key_data(void)
ch1 = *kp++;
if (!ch1)
continue;
- if ((state_tbl[i]&16) != 0 && ch1 == SPK_KEY)
+ if ((state_tbl[i] & 16) != 0 && ch1 == SPK_KEY)
continue;
key = (state_tbl[i] << 8) + ch;
counters[ch1]--;
@@ -126,14 +126,14 @@ static int help_init(void)
int i;
int num_funcs = MSG_FUNCNAMES_END - MSG_FUNCNAMES_START + 1;

- state_tbl = spk_our_keys[0]+SHIFT_TBL_SIZE+2;
+ state_tbl = spk_our_keys[0] + SHIFT_TBL_SIZE + 2;
for (i = 0; i < num_funcs; i++) {
char *cur_funcname = spk_msg_get(MSG_FUNCNAMES_START + i);

if (start == *cur_funcname)
continue;
start = *cur_funcname;
- letter_offsets[(start&31)-1] = i;
+ letter_offsets[(start & 31) - 1] = i;
}
return 0;
}
@@ -156,12 +156,12 @@ int spk_handle_help(struct vc_data *vc, u_char type, u_char ch, u_short key)
ch |= 32; /* lower case */
if (ch < 'a' || ch > 'z')
return -1;
- if (letter_offsets[ch-'a'] == -1) {
+ if (letter_offsets[ch - 'a'] == -1) {
synth_printf(spk_msg_get(MSG_NO_COMMAND), ch);
synth_printf("\n");
return 1;
}
- cur_item = letter_offsets[ch-'a'];
+ cur_item = letter_offsets[ch - 'a'];
} else if (type == KT_CUR) {
if (ch == 0
&& (MSG_FUNCNAMES_START + cur_item + 1) <=
@@ -182,7 +182,7 @@ int spk_handle_help(struct vc_data *vc, u_char type, u_char ch, u_short key)
name = NULL;
if ((type != KT_SPKUP) && (key > 0) && (key <= num_key_names)) {
synth_printf("%s\n",
- spk_msg_get(MSG_KEYNAMES_START + key-1));
+ spk_msg_get(MSG_KEYNAMES_START + key - 1));
return 1;
}
for (i = 0; funcvals[i] != 0 && !name; i++) {
@@ -191,7 +191,7 @@ int spk_handle_help(struct vc_data *vc, u_char type, u_char ch, u_short key)
}
if (!name)
return -1;
- kp = spk_our_keys[key]+1;
+ kp = spk_our_keys[key] + 1;
for (i = 0; i < nstates; i++) {
if (ch == kp[i])
break;
diff --git a/drivers/staging/speakup/kobjects.c b/drivers/staging/speakup/kobjects.c
index 13b4eba..eacbfb1 100644
--- a/drivers/staging/speakup/kobjects.c
+++ b/drivers/staging/speakup/kobjects.c
@@ -251,7 +251,7 @@ static ssize_t keymap_show(struct kobject *kobj, struct kobj_attribute *attr,
}
cp += sprintf(cp, "0, %d\n", KEY_MAP_VER);
spin_unlock_irqrestore(&speakup_info.spinlock, flags);
- return (int)(cp-buf);
+ return (int)(cp - buf);
}

/*
@@ -288,11 +288,11 @@ static ssize_t keymap_store(struct kobject *kobj, struct kobj_attribute *attr,
cp = spk_s2uchar(cp, cp1);
cp1++;
}
- i = (int)cp1[-2]+1;
- i *= (int)cp1[-1]+1;
+ i = (int)cp1[-2] + 1;
+ i *= (int)cp1[-1] + 1;
i += 2; /* 0 and last map ver */
if (cp1[-3] != KEY_MAP_VER || cp1[-1] > 10 ||
- i+SHIFT_TBL_SIZE+4 >= sizeof(spk_key_buf)) {
+ i + SHIFT_TBL_SIZE + 4 >= sizeof(spk_key_buf)) {
pr_warn("i %d %d %d %d\n", i,
(int)cp1[-3], (int)cp1[-2], (int)cp1[-1]);
kfree(in_buff);
@@ -344,15 +344,15 @@ static ssize_t silent_store(struct kobject *kobj, struct kobj_attribute *attr,
return -EINVAL;
}
spin_lock_irqsave(&speakup_info.spinlock, flags);
- if (ch&2) {
+ if (ch & 2) {
shut = 1;
spk_do_flush();
} else {
shut = 0;
}
- if (ch&4)
+ if (ch & 4)
shut |= 0x40;
- if (ch&1)
+ if (ch & 1)
spk_shut_up |= shut;
else
spk_shut_up &= ~shut;
@@ -476,12 +476,12 @@ static ssize_t punc_show(struct kobject *kobj, struct kobj_attribute *attr,
pb = (struct st_bits_data *) &spk_punc_info[var->value];
mask = pb->mask;
for (i = 33; i < 128; i++) {
- if (!(spk_chartab[i]&mask))
+ if (!(spk_chartab[i] & mask))
continue;
*cp++ = (char)i;
}
spin_unlock_irqrestore(&speakup_info.spinlock, flags);
- return cp-buf;
+ return cp - buf;
}

/*
@@ -572,7 +572,7 @@ ssize_t spk_var_show(struct kobject *kobj, struct kobj_attribute *attr,
*cp1++ = '"';
*cp1++ = '\n';
*cp1 = '\0';
- rv = cp1-buf;
+ rv = cp1 - buf;
} else {
rv = sprintf(buf, "\"\"\n");
}
@@ -862,42 +862,42 @@ static struct kobj_attribute version_attribute =
__ATTR_RO(version);

static struct kobj_attribute delimiters_attribute =
- __ATTR(delimiters, S_IWUSR|S_IRUGO, punc_show, punc_store);
+ __ATTR(delimiters, S_IWUSR | S_IRUGO, punc_show, punc_store);
static struct kobj_attribute ex_num_attribute =
- __ATTR(ex_num, S_IWUSR|S_IRUGO, punc_show, punc_store);
+ __ATTR(ex_num, S_IWUSR | S_IRUGO, punc_show, punc_store);
static struct kobj_attribute punc_all_attribute =
- __ATTR(punc_all, S_IWUSR|S_IRUGO, punc_show, punc_store);
+ __ATTR(punc_all, S_IWUSR | S_IRUGO, punc_show, punc_store);
static struct kobj_attribute punc_most_attribute =
- __ATTR(punc_most, S_IWUSR|S_IRUGO, punc_show, punc_store);
+ __ATTR(punc_most, S_IWUSR | S_IRUGO, punc_show, punc_store);
static struct kobj_attribute punc_some_attribute =
- __ATTR(punc_some, S_IWUSR|S_IRUGO, punc_show, punc_store);
+ __ATTR(punc_some, S_IWUSR | S_IRUGO, punc_show, punc_store);
static struct kobj_attribute repeats_attribute =
- __ATTR(repeats, S_IWUSR|S_IRUGO, punc_show, punc_store);
+ __ATTR(repeats, S_IWUSR | S_IRUGO, punc_show, punc_store);

static struct kobj_attribute attrib_bleep_attribute =
- __ATTR(attrib_bleep, S_IWUSR|S_IRUGO, spk_var_show, spk_var_store);
+ __ATTR(attrib_bleep, S_IWUSR | S_IRUGO, spk_var_show, spk_var_store);
static struct kobj_attribute bell_pos_attribute =
- __ATTR(bell_pos, S_IWUSR|S_IRUGO, spk_var_show, spk_var_store);
+ __ATTR(bell_pos, S_IWUSR | S_IRUGO, spk_var_show, spk_var_store);
static struct kobj_attribute bleep_time_attribute =
- __ATTR(bleep_time, S_IWUSR|S_IRUGO, spk_var_show, spk_var_store);
+ __ATTR(bleep_time, S_IWUSR | S_IRUGO, spk_var_show, spk_var_store);
static struct kobj_attribute bleeps_attribute =
- __ATTR(bleeps, S_IWUSR|S_IRUGO, spk_var_show, spk_var_store);
+ __ATTR(bleeps, S_IWUSR | S_IRUGO, spk_var_show, spk_var_store);
static struct kobj_attribute cursor_time_attribute =
- __ATTR(cursor_time, S_IWUSR|S_IRUGO, spk_var_show, spk_var_store);
+ __ATTR(cursor_time, S_IWUSR | S_IRUGO, spk_var_show, spk_var_store);
static struct kobj_attribute key_echo_attribute =
- __ATTR(key_echo, S_IWUSR|S_IRUGO, spk_var_show, spk_var_store);
+ __ATTR(key_echo, S_IWUSR | S_IRUGO, spk_var_show, spk_var_store);
static struct kobj_attribute no_interrupt_attribute =
- __ATTR(no_interrupt, S_IWUSR|S_IRUGO, spk_var_show, spk_var_store);
+ __ATTR(no_interrupt, S_IWUSR | S_IRUGO, spk_var_show, spk_var_store);
static struct kobj_attribute punc_level_attribute =
- __ATTR(punc_level, S_IWUSR|S_IRUGO, spk_var_show, spk_var_store);
+ __ATTR(punc_level, S_IWUSR | S_IRUGO, spk_var_show, spk_var_store);
static struct kobj_attribute reading_punc_attribute =
- __ATTR(reading_punc, S_IWUSR|S_IRUGO, spk_var_show, spk_var_store);
+ __ATTR(reading_punc, S_IWUSR | S_IRUGO, spk_var_show, spk_var_store);
static struct kobj_attribute say_control_attribute =
- __ATTR(say_control, S_IWUSR|S_IRUGO, spk_var_show, spk_var_store);
+ __ATTR(say_control, S_IWUSR | S_IRUGO, spk_var_show, spk_var_store);
static struct kobj_attribute say_word_ctl_attribute =
- __ATTR(say_word_ctl, S_IWUSR|S_IRUGO, spk_var_show, spk_var_store);
+ __ATTR(say_word_ctl, S_IWUSR | S_IRUGO, spk_var_show, spk_var_store);
static struct kobj_attribute spell_delay_attribute =
- __ATTR(spell_delay, S_IWUSR|S_IRUGO, spk_var_show, spk_var_store);
+ __ATTR(spell_delay, S_IWUSR | S_IRUGO, spk_var_show, spk_var_store);

/*
* These attributes are i18n related.
diff --git a/drivers/staging/speakup/selection.c b/drivers/staging/speakup/selection.c
index cf854ad..3f7fb33 100644
--- a/drivers/staging/speakup/selection.c
+++ b/drivers/staging/speakup/selection.c
@@ -99,7 +99,7 @@ int speakup_set_selection(struct tty_struct *tty)
sel_start = new_sel_start;
sel_end = new_sel_end;
/* Allocate a new buffer before freeing the old one ... */
- bp = kmalloc((sel_end-sel_start)/2+1, GFP_ATOMIC);
+ bp = kmalloc((sel_end - sel_start) / 2 + 1, GFP_ATOMIC);
if (!bp) {
speakup_clear_selection();
return -ENOMEM;
diff --git a/drivers/staging/speakup/serialio.c b/drivers/staging/speakup/serialio.c
index 3b5835b..2033faa 100644
--- a/drivers/staging/speakup/serialio.c
+++ b/drivers/staging/speakup/serialio.c
@@ -88,7 +88,7 @@ static irqreturn_t synth_readbuf_handler(int irq, void *dev_id)
spin_lock_irqsave(&speakup_info.spinlock, flags);
while (inb_p(speakup_info.port_tts + UART_LSR) & UART_LSR_DR) {

- c = inb_p(speakup_info.port_tts+UART_RX);
+ c = inb_p(speakup_info.port_tts + UART_RX);
synth->read_buff_add((u_char) c);
/*printk(KERN_ERR "c = %d\n", c); */
/*pr_warn("C = %d\n", c); */
@@ -113,12 +113,12 @@ static void start_serial_interrupt(int irq)
outb(UART_MCR_DTR | UART_MCR_RTS | UART_MCR_OUT2,
speakup_info.port_tts + UART_MCR);
/* Turn on Interrupts */
- outb(UART_IER_MSI|UART_IER_RLSI|UART_IER_RDI,
+ outb(UART_IER_MSI | UART_IER_RLSI | UART_IER_RDI,
speakup_info.port_tts + UART_IER);
- inb(speakup_info.port_tts+UART_LSR);
- inb(speakup_info.port_tts+UART_RX);
- inb(speakup_info.port_tts+UART_IIR);
- inb(speakup_info.port_tts+UART_MSR);
+ inb(speakup_info.port_tts + UART_LSR);
+ inb(speakup_info.port_tts + UART_RX);
+ inb(speakup_info.port_tts + UART_IIR);
+ inb(speakup_info.port_tts + UART_MSR);
outb(1, speakup_info.port_tts + UART_FCR); /* Turn FIFO On */
}

@@ -131,7 +131,7 @@ void spk_stop_serial_interrupt(void)
return;

/* Turn off interrupts */
- outb(0, speakup_info.port_tts+UART_IER);
+ outb(0, speakup_info.port_tts + UART_IER);
/* Free IRQ */
free_irq(serstate->irq, (void *) synth_readbuf_handler);
}
diff --git a/drivers/staging/speakup/speakup_acntpc.c b/drivers/staging/speakup/speakup_acntpc.c
index efb791b..2649ff1 100644
--- a/drivers/staging/speakup/speakup_acntpc.c
+++ b/drivers/staging/speakup/speakup_acntpc.c
@@ -1,4 +1,4 @@
-/*
+ /*
* written by: Kirk Reiser <***@braille.uwo.ca>
* this version considerably modified by David Borowski, ***@rogers.com
*
@@ -57,28 +57,28 @@ static struct var_t vars[] = {
* These attributes will appear in /sys/accessibility/speakup/acntpc.
*/
static struct kobj_attribute caps_start_attribute =
- __ATTR(caps_start, S_IWUSR|S_IRUGO, spk_var_show, spk_var_store);
+ __ATTR(caps_start, S_IWUSR | S_IRUGO, spk_var_show, spk_var_store);
static struct kobj_attribute caps_stop_attribute =
- __ATTR(caps_stop, S_IWUSR|S_IRUGO, spk_var_show, spk_var_store);
+ __ATTR(caps_stop, S_IWUSR | S_IRUGO, spk_var_show, spk_var_store);
static struct kobj_attribute pitch_attribute =
- __ATTR(pitch, S_IWUSR|S_IRUGO, spk_var_show, spk_var_store);
+ __ATTR(pitch, S_IWUSR | S_IRUGO, spk_var_show, spk_var_store);
static struct kobj_attribute rate_attribute =
- __ATTR(rate, S_IWUSR|S_IRUGO, spk_var_show, spk_var_store);
+ __ATTR(rate, S_IWUSR | S_IRUGO, spk_var_show, spk_var_store);
static struct kobj_attribute tone_attribute =
- __ATTR(tone, S_IWUSR|S_IRUGO, spk_var_show, spk_var_store);
+ __ATTR(tone, S_IWUSR | S_IRUGO, spk_var_show, spk_var_store);
static struct kobj_attribute vol_attribute =
- __ATTR(vol, S_IWUSR|S_IRUGO, spk_var_show, spk_var_store);
+ __ATTR(vol, S_IWUSR | S_IRUGO, spk_var_show, spk_var_store);

static struct kobj_attribute delay_time_attribute =
- __ATTR(delay_time, S_IWUSR|S_IRUGO, spk_var_show, spk_var_store);
+ __ATTR(delay_time, S_IWUSR | S_IRUGO, spk_var_show, spk_var_store);
static struct kobj_attribute direct_attribute =
- __ATTR(direct, S_IWUSR|S_IRUGO, spk_var_show, spk_var_store);
+ __ATTR(direct, S_IWUSR | S_IRUGO, spk_var_show, spk_var_store);
static struct kobj_attribute full_time_attribute =
- __ATTR(full_time, S_IWUSR|S_IRUGO, spk_var_show, spk_var_store);
+ __ATTR(full_time, S_IWUSR | S_IRUGO, spk_var_show, spk_var_store);
static struct kobj_attribute jiffy_delta_attribute =
- __ATTR(jiffy_delta, S_IWUSR|S_IRUGO, spk_var_show, spk_var_store);
+ __ATTR(jiffy_delta, S_IWUSR | S_IRUGO, spk_var_show, spk_var_store);
static struct kobj_attribute trigger_time_attribute =
- __ATTR(trigger_time, S_IWUSR|S_IRUGO, spk_var_show, spk_var_store);
+ __ATTR(trigger_time, S_IWUSR | S_IRUGO, spk_var_show, spk_var_store);

/*
* Create a group of attributes so that we can create and destroy them all
@@ -233,7 +233,7 @@ static void do_catch_up(struct spk_synth *synth)
delay_time_val = delay_time->u.n.value;
spin_unlock_irqrestore(&speakup_info.spinlock, flags);
schedule_timeout(msecs_to_jiffies(delay_time_val));
- jiff_max = jiffies+jiffy_delta_val;
+ jiff_max = jiffies + jiffy_delta_val;
}
}
timeout = SPK_XMITR_TIMEOUT;
@@ -260,13 +260,13 @@ static int synth_probe(struct spk_synth *synth)
speakup_info.port_tts = port_forced;
pr_info("probe forced to %x by kernel command line\n",
speakup_info.port_tts);
- if (synth_request_region(speakup_info.port_tts-1,
+ if (synth_request_region(speakup_info.port_tts - 1,
SYNTH_IO_EXTENT)) {
pr_warn("sorry, port already reserved\n");
return -EBUSY;
}
- port_val = inw(speakup_info.port_tts-1);
- synth_port_control = speakup_info.port_tts-1;
+ port_val = inw(speakup_info.port_tts - 1);
+ synth_port_control = speakup_info.port_tts - 1;
} else {
for (i = 0; synth_portlist[i]; i++) {
if (synth_request_region(synth_portlist[i],
--
2.1.4
s***@gmail.com
2015-12-27 14:40:39 UTC
Permalink
From: Shraddha Barke <***@gmail.com>

Remove explicit NULL comparison and write it in its simpler form.

Signed-off-by: Shraddha Barke <***@gmail.com>
---
drivers/staging/speakup/buffers.c | 4 ++--
drivers/staging/speakup/fakekey.c | 2 +-
drivers/staging/speakup/i18n.c | 4 ++--
drivers/staging/speakup/kobjects.c | 2 +-
drivers/staging/speakup/main.c | 38 +++++++++++++++++------------------
drivers/staging/speakup/selection.c | 2 +-
drivers/staging/speakup/synth.c | 16 +++++++--------
drivers/staging/speakup/varhandlers.c | 6 +++---
8 files changed, 37 insertions(+), 37 deletions(-)

diff --git a/drivers/staging/speakup/buffers.c b/drivers/staging/speakup/buffers.c
index 8565c23..b055b9e 100644
--- a/drivers/staging/speakup/buffers.c
+++ b/drivers/staging/speakup/buffers.c
@@ -27,7 +27,7 @@ void speakup_start_ttys(void)
for (i = 0; i < MAX_NR_CONSOLES; i++) {
if (speakup_console[i] && speakup_console[i]->tty_stopped)
continue;
- if ((vc_cons[i].d != NULL) && (vc_cons[i].d->port.tty != NULL))
+ if ((vc_cons[i].d) && (vc_cons[i].d->port.tty))
start_tty(vc_cons[i].d->port.tty);
}
}
@@ -38,7 +38,7 @@ static void speakup_stop_ttys(void)
int i;

for (i = 0; i < MAX_NR_CONSOLES; i++)
- if ((vc_cons[i].d != NULL) && (vc_cons[i].d->port.tty != NULL))
+ if ((vc_cons[i].d) && (vc_cons[i].d->port.tty))
stop_tty(vc_cons[i].d->port.tty);
}

diff --git a/drivers/staging/speakup/fakekey.c b/drivers/staging/speakup/fakekey.c
index af9b5a2..7350482 100644
--- a/drivers/staging/speakup/fakekey.c
+++ b/drivers/staging/speakup/fakekey.c
@@ -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;
}
diff --git a/drivers/staging/speakup/i18n.c b/drivers/staging/speakup/i18n.c
index 12f880e..470010a 100644
--- a/drivers/staging/speakup/i18n.c
+++ b/drivers/staging/speakup/i18n.c
@@ -410,9 +410,9 @@ static char *next_specifier(char *input)
int found = 0;
char *next_percent = input;

- while ((next_percent != NULL) && !found) {
+ while ((next_percent) && !found) {
next_percent = strchr(next_percent, '%');
- if (next_percent != NULL) {
+ if (next_percent) {
/* skip over doubled percent signs */
while ((next_percent[0] == '%')
&& (next_percent[1] == '%'))
diff --git a/drivers/staging/speakup/kobjects.c b/drivers/staging/speakup/kobjects.c
index fdfeb42..13b4eba 100644
--- a/drivers/staging/speakup/kobjects.c
+++ b/drivers/staging/speakup/kobjects.c
@@ -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 != NULL) && (!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);
diff --git a/drivers/staging/speakup/main.c b/drivers/staging/speakup/main.c
index 456f650..9b4dab8 100644
--- a/drivers/staging/speakup/main.c
+++ b/drivers/staging/speakup/main.c
@@ -298,7 +298,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();
}

@@ -440,7 +440,7 @@ static void speak_char(u_char ch)
synth_printf("%s", spk_str_caps_stop);
return;
}
- if (cp == NULL) {
+ if (!cp) {
pr_info("speak_char: cp == NULL!\n");
return;
}
@@ -1150,7 +1150,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) {
@@ -1187,7 +1187,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;
}
@@ -1271,7 +1271,7 @@ void spk_reset_default_chars(void)

/* First, free any non-default */
for (i = 0; i < 256; i++) {
- if ((spk_characters[i] != NULL)
+ if ((spk_characters[i])
&& (spk_characters[i] != spk_default_chars[i]))
kfree(spk_characters[i]);
}
@@ -1313,10 +1313,10 @@ 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] == NULL)
+ if (!speakup_console[vc_num])
return -ENOMEM;
speakup_date(vc);
} else if (!spk_parked)
@@ -1365,7 +1365,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;
@@ -1479,7 +1479,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;
}
@@ -1501,7 +1501,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;
}
@@ -1694,7 +1694,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;
}
@@ -1711,7 +1711,7 @@ static void speakup_con_write(struct vc_data *vc, const char *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 */
@@ -1740,7 +1740,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 */
@@ -1755,7 +1755,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;
@@ -1799,7 +1799,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;
@@ -1880,7 +1880,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;
}
@@ -1971,7 +1971,7 @@ do_goto:

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;
}
@@ -2049,7 +2049,7 @@ speakup_key(struct vc_data *vc, int shift_state, int keycode, u_short keysym,
u_char shift_info, offset;
int ret = 0;

- if (synth == NULL)
+ if (!synth)
return 0;

spin_lock_irqsave(&speakup_info.spinlock, flags);
@@ -2119,7 +2119,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;
diff --git a/drivers/staging/speakup/selection.c b/drivers/staging/speakup/selection.c
index aa5ab6c..cf854ad 100644
--- a/drivers/staging/speakup/selection.c
+++ b/drivers/staging/speakup/selection.c
@@ -172,7 +172,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/synth.c b/drivers/staging/speakup/synth.c
index 01eddab..669d63f 100644
--- a/drivers/staging/speakup/synth.c
+++ b/drivers/staging/speakup/synth.c
@@ -51,7 +51,7 @@ int spk_serial_synth_probe(struct spk_synth *synth)

if ((synth->ser >= SPK_LO_TTY) && (synth->ser <= SPK_HI_TTY)) {
ser = spk_serial_init(synth->ser);
- if (ser == NULL) {
+ if (!ser) {
failed = -1;
} else {
outb_p(0, ser->port);
@@ -271,7 +271,7 @@ void spk_reset_index_count(int sc)

int synth_supports_indexing(void)
{
- if (synth->get_index != NULL)
+ if (synth->get_index)
return 1;
return 0;
}
@@ -350,7 +350,7 @@ int synth_init(char *synth_name)
int ret = 0;
struct spk_synth *synth = NULL;

- if (synth_name == NULL)
+ if (!synth_name)
return 0;

if (strcmp(synth_name, "none") == 0) {
@@ -362,7 +362,7 @@ int synth_init(char *synth_name)

mutex_lock(&spk_mutex);
/* First, check if we already have it loaded. */
- for (i = 0; i < MAXSYNTHS && synths[i] != NULL; i++)
+ for (i = 0; i < MAXSYNTHS && synths[i]; i++)
if (strcmp(synths[i]->name, synth_name) == 0)
synth = synths[i];

@@ -421,7 +421,7 @@ void synth_release(void)
struct var_t *var;
unsigned long flags;

- if (synth == NULL)
+ if (!synth)
return;
spin_lock_irqsave(&speakup_info.spinlock, flags);
pr_info("releasing synth %s\n", synth->name);
@@ -444,7 +444,7 @@ int synth_add(struct spk_synth *in_synth)
int status = 0;

mutex_lock(&spk_mutex);
- for (i = 0; i < MAXSYNTHS && synths[i] != NULL; i++)
+ for (i = 0; i < MAXSYNTHS && synths[i]; i++)
/* synth_remove() is responsible for rotating the array down */
if (in_synth == synths[i]) {
mutex_unlock(&spk_mutex);
@@ -471,11 +471,11 @@ void synth_remove(struct spk_synth *in_synth)
mutex_lock(&spk_mutex);
if (synth == in_synth)
synth_release();
- for (i = 0; synths[i] != NULL; i++) {
+ for (i = 0; synths[i]; i++) {
if (in_synth == synths[i])
break;
}
- for ( ; synths[i] != NULL; i++) /* compress table */
+ for ( ; synths[i]; i++) /* compress table */
synths[i] = synths[i+1];
module_status = 0;
mutex_unlock(&spk_mutex);
diff --git a/drivers/staging/speakup/varhandlers.c b/drivers/staging/speakup/varhandlers.c
index ab4fe8d..bf81d96 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) {
@@ -208,11 +208,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 ret;
}
- if (p_val != NULL)
+ if (p_val)
*p_val = val;
if (var->var_id == PUNC_LEVEL) {
spk_punc_mask = spk_punc_masks[val];
--
2.1.4
Loading...