aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/speakup
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/staging/speakup')
-rw-r--r--drivers/staging/speakup/buffers.c1
-rw-r--r--drivers/staging/speakup/i18n.h28
-rw-r--r--drivers/staging/speakup/keyhelp.c7
-rw-r--r--drivers/staging/speakup/kobjects.c7
-rw-r--r--drivers/staging/speakup/main.c46
-rw-r--r--drivers/staging/speakup/selection.c1
-rw-r--r--drivers/staging/speakup/serialio.c2
-rw-r--r--drivers/staging/speakup/serialio.h2
-rw-r--r--drivers/staging/speakup/speakup_acntpc.c3
-rw-r--r--drivers/staging/speakup/speakup_audptr.c2
-rw-r--r--drivers/staging/speakup/speakup_decext.c3
-rw-r--r--drivers/staging/speakup/speakup_decpc.c9
-rw-r--r--drivers/staging/speakup/speakup_dectlk.c2
-rw-r--r--drivers/staging/speakup/speakup_dtlk.c5
-rw-r--r--drivers/staging/speakup/speakup_keypc.c3
-rw-r--r--drivers/staging/speakup/speakup_ltlk.c1
-rw-r--r--drivers/staging/speakup/speakup_soft.c3
-rw-r--r--drivers/staging/speakup/speakup_spkout.c1
-rw-r--r--drivers/staging/speakup/spk_types.h4
-rw-r--r--drivers/staging/speakup/spkguide.txt36
-rw-r--r--drivers/staging/speakup/synth.c9
-rw-r--r--drivers/staging/speakup/thread.c1
-rw-r--r--drivers/staging/speakup/varhandlers.c7
23 files changed, 140 insertions, 43 deletions
diff --git a/drivers/staging/speakup/buffers.c b/drivers/staging/speakup/buffers.c
index 382973e8b80f..d45c8afb041d 100644
--- a/drivers/staging/speakup/buffers.c
+++ b/drivers/staging/speakup/buffers.c
@@ -101,6 +101,5 @@ EXPORT_SYMBOL_GPL(synth_buffer_peek);
void synth_buffer_clear(void)
{
buff_in = buff_out = synth_buffer;
- return;
}
EXPORT_SYMBOL_GPL(synth_buffer_clear);
diff --git a/drivers/staging/speakup/i18n.h b/drivers/staging/speakup/i18n.h
index dd338f4218de..16a0871373d9 100644
--- a/drivers/staging/speakup/i18n.h
+++ b/drivers/staging/speakup/i18n.h
@@ -106,19 +106,23 @@ enum msg_index_t {
MSG_KEYNAMES_START,
MSG_KEYNAME_ESC = MSG_KEYNAMES_START,
MSG_KEYNAME_1, MSG_KEYNAME_2, MSG_KEYNAME_3, MSG_KEYNAME_4,
- MSG_KEYNAME_5, MSG_KEYNAME_6, MSG_KEYNAME_7, MSG_KEYNAME_8, MSG_KEYNAME_9,
+ MSG_KEYNAME_5, MSG_KEYNAME_6, MSG_KEYNAME_7, MSG_KEYNAME_8,
+ MSG_KEYNAME_9,
MSG_KEYNAME_0, MSG_KEYNAME_DASH, MSG_KEYNAME_EQUAL, MSG_KEYNAME_BS,
MSG_KEYNAME_TAB,
- MSG_KEYNAME_Q, MSG_KEYNAME_W, MSG_KEYNAME_E, MSG_KEYNAME_R, MSG_KEYNAME_T,
- MSG_KEYNAME_Y, MSG_KEYNAME_U, MSG_KEYNAME_I, MSG_KEYNAME_O, MSG_KEYNAME_P,
+ MSG_KEYNAME_Q, MSG_KEYNAME_W, MSG_KEYNAME_E, MSG_KEYNAME_R,
+ MSG_KEYNAME_T, MSG_KEYNAME_Y, MSG_KEYNAME_U, MSG_KEYNAME_I,
+ MSG_KEYNAME_O, MSG_KEYNAME_P,
MSG_KEYNAME_LEFTBRACE, MSG_KEYNAME_RIGHTBRACE, MSG_KEYNAME_ENTER,
MSG_KEYNAME_LEFTCTRL, MSG_KEYNAME_A,
- MSG_KEYNAME_S, MSG_KEYNAME_D, MSG_KEYNAME_F, MSG_KEYNAME_G, MSG_KEYNAME_H,
- MSG_KEYNAME_J, MSG_KEYNAME_K, MSG_KEYNAME_L, MSG_KEYNAME_SEMICOLON,
+ MSG_KEYNAME_S, MSG_KEYNAME_D, MSG_KEYNAME_F, MSG_KEYNAME_G,
+ MSG_KEYNAME_H, MSG_KEYNAME_J, MSG_KEYNAME_K, MSG_KEYNAME_L,
+ MSG_KEYNAME_SEMICOLON,
MSG_KEYNAME_SINGLEQUOTE, MSG_KEYNAME_GRAVE,
- MSG_KEYNAME_LEFTSHFT, MSG_KEYNAME_BACKSLASH, MSG_KEYNAME_Z, MSG_KEYNAME_X,
- MSG_KEYNAME_C, MSG_KEYNAME_V, MSG_KEYNAME_B, MSG_KEYNAME_N, MSG_KEYNAME_M,
- MSG_KEYNAME_COMMA, MSG_KEYNAME_DOT, MSG_KEYNAME_SLASH, MSG_KEYNAME_RIGHTSHFT,
+ MSG_KEYNAME_LEFTSHFT, MSG_KEYNAME_BACKSLASH, MSG_KEYNAME_Z,
+ MSG_KEYNAME_X, MSG_KEYNAME_C, MSG_KEYNAME_V, MSG_KEYNAME_B,
+ MSG_KEYNAME_N, MSG_KEYNAME_M, MSG_KEYNAME_COMMA, MSG_KEYNAME_DOT,
+ MSG_KEYNAME_SLASH, MSG_KEYNAME_RIGHTSHFT,
MSG_KEYNAME_KPSTAR,
MSG_KEYNAME_LEFTALT, MSG_KEYNAME_SPACE, MSG_KEYNAME_CAPSLOCK,
MSG_KEYNAME_F1, MSG_KEYNAME_F2,
@@ -144,8 +148,9 @@ enum msg_index_t {
MSG_KEYNAME_INS,
MSG_KEYNAME_DEL, MSG_KEYNAME_MACRO, MSG_KEYNAME_MUTE,
MSG_KEYNAME_VOLDOWN, MSG_KEYNAME_VOLUP,
- MSG_KEYNAME_POWER, MSG_KEYNAME_KPEQUAL, MSG_KEYNAME_KPPLUSDASH, MSG_KEYNAME_PAUSE, MSG_KEYNAME_F21,
- MSG_KEYNAME_F22, MSG_KEYNAME_F23, MSG_KEYNAME_F24, MSG_KEYNAME_KPCOMMA, MSG_KEYNAME_LEFTMETA,
+ MSG_KEYNAME_POWER, MSG_KEYNAME_KPEQUAL, MSG_KEYNAME_KPPLUSDASH,
+ MSG_KEYNAME_PAUSE, MSG_KEYNAME_F21, MSG_KEYNAME_F22, MSG_KEYNAME_F23,
+ MSG_KEYNAME_F24, MSG_KEYNAME_KPCOMMA, MSG_KEYNAME_LEFTMETA,
MSG_KEYNAME_RIGHTMETA, MSG_KEYNAME_COMPOSE, MSG_KEYNAME_STOP,
MSG_KEYNAME_AGAIN, MSG_KEYNAME_PROPS,
MSG_KEYNAME_UNDO, MSG_KEYNAME_FRONT, MSG_KEYNAME_COPY, MSG_KEYNAME_OPEN,
@@ -180,7 +185,8 @@ enum msg_index_t {
MSG_FUNCNAME_CHAR_PHONETIC, MSG_FUNCNAME_CHAR_PREVIOUS,
MSG_FUNCNAME_CURSOR_PARK, MSG_FUNCNAME_CUT,
MSG_FUNCNAME_EDIT_DELIM, MSG_FUNCNAME_EDIT_EXNUM,
- MSG_FUNCNAME_EDIT_MOST, MSG_FUNCNAME_EDIT_REPEATS, MSG_FUNCNAME_EDIT_SOME,
+ MSG_FUNCNAME_EDIT_MOST, MSG_FUNCNAME_EDIT_REPEATS,
+ MSG_FUNCNAME_EDIT_SOME,
MSG_FUNCNAME_GOTO, MSG_FUNCNAME_GOTO_BOTTOM, MSG_FUNCNAME_GOTO_LEFT,
MSG_FUNCNAME_GOTO_RIGHT, MSG_FUNCNAME_GOTO_TOP, MSG_FUNCNAME_HELP,
MSG_FUNCNAME_LINE_SAY_CURRENT, MSG_FUNCNAME_LINE_SAY_NEXT,
diff --git a/drivers/staging/speakup/keyhelp.c b/drivers/staging/speakup/keyhelp.c
index 5091625a4901..94756742136f 100644
--- a/drivers/staging/speakup/keyhelp.c
+++ b/drivers/staging/speakup/keyhelp.c
@@ -64,6 +64,7 @@ static void build_key_data(void)
u_char *kp, counters[MAXFUNCS], ch, ch1;
u_short *p_key = key_data, key;
int i, offset = 1;
+
nstates = (int)(state_tbl[-1]);
memset(counters, 0, sizeof(counters));
memset(key_offsets, 0, sizeof(key_offsets));
@@ -112,6 +113,7 @@ static void build_key_data(void)
static void say_key(int key)
{
int i, state = key >> 8;
+
key &= 0xff;
for (i = 0; i < 6; i++) {
if (state & masks[i])
@@ -127,9 +129,11 @@ static int help_init(void)
char start = SPACE;
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;
@@ -144,6 +148,7 @@ int spk_handle_help(struct vc_data *vc, u_char type, u_char ch, u_short key)
char *name;
u_char func, *kp;
u_short *p_keys, val;
+
if (letter_offsets[0] == -1)
help_init();
if (type == KT_LATIN) {
diff --git a/drivers/staging/speakup/kobjects.c b/drivers/staging/speakup/kobjects.c
index 2ef7f6f201a8..bcc7f62654f4 100644
--- a/drivers/staging/speakup/kobjects.c
+++ b/drivers/staging/speakup/kobjects.c
@@ -232,6 +232,7 @@ static ssize_t keymap_show(struct kobject *kobj, struct kobj_attribute *attr,
u_char *cp1;
u_char ch;
unsigned long flags;
+
spin_lock_irqsave(&speakup_info.spinlock, flags);
cp1 = spk_key_buf + SHIFT_TBL_SIZE;
num_keys = (int)(*cp1);
@@ -905,9 +906,11 @@ static struct kobj_attribute spell_delay_attribute =
static struct kobj_attribute announcements_attribute =
__ATTR(announcements, S_IWUSR|S_IRUGO, message_show, message_store);
static struct kobj_attribute characters_attribute =
- __ATTR(characters, S_IWUSR|S_IRUGO, chars_chartab_show, chars_chartab_store);
+ __ATTR(characters, S_IWUSR|S_IRUGO, chars_chartab_show,
+ chars_chartab_store);
static struct kobj_attribute chartab_attribute =
- __ATTR(chartab, S_IWUSR|S_IRUGO, chars_chartab_show, chars_chartab_store);
+ __ATTR(chartab, S_IWUSR|S_IRUGO, chars_chartab_show,
+ chars_chartab_store);
static struct kobj_attribute ctl_keys_attribute =
__ATTR(ctl_keys, S_IWUSR|S_IRUGO, message_show, message_store);
static struct kobj_attribute colors_attribute =
diff --git a/drivers/staging/speakup/main.c b/drivers/staging/speakup/main.c
index 0cd3cdba8644..3f30a1b6e72c 100644
--- a/drivers/staging/speakup/main.c
+++ b/drivers/staging/speakup/main.c
@@ -78,7 +78,8 @@ int spk_key_echo, spk_say_word_ctl;
int spk_say_ctrl, spk_bell_pos;
short spk_punc_mask;
int spk_punc_level, spk_reading_punc;
-char spk_str_caps_start[MAXVARLEN + 1] = "\0", spk_str_caps_stop[MAXVARLEN + 1] = "\0";
+char spk_str_caps_start[MAXVARLEN + 1] = "\0";
+char spk_str_caps_stop[MAXVARLEN + 1] = "\0";
const struct st_bits_data spk_punc_info[] = {
{"none", "", 0},
{"some", "/$%&@", SOME},
@@ -282,6 +283,7 @@ static void bleep(u_short val)
};
short freq;
int time = spk_bleep_time;
+
freq = vals[val % 12];
if (val > 11)
freq *= (1 << (val / 12));
@@ -305,6 +307,7 @@ static void speakup_shut_up(struct vc_data *vc)
static void speech_kill(struct vc_data *vc)
{
char val = synth->is_alive(synth);
+
if (val == 0)
return;
@@ -393,6 +396,7 @@ static void say_attributes(struct vc_data *vc)
{
int fg = spk_attr & 0x0f;
int bg = spk_attr >> 4;
+
if (fg > 8) {
synth_printf("%s ", spk_msg_get(MSG_BRIGHT));
fg -= 8;
@@ -426,6 +430,7 @@ static void speak_char(u_char ch)
{
char *cp = spk_characters[ch];
struct var_t *direct = spk_get_var(DIRECT);
+
if (direct && direct->u.n.value) {
if (IS_CHAR(ch, B_CAP)) {
spk_pitch_shift++;
@@ -459,6 +464,7 @@ static void speak_char(u_char ch)
static u16 get_char(struct vc_data *vc, u16 *pos, u_char *attribs)
{
u16 ch = ' ';
+
if (vc && pos) {
u16 w = scr_readw(pos);
u16 c = w & 0xff;
@@ -475,6 +481,7 @@ static u16 get_char(struct vc_data *vc, u16 *pos, u_char *attribs)
static void say_char(struct vc_data *vc)
{
u_short ch;
+
spk_old_attr = spk_attr;
ch = get_char(vc, (u_short *) spk_pos, &spk_attr);
if (spk_attr != spk_old_attr) {
@@ -489,6 +496,7 @@ static void say_char(struct vc_data *vc)
static void say_phonetic_char(struct vc_data *vc)
{
u_short ch;
+
spk_old_attr = spk_attr;
ch = get_char(vc, (u_short *) spk_pos, &spk_attr);
if (isascii(ch) && isalpha(ch)) {
@@ -539,6 +547,7 @@ static u_long get_word(struct vc_data *vc)
char ch;
u_short attr_ch;
u_char temp;
+
spk_old_attr = spk_attr;
ch = (char)get_char(vc, (u_short *) tmp_pos, &temp);
@@ -582,6 +591,7 @@ static void say_word(struct vc_data *vc)
{
u_long cnt = get_word(vc);
u_short saved_punc_mask = spk_punc_mask;
+
if (cnt == 0)
return;
spk_punc_mask = PUNC;
@@ -595,6 +605,7 @@ static void say_prev_word(struct vc_data *vc)
u_char temp;
char ch;
u_short edge_said = 0, last_state = 0, state = 0;
+
spk_parked |= 0x01;
if (spk_x == 0) {
@@ -647,8 +658,8 @@ static void say_next_word(struct vc_data *vc)
u_char temp;
char ch;
u_short edge_said = 0, last_state = 2, state = 0;
- spk_parked |= 0x01;
+ spk_parked |= 0x01;
if (spk_x == vc->vc_cols - 1 && spk_y == vc->vc_rows - 1) {
announce_edge(vc, edge_bottom);
return;
@@ -688,6 +699,7 @@ static void spell_word(struct vc_data *vc)
char *cp = buf, *str_cap = spk_str_caps_stop;
char *cp1, *last_cap = spk_str_caps_stop;
u_char ch;
+
if (!get_word(vc))
return;
while ((ch = (u_char) *cp)) {
@@ -746,6 +758,7 @@ static void say_line(struct vc_data *vc)
int i = get_line(vc);
char *cp;
u_short saved_punc_mask = spk_punc_mask;
+
if (i == 0) {
synth_printf("%s\n", spk_msg_get(MSG_BLANK));
return;
@@ -792,6 +805,7 @@ static int say_from_to(struct vc_data *vc, u_long from, u_long to,
int i = 0;
u_char tmp;
u_short saved_punc_mask = spk_punc_mask;
+
spk_old_attr = spk_attr;
spk_attr = get_attributes((u_short *) from);
while (from < to) {
@@ -820,6 +834,7 @@ static void say_line_from_to(struct vc_data *vc, u_long from, u_long to,
{
u_long start = vc->vc_origin + (spk_y * vc->vc_size_row);
u_long end = start + (to * 2);
+
start += from * 2;
if (say_from_to(vc, start, end, read_punc) <= 0)
if (cursor_track != read_all_mode)
@@ -903,6 +918,7 @@ static int get_sentence_buf(struct vc_data *vc, int read_punc)
static void say_screen_from_to(struct vc_data *vc, u_long from, u_long to)
{
u_long start = vc->vc_origin, end;
+
if (from > 0)
start += from * vc->vc_size_row;
if (to > vc->vc_rows)
@@ -922,6 +938,7 @@ static void say_screen(struct vc_data *vc)
static void speakup_win_say(struct vc_data *vc)
{
u_long start, end, from, to;
+
if (win_start < 2) {
synth_printf("%s\n", spk_msg_get(MSG_NO_WINDOW));
return;
@@ -972,6 +989,7 @@ static void say_first_char(struct vc_data *vc)
{
int i, len = get_line(vc);
u_char ch;
+
spk_parked |= 0x01;
if (len == 0) {
synth_printf("%s\n", spk_msg_get(MSG_BLANK));
@@ -991,6 +1009,7 @@ static void say_last_char(struct vc_data *vc)
{
int len = get_line(vc);
u_char ch;
+
spk_parked |= 0x01;
if (len == 0) {
synth_printf("%s\n", spk_msg_get(MSG_BLANK));
@@ -1015,6 +1034,7 @@ static void say_char_num(struct vc_data *vc)
{
u_char tmp;
u_short ch = get_char(vc, (u_short *) spk_pos, &tmp);
+
ch &= 0xff;
synth_printf(spk_msg_get(MSG_CHAR_INFO), ch, ch);
}
@@ -1049,6 +1069,7 @@ static void spkup_write(const char *in_buf, int count)
static u_char ch = '\0', old_ch = '\0';
static u_short char_type, last_type;
int in_count = count;
+
spk_keydown = 0;
while (count--) {
if (cursor_track == read_all_mode) {
@@ -1126,6 +1147,7 @@ static DEFINE_TIMER(cursor_timer, cursor_done, 0, 0);
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;
spin_lock_irqsave(&speakup_info.spinlock, flags);
@@ -1156,6 +1178,7 @@ static void do_handle_shift(struct vc_data *vc, u_char value, char up_flag)
static void do_handle_latin(struct vc_data *vc, u_char value, char up_flag)
{
unsigned long flags;
+
spin_lock_irqsave(&speakup_info.spinlock, flags);
if (up_flag) {
spk_lastkey = spk_keydown = 0;
@@ -1181,6 +1204,7 @@ int spk_set_key_info(const u_char *key_info, u_char *k_buffer)
const u_char *cp = key_info;
u_char *cp1 = k_buffer;
u_char ch, version, num_keys;
+
version = *cp++;
if (version != KEY_MAP_VER)
return -1;
@@ -1263,6 +1287,7 @@ static const struct st_bits_data *pb_edit;
static int edit_bits(struct vc_data *vc, u_char type, u_char ch, u_short key)
{
short mask = pb_edit->mask, ch_type = spk_chartab[ch];
+
if (type != KT_LATIN || (ch_type & B_NUM) || ch < SPACE)
return -1;
if (ch == SPACE) {
@@ -1448,6 +1473,7 @@ 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;
+
spin_lock_irqsave(&speakup_info.spinlock, flags);
if (cursor_track == read_all_mode) {
spk_parked &= 0xfe;
@@ -1531,6 +1557,7 @@ static void reset_highlight_buffers(struct vc_data *vc)
{
int i;
int vc_num = vc->vc_num;
+
for (i = 0; i < 8; i++)
speakup_console[vc_num]->ht.highsize[i] = 0;
}
@@ -1549,6 +1576,7 @@ static int count_highlight_color(struct vc_data *vc)
for (i = 0; i < vc->vc_rows; i++) {
u16 *end = start + vc->vc_cols * 2;
u16 *ptr;
+
for (ptr = start; ptr < end; ptr++) {
ch = get_attributes(ptr);
bg = (ch & 0x70) >> 4;
@@ -1593,6 +1621,7 @@ static int speak_highlight(struct vc_data *vc)
{
int hc, d;
int vc_num = vc->vc_num;
+
if (count_highlight_color(vc) == 1)
return 0;
hc = get_highlight_color(vc);
@@ -1617,6 +1646,7 @@ static void cursor_done(u_long data)
{
struct vc_data *vc = vc_cons[cursor_con].d;
unsigned long flags;
+
del_timer(&cursor_timer);
spin_lock_irqsave(&speakup_info.spinlock, flags);
if (cursor_con != fg_console) {
@@ -1656,6 +1686,7 @@ out:
static void speakup_bs(struct vc_data *vc)
{
unsigned long flags;
+
if (!speakup_console[vc->vc_num])
return;
if (!spin_trylock_irqsave(&speakup_info.spinlock, flags))
@@ -1679,6 +1710,7 @@ static void speakup_bs(struct vc_data *vc)
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 (!spin_trylock_irqsave(&speakup_info.spinlock, flags))
@@ -1707,6 +1739,7 @@ static void speakup_con_write(struct vc_data *vc, const char *str, int len)
static void speakup_con_update(struct vc_data *vc)
{
unsigned long flags;
+
if (speakup_console[vc->vc_num] == NULL || spk_parked)
return;
if (!spin_trylock_irqsave(&speakup_info.spinlock, flags))
@@ -1721,6 +1754,7 @@ static void do_handle_spec(struct vc_data *vc, u_char value, char up_flag)
unsigned long flags;
int on_off = 2;
char *label;
+
if (synth == NULL || up_flag || spk_killed)
return;
spin_lock_irqsave(&speakup_info.spinlock, flags);
@@ -1762,6 +1796,7 @@ static int inc_dec_var(u_char value)
char *pn;
int var_id = (int)value - VAR_START;
int how = (var_id & 1) ? E_INC : E_DEC;
+
var_id = var_id / 2 + FIRST_SET_VAR;
p_header = spk_get_var_header(var_id);
if (p_header == NULL)
@@ -1788,6 +1823,7 @@ static int inc_dec_var(u_char value)
static void speakup_win_set(struct vc_data *vc)
{
char info[40];
+
if (win_start > 1) {
synth_printf("%s\n", spk_msg_get(MSG_WINDOW_ALREADY_SET));
return;
@@ -1842,6 +1878,7 @@ static void speakup_win_enable(struct vc_data *vc)
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) {
synth_printf("%s\n", spk_msg_get(MSG_ERROR));
return;
@@ -1939,7 +1976,6 @@ static void speakup_goto(struct vc_data *vc)
}
synth_printf("%s\n", spk_msg_get(MSG_GOTO));
spk_special_handler = handle_goto;
- return;
}
static void speakup_help(struct vc_data *vc)
@@ -2011,6 +2047,7 @@ speakup_key(struct vc_data *vc, int shift_state, int keycode, u_short keysym,
u_char type = KTYP(keysym), value = KVAL(keysym), new_key = 0;
u_char shift_info, offset;
int ret = 0;
+
if (synth == NULL)
return 0;
@@ -2161,6 +2198,7 @@ static int keyboard_notifier_call(struct notifier_block *nb,
case KBD_POST_KEYSYM:{
unsigned char type = KTYP(param->value) - 0xf0;
unsigned char val = KVAL(param->value);
+
switch (type) {
case KT_SHIFT:
do_handle_shift(vc, val, up);
@@ -2187,6 +2225,7 @@ static int vt_notifier_call(struct notifier_block *nb,
{
struct vt_notifier_param *param = _param;
struct vc_data *vc = param->vc;
+
switch (code) {
case VT_ALLOCATE:
if (vc->vc_mode == KD_TEXT)
@@ -2200,6 +2239,7 @@ static int vt_notifier_call(struct notifier_block *nb,
speakup_bs(vc);
else if (param->c < 0x100) {
char d = param->c;
+
speakup_con_write(vc, &d, 1);
}
break;
diff --git a/drivers/staging/speakup/selection.c b/drivers/staging/speakup/selection.c
index ca04d3669acc..507fc9a1776e 100644
--- a/drivers/staging/speakup/selection.c
+++ b/drivers/staging/speakup/selection.c
@@ -66,6 +66,7 @@ int speakup_set_selection(struct tty_struct *tty)
if (ps > pe) {
/* make sel_start <= sel_end */
int tmp = ps;
+
ps = pe;
pe = tmp;
}
diff --git a/drivers/staging/speakup/serialio.c b/drivers/staging/speakup/serialio.c
index c62d74c47906..1d9d51bdf517 100644
--- a/drivers/staging/speakup/serialio.c
+++ b/drivers/staging/speakup/serialio.c
@@ -83,6 +83,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;
+
spin_lock_irqsave(&speakup_info.spinlock, flags);
while (inb_p(speakup_info.port_tts + UART_LSR) & UART_LSR_DR) {
@@ -137,6 +138,7 @@ void spk_stop_serial_interrupt(void)
int spk_wait_for_xmitr(void)
{
int tmout = SPK_XMITR_TIMEOUT;
+
if ((synth->alive) && (timeouts >= NUM_DISABLE_TIMEOUTS)) {
pr_warn("%s: too many timeouts, deactivating speakup\n",
synth->long_name);
diff --git a/drivers/staging/speakup/serialio.h b/drivers/staging/speakup/serialio.h
index 0a937732a190..317bb8432a04 100644
--- a/drivers/staging/speakup/serialio.h
+++ b/drivers/staging/speakup/serialio.h
@@ -4,7 +4,7 @@
#include <linux/serial.h> /* for rs_table, serial constants */
#include <linux/serial_reg.h> /* for more serial constants */
#ifndef __sparc__
-#include <asm/serial.h>
+#include <linux/serial.h>
#endif
/*
diff --git a/drivers/staging/speakup/speakup_acntpc.c b/drivers/staging/speakup/speakup_acntpc.c
index 31f952b9049b..f0bfd9e99191 100644
--- a/drivers/staging/speakup/speakup_acntpc.c
+++ b/drivers/staging/speakup/speakup_acntpc.c
@@ -152,8 +152,10 @@ static inline bool synth_full(void)
static const char *synth_immediate(struct spk_synth *synth, const char *buf)
{
u_char ch;
+
while ((ch = *buf)) {
int timeout = SPK_XMITR_TIMEOUT;
+
if (ch == '\n')
ch = PROCSPEECH;
if (synth_full())
@@ -257,6 +259,7 @@ static int synth_probe(struct spk_synth *synth)
{
unsigned int port_val = 0;
int i = 0;
+
pr_info("Probing for %s.\n", synth->long_name);
if (port_forced) {
speakup_info.port_tts = port_forced;
diff --git a/drivers/staging/speakup/speakup_audptr.c b/drivers/staging/speakup/speakup_audptr.c
index 362f9747e48d..5cbaec8335fe 100644
--- a/drivers/staging/speakup/speakup_audptr.c
+++ b/drivers/staging/speakup/speakup_audptr.c
@@ -132,6 +132,7 @@ static struct spk_synth synth_audptr = {
static void synth_flush(struct spk_synth *synth)
{
int timeout = SPK_XMITR_TIMEOUT;
+
while (spk_serial_tx_busy()) {
if (!--timeout)
break;
@@ -145,6 +146,7 @@ static void synth_version(struct spk_synth *synth)
{
unsigned char test = 0;
char synth_id[40] = "";
+
spk_synth_immediate(synth, "\x05[Q]");
synth_id[test] = spk_serial_in();
if (synth_id[test] == 'A') {
diff --git a/drivers/staging/speakup/speakup_decext.c b/drivers/staging/speakup/speakup_decext.c
index 67b7de1d8c75..555029036dc2 100644
--- a/drivers/staging/speakup/speakup_decext.c
+++ b/drivers/staging/speakup/speakup_decext.c
@@ -39,6 +39,7 @@ static unsigned char last_char;
static inline u_char get_last_char(void)
{
u_char avail = inb_p(speakup_info.port_tts + UART_LSR) & UART_LSR_DR;
+
if (avail)
last_char = inb_p(speakup_info.port_tts + UART_RX);
return last_char;
@@ -203,7 +204,7 @@ static void do_catch_up(struct spk_synth *synth)
else if (ch <= SPACE) {
if (!in_escape && strchr(",.!?;:", last))
spk_serial_out(PROCSPEECH);
- if (jiffies >= jiff_max) {
+ if (time_after_eq(jiffies, jiff_max)) {
if (!in_escape)
spk_serial_out(PROCSPEECH);
spin_lock_irqsave(&speakup_info.spinlock, flags);
diff --git a/drivers/staging/speakup/speakup_decpc.c b/drivers/staging/speakup/speakup_decpc.c
index 67678d8888c2..7c9c432e48d9 100644
--- a/drivers/staging/speakup/speakup_decpc.c
+++ b/drivers/staging/speakup/speakup_decpc.c
@@ -260,6 +260,7 @@ static void dt_sendcmd(u_int cmd)
static int dt_waitbit(int bit)
{
int timeout = 100;
+
while (--timeout > 0) {
if ((dt_getstatus() & bit) == bit)
return 1;
@@ -271,6 +272,7 @@ static int dt_waitbit(int bit)
static int dt_wait_dma(void)
{
int timeout = 100, state = dma_state;
+
if (!dt_waitbit(STAT_dma_ready))
return 0;
while (--timeout > 0) {
@@ -285,6 +287,7 @@ static int dt_wait_dma(void)
static int dt_ctrl(u_int cmd)
{
int timeout = 10;
+
if (!dt_waitbit(STAT_cmd_ready))
return -1;
outb_p(0, speakup_info.port_tts+2);
@@ -304,6 +307,7 @@ static int dt_ctrl(u_int cmd)
static void synth_flush(struct spk_synth *synth)
{
int timeout = 10;
+
if (is_flushing)
return;
is_flushing = 4;
@@ -346,6 +350,7 @@ static int dt_sendchar(char ch)
static int testkernel(void)
{
int status = 0;
+
if (dt_getstatus() == 0xffff) {
status = -1;
goto oops;
@@ -415,7 +420,7 @@ static void do_catch_up(struct spk_synth *synth)
else if (ch <= SPACE) {
if (!in_escape && strchr(",.!?;:", last))
dt_sendchar(PROCSPEECH);
- if (jiffies >= jiff_max) {
+ if (time_after_eq(jiffies, jiff_max)) {
if (!in_escape)
dt_sendchar(PROCSPEECH);
spin_lock_irqsave(&speakup_info.spinlock, flags);
@@ -437,6 +442,7 @@ static void do_catch_up(struct spk_synth *synth)
static const char *synth_immediate(struct spk_synth *synth, const char *buf)
{
u_char ch;
+
while ((ch = *buf)) {
if (ch == '\n')
ch = PROCSPEECH;
@@ -450,6 +456,7 @@ static const char *synth_immediate(struct spk_synth *synth, const char *buf)
static int synth_probe(struct spk_synth *synth)
{
int i = 0, failed = 0;
+
pr_info("Probing for %s.\n", synth->long_name);
for (i = 0; synth_portlist[i]; i++) {
if (synth_request_region(synth_portlist[i], SYNTH_IO_EXTENT)) {
diff --git a/drivers/staging/speakup/speakup_dectlk.c b/drivers/staging/speakup/speakup_dectlk.c
index c07c9670eef4..69e7c2b41b94 100644
--- a/drivers/staging/speakup/speakup_dectlk.c
+++ b/drivers/staging/speakup/speakup_dectlk.c
@@ -169,6 +169,7 @@ static u_char lastind;
static unsigned char get_index(void)
{
u_char rv;
+
rv = lastind;
lastind = 0;
return rv;
@@ -180,6 +181,7 @@ static void read_buff_add(u_char c)
if (c == 0x01) {
unsigned long flags;
+
spin_lock_irqsave(&flush_lock, flags);
is_flushing = 0;
wake_up_interruptible(&flush);
diff --git a/drivers/staging/speakup/speakup_dtlk.c b/drivers/staging/speakup/speakup_dtlk.c
index 98d1f497e4e0..d7d515273896 100644
--- a/drivers/staging/speakup/speakup_dtlk.c
+++ b/drivers/staging/speakup/speakup_dtlk.c
@@ -174,6 +174,7 @@ static inline bool synth_full(void)
static void spk_out(const char ch)
{
int timeout = SPK_XMITR_TIMEOUT;
+
while (!synth_writable()) {
if (!--timeout)
break;
@@ -246,6 +247,7 @@ static void do_catch_up(struct spk_synth *synth)
static const char *synth_immediate(struct spk_synth *synth, const char *buf)
{
u_char ch;
+
while ((ch = (u_char)*buf)) {
if (synth_full())
return buf;
@@ -267,6 +269,7 @@ static void synth_flush(struct spk_synth *synth)
static char synth_read_tts(void)
{
u_char ch;
+
while (!synth_readable())
cpu_relax();
ch = synth_status & 0x7f;
@@ -283,6 +286,7 @@ static struct synth_settings *synth_interrogate(struct spk_synth *synth)
static char buf[sizeof(struct synth_settings) + 1];
int total, i;
static struct synth_settings status;
+
synth_immediate(synth, "\x18\x01?");
for (total = 0, i = 0; i < 50; i++) {
buf[total] = synth_read_tts();
@@ -324,6 +328,7 @@ static int synth_probe(struct spk_synth *synth)
unsigned int port_val = 0;
int i = 0;
struct synth_settings *sp;
+
pr_info("Probing for DoubleTalk.\n");
if (port_forced) {
speakup_info.port_tts = port_forced;
diff --git a/drivers/staging/speakup/speakup_keypc.c b/drivers/staging/speakup/speakup_keypc.c
index 9d30c1945f92..4ed38898a17a 100644
--- a/drivers/staging/speakup/speakup_keypc.c
+++ b/drivers/staging/speakup/speakup_keypc.c
@@ -143,6 +143,7 @@ static inline bool synth_full(void)
static char *oops(void)
{
int s1, s2, s3, s4;
+
s1 = inb_p(synth_port);
s2 = inb_p(synth_port+1);
s3 = inb_p(synth_port+2);
@@ -155,6 +156,7 @@ static const char *synth_immediate(struct spk_synth *synth, const char *buf)
{
u_char ch;
int timeout;
+
while ((ch = *buf)) {
if (ch == '\n')
ch = PROCSPEECH;
@@ -264,6 +266,7 @@ static int synth_probe(struct spk_synth *synth)
{
unsigned int port_val = 0;
int i = 0;
+
pr_info("Probing for %s.\n", synth->long_name);
if (port_forced) {
synth_port = port_forced;
diff --git a/drivers/staging/speakup/speakup_ltlk.c b/drivers/staging/speakup/speakup_ltlk.c
index d6de72295d33..377a6e2b8b93 100644
--- a/drivers/staging/speakup/speakup_ltlk.c
+++ b/drivers/staging/speakup/speakup_ltlk.c
@@ -141,6 +141,7 @@ static void synth_interrogate(struct spk_synth *synth)
{
unsigned char *t, i;
unsigned char buf[50], rom_v[20];
+
spk_synth_immediate(synth, "\x18\x01?");
for (i = 0; i < 50; i++) {
buf[i] = spk_serial_in();
diff --git a/drivers/staging/speakup/speakup_soft.c b/drivers/staging/speakup/speakup_soft.c
index 9ed726509261..e6e93fbd183a 100644
--- a/drivers/staging/speakup/speakup_soft.c
+++ b/drivers/staging/speakup/speakup_soft.c
@@ -192,6 +192,7 @@ static int softsynth_open(struct inode *inode, struct file *fp)
static int softsynth_close(struct inode *inode, struct file *fp)
{
unsigned long flags;
+
spin_lock_irqsave(&speakup_info.spinlock, flags);
synth_soft.alive = 0;
init_pos = 0;
@@ -283,6 +284,7 @@ static unsigned int softsynth_poll(struct file *fp,
{
unsigned long flags;
int ret = 0;
+
poll_wait(fp, &speakup_event, wait);
spin_lock_irqsave(&speakup_info.spinlock, flags);
@@ -295,6 +297,7 @@ static unsigned int softsynth_poll(struct file *fp,
static unsigned char get_index(void)
{
int rv;
+
rv = last_index;
last_index = 0;
return rv;
diff --git a/drivers/staging/speakup/speakup_spkout.c b/drivers/staging/speakup/speakup_spkout.c
index 77f2dc2c3d97..bccddf8b89fd 100644
--- a/drivers/staging/speakup/speakup_spkout.c
+++ b/drivers/staging/speakup/speakup_spkout.c
@@ -131,6 +131,7 @@ static struct spk_synth synth_spkout = {
static void synth_flush(struct spk_synth *synth)
{
int timeout = SPK_XMITR_TIMEOUT;
+
while (spk_serial_tx_busy()) {
if (!--timeout)
break;
diff --git a/drivers/staging/speakup/spk_types.h b/drivers/staging/speakup/spk_types.h
index 3ac552c1236e..8c565c94b8b2 100644
--- a/drivers/staging/speakup/spk_types.h
+++ b/drivers/staging/speakup/spk_types.h
@@ -39,10 +39,10 @@ enum var_id_t {
DELIM, REPEATS, EXNUMBER,
DELAY, TRIGGER, JIFFY, FULL, /* all timers must be together */
BLEEP_TIME, CURSOR_TIME, BELL_POS,
-SAY_CONTROL, SAY_WORD_CTL, NO_INTERRUPT, KEY_ECHO,
+ SAY_CONTROL, SAY_WORD_CTL, NO_INTERRUPT, KEY_ECHO,
SPELL_DELAY, PUNC_LEVEL, READING_PUNC,
ATTRIB_BLEEP, BLEEPS,
- RATE, PITCH, VOL, TONE, PUNCT, VOICE, FREQUENCY, LANG, DIRECT,
+ RATE, PITCH, VOL, TONE, PUNCT, VOICE, FREQUENCY, LANG, DIRECT,
CAPS_START, CAPS_STOP, CHARTAB,
MAXVARS
};
diff --git a/drivers/staging/speakup/spkguide.txt b/drivers/staging/speakup/spkguide.txt
index f3210571e396..b699de3c649f 100644
--- a/drivers/staging/speakup/spkguide.txt
+++ b/drivers/staging/speakup/spkguide.txt
@@ -88,7 +88,7 @@ NOT * support the internal Tripletalk!
Speakup does support two other synthesizers, but because they work in
conjunction with other software, they must be loaded as modules after
-their related software is loaded, and so are not available at boot up.
+their related software is loaded, and so are not available at boot up.
These are as follows:
decpc -- DecTalk PC (not available at boot up)
@@ -106,7 +106,7 @@ the bootup messages.
Once you have booted the system, and if necessary, have supplied the
proper bootup parameter for your synthesizer, Speakup will begin
-talking as soon as the kernel is loaded. In fact, it will talk a lot!
+talking as soon as the kernel is loaded. In fact, it will talk a lot!
It will speak all the boot up messages that the kernel prints on the
screen during the boot process. This is because Speakup is not a
separate screen reader, but is actually built into the operating
@@ -115,7 +115,7 @@ screen using the kernel, and must get their keyboard input through the
kernel, they are automatically handled properly by Speakup. There are a
few exceptions, but we'll come to those later.
-Note: In this guide I will refer to the numeric keypad as the keypad.
+Note: In this guide I will refer to the numeric keypad as the keypad.
This is done because the speakupmap.map file referred to later in this
manual uses the term keypad instead of numeric keypad. Also I'm lazy
and would rather only type one word. So keypad it is. Got it? Good.
@@ -143,7 +143,7 @@ that way, until you press another key.
You can check to see if the boot process has completed by pressing the 8
key on the keypad, which reads the current line. This also has the
effect of starting Speakup talking again, so you can press keypad enter
-to silence it again if the boot process has not completed.
+to silence it again if the boot process has not completed.
When the boot process is complete, you will arrive at a "login" prompt.
At this point, you'll need to type in your user id and password, as
@@ -159,7 +159,7 @@ which require root privileges.
When you are running a program or command, Speakup will automatically
speak new text as it arrives on the screen. You can at any time silence
-the speech with keypad enter, or use any of the Speakup review keys.
+the speech with keypad enter, or use any of the Speakup review keys.
Here are some basic Speakup review keys, and a short description of what
they do.
@@ -215,12 +215,12 @@ example, if you press the keypad 8 key, you will hear:
"Keypad 8 is line, say current."
-You'll notice that some commands do not have keys assigned to them.
+You'll notice that some commands do not have keys assigned to them.
This is because they are very infrequently used commands, and are also
accessible through the sys system. We'll discuss the sys system later
in this manual.
-You'll also notice that some commands have two keys assigned to them.
+You'll also notice that some commands have two keys assigned to them.
This is because Speakup has a built in set of alternative key bindings
for laptop users. The alternate speakup key is the caps lock key. You
can press and hold the caps lock key, while pressing an alternate
@@ -292,12 +292,12 @@ spk key_kp5 = spell_phonetic
spk key_kp6 = say_to_right
key_kpplus = say_screen
spk key_kpplus = say_win
- key_kp1 = say_prev_char
+ key_kp1 = say_prev_char
spk key_kp1 = right_edge
key_kp2 = say_char
spk key_kp2 = say_to_bottom
double key_kp2 = say_phonetic_char
- key_kp3 = say_next_char
+ key_kp3 = say_next_char
spk key_kp3 = bottom_edge
key_kp0 = spk_key
key_kpdot = say_position
@@ -354,7 +354,7 @@ As a convenience, run as root
ln -s /sys/accessibility/speakup /speakup
-to directly access speakup parameters from /speakup.
+to directly access speakup parameters from /speakup.
You can see these entries by typing the command:
ls -1 /speakup/*
@@ -497,7 +497,7 @@ only, is owned by root, and belongs to the root group. Doing a cat of
this:
cat /speakup/version
-Speakup v-2.00 CVS: Thu Oct 21 10:38:21 EDT 2004
+Speakup v-2.00 CVS: Thu Oct 21 10:38:21 EDT 2004
synth dtlk version 1.1
The display shows the Speakup version number, along with the version
@@ -517,7 +517,7 @@ volume is set at.
All the entries in the Speakup sys system are readable, some are
writable by root only, and some are writable by everyone. Unless you
know what you are doing, you should probably leave the ones that are
-writable by root only alone. Most of the names are self explanatory.
+writable by root only alone. Most of the names are self explanatory.
Vol for controlling volume, pitch for pitch, rate for controlling speaking
rate, etc. If you find one you aren't sure about, you can post a query
on the Speakup list.
@@ -527,7 +527,7 @@ on the Speakup list.
It is possible to change to a different synthesizer while speakup is
running. In other words, it is not necessary to reboot the system
in order to use a different synthesizer. You can simply echo the
-synthesizer keyword to the /speakup/synth sys entry.
+synthesizer keyword to the /speakup/synth sys entry.
Depending on your situation, you may wish to echo none to the synth
sys entry, to disable speech while one synthesizer is disconnected and
a second one is connected in its place. Then echo the keyword for the
@@ -632,7 +632,7 @@ Espeakup is a connector between Speakup and the eSpeak software synthesizer.
Espeakup may already be available as a package for your distribution
of Linux. If it is not packaged, you need to install it manually.
You can find it in the contrib/ subdirectory of the Speakup sources.
-The filename is espeakup-$VERSION.tar.bz2, where $VERSION
+The filename is espeakup-$VERSION.tar.bz2, where $VERSION
depends on the current release of Espeakup. The Speakup 3.1.2 source
ships with version 0.71 of Espeakup.
The README file included with the Espeakup sources describes the process
@@ -660,7 +660,7 @@ daemons are started by the bootup scripts.
These procedures are not described in this document.
If you built Espeakup manually, the "make install" step placed the binary
-under /usr/bin.
+under /usr/bin.
Run the following command as root:
/usr/bin/espeakup
Espeakup should start speaking.
@@ -684,7 +684,7 @@ distribution may also have a precompiled Speech Dispatcher package.
Once you've installed, configured, and tested Speech Dispatcher with your
chosen software synthesizer, you still need one more piece of software
-in order to make things work. You need a package called speechd-up.
+in order to make things work. You need a package called speechd-up.
You get it from the free(b)soft web site mentioned above. After you've
compiled and installed speechd-up, you are almost ready to begin using
your software synthesizer.
@@ -813,7 +813,7 @@ press the keypad slash key once. Speakup will say, "mark". Next,
position the reading cursor on the rightmost character of the above
url. Press the keypad slash key once again to actually cut the text
from the screen. Speakup will say, "cut". Although we call this
-cutting, Speakup does not actually delete the cut text from the screen.
+cutting, Speakup does not actually delete the cut text from the screen.
It makes a copy of the text in a special buffer for later pasting.
Now that you have the url cut from the screen, you can paste it into
@@ -960,7 +960,7 @@ you reboot, or until you load another keymap.
One final warning. If you try to load a partial map, you will quickly
find that all the mappings you didn't include in your file got deleted
-from the working map. Be extremely careful, and always make a backup!
+from the working map. Be extremely careful, and always make a backup!
You have been warned!
14. Internationalizing Speakup
diff --git a/drivers/staging/speakup/synth.c b/drivers/staging/speakup/synth.c
index 172cf62b1aaf..f3aa4239dc68 100644
--- a/drivers/staging/speakup/synth.c
+++ b/drivers/staging/speakup/synth.c
@@ -122,7 +122,7 @@ void spk_do_catch_up(struct spk_synth *synth)
schedule_timeout(msecs_to_jiffies(full_time_val));
continue;
}
- if ((jiffies >= jiff_max) && (ch == SPACE)) {
+ if (time_after_eq(jiffies, jiff_max) && (ch == SPACE)) {
spin_lock_irqsave(&speakup_info.spinlock, flags);
jiffy_delta_val = jiffy_delta->u.n.value;
delay_time_val = delay_time->u.n.value;
@@ -148,6 +148,7 @@ EXPORT_SYMBOL_GPL(spk_do_catch_up);
const char *spk_synth_immediate(struct spk_synth *synth, const char *buff)
{
u_char ch;
+
while ((ch = *buff)) {
if (ch == '\n')
ch = synth->procspeech;
@@ -259,6 +260,7 @@ static int sentence_count;
void spk_reset_index_count(int sc)
{
static int first = 1;
+
if (first)
first = 0;
else
@@ -277,6 +279,7 @@ int synth_supports_indexing(void)
void synth_insert_next_index(int sent_num)
{
int out;
+
if (synth->alive) {
if (sent_num == 0) {
synth->indexing.currindex++;
@@ -295,6 +298,7 @@ void synth_insert_next_index(int sent_num)
void spk_get_index_count(int *linecount, int *sentcount)
{
int ind = synth->get_index();
+
if (ind) {
sentence_count = ind % 10;
@@ -315,6 +319,7 @@ static struct resource synth_res;
int synth_request_region(unsigned long start, unsigned long n)
{
struct resource *parent = &ioport_resource;
+
memset(&synth_res, 0, sizeof(synth_res));
synth_res.name = synth->name;
synth_res.start = start;
@@ -437,6 +442,7 @@ int synth_add(struct spk_synth *in_synth)
{
int i;
int status = 0;
+
mutex_lock(&spk_mutex);
for (i = 0; i < MAXSYNTHS && synths[i] != NULL; i++)
/* synth_remove() is responsible for rotating the array down */
@@ -461,6 +467,7 @@ EXPORT_SYMBOL_GPL(synth_add);
void synth_remove(struct spk_synth *in_synth)
{
int i;
+
mutex_lock(&spk_mutex);
if (synth == in_synth)
synth_release();
diff --git a/drivers/staging/speakup/thread.c b/drivers/staging/speakup/thread.c
index 4397c8e898c7..d95efb702fe4 100644
--- a/drivers/staging/speakup/thread.c
+++ b/drivers/staging/speakup/thread.c
@@ -21,6 +21,7 @@ int speakup_thread(void *data)
mutex_lock(&spk_mutex);
while (1) {
DEFINE_WAIT(wait);
+
while (1) {
spin_lock_irqsave(&speakup_info.spinlock, flags);
our_sound = spk_unprocessed_sound;
diff --git a/drivers/staging/speakup/varhandlers.c b/drivers/staging/speakup/varhandlers.c
index 445a3fda380e..1b0d1c08741f 100644
--- a/drivers/staging/speakup/varhandlers.c
+++ b/drivers/staging/speakup/varhandlers.c
@@ -112,12 +112,12 @@ void speakup_register_var(struct var_t *var)
default:
break;
}
- return;
}
void speakup_unregister_var(enum var_id_t var_id)
{
struct st_var_header *p_header;
+
BUG_ON(var_id < 0 || var_id >= MAXVARS);
p_header = var_ptrs[var_id];
p_header->data = NULL;
@@ -126,6 +126,7 @@ void speakup_unregister_var(enum var_id_t var_id)
struct st_var_header *spk_get_var_header(enum var_id_t var_id)
{
struct st_var_header *p_header;
+
if (var_id < 0 || var_id >= MAXVARS)
return NULL;
p_header = var_ptrs[var_id];
@@ -224,6 +225,7 @@ int spk_set_num_var(int input, struct st_var_header *var, int how)
return ret;
if (synth->synth_adjust != NULL) {
int status = synth->synth_adjust(var);
+
return (status != 0) ? status : ret;
}
if (!var_data->u.n.synth_fmt)
@@ -272,6 +274,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) {
for (cp = (u_char *)spk_punc_info[3].value; *cp; cp++)
spk_chartab[*cp] &= ~mask;
@@ -308,6 +311,7 @@ int spk_set_mask_bits(const char *input, const int which, const int how)
char *spk_strlwr(char *s)
{
char *p;
+
if (s == NULL)
return NULL;
@@ -319,6 +323,7 @@ char *spk_strlwr(char *s)
char *spk_s2uchar(char *start, char *dest)
{
int val = 0;
+
val = simple_strtoul(skip_spaces(start), &start, 10);
if (*start == ',')
start++;