Commit 8e69a811 authored by Domagoj Trsan's avatar Domagoj Trsan Committed by Greg Kroah-Hartman

staging: speakup: fix missing blank lines after declarations

Signed-off-by: default avatarDomagoj Trsan <domagoj.trsan@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent e4873523
...@@ -64,6 +64,7 @@ static void build_key_data(void) ...@@ -64,6 +64,7 @@ static void build_key_data(void)
u_char *kp, counters[MAXFUNCS], ch, ch1; u_char *kp, counters[MAXFUNCS], ch, ch1;
u_short *p_key = key_data, key; u_short *p_key = key_data, key;
int i, offset = 1; int i, offset = 1;
nstates = (int)(state_tbl[-1]); nstates = (int)(state_tbl[-1]);
memset(counters, 0, sizeof(counters)); memset(counters, 0, sizeof(counters));
memset(key_offsets, 0, sizeof(key_offsets)); memset(key_offsets, 0, sizeof(key_offsets));
...@@ -112,6 +113,7 @@ static void build_key_data(void) ...@@ -112,6 +113,7 @@ static void build_key_data(void)
static void say_key(int key) static void say_key(int key)
{ {
int i, state = key >> 8; int i, state = key >> 8;
key &= 0xff; key &= 0xff;
for (i = 0; i < 6; i++) { for (i = 0; i < 6; i++) {
if (state & masks[i]) if (state & masks[i])
...@@ -131,6 +133,7 @@ static int help_init(void) ...@@ -131,6 +133,7 @@ static int help_init(void)
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++) { for (i = 0; i < num_funcs; i++) {
char *cur_funcname = spk_msg_get(MSG_FUNCNAMES_START + i); char *cur_funcname = spk_msg_get(MSG_FUNCNAMES_START + i);
if (start == *cur_funcname) if (start == *cur_funcname)
continue; continue;
start = *cur_funcname; start = *cur_funcname;
...@@ -145,6 +148,7 @@ int spk_handle_help(struct vc_data *vc, u_char type, u_char ch, u_short key) ...@@ -145,6 +148,7 @@ int spk_handle_help(struct vc_data *vc, u_char type, u_char ch, u_short key)
char *name; char *name;
u_char func, *kp; u_char func, *kp;
u_short *p_keys, val; u_short *p_keys, val;
if (letter_offsets[0] == -1) if (letter_offsets[0] == -1)
help_init(); help_init();
if (type == KT_LATIN) { if (type == KT_LATIN) {
......
...@@ -232,6 +232,7 @@ static ssize_t keymap_show(struct kobject *kobj, struct kobj_attribute *attr, ...@@ -232,6 +232,7 @@ static ssize_t keymap_show(struct kobject *kobj, struct kobj_attribute *attr,
u_char *cp1; u_char *cp1;
u_char ch; u_char ch;
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&speakup_info.spinlock, flags); spin_lock_irqsave(&speakup_info.spinlock, flags);
cp1 = spk_key_buf + SHIFT_TBL_SIZE; cp1 = spk_key_buf + SHIFT_TBL_SIZE;
num_keys = (int)(*cp1); num_keys = (int)(*cp1);
......
...@@ -283,6 +283,7 @@ static void bleep(u_short val) ...@@ -283,6 +283,7 @@ static void bleep(u_short val)
}; };
short freq; short freq;
int time = spk_bleep_time; int time = spk_bleep_time;
freq = vals[val % 12]; freq = vals[val % 12];
if (val > 11) if (val > 11)
freq *= (1 << (val / 12)); freq *= (1 << (val / 12));
...@@ -306,6 +307,7 @@ static void speakup_shut_up(struct vc_data *vc) ...@@ -306,6 +307,7 @@ static void speakup_shut_up(struct vc_data *vc)
static void speech_kill(struct vc_data *vc) static void speech_kill(struct vc_data *vc)
{ {
char val = synth->is_alive(synth); char val = synth->is_alive(synth);
if (val == 0) if (val == 0)
return; return;
...@@ -394,6 +396,7 @@ static void say_attributes(struct vc_data *vc) ...@@ -394,6 +396,7 @@ static void say_attributes(struct vc_data *vc)
{ {
int fg = spk_attr & 0x0f; int fg = spk_attr & 0x0f;
int bg = spk_attr >> 4; int bg = spk_attr >> 4;
if (fg > 8) { if (fg > 8) {
synth_printf("%s ", spk_msg_get(MSG_BRIGHT)); synth_printf("%s ", spk_msg_get(MSG_BRIGHT));
fg -= 8; fg -= 8;
...@@ -427,6 +430,7 @@ static void speak_char(u_char ch) ...@@ -427,6 +430,7 @@ static void speak_char(u_char ch)
{ {
char *cp = spk_characters[ch]; char *cp = spk_characters[ch];
struct var_t *direct = spk_get_var(DIRECT); struct var_t *direct = spk_get_var(DIRECT);
if (direct && direct->u.n.value) { if (direct && direct->u.n.value) {
if (IS_CHAR(ch, B_CAP)) { if (IS_CHAR(ch, B_CAP)) {
spk_pitch_shift++; spk_pitch_shift++;
...@@ -460,6 +464,7 @@ static void speak_char(u_char ch) ...@@ -460,6 +464,7 @@ static void speak_char(u_char ch)
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 = ' '; u16 ch = ' ';
if (vc && pos) { if (vc && pos) {
u16 w = scr_readw(pos); u16 w = scr_readw(pos);
u16 c = w & 0xff; u16 c = w & 0xff;
...@@ -476,6 +481,7 @@ static u16 get_char(struct vc_data *vc, u16 *pos, u_char *attribs) ...@@ -476,6 +481,7 @@ static u16 get_char(struct vc_data *vc, u16 *pos, u_char *attribs)
static void say_char(struct vc_data *vc) static void say_char(struct vc_data *vc)
{ {
u_short ch; u_short ch;
spk_old_attr = spk_attr; spk_old_attr = spk_attr;
ch = get_char(vc, (u_short *) spk_pos, &spk_attr); ch = get_char(vc, (u_short *) spk_pos, &spk_attr);
if (spk_attr != spk_old_attr) { if (spk_attr != spk_old_attr) {
...@@ -490,6 +496,7 @@ static void say_char(struct vc_data *vc) ...@@ -490,6 +496,7 @@ static void say_char(struct vc_data *vc)
static void say_phonetic_char(struct vc_data *vc) static void say_phonetic_char(struct vc_data *vc)
{ {
u_short ch; u_short ch;
spk_old_attr = spk_attr; spk_old_attr = spk_attr;
ch = get_char(vc, (u_short *) spk_pos, &spk_attr); ch = get_char(vc, (u_short *) spk_pos, &spk_attr);
if (isascii(ch) && isalpha(ch)) { if (isascii(ch) && isalpha(ch)) {
...@@ -540,6 +547,7 @@ static u_long get_word(struct vc_data *vc) ...@@ -540,6 +547,7 @@ static u_long get_word(struct vc_data *vc)
char ch; char ch;
u_short attr_ch; u_short attr_ch;
u_char temp; u_char temp;
spk_old_attr = spk_attr; spk_old_attr = spk_attr;
ch = (char)get_char(vc, (u_short *) tmp_pos, &temp); ch = (char)get_char(vc, (u_short *) tmp_pos, &temp);
...@@ -583,6 +591,7 @@ static void say_word(struct vc_data *vc) ...@@ -583,6 +591,7 @@ static void say_word(struct vc_data *vc)
{ {
u_long cnt = get_word(vc); u_long cnt = get_word(vc);
u_short saved_punc_mask = spk_punc_mask; u_short saved_punc_mask = spk_punc_mask;
if (cnt == 0) if (cnt == 0)
return; return;
spk_punc_mask = PUNC; spk_punc_mask = PUNC;
...@@ -596,6 +605,7 @@ static void say_prev_word(struct vc_data *vc) ...@@ -596,6 +605,7 @@ static void say_prev_word(struct vc_data *vc)
u_char temp; u_char temp;
char ch; char ch;
u_short edge_said = 0, last_state = 0, state = 0; u_short edge_said = 0, last_state = 0, state = 0;
spk_parked |= 0x01; spk_parked |= 0x01;
if (spk_x == 0) { if (spk_x == 0) {
...@@ -648,8 +658,8 @@ static void say_next_word(struct vc_data *vc) ...@@ -648,8 +658,8 @@ static void say_next_word(struct vc_data *vc)
u_char temp; u_char temp;
char ch; char ch;
u_short edge_said = 0, last_state = 2, state = 0; 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) { if (spk_x == vc->vc_cols - 1 && spk_y == vc->vc_rows - 1) {
announce_edge(vc, edge_bottom); announce_edge(vc, edge_bottom);
return; return;
...@@ -689,6 +699,7 @@ static void spell_word(struct vc_data *vc) ...@@ -689,6 +699,7 @@ static void spell_word(struct vc_data *vc)
char *cp = buf, *str_cap = spk_str_caps_stop; char *cp = buf, *str_cap = spk_str_caps_stop;
char *cp1, *last_cap = spk_str_caps_stop; char *cp1, *last_cap = spk_str_caps_stop;
u_char ch; u_char ch;
if (!get_word(vc)) if (!get_word(vc))
return; return;
while ((ch = (u_char) *cp)) { while ((ch = (u_char) *cp)) {
...@@ -747,6 +758,7 @@ static void say_line(struct vc_data *vc) ...@@ -747,6 +758,7 @@ static void say_line(struct vc_data *vc)
int i = get_line(vc); int i = get_line(vc);
char *cp; char *cp;
u_short saved_punc_mask = spk_punc_mask; u_short saved_punc_mask = spk_punc_mask;
if (i == 0) { if (i == 0) {
synth_printf("%s\n", spk_msg_get(MSG_BLANK)); synth_printf("%s\n", spk_msg_get(MSG_BLANK));
return; return;
...@@ -793,6 +805,7 @@ static int say_from_to(struct vc_data *vc, u_long from, u_long to, ...@@ -793,6 +805,7 @@ static int say_from_to(struct vc_data *vc, u_long from, u_long to,
int i = 0; int i = 0;
u_char tmp; u_char tmp;
u_short saved_punc_mask = spk_punc_mask; u_short saved_punc_mask = spk_punc_mask;
spk_old_attr = spk_attr; spk_old_attr = spk_attr;
spk_attr = get_attributes((u_short *) from); spk_attr = get_attributes((u_short *) from);
while (from < to) { while (from < to) {
...@@ -821,6 +834,7 @@ static void say_line_from_to(struct vc_data *vc, u_long from, u_long to, ...@@ -821,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 start = vc->vc_origin + (spk_y * vc->vc_size_row);
u_long end = start + (to * 2); u_long end = start + (to * 2);
start += from * 2; start += from * 2;
if (say_from_to(vc, start, end, read_punc) <= 0) if (say_from_to(vc, start, end, read_punc) <= 0)
if (cursor_track != read_all_mode) if (cursor_track != read_all_mode)
...@@ -904,6 +918,7 @@ static int get_sentence_buf(struct vc_data *vc, int read_punc) ...@@ -904,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) static void say_screen_from_to(struct vc_data *vc, u_long from, u_long to)
{ {
u_long start = vc->vc_origin, end; u_long start = vc->vc_origin, end;
if (from > 0) if (from > 0)
start += from * vc->vc_size_row; start += from * vc->vc_size_row;
if (to > vc->vc_rows) if (to > vc->vc_rows)
...@@ -923,6 +938,7 @@ static void say_screen(struct vc_data *vc) ...@@ -923,6 +938,7 @@ static void say_screen(struct vc_data *vc)
static void speakup_win_say(struct vc_data *vc) static void speakup_win_say(struct vc_data *vc)
{ {
u_long start, end, from, to; u_long start, end, from, to;
if (win_start < 2) { if (win_start < 2) {
synth_printf("%s\n", spk_msg_get(MSG_NO_WINDOW)); synth_printf("%s\n", spk_msg_get(MSG_NO_WINDOW));
return; return;
...@@ -973,6 +989,7 @@ static void say_first_char(struct vc_data *vc) ...@@ -973,6 +989,7 @@ static void say_first_char(struct vc_data *vc)
{ {
int i, len = get_line(vc); int i, len = get_line(vc);
u_char ch; u_char ch;
spk_parked |= 0x01; spk_parked |= 0x01;
if (len == 0) { if (len == 0) {
synth_printf("%s\n", spk_msg_get(MSG_BLANK)); synth_printf("%s\n", spk_msg_get(MSG_BLANK));
...@@ -992,6 +1009,7 @@ static void say_last_char(struct vc_data *vc) ...@@ -992,6 +1009,7 @@ static void say_last_char(struct vc_data *vc)
{ {
int len = get_line(vc); int len = get_line(vc);
u_char ch; u_char ch;
spk_parked |= 0x01; spk_parked |= 0x01;
if (len == 0) { if (len == 0) {
synth_printf("%s\n", spk_msg_get(MSG_BLANK)); synth_printf("%s\n", spk_msg_get(MSG_BLANK));
...@@ -1016,6 +1034,7 @@ static void say_char_num(struct vc_data *vc) ...@@ -1016,6 +1034,7 @@ static void say_char_num(struct vc_data *vc)
{ {
u_char tmp; u_char tmp;
u_short ch = get_char(vc, (u_short *) spk_pos, &tmp); u_short ch = get_char(vc, (u_short *) spk_pos, &tmp);
ch &= 0xff; ch &= 0xff;
synth_printf(spk_msg_get(MSG_CHAR_INFO), ch, ch); synth_printf(spk_msg_get(MSG_CHAR_INFO), ch, ch);
} }
...@@ -1050,6 +1069,7 @@ static void spkup_write(const char *in_buf, int count) ...@@ -1050,6 +1069,7 @@ static void spkup_write(const char *in_buf, int count)
static u_char ch = '\0', old_ch = '\0'; static u_char ch = '\0', old_ch = '\0';
static u_short char_type, last_type; static u_short char_type, last_type;
int in_count = count; int in_count = count;
spk_keydown = 0; spk_keydown = 0;
while (count--) { while (count--) {
if (cursor_track == read_all_mode) { if (cursor_track == read_all_mode) {
...@@ -1127,6 +1147,7 @@ static DEFINE_TIMER(cursor_timer, cursor_done, 0, 0); ...@@ -1127,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) static void do_handle_shift(struct vc_data *vc, u_char value, char up_flag)
{ {
unsigned long flags; unsigned long flags;
if (synth == NULL || up_flag || spk_killed) if (synth == NULL || up_flag || spk_killed)
return; return;
spin_lock_irqsave(&speakup_info.spinlock, flags); spin_lock_irqsave(&speakup_info.spinlock, flags);
...@@ -1157,6 +1178,7 @@ static void do_handle_shift(struct vc_data *vc, u_char value, char up_flag) ...@@ -1157,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) static void do_handle_latin(struct vc_data *vc, u_char value, char up_flag)
{ {
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&speakup_info.spinlock, flags); spin_lock_irqsave(&speakup_info.spinlock, flags);
if (up_flag) { if (up_flag) {
spk_lastkey = spk_keydown = 0; spk_lastkey = spk_keydown = 0;
...@@ -1182,6 +1204,7 @@ int spk_set_key_info(const u_char *key_info, u_char *k_buffer) ...@@ -1182,6 +1204,7 @@ int spk_set_key_info(const u_char *key_info, u_char *k_buffer)
const u_char *cp = key_info; const u_char *cp = key_info;
u_char *cp1 = k_buffer; u_char *cp1 = k_buffer;
u_char ch, version, num_keys; u_char ch, version, num_keys;
version = *cp++; version = *cp++;
if (version != KEY_MAP_VER) if (version != KEY_MAP_VER)
return -1; return -1;
...@@ -1264,6 +1287,7 @@ static const struct st_bits_data *pb_edit; ...@@ -1264,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) 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]; short mask = pb_edit->mask, ch_type = spk_chartab[ch];
if (type != KT_LATIN || (ch_type & B_NUM) || ch < SPACE) if (type != KT_LATIN || (ch_type & B_NUM) || ch < SPACE)
return -1; return -1;
if (ch == SPACE) { if (ch == SPACE) {
...@@ -1449,6 +1473,7 @@ static void handle_cursor_read_all(struct vc_data *vc, int command) ...@@ -1449,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) static int pre_handle_cursor(struct vc_data *vc, u_char value, char up_flag)
{ {
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&speakup_info.spinlock, flags); spin_lock_irqsave(&speakup_info.spinlock, flags);
if (cursor_track == read_all_mode) { if (cursor_track == read_all_mode) {
spk_parked &= 0xfe; spk_parked &= 0xfe;
...@@ -1532,6 +1557,7 @@ static void reset_highlight_buffers(struct vc_data *vc) ...@@ -1532,6 +1557,7 @@ static void reset_highlight_buffers(struct vc_data *vc)
{ {
int i; int i;
int vc_num = vc->vc_num; int vc_num = vc->vc_num;
for (i = 0; i < 8; i++) for (i = 0; i < 8; i++)
speakup_console[vc_num]->ht.highsize[i] = 0; speakup_console[vc_num]->ht.highsize[i] = 0;
} }
...@@ -1550,6 +1576,7 @@ static int count_highlight_color(struct vc_data *vc) ...@@ -1550,6 +1576,7 @@ static int count_highlight_color(struct vc_data *vc)
for (i = 0; i < vc->vc_rows; i++) { for (i = 0; i < vc->vc_rows; i++) {
u16 *end = start + vc->vc_cols * 2; u16 *end = start + vc->vc_cols * 2;
u16 *ptr; u16 *ptr;
for (ptr = start; ptr < end; ptr++) { for (ptr = start; ptr < end; ptr++) {
ch = get_attributes(ptr); ch = get_attributes(ptr);
bg = (ch & 0x70) >> 4; bg = (ch & 0x70) >> 4;
...@@ -1594,6 +1621,7 @@ static int speak_highlight(struct vc_data *vc) ...@@ -1594,6 +1621,7 @@ static int speak_highlight(struct vc_data *vc)
{ {
int hc, d; int hc, d;
int vc_num = vc->vc_num; int vc_num = vc->vc_num;
if (count_highlight_color(vc) == 1) if (count_highlight_color(vc) == 1)
return 0; return 0;
hc = get_highlight_color(vc); hc = get_highlight_color(vc);
...@@ -1618,6 +1646,7 @@ static void cursor_done(u_long data) ...@@ -1618,6 +1646,7 @@ static void cursor_done(u_long data)
{ {
struct vc_data *vc = vc_cons[cursor_con].d; struct vc_data *vc = vc_cons[cursor_con].d;
unsigned long flags; unsigned long flags;
del_timer(&cursor_timer); del_timer(&cursor_timer);
spin_lock_irqsave(&speakup_info.spinlock, flags); spin_lock_irqsave(&speakup_info.spinlock, flags);
if (cursor_con != fg_console) { if (cursor_con != fg_console) {
...@@ -1657,6 +1686,7 @@ static void cursor_done(u_long data) ...@@ -1657,6 +1686,7 @@ static void cursor_done(u_long data)
static void speakup_bs(struct vc_data *vc) static void speakup_bs(struct vc_data *vc)
{ {
unsigned long flags; unsigned long flags;
if (!speakup_console[vc->vc_num]) if (!speakup_console[vc->vc_num])
return; return;
if (!spin_trylock_irqsave(&speakup_info.spinlock, flags)) if (!spin_trylock_irqsave(&speakup_info.spinlock, flags))
...@@ -1680,6 +1710,7 @@ static void speakup_bs(struct vc_data *vc) ...@@ -1680,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) static void speakup_con_write(struct vc_data *vc, const char *str, int len)
{ {
unsigned long flags; unsigned long flags;
if ((vc->vc_num != fg_console) || spk_shut_up || synth == NULL) if ((vc->vc_num != fg_console) || spk_shut_up || synth == NULL)
return; return;
if (!spin_trylock_irqsave(&speakup_info.spinlock, flags)) if (!spin_trylock_irqsave(&speakup_info.spinlock, flags))
...@@ -1708,6 +1739,7 @@ static void speakup_con_write(struct vc_data *vc, const char *str, int len) ...@@ -1708,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) static void speakup_con_update(struct vc_data *vc)
{ {
unsigned long flags; unsigned long flags;
if (speakup_console[vc->vc_num] == NULL || spk_parked) if (speakup_console[vc->vc_num] == NULL || spk_parked)
return; return;
if (!spin_trylock_irqsave(&speakup_info.spinlock, flags)) if (!spin_trylock_irqsave(&speakup_info.spinlock, flags))
...@@ -1722,6 +1754,7 @@ static void do_handle_spec(struct vc_data *vc, u_char value, char up_flag) ...@@ -1722,6 +1754,7 @@ static void do_handle_spec(struct vc_data *vc, u_char value, char up_flag)
unsigned long flags; unsigned long flags;
int on_off = 2; int on_off = 2;
char *label; char *label;
if (synth == NULL || up_flag || spk_killed) if (synth == NULL || up_flag || spk_killed)
return; return;
spin_lock_irqsave(&speakup_info.spinlock, flags); spin_lock_irqsave(&speakup_info.spinlock, flags);
...@@ -1763,6 +1796,7 @@ static int inc_dec_var(u_char value) ...@@ -1763,6 +1796,7 @@ static int inc_dec_var(u_char value)
char *pn; char *pn;
int var_id = (int)value - VAR_START; int var_id = (int)value - VAR_START;
int how = (var_id & 1) ? E_INC : E_DEC; int how = (var_id & 1) ? E_INC : E_DEC;
var_id = var_id / 2 + FIRST_SET_VAR; var_id = var_id / 2 + FIRST_SET_VAR;
p_header = spk_get_var_header(var_id); p_header = spk_get_var_header(var_id);
if (p_header == NULL) if (p_header == NULL)
...@@ -1789,6 +1823,7 @@ static int inc_dec_var(u_char value) ...@@ -1789,6 +1823,7 @@ static int inc_dec_var(u_char value)
static void speakup_win_set(struct vc_data *vc) static void speakup_win_set(struct vc_data *vc)
{ {
char info[40]; char info[40];
if (win_start > 1) { if (win_start > 1) {
synth_printf("%s\n", spk_msg_get(MSG_WINDOW_ALREADY_SET)); synth_printf("%s\n", spk_msg_get(MSG_WINDOW_ALREADY_SET));
return; return;
...@@ -1843,6 +1878,7 @@ static void speakup_win_enable(struct vc_data *vc) ...@@ -1843,6 +1878,7 @@ static void speakup_win_enable(struct vc_data *vc)
static void speakup_bits(struct vc_data *vc) static void speakup_bits(struct vc_data *vc)
{ {
int val = this_speakup_key - (FIRST_EDIT_BITS - 1); int val = this_speakup_key - (FIRST_EDIT_BITS - 1);
if (spk_special_handler != NULL || val < 1 || val > 6) { if (spk_special_handler != NULL || val < 1 || val > 6) {
synth_printf("%s\n", spk_msg_get(MSG_ERROR)); synth_printf("%s\n", spk_msg_get(MSG_ERROR));
return; return;
...@@ -2011,6 +2047,7 @@ speakup_key(struct vc_data *vc, int shift_state, int keycode, u_short keysym, ...@@ -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 type = KTYP(keysym), value = KVAL(keysym), new_key = 0;
u_char shift_info, offset; u_char shift_info, offset;
int ret = 0; int ret = 0;
if (synth == NULL) if (synth == NULL)
return 0; return 0;
...@@ -2161,6 +2198,7 @@ static int keyboard_notifier_call(struct notifier_block *nb, ...@@ -2161,6 +2198,7 @@ static int keyboard_notifier_call(struct notifier_block *nb,
case KBD_POST_KEYSYM:{ case KBD_POST_KEYSYM:{
unsigned char type = KTYP(param->value) - 0xf0; unsigned char type = KTYP(param->value) - 0xf0;
unsigned char val = KVAL(param->value); unsigned char val = KVAL(param->value);
switch (type) { switch (type) {
case KT_SHIFT: case KT_SHIFT:
do_handle_shift(vc, val, up); do_handle_shift(vc, val, up);
...@@ -2187,6 +2225,7 @@ static int vt_notifier_call(struct notifier_block *nb, ...@@ -2187,6 +2225,7 @@ static int vt_notifier_call(struct notifier_block *nb,
{ {
struct vt_notifier_param *param = _param; struct vt_notifier_param *param = _param;
struct vc_data *vc = param->vc; struct vc_data *vc = param->vc;
switch (code) { switch (code) {
case VT_ALLOCATE: case VT_ALLOCATE:
if (vc->vc_mode == KD_TEXT) if (vc->vc_mode == KD_TEXT)
......
...@@ -83,6 +83,7 @@ static irqreturn_t synth_readbuf_handler(int irq, void *dev_id) ...@@ -83,6 +83,7 @@ static irqreturn_t synth_readbuf_handler(int irq, void *dev_id)
/*printk(KERN_ERR "in irq\n"); */ /*printk(KERN_ERR "in irq\n"); */
/*pr_warn("in IRQ\n"); */ /*pr_warn("in IRQ\n"); */
int c; int c;
spin_lock_irqsave(&speakup_info.spinlock, flags); spin_lock_irqsave(&speakup_info.spinlock, flags);
while (inb_p(speakup_info.port_tts + UART_LSR) & UART_LSR_DR) { while (inb_p(speakup_info.port_tts + UART_LSR) & UART_LSR_DR) {
...@@ -137,6 +138,7 @@ void spk_stop_serial_interrupt(void) ...@@ -137,6 +138,7 @@ void spk_stop_serial_interrupt(void)
int spk_wait_for_xmitr(void) int spk_wait_for_xmitr(void)
{ {
int tmout = SPK_XMITR_TIMEOUT; int tmout = SPK_XMITR_TIMEOUT;
if ((synth->alive) && (timeouts >= NUM_DISABLE_TIMEOUTS)) { if ((synth->alive) && (timeouts >= NUM_DISABLE_TIMEOUTS)) {
pr_warn("%s: too many timeouts, deactivating speakup\n", pr_warn("%s: too many timeouts, deactivating speakup\n",
synth->long_name); synth->long_name);
......
...@@ -152,8 +152,10 @@ static inline bool synth_full(void) ...@@ -152,8 +152,10 @@ static inline bool synth_full(void)
static const char *synth_immediate(struct spk_synth *synth, const char *buf) static const char *synth_immediate(struct spk_synth *synth, const char *buf)
{ {
u_char ch; u_char ch;
while ((ch = *buf)) { while ((ch = *buf)) {
int timeout = SPK_XMITR_TIMEOUT; int timeout = SPK_XMITR_TIMEOUT;
if (ch == '\n') if (ch == '\n')
ch = PROCSPEECH; ch = PROCSPEECH;
if (synth_full()) if (synth_full())
...@@ -257,6 +259,7 @@ static int synth_probe(struct spk_synth *synth) ...@@ -257,6 +259,7 @@ static int synth_probe(struct spk_synth *synth)
{ {
unsigned int port_val = 0; unsigned int port_val = 0;
int i = 0; int i = 0;
pr_info("Probing for %s.\n", synth->long_name); pr_info("Probing for %s.\n", synth->long_name);
if (port_forced) { if (port_forced) {
speakup_info.port_tts = port_forced; speakup_info.port_tts = port_forced;
......
...@@ -132,6 +132,7 @@ static struct spk_synth synth_audptr = { ...@@ -132,6 +132,7 @@ static struct spk_synth synth_audptr = {
static void synth_flush(struct spk_synth *synth) static void synth_flush(struct spk_synth *synth)
{ {
int timeout = SPK_XMITR_TIMEOUT; int timeout = SPK_XMITR_TIMEOUT;
while (spk_serial_tx_busy()) { while (spk_serial_tx_busy()) {
if (!--timeout) if (!--timeout)
break; break;
...@@ -145,6 +146,7 @@ static void synth_version(struct spk_synth *synth) ...@@ -145,6 +146,7 @@ static void synth_version(struct spk_synth *synth)
{ {
unsigned char test = 0; unsigned char test = 0;
char synth_id[40] = ""; char synth_id[40] = "";
spk_synth_immediate(synth, "\x05[Q]"); spk_synth_immediate(synth, "\x05[Q]");
synth_id[test] = spk_serial_in(); synth_id[test] = spk_serial_in();
if (synth_id[test] == 'A') { if (synth_id[test] == 'A') {
......
...@@ -39,6 +39,7 @@ static unsigned char last_char; ...@@ -39,6 +39,7 @@ static unsigned char last_char;
static inline u_char get_last_char(void) static inline u_char get_last_char(void)
{ {
u_char avail = inb_p(speakup_info.port_tts + UART_LSR) & UART_LSR_DR; u_char avail = inb_p(speakup_info.port_tts + UART_LSR) & UART_LSR_DR;
if (avail) if (avail)
last_char = inb_p(speakup_info.port_tts + UART_RX); last_char = inb_p(speakup_info.port_tts + UART_RX);
return last_char; return last_char;
......
...@@ -260,6 +260,7 @@ static void dt_sendcmd(u_int cmd) ...@@ -260,6 +260,7 @@ static void dt_sendcmd(u_int cmd)
static int dt_waitbit(int bit) static int dt_waitbit(int bit)
{ {
int timeout = 100; int timeout = 100;
while (--timeout > 0) { while (--timeout > 0) {
if ((dt_getstatus() & bit) == bit) if ((dt_getstatus() & bit) == bit)
return 1; return 1;
...@@ -271,6 +272,7 @@ static int dt_waitbit(int bit) ...@@ -271,6 +272,7 @@ static int dt_waitbit(int bit)
static int dt_wait_dma(void) static int dt_wait_dma(void)
{ {
int timeout = 100, state = dma_state; int timeout = 100, state = dma_state;
if (!dt_waitbit(STAT_dma_ready)) if (!dt_waitbit(STAT_dma_ready))
return 0; return 0;
while (--timeout > 0) { while (--timeout > 0) {
...@@ -285,6 +287,7 @@ static int dt_wait_dma(void) ...@@ -285,6 +287,7 @@ static int dt_wait_dma(void)
static int dt_ctrl(u_int cmd) static int dt_ctrl(u_int cmd)
{ {
int timeout = 10; int timeout = 10;
if (!dt_waitbit(STAT_cmd_ready)) if (!dt_waitbit(STAT_cmd_ready))
return -1; return -1;
outb_p(0, speakup_info.port_tts+2); outb_p(0, speakup_info.port_tts+2);
...@@ -304,6 +307,7 @@ static int dt_ctrl(u_int cmd) ...@@ -304,6 +307,7 @@ static int dt_ctrl(u_int cmd)
static void synth_flush(struct spk_synth *synth) static void synth_flush(struct spk_synth *synth)
{ {
int timeout = 10; int timeout = 10;
if (is_flushing) if (is_flushing)
return; return;
is_flushing = 4; is_flushing = 4;
...@@ -346,6 +350,7 @@ static int dt_sendchar(char ch) ...@@ -346,6 +350,7 @@ static int dt_sendchar(char ch)
static int testkernel(void) static int testkernel(void)
{ {
int status = 0; int status = 0;
if (dt_getstatus() == 0xffff) { if (dt_getstatus() == 0xffff) {
status = -1; status = -1;
goto oops; goto oops;
...@@ -437,6 +442,7 @@ static void do_catch_up(struct spk_synth *synth) ...@@ -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) static const char *synth_immediate(struct spk_synth *synth, const char *buf)
{ {
u_char ch; u_char ch;
while ((ch = *buf)) { while ((ch = *buf)) {
if (ch == '\n') if (ch == '\n')
ch = PROCSPEECH; ch = PROCSPEECH;
...@@ -450,6 +456,7 @@ static const char *synth_immediate(struct spk_synth *synth, const char *buf) ...@@ -450,6 +456,7 @@ static const char *synth_immediate(struct spk_synth *synth, const char *buf)
static int synth_probe(struct spk_synth *synth) static int synth_probe(struct spk_synth *synth)
{ {
int i = 0, failed = 0; int i = 0, failed = 0;
pr_info("Probing for %s.\n", synth->long_name); pr_info("Probing for %s.\n", synth->long_name);
for (i = 0; synth_portlist[i]; i++) { for (i = 0; synth_portlist[i]; i++) {
if (synth_request_region(synth_portlist[i], SYNTH_IO_EXTENT)) { if (synth_request_region(synth_portlist[i], SYNTH_IO_EXTENT)) {
......
...@@ -169,6 +169,7 @@ static u_char lastind; ...@@ -169,6 +169,7 @@ static u_char lastind;
static unsigned char get_index(void) static unsigned char get_index(void)
{ {
u_char rv; u_char rv;
rv = lastind; rv = lastind;
lastind = 0; lastind = 0;
return rv; return rv;
...@@ -180,6 +181,7 @@ static void read_buff_add(u_char c) ...@@ -180,6 +181,7 @@ static void read_buff_add(u_char c)
if (c == 0x01) { if (c == 0x01) {
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&flush_lock, flags); spin_lock_irqsave(&flush_lock, flags);
is_flushing = 0; is_flushing = 0;
wake_up_interruptible(&flush); wake_up_interruptible(&flush);
......
...@@ -174,6 +174,7 @@ static inline bool synth_full(void) ...@@ -174,6 +174,7 @@ static inline bool synth_full(void)
static void spk_out(const char ch) static void spk_out(const char ch)
{ {
int timeout = SPK_XMITR_TIMEOUT; int timeout = SPK_XMITR_TIMEOUT;
while (!synth_writable()) { while (!synth_writable()) {
if (!--timeout) if (!--timeout)
break; break;
...@@ -246,6 +247,7 @@ static void do_catch_up(struct spk_synth *synth) ...@@ -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) static const char *synth_immediate(struct spk_synth *synth, const char *buf)
{ {
u_char ch; u_char ch;
while ((ch = (u_char)*buf)) { while ((ch = (u_char)*buf)) {
if (synth_full()) if (synth_full())
return buf; return buf;
...@@ -267,6 +269,7 @@ static void synth_flush(struct spk_synth *synth) ...@@ -267,6 +269,7 @@ static void synth_flush(struct spk_synth *synth)
static char synth_read_tts(void) static char synth_read_tts(void)
{ {
u_char ch; u_char ch;
while (!synth_readable()) while (!synth_readable())
cpu_relax(); cpu_relax();
ch = synth_status & 0x7f; ch = synth_status & 0x7f;
...@@ -283,6 +286,7 @@ static struct synth_settings *synth_interrogate(struct spk_synth *synth) ...@@ -283,6 +286,7 @@ static struct synth_settings *synth_interrogate(struct spk_synth *synth)
static char buf[sizeof(struct synth_settings) + 1]; static char buf[sizeof(struct synth_settings) + 1];
int total, i; int total, i;
static struct synth_settings status; static struct synth_settings status;
synth_immediate(synth, "\x18\x01?"); synth_immediate(synth, "\x18\x01?");
for (total = 0, i = 0; i < 50; i++) { for (total = 0, i = 0; i < 50; i++) {
buf[total] = synth_read_tts(); buf[total] = synth_read_tts();
...@@ -324,6 +328,7 @@ static int synth_probe(struct spk_synth *synth) ...@@ -324,6 +328,7 @@ static int synth_probe(struct spk_synth *synth)
unsigned int port_val = 0; unsigned int port_val = 0;
int i = 0; int i = 0;
struct synth_settings *sp; struct synth_settings *sp;
pr_info("Probing for DoubleTalk.\n"); pr_info("Probing for DoubleTalk.\n");
if (port_forced) { if (port_forced) {
speakup_info.port_tts = port_forced; speakup_info.port_tts = port_forced;
......
...@@ -143,6 +143,7 @@ static inline bool synth_full(void) ...@@ -143,6 +143,7 @@ static inline bool synth_full(void)
static char *oops(void) static char *oops(void)
{ {
int s1, s2, s3, s4; int s1, s2, s3, s4;
s1 = inb_p(synth_port); s1 = inb_p(synth_port);
s2 = inb_p(synth_port+1); s2 = inb_p(synth_port+1);
s3 = inb_p(synth_port+2); s3 = inb_p(synth_port+2);
...@@ -155,6 +156,7 @@ static const char *synth_immediate(struct spk_synth *synth, const char *buf) ...@@ -155,6 +156,7 @@ static const char *synth_immediate(struct spk_synth *synth, const char *buf)
{ {
u_char ch; u_char ch;
int timeout; int timeout;
while ((ch = *buf)) { while ((ch = *buf)) {
if (ch == '\n') if (ch == '\n')
ch = PROCSPEECH; ch = PROCSPEECH;
...@@ -264,6 +266,7 @@ static int synth_probe(struct spk_synth *synth) ...@@ -264,6 +266,7 @@ static int synth_probe(struct spk_synth *synth)
{ {
unsigned int port_val = 0; unsigned int port_val = 0;
int i = 0; int i = 0;
pr_info("Probing for %s.\n", synth->long_name); pr_info("Probing for %s.\n", synth->long_name);
if (port_forced) { if (port_forced) {
synth_port = port_forced; synth_port = port_forced;
......
...@@ -141,6 +141,7 @@ static void synth_interrogate(struct spk_synth *synth) ...@@ -141,6 +141,7 @@ static void synth_interrogate(struct spk_synth *synth)
{ {
unsigned char *t, i; unsigned char *t, i;
unsigned char buf[50], rom_v[20]; unsigned char buf[50], rom_v[20];
spk_synth_immediate(synth, "\x18\x01?"); spk_synth_immediate(synth, "\x18\x01?");
for (i = 0; i < 50; i++) { for (i = 0; i < 50; i++) {
buf[i] = spk_serial_in(); buf[i] = spk_serial_in();
......
...@@ -192,6 +192,7 @@ static int softsynth_open(struct inode *inode, struct file *fp) ...@@ -192,6 +192,7 @@ static int softsynth_open(struct inode *inode, struct file *fp)
static int softsynth_close(struct inode *inode, struct file *fp) static int softsynth_close(struct inode *inode, struct file *fp)
{ {
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&speakup_info.spinlock, flags); spin_lock_irqsave(&speakup_info.spinlock, flags);
synth_soft.alive = 0; synth_soft.alive = 0;
init_pos = 0; init_pos = 0;
...@@ -283,6 +284,7 @@ static unsigned int softsynth_poll(struct file *fp, ...@@ -283,6 +284,7 @@ static unsigned int softsynth_poll(struct file *fp,
{ {
unsigned long flags; unsigned long flags;
int ret = 0; int ret = 0;
poll_wait(fp, &speakup_event, wait); poll_wait(fp, &speakup_event, wait);
spin_lock_irqsave(&speakup_info.spinlock, flags); spin_lock_irqsave(&speakup_info.spinlock, flags);
...@@ -295,6 +297,7 @@ static unsigned int softsynth_poll(struct file *fp, ...@@ -295,6 +297,7 @@ static unsigned int softsynth_poll(struct file *fp,
static unsigned char get_index(void) static unsigned char get_index(void)
{ {
int rv; int rv;
rv = last_index; rv = last_index;
last_index = 0; last_index = 0;
return rv; return rv;
......
...@@ -131,6 +131,7 @@ static struct spk_synth synth_spkout = { ...@@ -131,6 +131,7 @@ static struct spk_synth synth_spkout = {
static void synth_flush(struct spk_synth *synth) static void synth_flush(struct spk_synth *synth)
{ {
int timeout = SPK_XMITR_TIMEOUT; int timeout = SPK_XMITR_TIMEOUT;
while (spk_serial_tx_busy()) { while (spk_serial_tx_busy()) {
if (!--timeout) if (!--timeout)
break; break;
......
...@@ -148,6 +148,7 @@ EXPORT_SYMBOL_GPL(spk_do_catch_up); ...@@ -148,6 +148,7 @@ EXPORT_SYMBOL_GPL(spk_do_catch_up);
const char *spk_synth_immediate(struct spk_synth *synth, const char *buff) const char *spk_synth_immediate(struct spk_synth *synth, const char *buff)
{ {
u_char ch; u_char ch;
while ((ch = *buff)) { while ((ch = *buff)) {
if (ch == '\n') if (ch == '\n')
ch = synth->procspeech; ch = synth->procspeech;
...@@ -259,6 +260,7 @@ static int sentence_count; ...@@ -259,6 +260,7 @@ static int sentence_count;
void spk_reset_index_count(int sc) void spk_reset_index_count(int sc)
{ {
static int first = 1; static int first = 1;
if (first) if (first)
first = 0; first = 0;
else else
...@@ -277,6 +279,7 @@ int synth_supports_indexing(void) ...@@ -277,6 +279,7 @@ int synth_supports_indexing(void)
void synth_insert_next_index(int sent_num) void synth_insert_next_index(int sent_num)
{ {
int out; int out;
if (synth->alive) { if (synth->alive) {
if (sent_num == 0) { if (sent_num == 0) {
synth->indexing.currindex++; synth->indexing.currindex++;
...@@ -295,6 +298,7 @@ void synth_insert_next_index(int sent_num) ...@@ -295,6 +298,7 @@ void synth_insert_next_index(int sent_num)
void spk_get_index_count(int *linecount, int *sentcount) void spk_get_index_count(int *linecount, int *sentcount)
{ {
int ind = synth->get_index(); int ind = synth->get_index();
if (ind) { if (ind) {
sentence_count = ind % 10; sentence_count = ind % 10;
...@@ -315,6 +319,7 @@ static struct resource synth_res; ...@@ -315,6 +319,7 @@ static struct resource synth_res;
int synth_request_region(unsigned long start, unsigned long n) int synth_request_region(unsigned long start, unsigned long n)
{ {
struct resource *parent = &ioport_resource; struct resource *parent = &ioport_resource;
memset(&synth_res, 0, sizeof(synth_res)); memset(&synth_res, 0, sizeof(synth_res));
synth_res.name = synth->name; synth_res.name = synth->name;
synth_res.start = start; synth_res.start = start;
...@@ -437,6 +442,7 @@ int synth_add(struct spk_synth *in_synth) ...@@ -437,6 +442,7 @@ int synth_add(struct spk_synth *in_synth)
{ {
int i; int i;
int status = 0; int status = 0;
mutex_lock(&spk_mutex); mutex_lock(&spk_mutex);
for (i = 0; i < MAXSYNTHS && synths[i] != NULL; i++) for (i = 0; i < MAXSYNTHS && synths[i] != NULL; i++)
/* synth_remove() is responsible for rotating the array down */ /* synth_remove() is responsible for rotating the array down */
...@@ -461,6 +467,7 @@ EXPORT_SYMBOL_GPL(synth_add); ...@@ -461,6 +467,7 @@ EXPORT_SYMBOL_GPL(synth_add);
void synth_remove(struct spk_synth *in_synth) void synth_remove(struct spk_synth *in_synth)
{ {
int i; int i;
mutex_lock(&spk_mutex); mutex_lock(&spk_mutex);
if (synth == in_synth) if (synth == in_synth)
synth_release(); synth_release();
......
...@@ -117,6 +117,7 @@ void speakup_register_var(struct var_t *var) ...@@ -117,6 +117,7 @@ void speakup_register_var(struct var_t *var)
void speakup_unregister_var(enum var_id_t var_id) void speakup_unregister_var(enum var_id_t var_id)
{ {
struct st_var_header *p_header; struct st_var_header *p_header;
BUG_ON(var_id < 0 || var_id >= MAXVARS); BUG_ON(var_id < 0 || var_id >= MAXVARS);
p_header = var_ptrs[var_id]; p_header = var_ptrs[var_id];
p_header->data = NULL; p_header->data = NULL;
...@@ -125,6 +126,7 @@ void speakup_unregister_var(enum var_id_t var_id) ...@@ -125,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 *spk_get_var_header(enum var_id_t var_id)
{ {
struct st_var_header *p_header; struct st_var_header *p_header;
if (var_id < 0 || var_id >= MAXVARS) if (var_id < 0 || var_id >= MAXVARS)
return NULL; return NULL;
p_header = var_ptrs[var_id]; p_header = var_ptrs[var_id];
...@@ -271,6 +273,7 @@ int spk_set_mask_bits(const char *input, const int which, const int how) ...@@ -271,6 +273,7 @@ int spk_set_mask_bits(const char *input, const int which, const int how)
{ {
u_char *cp; u_char *cp;
short mask = spk_punc_info[which].mask; short mask = spk_punc_info[which].mask;
if (how&1) { if (how&1) {
for (cp = (u_char *)spk_punc_info[3].value; *cp; cp++) for (cp = (u_char *)spk_punc_info[3].value; *cp; cp++)
spk_chartab[*cp] &= ~mask; spk_chartab[*cp] &= ~mask;
...@@ -307,6 +310,7 @@ int spk_set_mask_bits(const char *input, const int which, const int how) ...@@ -307,6 +310,7 @@ int spk_set_mask_bits(const char *input, const int which, const int how)
char *spk_strlwr(char *s) char *spk_strlwr(char *s)
{ {
char *p; char *p;
if (s == NULL) if (s == NULL)
return NULL; return NULL;
...@@ -318,6 +322,7 @@ char *spk_strlwr(char *s) ...@@ -318,6 +322,7 @@ char *spk_strlwr(char *s)
char *spk_s2uchar(char *start, char *dest) char *spk_s2uchar(char *start, char *dest)
{ {
int val = 0; int val = 0;
val = simple_strtoul(skip_spaces(start), &start, 10); val = simple_strtoul(skip_spaces(start), &start, 10);
if (*start == ',') if (*start == ',')
start++; start++;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment