rfkill: use variable instead of duplicating the expression
authorJoão Paulo Rechi Vita <jprvita@gmail.com>
Tue, 19 Jan 2016 15:42:37 +0000 (10:42 -0500)
committerJohannes Berg <johannes.berg@intel.com>
Wed, 24 Feb 2016 08:04:23 +0000 (09:04 +0100)
RFKILL_BLOCK_SW value have just been saved to prev, no need to check it
again in the if expression. This makes code a little bit easier to read.

Signed-off-by: João Paulo Rechi Vita <jprvita@endlessm.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
net/rfkill/core.c

index 166439995f34d2cb3944f2475e02a6774abd0bdb..061ed37c07cfa04f800fcca18961857ddb80f445 100644 (file)
@@ -287,7 +287,7 @@ static void rfkill_set_block(struct rfkill *rfkill, bool blocked)
        spin_lock_irqsave(&rfkill->lock, flags);
        prev = rfkill->state & RFKILL_BLOCK_SW;
 
-       if (rfkill->state & RFKILL_BLOCK_SW)
+       if (prev)
                rfkill->state |= RFKILL_BLOCK_SW_PREV;
        else
                rfkill->state &= ~RFKILL_BLOCK_SW_PREV;