Commit 3efe810f authored by William Hubbs's avatar William Hubbs Committed by Greg Kroah-Hartman

staging: speakup: main: remove custom locking macros

Signed-off-by: default avatarWilliam Hubbs <w.d.hubbs@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 550e579a
...@@ -1129,7 +1129,7 @@ static void do_handle_shift(struct vc_data *vc, u_char value, char up_flag) ...@@ -1129,7 +1129,7 @@ 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;
spk_lock(flags); spin_lock_irqsave(&speakup_info.spinlock, flags);
if (cursor_track == read_all_mode) { if (cursor_track == read_all_mode) {
switch (value) { switch (value) {
case KVAL(K_SHIFT): case KVAL(K_SHIFT):
...@@ -1151,20 +1151,20 @@ static void do_handle_shift(struct vc_data *vc, u_char value, char up_flag) ...@@ -1151,20 +1151,20 @@ static void do_handle_shift(struct vc_data *vc, u_char value, char up_flag)
} }
if (spk_say_ctrl && value < NUM_CTL_LABELS) if (spk_say_ctrl && value < NUM_CTL_LABELS)
synth_printf("%s", spk_msg_get(MSG_CTL_START + value)); 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) static void do_handle_latin(struct vc_data *vc, u_char value, char up_flag)
{ {
unsigned long flags; unsigned long flags;
spk_lock(flags); spin_lock_irqsave(&speakup_info.spinlock, flags);
if (up_flag) { if (up_flag) {
spk_lastkey = spk_keydown = 0; spk_lastkey = spk_keydown = 0;
spk_unlock(flags); spin_unlock_irqrestore(&speakup_info.spinlock, flags);
return; return;
} }
if (synth == NULL || spk_killed) { if (synth == NULL || spk_killed) {
spk_unlock(flags); spin_unlock_irqrestore(&speakup_info.spinlock, flags);
return; return;
} }
spk_shut_up &= 0xfe; spk_shut_up &= 0xfe;
...@@ -1173,7 +1173,7 @@ static void do_handle_latin(struct vc_data *vc, u_char value, char up_flag) ...@@ -1173,7 +1173,7 @@ static void do_handle_latin(struct vc_data *vc, u_char value, char up_flag)
spk_parked &= 0xfe; spk_parked &= 0xfe;
if (spk_key_echo == 2 && value >= MINECHOCHAR) if (spk_key_echo == 2 && value >= MINECHOCHAR)
speak_char(value); 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) int spk_set_key_info(const u_char *key_info, u_char *k_buffer)
...@@ -1449,21 +1449,21 @@ static void handle_cursor_read_all(struct vc_data *vc, int command) ...@@ -1449,21 +1449,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) static int pre_handle_cursor(struct vc_data *vc, u_char value, char up_flag)
{ {
unsigned long flags; unsigned long flags;
spk_lock(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;
if (synth == NULL || up_flag || spk_shut_up) { if (synth == NULL || up_flag || spk_shut_up) {
spk_unlock(flags); spin_unlock_irqrestore(&speakup_info.spinlock, flags);
return NOTIFY_STOP; return NOTIFY_STOP;
} }
del_timer(&cursor_timer); del_timer(&cursor_timer);
spk_shut_up &= 0xfe; spk_shut_up &= 0xfe;
spk_do_flush(); spk_do_flush();
start_read_all_timer(vc, value + 1); start_read_all_timer(vc, value + 1);
spk_unlock(flags); spin_unlock_irqrestore(&speakup_info.spinlock, flags);
return NOTIFY_STOP; return NOTIFY_STOP;
} }
spk_unlock(flags); spin_unlock_irqrestore(&speakup_info.spinlock, flags);
return NOTIFY_OK; return NOTIFY_OK;
} }
...@@ -1472,10 +1472,10 @@ static void do_handle_cursor(struct vc_data *vc, u_char value, char up_flag) ...@@ -1472,10 +1472,10 @@ static void do_handle_cursor(struct vc_data *vc, u_char value, char up_flag)
unsigned long flags; unsigned long flags;
struct var_t *cursor_timeout; struct var_t *cursor_timeout;
spk_lock(flags); spin_lock_irqsave(&speakup_info.spinlock, flags);
spk_parked &= 0xfe; spk_parked &= 0xfe;
if (synth == NULL || up_flag || spk_shut_up || cursor_track == CT_Off) { if (synth == NULL || up_flag || spk_shut_up || cursor_track == CT_Off) {
spk_unlock(flags); spin_unlock_irqrestore(&speakup_info.spinlock, flags);
return; return;
} }
spk_shut_up &= 0xfe; spk_shut_up &= 0xfe;
...@@ -1494,7 +1494,7 @@ static void do_handle_cursor(struct vc_data *vc, u_char value, char up_flag) ...@@ -1494,7 +1494,7 @@ static void do_handle_cursor(struct vc_data *vc, u_char value, char up_flag)
cursor_timeout = spk_get_var(CURSOR_TIME); cursor_timeout = spk_get_var(CURSOR_TIME);
mod_timer(&cursor_timer, mod_timer(&cursor_timer,
jiffies + msecs_to_jiffies(cursor_timeout->u.n.value)); 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) static void update_color_buffer(struct vc_data *vc, const char *ic, int len)
...@@ -1619,7 +1619,7 @@ static void cursor_done(u_long data) ...@@ -1619,7 +1619,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);
spk_lock(flags); spin_lock_irqsave(&speakup_info.spinlock, flags);
if (cursor_con != fg_console) { if (cursor_con != fg_console) {
is_cursor = 0; is_cursor = 0;
goto out; goto out;
...@@ -1650,7 +1650,7 @@ static void cursor_done(u_long data) ...@@ -1650,7 +1650,7 @@ static void cursor_done(u_long data)
say_char(vc); say_char(vc);
spk_keydown = is_cursor = 0; spk_keydown = is_cursor = 0;
out: out:
spk_unlock(flags); spin_unlock_irqrestore(&speakup_info.spinlock, flags);
} }
/* called by: vt_notifier_call() */ /* called by: vt_notifier_call() */
...@@ -1659,13 +1659,13 @@ static void speakup_bs(struct vc_data *vc) ...@@ -1659,13 +1659,13 @@ 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 (!spk_trylock(flags)) if (!spin_trylock_irqsave(&speakup_info.spinlock, flags))
/* Speakup output, discard */ /* Speakup output, discard */
return; return;
if (!spk_parked) if (!spk_parked)
speakup_date(vc); speakup_date(vc);
if (spk_shut_up || synth == NULL) { if (spk_shut_up || synth == NULL) {
spk_unlock(flags); spin_unlock_irqrestore(&speakup_info.spinlock, flags);
return; return;
} }
if (vc->vc_num == fg_console && spk_keydown) { if (vc->vc_num == fg_console && spk_keydown) {
...@@ -1673,7 +1673,7 @@ static void speakup_bs(struct vc_data *vc) ...@@ -1673,7 +1673,7 @@ static void speakup_bs(struct vc_data *vc)
if (!is_cursor) if (!is_cursor)
say_char(vc); say_char(vc);
} }
spk_unlock(flags); spin_unlock_irqrestore(&speakup_info.spinlock, flags);
} }
/* called by: vt_notifier_call() */ /* called by: vt_notifier_call() */
...@@ -1682,7 +1682,7 @@ static void speakup_con_write(struct vc_data *vc, const char *str, int len) ...@@ -1682,7 +1682,7 @@ 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 (!spk_trylock(flags)) if (!spin_trylock_irqsave(&speakup_info.spinlock, flags))
/* Speakup output, discard */ /* Speakup output, discard */
return; return;
if (spk_bell_pos && spk_keydown && (vc->vc_x == spk_bell_pos - 1)) if (spk_bell_pos && spk_keydown && (vc->vc_x == spk_bell_pos - 1))
...@@ -1690,19 +1690,19 @@ static void speakup_con_write(struct vc_data *vc, const char *str, int len) ...@@ -1690,19 +1690,19 @@ static void speakup_con_write(struct vc_data *vc, const char *str, int len)
if ((is_cursor) || (cursor_track == read_all_mode)) { if ((is_cursor) || (cursor_track == read_all_mode)) {
if (cursor_track == CT_Highlight) if (cursor_track == CT_Highlight)
update_color_buffer(vc, str, len); update_color_buffer(vc, str, len);
spk_unlock(flags); spin_unlock_irqrestore(&speakup_info.spinlock, flags);
return; return;
} }
if (win_enabled) { if (win_enabled) {
if (vc->vc_x >= win_left && vc->vc_x <= win_right && if (vc->vc_x >= win_left && vc->vc_x <= win_right &&
vc->vc_y >= win_top && vc->vc_y <= win_bottom) { vc->vc_y >= win_top && vc->vc_y <= win_bottom) {
spk_unlock(flags); spin_unlock_irqrestore(&speakup_info.spinlock, flags);
return; return;
} }
} }
spkup_write(str, len); spkup_write(str, len);
spk_unlock(flags); spin_unlock_irqrestore(&speakup_info.spinlock, flags);
} }
void speakup_con_update(struct vc_data *vc) void speakup_con_update(struct vc_data *vc)
...@@ -1710,11 +1710,11 @@ void speakup_con_update(struct vc_data *vc) ...@@ -1710,11 +1710,11 @@ 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 (!spk_trylock(flags)) if (!spin_trylock_irqsave(&speakup_info.spinlock, flags))
/* Speakup output, discard */ /* Speakup output, discard */
return; return;
speakup_date(vc); 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) static void do_handle_spec(struct vc_data *vc, u_char value, char up_flag)
...@@ -1724,7 +1724,7 @@ static void do_handle_spec(struct vc_data *vc, u_char value, char up_flag) ...@@ -1724,7 +1724,7 @@ static void do_handle_spec(struct vc_data *vc, u_char value, char up_flag)
char *label; char *label;
if (synth == NULL || up_flag || spk_killed) if (synth == NULL || up_flag || spk_killed)
return; return;
spk_lock(flags); spin_lock_irqsave(&speakup_info.spinlock, flags);
spk_shut_up &= 0xfe; spk_shut_up &= 0xfe;
if (spk_no_intr) if (spk_no_intr)
spk_do_flush(); spk_do_flush();
...@@ -1745,13 +1745,13 @@ static void do_handle_spec(struct vc_data *vc, u_char value, char up_flag) ...@@ -1745,13 +1745,13 @@ static void do_handle_spec(struct vc_data *vc, u_char value, char up_flag)
break; break;
default: default:
spk_parked &= 0xfe; spk_parked &= 0xfe;
spk_unlock(flags); spin_unlock_irqrestore(&speakup_info.spinlock, flags);
return; return;
} }
if (on_off < 2) if (on_off < 2)
synth_printf("%s %s\n", synth_printf("%s %s\n",
label, spk_msg_get(MSG_STATUS_START + on_off)); 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) static int inc_dec_var(u_char value)
...@@ -2015,7 +2015,7 @@ speakup_key(struct vc_data *vc, int shift_state, int keycode, u_short keysym, ...@@ -2015,7 +2015,7 @@ speakup_key(struct vc_data *vc, int shift_state, int keycode, u_short keysym,
if (synth == NULL) if (synth == NULL)
return 0; return 0;
spk_lock(flags); spin_lock_irqsave(&speakup_info.spinlock, flags);
tty = vc->port.tty; tty = vc->port.tty;
if (type >= 0xf0) if (type >= 0xf0)
type -= 0xf0; type -= 0xf0;
...@@ -2114,7 +2114,7 @@ speakup_key(struct vc_data *vc, int shift_state, int keycode, u_short keysym, ...@@ -2114,7 +2114,7 @@ speakup_key(struct vc_data *vc, int shift_state, int keycode, u_short keysym,
} }
last_keycode = 0; last_keycode = 0;
out: out:
spk_unlock(flags); spin_unlock_irqrestore(&speakup_info.spinlock, flags);
return ret; return ret;
} }
......
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