Skip to content

Commit 54dcf0c

Browse files
Villemoesdavem330
authored andcommitted
drivers/sbus/char: Micro-optimization in display7seg.c
Flipping a bit doesn't need four lines of code; and gcc seems to actually generate two branches. Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 57a4a3d commit 54dcf0c

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

drivers/sbus/char/display7seg.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,10 +144,7 @@ static long d7s_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
144144

145145
case D7SIOCTM:
146146
/* toggle device mode-- flip display orientation */
147-
if (regs & D7S_FLIP)
148-
regs &= ~D7S_FLIP;
149-
else
150-
regs |= D7S_FLIP;
147+
regs ^= D7S_FLIP;
151148
writeb(regs, p->regs);
152149
break;
153150
}

0 commit comments

Comments
 (0)