staging: speakup: main: remove custom locking macros
authorWilliam Hubbs <w.d.hubbs@gmail.com>
Mon, 13 May 2013 05:02:56 +0000 (00:02 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 16 May 2013 23:11:08 +0000 (16:11 -0700)
Signed-off-by: William Hubbs <w.d.hubbs@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/speakup/main.c

index 6c7b55c2947d0f0f872b6d5dca65af7fd518ba65..53110c82108e8ab2127e2a8dd22489e1a345edd3 100644 (file)
@@ -1129,7 +1129,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 +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)
                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 +1173,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)
@@ -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)
 {
        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 +1472,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 +1494,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 +1619,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 +1650,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 +1659,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 +1673,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 +1682,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,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 (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)
@@ -1710,11 +1710,11 @@ 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 +1724,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 +1745,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)
@@ -2015,7 +2015,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;
@@ -2114,7 +2114,7 @@ no_map:
        }
        last_keycode = 0;
 out:
-       spk_unlock(flags);
+       spin_unlock_irqrestore(&speakup_info.spinlock, flags);
        return ret;
 }