summaryrefslogtreecommitdiff
path: root/drivers/staging/speakup
diff options
context:
space:
mode:
authorGustavo A. R. Silva <garsilva@embeddedor.com>2017-11-11 01:13:03 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-11-27 11:20:40 +0300
commitd69b9c3884bf9dceab7d971eaab7a89887b60378 (patch)
tree3636f9164eb11b773c171aa97ff5f5b3fdcf433f /drivers/staging/speakup
parentf6829ad6179906da6c2f7fd4ce526f4bb2e03579 (diff)
downloadlinux-d69b9c3884bf9dceab7d971eaab7a89887b60378.tar.xz
staging: speakup: selection: replace _manual_ swap with swap macro
Make use of the swap macro instead of _manually_ swapping values and remove unnecessary variable tmp. This makes the code easier to read and maintain. This code was detected with the help of Coccinelle. Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com> Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/speakup')
-rw-r--r--drivers/staging/speakup/selection.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/drivers/staging/speakup/selection.c b/drivers/staging/speakup/selection.c
index 66061b5c3427..0ed1fefee0e9 100644
--- a/drivers/staging/speakup/selection.c
+++ b/drivers/staging/speakup/selection.c
@@ -64,13 +64,8 @@ int speakup_set_selection(struct tty_struct *tty)
ps = spk_ys * vc->vc_size_row + (spk_xs << 1);
pe = spk_ye * vc->vc_size_row + (spk_xe << 1);
- if (ps > pe) {
- /* make sel_start <= sel_end */
- int tmp = ps;
-
- ps = pe;
- pe = tmp;
- }
+ if (ps > pe) /* make sel_start <= sel_end */
+ swap(ps, pe);
if (spk_sel_cons != vc_cons[fg_console].d) {
speakup_clear_selection();