diff options
Diffstat (limited to 'drivers/staging/speakup')
-rw-r--r-- | drivers/staging/speakup/Kconfig | 32 | ||||
-rw-r--r-- | drivers/staging/speakup/devsynth.c | 14 | ||||
-rw-r--r-- | drivers/staging/speakup/i18n.c | 12 | ||||
-rw-r--r-- | drivers/staging/speakup/kobjects.c | 48 | ||||
-rw-r--r-- | drivers/staging/speakup/main.c | 79 | ||||
-rw-r--r-- | drivers/staging/speakup/serialio.c | 4 | ||||
-rw-r--r-- | drivers/staging/speakup/speakup_acntpc.c | 22 | ||||
-rw-r--r-- | drivers/staging/speakup/speakup_apollo.c | 20 | ||||
-rw-r--r-- | drivers/staging/speakup/speakup_decext.c | 20 | ||||
-rw-r--r-- | drivers/staging/speakup/speakup_decpc.c | 22 | ||||
-rw-r--r-- | drivers/staging/speakup/speakup_dectlk.c | 20 | ||||
-rw-r--r-- | drivers/staging/speakup/speakup_dtlk.c | 22 | ||||
-rw-r--r-- | drivers/staging/speakup/speakup_keypc.c | 22 | ||||
-rw-r--r-- | drivers/staging/speakup/speakup_soft.c | 34 | ||||
-rw-r--r-- | drivers/staging/speakup/spk_priv.h | 13 | ||||
-rw-r--r-- | drivers/staging/speakup/synth.c | 38 | ||||
-rw-r--r-- | drivers/staging/speakup/thread.c | 4 | ||||
-rw-r--r-- | drivers/staging/speakup/varhandlers.c | 19 |
18 files changed, 221 insertions, 224 deletions
diff --git a/drivers/staging/speakup/Kconfig b/drivers/staging/speakup/Kconfig index b416ace..8c3e7a6 100644 --- a/drivers/staging/speakup/Kconfig +++ b/drivers/staging/speakup/Kconfig @@ -11,7 +11,7 @@ config SPEAKUP point your browser at <http://www.linux-speakup.org/>. There is also a mailing list at the above url that you can subscribe to. - + Supported synthesizers are accent sa, accent pc, appollo II., Auddapter, Braille 'n Speak, Dectalk external (old), Dectalk PC (full length isa board), @@ -19,24 +19,24 @@ config SPEAKUP Litetalk, Keynote Gold internal PC, software synthesizers, Speakout, transport, and a dummy module that can be used with a plain text terminal. - + Speakup can either be built in or compiled as a module by answering y or m. If you answer y here, then you must answer either y or m to at least one of the synthesizer drivers below. If you answer m here, then the synthesizer drivers below can only be built as modules. - + These drivers are not standalone drivers, but must be used in conjunction with Speakup. Think of them as video cards for blind people. - - + + The Dectalk pc driver can only be built as a module, and requires software to be pre-loaded on to the card before the module can be loaded. See the decpc choice below for more details. - + If you are not a blind person, or don't have access to one of the listed synthesizers, you should say n. @@ -84,7 +84,7 @@ config SPEAKUP_SYNTH_BNS config SPEAKUP_SYNTH_DECTLK tristate "DECtalk Express synthesizer support" ---help--- - + This is the Speakup driver for the DecTalk Express synthesizer. You can say y to build it into the kernel, or m to build it as a module. See the configuration @@ -93,7 +93,7 @@ config SPEAKUP_SYNTH_DECTLK config SPEAKUP_SYNTH_DECEXT tristate "DECtalk External (old) synthesizer support" ---help--- - + This is the Speakup driver for the DecTalk External (old) synthesizer. You can say y to build it into the kernel, or m to build it as a module. See the @@ -104,12 +104,12 @@ config SPEAKUP_SYNTH_DECPC depends on m tristate "DECtalk PC (big ISA card) synthesizer support" ---help--- - + This is the Speakup driver for the DecTalk PC (full length ISA) synthesizer. You can say m to build it as a module. See the configuration help on the Speakup choice above for more info. - + In order to use the DecTalk PC driver, you must download the dec_pc.tgz file from linux-speakup.org. It is in the pub/linux/goodies directory. The dec_pc.tgz file @@ -118,14 +118,14 @@ config SPEAKUP_SYNTH_DECPC This driver must be built as a module, and can not be loaded until the file system is mounted and the DecTalk PC software has been pre-loaded on to the board. - + See the README file in the dec_pc.tgz file for more details. config SPEAKUP_SYNTH_DTLK tristate "DoubleTalk PC synthesizer support" ---help--- - + This is the Speakup driver for the internal DoubleTalk PC synthesizer. You can say y to build it into the kernel, or m to build it as a module. See the @@ -135,7 +135,7 @@ config SPEAKUP_SYNTH_DTLK config SPEAKUP_SYNTH_KEYPC tristate "Keynote Gold PC synthesizer support" ---help--- - + This is the Speakup driver for the Keynote Gold PC synthesizer. You can say y to build it into the kernel, or m to build it as a module. See the @@ -166,7 +166,7 @@ config SPEAKUP_SYNTH_SOFT config SPEAKUP_SYNTH_SPKOUT tristate "Speak Out synthesizer support" ---help--- - + This is the Speakup driver for the Speakout synthesizer. You can say y to build it into the kernel, or m to build it as a module. See the configuration help on the @@ -175,7 +175,7 @@ config SPEAKUP_SYNTH_SPKOUT config SPEAKUP_SYNTH_TXPRT tristate "Transport synthesizer support" ---help--- - + This is the Speakup driver for the Transport synthesizer. You can say y to build it into the kernel, or m to build it as a module. See the configuration @@ -184,7 +184,7 @@ config SPEAKUP_SYNTH_TXPRT config SPEAKUP_SYNTH_DUMMY tristate "Dummy synthesizer driver (for testing)" ---help--- - + This is a dummy Speakup driver for plugging a mere serial terminal. This is handy if you want to test speakup but don't have the hardware. You can say y to build it into diff --git a/drivers/staging/speakup/devsynth.c b/drivers/staging/speakup/devsynth.c index 940769e..71c728a 100644 --- a/drivers/staging/speakup/devsynth.c +++ b/drivers/staging/speakup/devsynth.c @@ -13,11 +13,11 @@ static int misc_registered; static int dev_opened; -static ssize_t speakup_file_write(struct file *fp, const char *buffer, - size_t nbytes, loff_t *ppos) +static ssize_t speakup_file_write(struct file *fp, const char __user *buffer, + size_t nbytes, loff_t *ppos) { size_t count = nbytes; - const char *ptr = buffer; + const char __user *ptr = buffer; size_t bytes; unsigned long flags; u_char buf[256]; @@ -30,15 +30,15 @@ static ssize_t speakup_file_write(struct file *fp, const char *buffer, return -EFAULT; count -= bytes; ptr += bytes; - spk_lock(flags); + spin_lock_irqsave(&speakup_info.spinlock, flags); synth_write(buf, bytes); - spk_unlock(flags); + spin_unlock_irqrestore(&speakup_info.spinlock, flags); } return (ssize_t) nbytes; } -static ssize_t speakup_file_read(struct file *fp, char *buf, size_t nbytes, - loff_t *ppos) +static ssize_t speakup_file_read(struct file *fp, char __user *buf, + size_t nbytes, loff_t *ppos) { return 0; } diff --git a/drivers/staging/speakup/i18n.c b/drivers/staging/speakup/i18n.c index 2add1fc..9ea16c5 100644 --- a/drivers/staging/speakup/i18n.c +++ b/drivers/staging/speakup/i18n.c @@ -558,11 +558,11 @@ ssize_t spk_msg_set(enum msg_index_t index, char *text, size_t length) kfree(newstr); return -EINVAL; } - spk_lock(flags); + spin_lock_irqsave(&speakup_info.spinlock, flags); if (speakup_msgs[index] != speakup_default_msgs[index]) kfree(speakup_msgs[index]); speakup_msgs[index] = newstr; - spk_unlock(flags); + spin_unlock_irqrestore(&speakup_info.spinlock, flags); } else { rc = -ENOMEM; } @@ -595,14 +595,14 @@ void spk_reset_msg_group(struct msg_group_t *group) unsigned long flags; enum msg_index_t i; - spk_lock(flags); + spin_lock_irqsave(&speakup_info.spinlock, flags); for (i = group->start; i <= group->end; i++) { if (speakup_msgs[i] != speakup_default_msgs[i]) kfree(speakup_msgs[i]); speakup_msgs[i] = speakup_default_msgs[i]; } - spk_unlock(flags); + spin_unlock_irqrestore(&speakup_info.spinlock, flags); } /* Called at initialization time, to establish default messages. */ @@ -618,12 +618,12 @@ void spk_free_user_msgs(void) enum msg_index_t index; unsigned long flags; - spk_lock(flags); + spin_lock_irqsave(&speakup_info.spinlock, flags); for (index = MSG_FIRST_INDEX; index < MSG_LAST_INDEX; index++) { if (speakup_msgs[index] != speakup_default_msgs[index]) { kfree(speakup_msgs[index]); speakup_msgs[index] = speakup_default_msgs[index]; } } - spk_unlock(flags); + spin_unlock_irqrestore(&speakup_info.spinlock, flags); } diff --git a/drivers/staging/speakup/kobjects.c b/drivers/staging/speakup/kobjects.c index 943b6c1..51bdea3 100644 --- a/drivers/staging/speakup/kobjects.c +++ b/drivers/staging/speakup/kobjects.c @@ -35,7 +35,7 @@ static ssize_t chars_chartab_show(struct kobject *kobj, size_t bufsize = PAGE_SIZE; unsigned long flags; - spk_lock(flags); + spin_lock_irqsave(&speakup_info.spinlock, flags); *buf_pointer = '\0'; for (i = 0; i < 256; i++) { if (bufsize <= 1) @@ -70,7 +70,7 @@ static ssize_t chars_chartab_show(struct kobject *kobj, bufsize -= len; buf_pointer += len; } - spk_unlock(flags); + spin_unlock_irqrestore(&speakup_info.spinlock, flags); return buf_pointer - buf; } @@ -127,7 +127,7 @@ static ssize_t chars_chartab_store(struct kobject *kobj, size_t desc_length = 0; int i; - spk_lock(flags); + spin_lock_irqsave(&speakup_info.spinlock, flags); while (cp < end) { while ((cp < end) && (*cp == ' ' || *cp == '\t')) @@ -212,7 +212,7 @@ static ssize_t chars_chartab_store(struct kobject *kobj, spk_reset_default_chartab(); } - spk_unlock(flags); + spin_unlock_irqrestore(&speakup_info.spinlock, flags); report_char_chartab_status(reset, received, used, rejected, do_characters); return retval; @@ -232,7 +232,7 @@ static ssize_t keymap_show(struct kobject *kobj, struct kobj_attribute *attr, u_char *cp1; u_char ch; unsigned long flags; - spk_lock(flags); + spin_lock_irqsave(&speakup_info.spinlock, flags); cp1 = spk_key_buf + SHIFT_TBL_SIZE; num_keys = (int)(*cp1); nstates = (int)cp1[1]; @@ -248,7 +248,7 @@ static ssize_t keymap_show(struct kobject *kobj, struct kobj_attribute *attr, } } cp += sprintf(cp, "0, %d\n", KEY_MAP_VER); - spk_unlock(flags); + spin_unlock_irqrestore(&speakup_info.spinlock, flags); return (int)(cp-buf); } @@ -265,17 +265,17 @@ static ssize_t keymap_store(struct kobject *kobj, struct kobj_attribute *attr, u_char *cp1; unsigned long flags; - spk_lock(flags); + spin_lock_irqsave(&speakup_info.spinlock, flags); in_buff = kmemdup(buf, count + 1, GFP_ATOMIC); if (!in_buff) { - spk_unlock(flags); + spin_unlock_irqrestore(&speakup_info.spinlock, flags); return -ENOMEM; } if (strchr("dDrR", *in_buff)) { spk_set_key_info(spk_key_defaults, spk_key_buf); pr_info("keymap set to default values\n"); kfree(in_buff); - spk_unlock(flags); + spin_unlock_irqrestore(&speakup_info.spinlock, flags); return count; } if (in_buff[count - 1] == '\n') @@ -294,7 +294,7 @@ static ssize_t keymap_store(struct kobject *kobj, struct kobj_attribute *attr, pr_warn("i %d %d %d %d\n", i, (int)cp1[-3], (int)cp1[-2], (int)cp1[-1]); kfree(in_buff); - spk_unlock(flags); + spin_unlock_irqrestore(&speakup_info.spinlock, flags); return -EINVAL; } while (--i >= 0) { @@ -315,7 +315,7 @@ static ssize_t keymap_store(struct kobject *kobj, struct kobj_attribute *attr, } } kfree(in_buff); - spk_unlock(flags); + spin_unlock_irqrestore(&speakup_info.spinlock, flags); return ret; } @@ -341,7 +341,7 @@ static ssize_t silent_store(struct kobject *kobj, struct kobj_attribute *attr, pr_warn("silent value '%c' not in range (0,7)\n", ch); return -EINVAL; } - spk_lock(flags); + spin_lock_irqsave(&speakup_info.spinlock, flags); if (ch&2) { shut = 1; spk_do_flush(); @@ -354,7 +354,7 @@ static ssize_t silent_store(struct kobject *kobj, struct kobj_attribute *attr, spk_shut_up |= shut; else spk_shut_up &= ~shut; - spk_unlock(flags); + spin_unlock_irqrestore(&speakup_info.spinlock, flags); return count; } @@ -470,7 +470,7 @@ static ssize_t punc_show(struct kobject *kobj, struct kobj_attribute *attr, return -EINVAL; } - spk_lock(flags); + spin_lock_irqsave(&speakup_info.spinlock, flags); pb = (struct st_bits_data *) &spk_punc_info[var->value]; mask = pb->mask; for (i = 33; i < 128; i++) { @@ -478,7 +478,7 @@ static ssize_t punc_show(struct kobject *kobj, struct kobj_attribute *attr, continue; *cp++ = (char)i; } - spk_unlock(flags); + spin_unlock_irqrestore(&speakup_info.spinlock, flags); return cp-buf; } @@ -518,14 +518,14 @@ static ssize_t punc_store(struct kobject *kobj, struct kobj_attribute *attr, x--; punc_buf[x] = '\0'; - spk_lock(flags); + spin_lock_irqsave(&speakup_info.spinlock, flags); if (*punc_buf == 'd' || *punc_buf == 'r') - x = spk_set_mask_bits(0, var->value, 3); + x = spk_set_mask_bits(NULL, var->value, 3); else x = spk_set_mask_bits(punc_buf, var->value, 3); - spk_unlock(flags); + spin_unlock_irqrestore(&speakup_info.spinlock, flags); return count; } @@ -547,7 +547,7 @@ ssize_t spk_var_show(struct kobject *kobj, struct kobj_attribute *attr, if (param == NULL) return -EINVAL; - spk_lock(flags); + spin_lock_irqsave(&speakup_info.spinlock, flags); var = (struct var_t *) param->data; switch (param->var_type) { case VAR_NUM: @@ -580,7 +580,7 @@ ssize_t spk_var_show(struct kobject *kobj, struct kobj_attribute *attr, param->name, param->var_type); break; } - spk_unlock(flags); + spin_unlock_irqrestore(&speakup_info.spinlock, flags); return rv; } EXPORT_SYMBOL_GPL(spk_var_show); @@ -609,7 +609,7 @@ ssize_t spk_var_store(struct kobject *kobj, struct kobj_attribute *attr, cp = (char *)buf; string_unescape_any_inplace(cp); - spk_lock(flags); + spin_lock_irqsave(&speakup_info.spinlock, flags); switch (param->var_type) { case VAR_NUM: case VAR_TIME: @@ -670,7 +670,7 @@ ssize_t spk_var_store(struct kobject *kobj, struct kobj_attribute *attr, } } } - spk_unlock(flags); + spin_unlock_irqrestore(&speakup_info.spinlock, flags); if (ret == -ERESTART) pr_info("%s reset to default value\n", attr->attr.name); @@ -818,9 +818,9 @@ static ssize_t message_show(struct kobject *kobj, unsigned long flags; BUG_ON(!group); - spk_lock(flags); + spin_lock_irqsave(&speakup_info.spinlock, flags); retval = message_show_helper(buf, group->start, group->end); - spk_unlock(flags); + spin_unlock_irqrestore(&speakup_info.spinlock, flags); return retval; } diff --git a/drivers/staging/speakup/main.c b/drivers/staging/speakup/main.c index 6c7b55c..14079c4 100644 --- a/drivers/staging/speakup/main.c +++ b/drivers/staging/speakup/main.c @@ -95,7 +95,8 @@ const struct st_bits_data spk_punc_info[] = { static char mark_cut_flag; #define MAX_KEY 160 -u_char *spk_our_keys[MAX_KEY], *spk_shift_table; +static u_char *spk_shift_table; +u_char *spk_our_keys[MAX_KEY]; u_char spk_key_buf[600]; const u_char spk_key_defaults[] = { #include "speakupmap.h" @@ -457,7 +458,7 @@ static void speak_char(u_char ch) synth_buffer_add(SPACE); } -static u16 get_char(struct vc_data *vc, u16 * pos, u_char * attribs) +static u16 get_char(struct vc_data *vc, u16 *pos, u_char *attribs) { u16 ch = ' '; if (vc && pos) { @@ -1129,7 +1130,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) return; - spk_lock(flags); + spin_lock_irqsave(&speakup_info.spinlock, flags); if (cursor_track == read_all_mode) { switch (value) { case KVAL(K_SHIFT): @@ -1151,20 +1152,20 @@ static void do_handle_shift(struct vc_data *vc, u_char value, char up_flag) } if (spk_say_ctrl && value < NUM_CTL_LABELS) synth_printf("%s", spk_msg_get(MSG_CTL_START + value)); - spk_unlock(flags); + spin_unlock_irqrestore(&speakup_info.spinlock, flags); } static void do_handle_latin(struct vc_data *vc, u_char value, char up_flag) { unsigned long flags; - spk_lock(flags); + spin_lock_irqsave(&speakup_info.spinlock, flags); if (up_flag) { spk_lastkey = spk_keydown = 0; - spk_unlock(flags); + spin_unlock_irqrestore(&speakup_info.spinlock, flags); return; } if (synth == NULL || spk_killed) { - spk_unlock(flags); + spin_unlock_irqrestore(&speakup_info.spinlock, flags); return; } spk_shut_up &= 0xfe; @@ -1173,7 +1174,7 @@ static void do_handle_latin(struct vc_data *vc, u_char value, char up_flag) spk_parked &= 0xfe; if (spk_key_echo == 2 && value >= MINECHOCHAR) speak_char(value); - spk_unlock(flags); + spin_unlock_irqrestore(&speakup_info.spinlock, flags); } int spk_set_key_info(const u_char *key_info, u_char *k_buffer) @@ -1282,7 +1283,7 @@ static int edit_bits(struct vc_data *vc, u_char type, u_char ch, u_short key) } /* Allocation concurrency is protected by the console semaphore */ -int speakup_allocate(struct vc_data *vc) +static int speakup_allocate(struct vc_data *vc) { int vc_num; @@ -1299,7 +1300,7 @@ int speakup_allocate(struct vc_data *vc) return 0; } -void speakup_deallocate(struct vc_data *vc) +static void speakup_deallocate(struct vc_data *vc) { int vc_num; @@ -1449,21 +1450,21 @@ static void handle_cursor_read_all(struct vc_data *vc, int command) static int pre_handle_cursor(struct vc_data *vc, u_char value, char up_flag) { unsigned long flags; - spk_lock(flags); + spin_lock_irqsave(&speakup_info.spinlock, flags); if (cursor_track == read_all_mode) { spk_parked &= 0xfe; if (synth == NULL || up_flag || spk_shut_up) { - spk_unlock(flags); + spin_unlock_irqrestore(&speakup_info.spinlock, flags); return NOTIFY_STOP; } del_timer(&cursor_timer); spk_shut_up &= 0xfe; spk_do_flush(); start_read_all_timer(vc, value + 1); - spk_unlock(flags); + spin_unlock_irqrestore(&speakup_info.spinlock, flags); return NOTIFY_STOP; } - spk_unlock(flags); + spin_unlock_irqrestore(&speakup_info.spinlock, flags); return NOTIFY_OK; } @@ -1472,10 +1473,10 @@ static void do_handle_cursor(struct vc_data *vc, u_char value, char up_flag) unsigned long flags; struct var_t *cursor_timeout; - spk_lock(flags); + spin_lock_irqsave(&speakup_info.spinlock, flags); spk_parked &= 0xfe; if (synth == NULL || up_flag || spk_shut_up || cursor_track == CT_Off) { - spk_unlock(flags); + spin_unlock_irqrestore(&speakup_info.spinlock, flags); return; } spk_shut_up &= 0xfe; @@ -1494,7 +1495,7 @@ static void do_handle_cursor(struct vc_data *vc, u_char value, char up_flag) cursor_timeout = spk_get_var(CURSOR_TIME); mod_timer(&cursor_timer, jiffies + msecs_to_jiffies(cursor_timeout->u.n.value)); - spk_unlock(flags); + spin_unlock_irqrestore(&speakup_info.spinlock, flags); } static void update_color_buffer(struct vc_data *vc, const char *ic, int len) @@ -1619,7 +1620,7 @@ static void cursor_done(u_long data) struct vc_data *vc = vc_cons[cursor_con].d; unsigned long flags; del_timer(&cursor_timer); - spk_lock(flags); + spin_lock_irqsave(&speakup_info.spinlock, flags); if (cursor_con != fg_console) { is_cursor = 0; goto out; @@ -1650,7 +1651,7 @@ static void cursor_done(u_long data) say_char(vc); spk_keydown = is_cursor = 0; out: - spk_unlock(flags); + spin_unlock_irqrestore(&speakup_info.spinlock, flags); } /* called by: vt_notifier_call() */ @@ -1659,13 +1660,13 @@ static void speakup_bs(struct vc_data *vc) unsigned long flags; if (!speakup_console[vc->vc_num]) return; - if (!spk_trylock(flags)) + if (!spin_trylock_irqsave(&speakup_info.spinlock, flags)) /* Speakup output, discard */ return; if (!spk_parked) speakup_date(vc); if (spk_shut_up || synth == NULL) { - spk_unlock(flags); + spin_unlock_irqrestore(&speakup_info.spinlock, flags); return; } if (vc->vc_num == fg_console && spk_keydown) { @@ -1673,7 +1674,7 @@ static void speakup_bs(struct vc_data *vc) if (!is_cursor) say_char(vc); } - spk_unlock(flags); + spin_unlock_irqrestore(&speakup_info.spinlock, flags); } /* called by: vt_notifier_call() */ @@ -1682,7 +1683,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) return; - if (!spk_trylock(flags)) + if (!spin_trylock_irqsave(&speakup_info.spinlock, flags)) /* Speakup output, discard */ return; if (spk_bell_pos && spk_keydown && (vc->vc_x == spk_bell_pos - 1)) @@ -1690,31 +1691,31 @@ static void speakup_con_write(struct vc_data *vc, const char *str, int len) if ((is_cursor) || (cursor_track == read_all_mode)) { if (cursor_track == CT_Highlight) update_color_buffer(vc, str, len); - spk_unlock(flags); + spin_unlock_irqrestore(&speakup_info.spinlock, flags); return; } if (win_enabled) { if (vc->vc_x >= win_left && vc->vc_x <= win_right && vc->vc_y >= win_top && vc->vc_y <= win_bottom) { - spk_unlock(flags); + spin_unlock_irqrestore(&speakup_info.spinlock, flags); return; } } spkup_write(str, len); - spk_unlock(flags); + spin_unlock_irqrestore(&speakup_info.spinlock, flags); } -void speakup_con_update(struct vc_data *vc) +static void speakup_con_update(struct vc_data *vc) { unsigned long flags; if (speakup_console[vc->vc_num] == NULL || spk_parked) return; - if (!spk_trylock(flags)) + if (!spin_trylock_irqsave(&speakup_info.spinlock, flags)) /* Speakup output, discard */ return; speakup_date(vc); - spk_unlock(flags); + spin_unlock_irqrestore(&speakup_info.spinlock, flags); } static void do_handle_spec(struct vc_data *vc, u_char value, char up_flag) @@ -1724,7 +1725,7 @@ static void do_handle_spec(struct vc_data *vc, u_char value, char up_flag) char *label; if (synth == NULL || up_flag || spk_killed) return; - spk_lock(flags); + spin_lock_irqsave(&speakup_info.spinlock, flags); spk_shut_up &= 0xfe; if (spk_no_intr) spk_do_flush(); @@ -1745,13 +1746,13 @@ static void do_handle_spec(struct vc_data *vc, u_char value, char up_flag) break; default: spk_parked &= 0xfe; - spk_unlock(flags); + spin_unlock_irqrestore(&speakup_info.spinlock, flags); return; } if (on_off < 2) synth_printf("%s %s\n", label, spk_msg_get(MSG_STATUS_START + on_off)); - spk_unlock(flags); + spin_unlock_irqrestore(&speakup_info.spinlock, flags); } static int inc_dec_var(u_char value) @@ -1892,7 +1893,7 @@ oops: spk_special_handler = NULL; return 1; } - go_pos = simple_strtol(goto_buf, &cp, 10); + go_pos = kstrtol(goto_buf, 10, (long *)&cp); goto_pos = (u_long) go_pos; if (*cp == 'x') { if (*goto_buf < '0') @@ -1964,7 +1965,7 @@ static void speakup_lock(struct vc_data *vc) } typedef void (*spkup_hand) (struct vc_data *); -spkup_hand spkup_handler[] = { +static spkup_hand spkup_handler[] = { /* must be ordered same as defines in speakup.h */ do_nothing, speakup_goto, speech_kill, speakup_shut_up, speakup_cut, speakup_paste, say_first_char, say_last_char, @@ -2002,7 +2003,7 @@ static void do_spkup(struct vc_data *vc, u_char value) static const char *pad_chars = "0123456789+-*/\015,.?()"; -int +static int speakup_key(struct vc_data *vc, int shift_state, int keycode, u_short keysym, int up_flag) { @@ -2015,7 +2016,7 @@ speakup_key(struct vc_data *vc, int shift_state, int keycode, u_short keysym, if (synth == NULL) return 0; - spk_lock(flags); + spin_lock_irqsave(&speakup_info.spinlock, flags); tty = vc->port.tty; if (type >= 0xf0) type -= 0xf0; @@ -2033,7 +2034,7 @@ speakup_key(struct vc_data *vc, int shift_state, int keycode, u_short keysym, if (keycode >= MAX_KEY) goto no_map; key_info = spk_our_keys[keycode]; - if (key_info == 0) + if (!key_info) goto no_map; /* Check valid read all mode keys */ if ((cursor_track == read_all_mode) && (!up_flag)) { @@ -2114,7 +2115,7 @@ no_map: } last_keycode = 0; out: - spk_unlock(flags); + spin_unlock_irqrestore(&speakup_info.spinlock, flags); return ret; } @@ -2265,7 +2266,7 @@ static int __init speakup_init(void) (var->var_id >= 0) && (var->var_id < MAXVARS); var++) speakup_register_var(var); for (i = 1; spk_punc_info[i].mask != 0; i++) - spk_set_mask_bits(0, i, 2); + spk_set_mask_bits(NULL, i, 2); spk_set_key_info(spk_key_defaults, spk_key_buf); diff --git a/drivers/staging/speakup/serialio.c b/drivers/staging/speakup/serialio.c index e4d27aa..1354288 100644 --- a/drivers/staging/speakup/serialio.c +++ b/drivers/staging/speakup/serialio.c @@ -79,7 +79,7 @@ static irqreturn_t synth_readbuf_handler(int irq, void *dev_id) /*printk(KERN_ERR "in irq\n"); */ /*pr_warn("in IRQ\n"); */ int c; - spk_lock(flags); + 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); @@ -87,7 +87,7 @@ static irqreturn_t synth_readbuf_handler(int irq, void *dev_id) /*printk(KERN_ERR "c = %d\n", c); */ /*pr_warn("C = %d\n", c); */ } - spk_unlock(flags); + spin_unlock_irqrestore(&speakup_info.spinlock, flags); return IRQ_HANDLED; } diff --git a/drivers/staging/speakup/speakup_acntpc.c b/drivers/staging/speakup/speakup_acntpc.c index 1c1f0d5..80141ac 100644 --- a/drivers/staging/speakup/speakup_acntpc.c +++ b/drivers/staging/speakup/speakup_acntpc.c @@ -166,7 +166,7 @@ static const char *synth_immediate(struct spk_synth *synth, const char *buf) outb_p(ch, speakup_info.port_tts); buf++; } - return 0; + return NULL; } static void do_catch_up(struct spk_synth *synth) @@ -186,26 +186,26 @@ static void do_catch_up(struct spk_synth *synth) delay_time = spk_get_var(DELAY); full_time = spk_get_var(FULL); - spk_lock(flags); + spin_lock_irqsave(&speakup_info.spinlock, flags); jiffy_delta_val = jiffy_delta->u.n.value; - spk_unlock(flags); + spin_unlock_irqrestore(&speakup_info.spinlock, flags); jiff_max = jiffies + jiffy_delta_val; while (!kthread_should_stop()) { - spk_lock(flags); + spin_lock_irqsave(&speakup_info.spinlock, flags); if (speakup_info.flushing) { speakup_info.flushing = 0; - spk_unlock(flags); + spin_unlock_irqrestore(&speakup_info.spinlock, flags); synth->flush(synth); continue; } if (synth_buffer_empty()) { - spk_unlock(flags); + spin_unlock_irqrestore(&speakup_info.spinlock, flags); break; } set_current_state(TASK_INTERRUPTIBLE); full_time_val = full_time->u.n.value; - spk_unlock(flags); + spin_unlock_irqrestore(&speakup_info.spinlock, flags); if (synth_full()) { schedule_timeout(msecs_to_jiffies(full_time_val)); continue; @@ -217,9 +217,9 @@ static void do_catch_up(struct spk_synth *synth) break; udelay(1); } - spk_lock(flags); + spin_lock_irqsave(&speakup_info.spinlock, flags); ch = synth_buffer_getc(); - spk_unlock(flags); + spin_unlock_irqrestore(&speakup_info.spinlock, flags); if (ch == '\n') ch = PROCSPEECH; outb_p(ch, speakup_info.port_tts); @@ -231,10 +231,10 @@ static void do_catch_up(struct spk_synth *synth) udelay(1); } outb_p(PROCSPEECH, speakup_info.port_tts); - spk_lock(flags); + spin_lock_irqsave(&speakup_info.spinlock, flags); jiffy_delta_val = jiffy_delta->u.n.value; delay_time_val = delay_time->u.n.value; - spk_unlock(flags); + spin_unlock_irqrestore(&speakup_info.spinlock, flags); schedule_timeout(msecs_to_jiffies(delay_time_val)); jiff_max = jiffies+jiffy_delta_val; } diff --git a/drivers/staging/speakup/speakup_apollo.c b/drivers/staging/speakup/speakup_apollo.c index 3e450cc..95d3132 100644 --- a/drivers/staging/speakup/speakup_apollo.c +++ b/drivers/staging/speakup/speakup_apollo.c @@ -148,30 +148,30 @@ static void do_catch_up(struct spk_synth *synth) jiffy_delta = spk_get_var(JIFFY); delay_time = spk_get_var(DELAY); full_time = spk_get_var(FULL); - spk_lock(flags); + spin_lock_irqsave(&speakup_info.spinlock, flags); jiffy_delta_val = jiffy_delta->u.n.value; - spk_unlock(flags); + spin_unlock_irqrestore(&speakup_info.spinlock, flags); jiff_max = jiffies + jiffy_delta_val; while (!kthread_should_stop()) { - spk_lock(flags); + spin_lock_irqsave(&speakup_info.spinlock, flags); jiffy_delta_val = jiffy_delta->u.n.value; full_time_val = full_time->u.n.value; delay_time_val = delay_time->u.n.value; if (speakup_info.flushing) { speakup_info.flushing = 0; - spk_unlock(flags); + spin_unlock_irqrestore(&speakup_info.spinlock, flags); synth->flush(synth); continue; } if (synth_buffer_empty()) { - spk_unlock(flags); + spin_unlock_irqrestore(&speakup_info.spinlock, flags); break; } ch = synth_buffer_peek(); set_current_state(TASK_INTERRUPTIBLE); full_time_val = full_time->u.n.value; - spk_unlock(flags); + spin_unlock_irqrestore(&speakup_info.spinlock, flags); if (!spk_serial_out(ch)) { outb(UART_MCR_DTR, speakup_info.port_tts + UART_MCR); outb(UART_MCR_DTR | UART_MCR_RTS, @@ -180,11 +180,11 @@ static void do_catch_up(struct spk_synth *synth) continue; } if ((jiffies >= jiff_max) && (ch == SPACE)) { - spk_lock(flags); + spin_lock_irqsave(&speakup_info.spinlock, flags); jiffy_delta_val = jiffy_delta->u.n.value; full_time_val = full_time->u.n.value; delay_time_val = delay_time->u.n.value; - spk_unlock(flags); + spin_unlock_irqrestore(&speakup_info.spinlock, flags); if (spk_serial_out(synth->procspeech)) schedule_timeout(msecs_to_jiffies (delay_time_val)); @@ -194,9 +194,9 @@ static void do_catch_up(struct spk_synth *synth) jiff_max = jiffies + jiffy_delta_val; } set_current_state(TASK_RUNNING); - spk_lock(flags); + spin_lock_irqsave(&speakup_info.spinlock, flags); synth_buffer_getc(); - spk_unlock(flags); + spin_unlock_irqrestore(&speakup_info.spinlock, flags); } spk_serial_out(PROCSPEECH); } diff --git a/drivers/staging/speakup/speakup_decext.c b/drivers/staging/speakup/speakup_decext.c index d39a0de..d306e01 100644 --- a/drivers/staging/speakup/speakup_decext.c +++ b/drivers/staging/speakup/speakup_decext.c @@ -165,27 +165,27 @@ static void do_catch_up(struct spk_synth *synth) jiffy_delta = spk_get_var(JIFFY); delay_time = spk_get_var(DELAY); - spk_lock(flags); + spin_lock_irqsave(&speakup_info.spinlock, flags); jiffy_delta_val = jiffy_delta->u.n.value; - spk_unlock(flags); + spin_unlock_irqrestore(&speakup_info.spinlock, flags); jiff_max = jiffies + jiffy_delta_val; while (!kthread_should_stop()) { - spk_lock(flags); + spin_lock_irqsave(&speakup_info.spinlock, flags); if (speakup_info.flushing) { speakup_info.flushing = 0; - spk_unlock(flags); + spin_unlock_irqrestore(&speakup_info.spinlock, flags); synth->flush(synth); continue; } if (synth_buffer_empty()) { - spk_unlock(flags); + spin_unlock_irqrestore(&speakup_info.spinlock, flags); break; } ch = synth_buffer_peek(); set_current_state(TASK_INTERRUPTIBLE); delay_time_val = delay_time->u.n.value; - spk_unlock(flags); + spin_unlock_irqrestore(&speakup_info.spinlock, flags); if (ch == '\n') ch = 0x0D; if (synth_full() || !spk_serial_out(ch)) { @@ -193,9 +193,9 @@ static void do_catch_up(struct spk_synth *synth) continue; } set_current_state(TASK_RUNNING); - spk_lock(flags); + spin_lock_irqsave(&speakup_info.spinlock, flags); synth_buffer_getc(); - spk_unlock(flags); + spin_unlock_irqrestore(&speakup_info.spinlock, flags); if (ch == '[') in_escape = 1; else if (ch == ']') @@ -206,10 +206,10 @@ static void do_catch_up(struct spk_synth *synth) if (jiffies >= jiff_max) { if (!in_escape) spk_serial_out(PROCSPEECH); - spk_lock(flags); + spin_lock_irqsave(&speakup_info.spinlock, flags); jiffy_delta_val = jiffy_delta->u.n.value; delay_time_val = delay_time->u.n.value; - spk_unlock(flags); + spin_unlock_irqrestore(&speakup_info.spinlock, flags); schedule_timeout(msecs_to_jiffies (delay_time_val)); jiff_max = jiffies + jiffy_delta_val; diff --git a/drivers/staging/speakup/speakup_decpc.c b/drivers/staging/speakup/speakup_decpc.c index 6c88b55..ea6b72d 100644 --- a/drivers/staging/speakup/speakup_decpc.c +++ b/drivers/staging/speakup/speakup_decpc.c @@ -377,27 +377,27 @@ static void do_catch_up(struct spk_synth *synth) jiffy_delta = spk_get_var(JIFFY); delay_time = spk_get_var(DELAY); - spk_lock(flags); + spin_lock_irqsave(&speakup_info.spinlock, flags); jiffy_delta_val = jiffy_delta->u.n.value; - spk_unlock(flags); + spin_unlock_irqrestore(&speakup_info.spinlock, flags); jiff_max = jiffies + jiffy_delta_val; while (!kthread_should_stop()) { - spk_lock(flags); + spin_lock_irqsave(&speakup_info.spinlock, flags); if (speakup_info.flushing) { speakup_info.flushing = 0; - spk_unlock(flags); + spin_unlock_irqrestore(&speakup_info.spinlock, flags); synth->flush(synth); continue; } if (synth_buffer_empty()) { - spk_unlock(flags); + spin_unlock_irqrestore(&speakup_info.spinlock, flags); break; } ch = synth_buffer_peek(); set_current_state(TASK_INTERRUPTIBLE); delay_time_val = delay_time->u.n.value; - spk_unlock(flags); + spin_unlock_irqrestore(&speakup_info.spinlock, flags); if (ch == '\n') ch = 0x0D; if (dt_sendchar(ch)) { @@ -405,9 +405,9 @@ static void do_catch_up(struct spk_synth *synth) continue; } set_current_state(TASK_RUNNING); - spk_lock(flags); + spin_lock_irqsave(&speakup_info.spinlock, flags); synth_buffer_getc(); - spk_unlock(flags); + spin_unlock_irqrestore(&speakup_info.spinlock, flags); if (ch == '[') in_escape = 1; else if (ch == ']') @@ -418,10 +418,10 @@ static void do_catch_up(struct spk_synth *synth) if (jiffies >= jiff_max) { if (!in_escape) dt_sendchar(PROCSPEECH); - spk_lock(flags); + spin_lock_irqsave(&speakup_info.spinlock, flags); jiffy_delta_val = jiffy_delta->u.n.value; delay_time_val = delay_time->u.n.value; - spk_unlock(flags); + spin_unlock_irqrestore(&speakup_info.spinlock, flags); schedule_timeout(msecs_to_jiffies (delay_time_val)); jiff_max = jiffies + jiffy_delta_val; @@ -444,7 +444,7 @@ static const char *synth_immediate(struct spk_synth *synth, const char *buf) return buf; buf++; } - return 0; + return NULL; } static int synth_probe(struct spk_synth *synth) diff --git a/drivers/staging/speakup/speakup_dectlk.c b/drivers/staging/speakup/speakup_dectlk.c index 0dd2eb9..15fdec3 100644 --- a/drivers/staging/speakup/speakup_dectlk.c +++ b/drivers/staging/speakup/speakup_dectlk.c @@ -216,9 +216,9 @@ static void do_catch_up(struct spk_synth *synth) jiffy_delta = spk_get_var(JIFFY); delay_time = spk_get_var(DELAY); - spk_lock(flags); + spin_lock_irqsave(&speakup_info.spinlock, flags); jiffy_delta_val = jiffy_delta->u.n.value; - spk_unlock(flags); + spin_unlock_irqrestore(&speakup_info.spinlock, flags); jiff_max = jiffies + jiffy_delta_val; while (!kthread_should_stop()) { @@ -234,22 +234,22 @@ static void do_catch_up(struct spk_synth *synth) is_flushing = 0; spin_unlock_irqrestore(&flush_lock, flags); - spk_lock(flags); + spin_lock_irqsave(&speakup_info.spinlock, flags); if (speakup_info.flushing) { speakup_info.flushing = 0; - spk_unlock(flags); + spin_unlock_irqrestore(&speakup_info.spinlock, flags); synth->flush(synth); continue; } if (synth_buffer_empty()) { - spk_unlock(flags); + spin_unlock_irqrestore(&speakup_info.spinlock, flags); break; } ch = synth_buffer_peek(); set_current_state(TASK_INTERRUPTIBLE); delay_time_val = delay_time->u.n.value; synth_full_val = synth_full(); - spk_unlock(flags); + spin_unlock_irqrestore(&speakup_info.spinlock, flags); if (ch == '\n') ch = 0x0D; if (synth_full_val || !spk_serial_out(ch)) { @@ -257,9 +257,9 @@ static void do_catch_up(struct spk_synth *synth) continue; } set_current_state(TASK_RUNNING); - spk_lock(flags); + spin_lock_irqsave(&speakup_info.spinlock, flags); synth_buffer_getc(); - spk_unlock(flags); + spin_unlock_irqrestore(&speakup_info.spinlock, flags); if (ch == '[') in_escape = 1; else if (ch == ']') @@ -270,10 +270,10 @@ static void do_catch_up(struct spk_synth *synth) if (jiffies >= jiff_max) { if (!in_escape) spk_serial_out(PROCSPEECH); - spk_lock(flags); + spin_lock_irqsave(&speakup_info.spinlock, flags); jiffy_delta_val = jiffy_delta->u.n.value; delay_time_val = delay_time->u.n.value; - spk_unlock(flags); + spin_unlock_irqrestore(&speakup_info.spinlock, flags); schedule_timeout(msecs_to_jiffies (delay_time_val)); jiff_max = jiffies + jiffy_delta_val; diff --git a/drivers/staging/speakup/speakup_dtlk.c b/drivers/staging/speakup/speakup_dtlk.c index a9cefbd..1feb0fb 100644 --- a/drivers/staging/speakup/speakup_dtlk.c +++ b/drivers/staging/speakup/speakup_dtlk.c @@ -200,42 +200,42 @@ static void do_catch_up(struct spk_synth *synth) jiffy_delta = spk_get_var(JIFFY); delay_time = spk_get_var(DELAY); - spk_lock(flags); + spin_lock_irqsave(&speakup_info.spinlock, flags); jiffy_delta_val = jiffy_delta->u.n.value; - spk_unlock(flags); + spin_unlock_irqrestore(&speakup_info.spinlock, flags); jiff_max = jiffies + jiffy_delta_val; while (!kthread_should_stop()) { - spk_lock(flags); + spin_lock_irqsave(&speakup_info.spinlock, flags); if (speakup_info.flushing) { speakup_info.flushing = 0; - spk_unlock(flags); + spin_unlock_irqrestore(&speakup_info.spinlock, flags); synth->flush(synth); continue; } if (synth_buffer_empty()) { - spk_unlock(flags); + spin_unlock_irqrestore(&speakup_info.spinlock, flags); break; } set_current_state(TASK_INTERRUPTIBLE); delay_time_val = delay_time->u.n.value; - spk_unlock(flags); + spin_unlock_irqrestore(&speakup_info.spinlock, flags); if (synth_full()) { schedule_timeout(msecs_to_jiffies(delay_time_val)); continue; } set_current_state(TASK_RUNNING); - spk_lock(flags); + spin_lock_irqsave(&speakup_info.spinlock, flags); ch = synth_buffer_getc(); - spk_unlock(flags); + spin_unlock_irqrestore(&speakup_info.spinlock, flags); if (ch == '\n') ch = PROCSPEECH; spk_out(ch); if ((jiffies >= jiff_max) && (ch == SPACE)) { spk_out(PROCSPEECH); - spk_lock(flags); + spin_lock_irqsave(&speakup_info.spinlock, flags); delay_time_val = delay_time->u.n.value; jiffy_delta_val = jiffy_delta->u.n.value; - spk_unlock(flags); + spin_unlock_irqrestore(&speakup_info.spinlock, flags); schedule_timeout(msecs_to_jiffies(delay_time_val)); jiff_max = jiffies + jiffy_delta_val; } @@ -254,7 +254,7 @@ static const char *synth_immediate(struct spk_synth *synth, const char *buf) spk_out(ch); buf++; } - return 0; + return NULL; } static void synth_flush(struct spk_synth *synth) diff --git a/drivers/staging/speakup/speakup_keypc.c b/drivers/staging/speakup/speakup_keypc.c index feb5f22..2f2fe5e 100644 --- a/drivers/staging/speakup/speakup_keypc.c +++ b/drivers/staging/speakup/speakup_keypc.c @@ -168,7 +168,7 @@ static const char *synth_immediate(struct spk_synth *synth, const char *buf) udelay(70); buf++; } - return 0; + return NULL; } static void do_catch_up(struct spk_synth *synth) @@ -187,26 +187,26 @@ static void do_catch_up(struct spk_synth *synth) jiffy_delta = spk_get_var(JIFFY); delay_time = spk_get_var(DELAY); full_time = spk_get_var(FULL); -spk_lock(flags); +spin_lock_irqsave(&speakup_info.spinlock, flags); jiffy_delta_val = jiffy_delta->u.n.value; - spk_unlock(flags); + spin_unlock_irqrestore(&speakup_info.spinlock, flags); jiff_max = jiffies + jiffy_delta_val; while (!kthread_should_stop()) { - spk_lock(flags); + spin_lock_irqsave(&speakup_info.spinlock, flags); if (speakup_info.flushing) { speakup_info.flushing = 0; - spk_unlock(flags); + spin_unlock_irqrestore(&speakup_info.spinlock, flags); synth->flush(synth); continue; } if (synth_buffer_empty()) { - spk_unlock(flags); + spin_unlock_irqrestore(&speakup_info.spinlock, flags); break; } set_current_state(TASK_INTERRUPTIBLE); full_time_val = full_time->u.n.value; - spk_unlock(flags); + spin_unlock_irqrestore(&speakup_info.spinlock, flags); if (synth_full()) { schedule_timeout(msecs_to_jiffies(full_time_val)); continue; @@ -220,9 +220,9 @@ spk_lock(flags); oops(); break; } - spk_lock(flags); + spin_lock_irqsave(&speakup_info.spinlock, flags); ch = synth_buffer_getc(); - spk_unlock(flags); + spin_unlock_irqrestore(&speakup_info.spinlock, flags); if (ch == '\n') ch = PROCSPEECH; outb_p(ch, synth_port); @@ -237,10 +237,10 @@ spk_lock(flags); break; } outb_p(PROCSPEECH, synth_port); - spk_lock(flags); + spin_lock_irqsave(&speakup_info.spinlock, flags); jiffy_delta_val = jiffy_delta->u.n.value; delay_time_val = delay_time->u.n.value; - spk_unlock(flags); + spin_unlock_irqrestore(&speakup_info.spinlock, flags); schedule_timeout(msecs_to_jiffies(delay_time_val)); jiff_max = jiffies+jiffy_delta_val; } diff --git a/drivers/staging/speakup/speakup_soft.c b/drivers/staging/speakup/speakup_soft.c index e2f5c81..243c3d5 100644 --- a/drivers/staging/speakup/speakup_soft.c +++ b/drivers/staging/speakup/speakup_soft.c @@ -179,45 +179,45 @@ static int softsynth_open(struct inode *inode, struct file *fp) unsigned long flags; /*if ((fp->f_flags & O_ACCMODE) != O_RDONLY) */ /* return -EPERM; */ - spk_lock(flags); + spin_lock_irqsave(&speakup_info.spinlock, flags); if (synth_soft.alive) { - spk_unlock(flags); + spin_unlock_irqrestore(&speakup_info.spinlock, flags); return -EBUSY; } synth_soft.alive = 1; - spk_unlock(flags); + spin_unlock_irqrestore(&speakup_info.spinlock, flags); return 0; } static int softsynth_close(struct inode *inode, struct file *fp) { unsigned long flags; - spk_lock(flags); + spin_lock_irqsave(&speakup_info.spinlock, flags); synth_soft.alive = 0; init_pos = 0; - spk_unlock(flags); + spin_unlock_irqrestore(&speakup_info.spinlock, flags); /* Make sure we let applications go before leaving */ speakup_start_ttys(); return 0; } -static ssize_t softsynth_read(struct file *fp, char *buf, size_t count, +static ssize_t softsynth_read(struct file *fp, char __user *buf, size_t count, loff_t *pos) { int chars_sent = 0; - char *cp; + char __user *cp; char *init; char ch; int empty; unsigned long flags; DEFINE_WAIT(wait); - spk_lock(flags); + spin_lock_irqsave(&speakup_info.spinlock, flags); while (1) { prepare_to_wait(&speakup_event, &wait, TASK_INTERRUPTIBLE); if (!synth_buffer_empty() || speakup_info.flushing) break; - spk_unlock(flags); + spin_unlock_irqrestore(&speakup_info.spinlock, flags); if (fp->f_flags & O_NONBLOCK) { finish_wait(&speakup_event, &wait); return -EAGAIN; @@ -227,7 +227,7 @@ static ssize_t softsynth_read(struct file *fp, char *buf, size_t count, return -ERESTARTSYS; } schedule(); - spk_lock(flags); + spin_lock_irqsave(&speakup_info.spinlock, flags); } finish_wait(&speakup_event, &wait); @@ -244,16 +244,16 @@ static ssize_t softsynth_read(struct file *fp, char *buf, size_t count, } else { ch = synth_buffer_getc(); } - spk_unlock(flags); + spin_unlock_irqrestore(&speakup_info.spinlock, flags); if (copy_to_user(cp, &ch, 1)) return -EFAULT; - spk_lock(flags); + spin_lock_irqsave(&speakup_info.spinlock, flags); chars_sent++; cp++; } *pos += chars_sent; empty = synth_buffer_empty(); - spk_unlock(flags); + spin_unlock_irqrestore(&speakup_info.spinlock, flags); if (empty) { speakup_start_ttys(); *pos = 0; @@ -263,8 +263,8 @@ static ssize_t softsynth_read(struct file *fp, char *buf, size_t count, static int last_index; -static ssize_t softsynth_write(struct file *fp, const char *buf, size_t count, - loff_t *pos) +static ssize_t softsynth_write(struct file *fp, const char __user *buf, + size_t count, loff_t *pos) { unsigned long supplied_index = 0; int converted; @@ -285,10 +285,10 @@ static unsigned int softsynth_poll(struct file *fp, int ret = 0; poll_wait(fp, &speakup_event, wait); - spk_lock(flags); + spin_lock_irqsave(&speakup_info.spinlock, flags); if (!synth_buffer_empty() || speakup_info.flushing) ret = POLLIN | POLLRDNORM; - spk_unlock(flags); + spin_unlock_irqrestore(&speakup_info.spinlock, flags); return ret; } diff --git a/drivers/staging/speakup/spk_priv.h b/drivers/staging/speakup/spk_priv.h index 303105b..637ba67 100644 --- a/drivers/staging/speakup/spk_priv.h +++ b/drivers/staging/speakup/spk_priv.h @@ -77,17 +77,4 @@ extern struct speakup_info_t speakup_info; extern struct var_t synth_time_vars[]; -/* Protect the whole speakup machinery, must be taken at each kernel->speakup - * transition and released at all corresponding speakup->kernel transitions - * (flags must be the same variable between lock/trylock and unlock). - * - * The progression thread only interferes with the speakup machinery through - * the synth buffer, and so only needs to take the lock while tinkering with - * it. - */ -/* Speakup needs to disable the keyboard IRQ, hence _irqsave/restore */ -#define spk_lock(flags) spin_lock_irqsave(&speakup_info.spinlock, flags) -#define spk_trylock(flags) spin_trylock_irqsave(&speakup_info.spinlock, flags) -#define spk_unlock(flags) spin_unlock_irqrestore(&speakup_info.spinlock, flags) - #endif diff --git a/drivers/staging/speakup/synth.c b/drivers/staging/speakup/synth.c index d867dd9..0b3549b 100644 --- a/drivers/staging/speakup/synth.c +++ b/drivers/staging/speakup/synth.c @@ -25,6 +25,18 @@ static int module_status; bool spk_quiet_boot; struct speakup_info_t speakup_info = { + /* + * This spinlock is used to protect the entire speakup machinery, and + * must be taken at each kernel->speakup transition and released at + * each corresponding speakup->kernel transition. + * + * The progression thread only interferes with the speakup machinery through + * the synth buffer, so only needs to take the lock while tinkering with + * the buffer. + * + * We use spin_lock/trylock_irqsave and spin_unlock_irqrestore with this + * spinlock because speakup needs to disable the keyboard IRQ. + */ .spinlock = __SPIN_LOCK_UNLOCKED(speakup_info.spinlock), .flushing = 0, }; @@ -83,27 +95,27 @@ void spk_do_catch_up(struct spk_synth *synth) full_time = spk_get_var(FULL); delay_time = spk_get_var(DELAY); - spk_lock(flags); + spin_lock_irqsave(&speakup_info.spinlock, flags); jiffy_delta_val = jiffy_delta->u.n.value; - spk_unlock(flags); + spin_unlock_irqrestore(&speakup_info.spinlock, flags); jiff_max = jiffies + jiffy_delta_val; while (!kthread_should_stop()) { - spk_lock(flags); + spin_lock_irqsave(&speakup_info.spinlock, flags); if (speakup_info.flushing) { speakup_info.flushing = 0; - spk_unlock(flags); + spin_unlock_irqrestore(&speakup_info.spinlock, flags); synth->flush(synth); continue; } if (synth_buffer_empty()) { - spk_unlock(flags); + spin_unlock_irqrestore(&speakup_info.spinlock, flags); break; } ch = synth_buffer_peek(); set_current_state(TASK_INTERRUPTIBLE); full_time_val = full_time->u.n.value; - spk_unlock(flags); + spin_unlock_irqrestore(&speakup_info.spinlock, flags); if (ch == '\n') ch = synth->procspeech; if (!spk_serial_out(ch)) { @@ -111,11 +123,11 @@ void spk_do_catch_up(struct spk_synth *synth) continue; } if ((jiffies >= jiff_max) && (ch == SPACE)) { - spk_lock(flags); + spin_lock_irqsave(&speakup_info.spinlock, flags); jiffy_delta_val = jiffy_delta->u.n.value; delay_time_val = delay_time->u.n.value; full_time_val = full_time->u.n.value; - spk_unlock(flags); + spin_unlock_irqrestore(&speakup_info.spinlock, flags); if (spk_serial_out(synth->procspeech)) schedule_timeout( msecs_to_jiffies(delay_time_val)); @@ -125,9 +137,9 @@ void spk_do_catch_up(struct spk_synth *synth) jiff_max = jiffies + jiffy_delta_val; } set_current_state(TASK_RUNNING); - spk_lock(flags); + spin_lock_irqsave(&speakup_info.spinlock, flags); synth_buffer_getc(); - spk_unlock(flags); + spin_unlock_irqrestore(&speakup_info.spinlock, flags); } spk_serial_out(synth->procspeech); } @@ -145,7 +157,7 @@ const char *spk_synth_immediate(struct spk_synth *synth, const char *buff) return buff; buff++; } - return 0; + return NULL; } EXPORT_SYMBOL_GPL(spk_synth_immediate); @@ -403,11 +415,11 @@ void synth_release(void) if (synth == NULL) return; - spk_lock(flags); + spin_lock_irqsave(&speakup_info.spinlock, flags); pr_info("releasing synth %s\n", synth->name); synth->alive = 0; del_timer(&thread_timer); - spk_unlock(flags); + spin_unlock_irqrestore(&speakup_info.spinlock, flags); if (synth->attributes.name) sysfs_remove_group(speakup_kobj, &(synth->attributes)); for (var = synth->vars; var->var_id != MAXVARS; var++) diff --git a/drivers/staging/speakup/thread.c b/drivers/staging/speakup/thread.c index 42fa660..4397c8e 100644 --- a/drivers/staging/speakup/thread.c +++ b/drivers/staging/speakup/thread.c @@ -22,7 +22,7 @@ int speakup_thread(void *data) while (1) { DEFINE_WAIT(wait); while (1) { - spk_lock(flags); + spin_lock_irqsave(&speakup_info.spinlock, flags); our_sound = spk_unprocessed_sound; spk_unprocessed_sound.active = 0; prepare_to_wait(&speakup_event, &wait, @@ -32,7 +32,7 @@ int speakup_thread(void *data) (synth && synth->catch_up && synth->alive && (speakup_info.flushing || !synth_buffer_empty())); - spk_unlock(flags); + spin_unlock_irqrestore(&speakup_info.spinlock, flags); if (should_break) break; mutex_unlock(&spk_mutex); diff --git a/drivers/staging/speakup/varhandlers.c b/drivers/staging/speakup/varhandlers.c index 7f6288f..9aa2a78 100644 --- a/drivers/staging/speakup/varhandlers.c +++ b/drivers/staging/speakup/varhandlers.c @@ -137,18 +137,15 @@ struct st_var_header *spk_get_var_header(enum var_id_t var_id) struct st_var_header *spk_var_header_by_name(const char *name) { int i; - struct st_var_header *where = NULL; - if (name != NULL) { - i = 0; - while ((i < MAXVARS) && (where == NULL)) { - if (strcmp(name, var_ptrs[i]->name) == 0) - where = var_ptrs[i]; - else - i++; - } + if (!name) + return NULL; + + for (i = 0; i < MAXVARS; i++) { + if (strcmp(name, var_ptrs[i]->name) == 0) + return var_ptrs[i]; } - return where; + return NULL; } struct var_t *spk_get_var(enum var_id_t var_id) @@ -280,7 +277,7 @@ int spk_set_mask_bits(const char *input, const int which, const int how) spk_chartab[*cp] &= ~mask; } cp = (u_char *)input; - if (cp == 0) + if (!cp) cp = spk_punc_info[which].value; else { for ( ; *cp; cp++) { |