diff options
Diffstat (limited to 'drivers/staging/speakup')
-rw-r--r-- | drivers/staging/speakup/devsynth.c | 2 | ||||
-rw-r--r-- | drivers/staging/speakup/kobjects.c | 17 | ||||
-rw-r--r-- | drivers/staging/speakup/synth.c | 6 | ||||
-rw-r--r-- | drivers/staging/speakup/varhandlers.c | 6 |
4 files changed, 17 insertions, 14 deletions
diff --git a/drivers/staging/speakup/devsynth.c b/drivers/staging/speakup/devsynth.c index 8498971..58abd1d 100644 --- a/drivers/staging/speakup/devsynth.c +++ b/drivers/staging/speakup/devsynth.c @@ -34,7 +34,7 @@ static ssize_t speakup_file_write(struct file *fp, const char __user *buffer, synth_write(buf, bytes); spin_unlock_irqrestore(&speakup_info.spinlock, flags); } - return (ssize_t) nbytes; + return (ssize_t)nbytes; } static ssize_t speakup_file_read(struct file *fp, char __user *buf, diff --git a/drivers/staging/speakup/kobjects.c b/drivers/staging/speakup/kobjects.c index 528cbdc..e744aa9 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,8 +288,8 @@ 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)) { @@ -350,9 +350,9 @@ static ssize_t silent_store(struct kobject *kobj, struct kobj_attribute *attr, } 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; @@ -411,11 +411,13 @@ static ssize_t synth_direct_store(struct kobject *kobj, int len; int bytes; const char *ptr = buf; + unsigned long flags; if (!synth) return -EPERM; len = strlen(buf); + spin_lock_irqsave(&speakup_info.spinlock, flags); while (len > 0) { bytes = min_t(size_t, len, 250); strncpy(tmp, ptr, bytes); @@ -425,6 +427,7 @@ static ssize_t synth_direct_store(struct kobject *kobj, ptr += bytes; len -= bytes; } + spin_unlock_irqrestore(&speakup_info.spinlock, flags); return count; } @@ -973,11 +976,11 @@ static struct attribute *i18n_attrs[] = { * created for the attributes with the directory being the name of the * attribute group. */ -static struct attribute_group main_attr_group = { +static const struct attribute_group main_attr_group = { .attrs = main_attrs, }; -static struct attribute_group i18n_attr_group = { +static const struct attribute_group i18n_attr_group = { .attrs = i18n_attrs, .name = "i18n", }; diff --git a/drivers/staging/speakup/synth.c b/drivers/staging/speakup/synth.c index 4f462c3..54b2f39 100644 --- a/drivers/staging/speakup/synth.c +++ b/drivers/staging/speakup/synth.c @@ -18,7 +18,7 @@ #include "serialio.h" #define MAXSYNTHS 16 /* Max number of synths in array. */ -static struct spk_synth *synths[MAXSYNTHS]; +static struct spk_synth *synths[MAXSYNTHS + 1]; struct spk_synth *synth; char spk_pitch_buff[32] = ""; static int module_status; @@ -407,7 +407,7 @@ static int do_synth_init(struct spk_synth *in_synth) if (!spk_quiet_boot) synth_printf("%s found\n", synth->long_name); if (synth->attributes.name - && sysfs_create_group(speakup_kobj, &(synth->attributes)) < 0) + && sysfs_create_group(speakup_kobj, &synth->attributes) < 0) return -ENOMEM; synth_flags = synth->flags; wake_up_interruptible_all(&speakup_event); @@ -429,7 +429,7 @@ void synth_release(void) del_timer(&thread_timer); spin_unlock_irqrestore(&speakup_info.spinlock, flags); if (synth->attributes.name) - sysfs_remove_group(speakup_kobj, &(synth->attributes)); + sysfs_remove_group(speakup_kobj, &synth->attributes); for (var = synth->vars; var->var_id != MAXVARS; var++) speakup_unregister_var(var->var_id); spk_stop_serial_interrupt(); diff --git a/drivers/staging/speakup/varhandlers.c b/drivers/staging/speakup/varhandlers.c index e1393d2..21186e3 100644 --- a/drivers/staging/speakup/varhandlers.c +++ b/drivers/staging/speakup/varhandlers.c @@ -276,7 +276,7 @@ int spk_set_mask_bits(const char *input, const int which, const int how) u_char *cp; short mask = spk_punc_info[which].mask; - if (how&1) { + if (how & 1) { for (cp = (u_char *)spk_punc_info[3].value; *cp; cp++) spk_chartab[*cp] &= ~mask; } @@ -290,14 +290,14 @@ int spk_set_mask_bits(const char *input, const int which, const int how) if (mask < PUNC) { if (!(spk_chartab[*cp] & PUNC)) break; - } else if (spk_chartab[*cp]&B_NUM) + } else if (spk_chartab[*cp] & B_NUM) break; } if (*cp) return -EINVAL; cp = (u_char *)input; } - if (how&2) { + if (how & 2) { for (; *cp; cp++) if (*cp > SPACE) spk_chartab[*cp] |= mask; |