[PATCH 2/4] [media] imon: better code the pad_mouse toggling

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The logic with toggles the pad_mouse is confusing. Now, gcc 7.1
complains about it:

drivers/media/rc/imon.c: In function 'imon_incoming_scancode':
drivers/media/rc/imon.c:1725:23: warning: '~' on a boolean expression [-Wbool-operation]
    ictx->pad_mouse = (~ictx->pad_mouse) & 0x1;
                       ^
drivers/media/rc/imon.c:1725:23: note: did you mean to use logical not?
    ictx->pad_mouse = (~ictx->pad_mouse) & 0x1;
                       ^
                       !

Rewrite it to be clearer for both code reviewers and gcc.

Signed-off-by: Mauro Carvalho Chehab <mchehab@xxxxxxxxxxxxxxxx>
---
 drivers/media/rc/imon.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/rc/imon.c b/drivers/media/rc/imon.c
index 3489010601b5..9c510fe54b2a 100644
--- a/drivers/media/rc/imon.c
+++ b/drivers/media/rc/imon.c
@@ -1722,7 +1722,7 @@ static void imon_incoming_scancode(struct imon_context *ictx,
 	if (kc == KEY_KEYBOARD && !ictx->release_code) {
 		ictx->last_keycode = kc;
 		if (!nomouse) {
-			ictx->pad_mouse = ~(ictx->pad_mouse) & 0x1;
+			ictx->pad_mouse = !(ictx->pad_mouse & 0x1);
 			dev_dbg(dev, "toggling to %s mode\n",
 				ictx->pad_mouse ? "mouse" : "keyboard");
 			spin_unlock_irqrestore(&ictx->kc_lock, flags);
-- 
2.9.3




[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux