* [PATCH 1/4] staging: speakup: Comparison to NULL could be written
2017-03-09 16:34 [PATCH 0/4] staging: speakup: checkpatch guided cleanups Arushi Singhal
@ 2017-03-09 16:34 ` Arushi Singhal
2017-03-09 16:34 ` [PATCH 2/4] staging: speakup:indentation should use tabs Arushi Singhal
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Arushi Singhal @ 2017-03-09 16:34 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.
Signed-off-by: Arushi Singhal <arushisinghal19971997@gmail.com>
---
changes in v2
- fixed coding style error and upto the coding style.
---
drivers/staging/speakup/fakekey.c | 2 +-
drivers/staging/speakup/kobjects.c | 2 +-
drivers/staging/speakup/main.c | 38 +++++++++++++++++++-------------------
3 files changed, 21 insertions(+), 21 deletions(-)
diff --git a/drivers/staging/speakup/fakekey.c b/drivers/staging/speakup/fakekey.c
index d76da0a1382c..294c74b47224 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/kobjects.c b/drivers/staging/speakup/kobjects.c
index 5d871ec3693c..2fef55569bfd 100644
--- a/drivers/staging/speakup/kobjects.c
+++ b/drivers/staging/speakup/kobjects.c
@@ -391,7 +391,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 c2f70ef5b9b3..a12ec2b061fe 100644
--- a/drivers/staging/speakup/main.c
+++ b/drivers/staging/speakup/main.c
@@ -299,7 +299,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();
}
@@ -441,7 +441,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;
}
@@ -1157,7 +1157,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) {
@@ -1195,7 +1195,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;
}
@@ -1279,7 +1279,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]);
}
@@ -1321,10 +1321,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)
@@ -1373,7 +1373,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;
@@ -1487,7 +1487,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;
}
@@ -1509,7 +1509,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;
}
@@ -1705,7 +1705,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;
}
@@ -1722,7 +1722,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 */
@@ -1751,7 +1751,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 */
@@ -1766,7 +1766,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;
@@ -1810,7 +1810,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;
@@ -1893,7 +1893,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;
}
@@ -1984,7 +1984,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;
}
@@ -2065,7 +2065,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);
@@ -2135,7 +2135,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;
--
2.11.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 3/4] staging: speakup: Alignment match open parenthesis
2017-03-09 16:34 [PATCH 0/4] staging: speakup: checkpatch guided cleanups Arushi Singhal
2017-03-09 16:34 ` [PATCH 1/4] staging: speakup: Comparison to NULL could be written Arushi Singhal
2017-03-09 16:34 ` [PATCH 2/4] staging: speakup:indentation should use tabs Arushi Singhal
@ 2017-03-09 16:34 ` Arushi Singhal
2017-03-09 16:34 ` [PATCH 4/4] staging: speakup: Placed Logical on the previous line Arushi Singhal
2017-03-09 18:36 ` [PATCH 0/4] staging: speakup: checkpatch guided cleanups Greg KH
4 siblings, 0 replies; 6+ messages in thread
From: Arushi Singhal @ 2017-03-09 16:34 UTC (permalink / raw)
To: w.d.hubbs
Cc: chris, outreachy-kernel, kirk, samuel.thibault, gregkh, speakup,
devel, linux-kernel, Arushi Singhal
Fix checkpatch issues: "CHECK: Alignment should match open parenthesis".
Signed-off-by: Arushi Singhal <arushisinghal19971997@gmail.com>
---
changes in v2
- Aligned the lines which are not aligned in previous patch.
---
drivers/staging/speakup/i18n.c | 2 +-
drivers/staging/speakup/kobjects.c | 40 +++++++++++++++++++-------------------
2 files changed, 21 insertions(+), 21 deletions(-)
diff --git a/drivers/staging/speakup/i18n.c b/drivers/staging/speakup/i18n.c
index 11f1418b4006..ac1ebead3c3f 100644
--- a/drivers/staging/speakup/i18n.c
+++ b/drivers/staging/speakup/i18n.c
@@ -607,7 +607,7 @@ void spk_reset_msg_group(struct msg_group_t *group)
void spk_initialize_msgs(void)
{
memcpy(speakup_msgs, speakup_default_msgs,
- sizeof(speakup_default_msgs));
+ sizeof(speakup_default_msgs));
}
/* Free user-supplied strings when module is unloaded: */
diff --git a/drivers/staging/speakup/kobjects.c b/drivers/staging/speakup/kobjects.c
index 2fef55569bfd..8c93188b832c 100644
--- a/drivers/staging/speakup/kobjects.c
+++ b/drivers/staging/speakup/kobjects.c
@@ -79,7 +79,7 @@ static ssize_t chars_chartab_show(struct kobject *kobj,
* character descriptions or chartab entries.
*/
static void report_char_chartab_status(int reset, int received, int used,
- int rejected, int do_characters)
+ int rejected, int do_characters)
{
static char const *object_type[] = {
"character class entries",
@@ -92,8 +92,8 @@ static void report_char_chartab_status(int reset, int received, int used,
pr_info("%s reset to defaults\n", object_type[do_characters]);
} else if (received) {
len = snprintf(buf, sizeof(buf),
- " updated %d of %d %s\n",
- used, received, object_type[do_characters]);
+ " updated %d of %d %s\n",
+ used, received, object_type[do_characters]);
if (rejected)
snprintf(buf + (len - 1), sizeof(buf) - (len - 1),
" with %d reject%s\n",
@@ -213,7 +213,7 @@ static ssize_t chars_chartab_store(struct kobject *kobj,
spin_unlock_irqrestore(&speakup_info.spinlock, flags);
report_char_chartab_status(reset, received, used, rejected,
- do_characters);
+ do_characters);
return retval;
}
@@ -221,7 +221,7 @@ static ssize_t chars_chartab_store(struct kobject *kobj,
* This is called when a user reads the keymap parameter.
*/
static ssize_t keymap_show(struct kobject *kobj, struct kobj_attribute *attr,
- char *buf)
+ char *buf)
{
char *cp = buf;
int i;
@@ -257,7 +257,7 @@ static ssize_t keymap_show(struct kobject *kobj, struct kobj_attribute *attr,
* This is called when a user changes the keymap parameter.
*/
static ssize_t keymap_store(struct kobject *kobj, struct kobj_attribute *attr,
- const char *buf, size_t count)
+ const char *buf, size_t count)
{
int i;
ssize_t ret = count;
@@ -291,9 +291,9 @@ static ssize_t keymap_store(struct kobject *kobj, struct kobj_attribute *attr,
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]);
+ (int)cp1[-3], (int)cp1[-2], (int)cp1[-1]);
kfree(in_buff);
spin_unlock_irqrestore(&speakup_info.spinlock, flags);
return -EINVAL;
@@ -307,7 +307,7 @@ static ssize_t keymap_store(struct kobject *kobj, struct kobj_attribute *attr,
if (i != 0 || cp1[-1] != KEY_MAP_VER || cp1[-2] != 0) {
ret = -EINVAL;
pr_warn("end %d %d %d %d\n", i,
- (int)cp1[-3], (int)cp1[-2], (int)cp1[-1]);
+ (int)cp1[-3], (int)cp1[-2], (int)cp1[-1]);
} else {
if (spk_set_key_info(in_buff, spk_key_buf)) {
spk_set_key_info(spk_key_defaults, spk_key_buf);
@@ -324,7 +324,7 @@ static ssize_t keymap_store(struct kobject *kobj, struct kobj_attribute *attr,
* This is called when a user changes the value of the silent parameter.
*/
static ssize_t silent_store(struct kobject *kobj, struct kobj_attribute *attr,
- const char *buf, size_t count)
+ const char *buf, size_t count)
{
int len;
struct vc_data *vc = vc_cons[fg_console].d;
@@ -363,7 +363,7 @@ static ssize_t silent_store(struct kobject *kobj, struct kobj_attribute *attr,
* This is called when a user reads the synth setting.
*/
static ssize_t synth_show(struct kobject *kobj, struct kobj_attribute *attr,
- char *buf)
+ char *buf)
{
int rv;
@@ -378,7 +378,7 @@ static ssize_t synth_show(struct kobject *kobj, struct kobj_attribute *attr,
* This is called when a user requests to change synthesizers.
*/
static ssize_t synth_store(struct kobject *kobj, struct kobj_attribute *attr,
- const char *buf, size_t count)
+ const char *buf, size_t count)
{
int len;
char new_synth_name[10];
@@ -434,7 +434,7 @@ static ssize_t synth_direct_store(struct kobject *kobj,
* This function is called when a user reads the version.
*/
static ssize_t version_show(struct kobject *kobj, struct kobj_attribute *attr,
- char *buf)
+ char *buf)
{
char *cp;
@@ -450,7 +450,7 @@ static ssize_t version_show(struct kobject *kobj, struct kobj_attribute *attr,
* This is called when a user reads the punctuation settings.
*/
static ssize_t punc_show(struct kobject *kobj, struct kobj_attribute *attr,
- char *buf)
+ char *buf)
{
int i;
char *cp = buf;
@@ -470,7 +470,7 @@ static ssize_t punc_show(struct kobject *kobj, struct kobj_attribute *attr,
var = spk_get_punc_var(p_header->var_id);
if (!var) {
pr_warn("var is null, p_header->var_id is %i\n",
- p_header->var_id);
+ p_header->var_id);
return -EINVAL;
}
@@ -490,7 +490,7 @@ static ssize_t punc_show(struct kobject *kobj, struct kobj_attribute *attr,
* This is called when a user changes the punctuation settings.
*/
static ssize_t punc_store(struct kobject *kobj, struct kobj_attribute *attr,
- const char *buf, size_t count)
+ const char *buf, size_t count)
{
int x;
struct st_var_header *p_header;
@@ -512,7 +512,7 @@ static ssize_t punc_store(struct kobject *kobj, struct kobj_attribute *attr,
var = spk_get_punc_var(p_header->var_id);
if (!var) {
pr_warn("var is null, p_header->var_id is %i\n",
- p_header->var_id);
+ p_header->var_id);
return -EINVAL;
}
@@ -537,7 +537,7 @@ static ssize_t punc_store(struct kobject *kobj, struct kobj_attribute *attr,
* This function is called when a user reads one of the variable parameters.
*/
ssize_t spk_var_show(struct kobject *kobj, struct kobj_attribute *attr,
- char *buf)
+ char *buf)
{
int rv = 0;
struct st_var_header *param;
@@ -581,7 +581,7 @@ ssize_t spk_var_show(struct kobject *kobj, struct kobj_attribute *attr,
break;
default:
rv = sprintf(buf, "Bad parameter %s, type %i\n",
- param->name, param->var_type);
+ param->name, param->var_type);
break;
}
spin_unlock_irqrestore(&speakup_info.spinlock, flags);
@@ -613,7 +613,7 @@ static inline void spk_reset_default_value(char *header_name,
* variable parameters.
*/
ssize_t spk_var_store(struct kobject *kobj, struct kobj_attribute *attr,
- const char *buf, size_t count)
+ const char *buf, size_t count)
{
struct st_var_header *param;
int ret;
--
2.11.0
^ permalink raw reply related [flat|nested] 6+ messages in thread