linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* drivers/input/touchscreen/elants_i2c.c:859:45: warning: Clarify calculation precedence for '&' and
@ 2020-08-01 22:18 kernel test robot
  2020-08-06 22:31 ` Dmitry Torokhov
  0 siblings, 1 reply; 3+ messages in thread
From: kernel test robot @ 2020-08-01 22:18 UTC (permalink / raw)
  To: Johnny Chuang; +Cc: kbuild-all, linux-kernel, Dmitry Torokhov, Peter Hutterer

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   d52daa8620c65960e1ef882adc1f92061326bd7a
commit: f27ad8932725f8dd0cd1a46763de4a40377b1ae6 Input: elants_i2c - support palm detection
date:   4 months ago
compiler: xtensa-linux-gcc (GCC) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>


cppcheck warnings: (new ones prefixed by >>)

>> drivers/input/touchscreen/elants_i2c.c:859:45: warning: Clarify calculation precedence for '&' and '?'. [clarifyCalculation]
    tool_type = buf[FW_POS_TOOL_TYPE] & BIT(0) ?
                                               ^

vim +859 drivers/input/touchscreen/elants_i2c.c

   838	
   839	/*
   840	 * Event reporting.
   841	 */
   842	
   843	static void elants_i2c_mt_event(struct elants_data *ts, u8 *buf)
   844	{
   845		struct input_dev *input = ts->input;
   846		unsigned int n_fingers;
   847		unsigned int tool_type;
   848		u16 finger_state;
   849		int i;
   850	
   851		n_fingers = buf[FW_POS_STATE + 1] & 0x0f;
   852		finger_state = ((buf[FW_POS_STATE + 1] & 0x30) << 4) |
   853				buf[FW_POS_STATE];
   854	
   855		dev_dbg(&ts->client->dev,
   856			"n_fingers: %u, state: %04x\n",  n_fingers, finger_state);
   857	
   858		/* Note: all fingers have the same tool type */
 > 859		tool_type = buf[FW_POS_TOOL_TYPE] & BIT(0) ?
   860				MT_TOOL_FINGER : MT_TOOL_PALM;
   861	
   862		for (i = 0; i < MAX_CONTACT_NUM && n_fingers; i++) {
   863			if (finger_state & 1) {
   864				unsigned int x, y, p, w;
   865				u8 *pos;
   866	
   867				pos = &buf[FW_POS_XY + i * 3];
   868				x = (((u16)pos[0] & 0xf0) << 4) | pos[1];
   869				y = (((u16)pos[0] & 0x0f) << 8) | pos[2];
   870				p = buf[FW_POS_PRESSURE + i];
   871				w = buf[FW_POS_WIDTH + i];
   872	
   873				dev_dbg(&ts->client->dev, "i=%d x=%d y=%d p=%d w=%d\n",
   874					i, x, y, p, w);
   875	
   876				input_mt_slot(input, i);
   877				input_mt_report_slot_state(input, tool_type, true);
   878				input_event(input, EV_ABS, ABS_MT_POSITION_X, x);
   879				input_event(input, EV_ABS, ABS_MT_POSITION_Y, y);
   880				input_event(input, EV_ABS, ABS_MT_PRESSURE, p);
   881				input_event(input, EV_ABS, ABS_MT_TOUCH_MAJOR, w);
   882	
   883				n_fingers--;
   884			}
   885	
   886			finger_state >>= 1;
   887		}
   888	
   889		input_mt_sync_frame(input);
   890		input_sync(input);
   891	}
   892	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: drivers/input/touchscreen/elants_i2c.c:859:45: warning: Clarify calculation precedence for '&' and
  2020-08-01 22:18 drivers/input/touchscreen/elants_i2c.c:859:45: warning: Clarify calculation precedence for '&' and kernel test robot
@ 2020-08-06 22:31 ` Dmitry Torokhov
  2020-08-11  0:27   ` [kbuild-all] " Xia, Hui
  0 siblings, 1 reply; 3+ messages in thread
From: Dmitry Torokhov @ 2020-08-06 22:31 UTC (permalink / raw)
  To: kernel test robot; +Cc: Johnny Chuang, kbuild-all, linux-kernel, Peter Hutterer

On Sun, Aug 02, 2020 at 06:18:19AM +0800, kernel test robot wrote:
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> head:   d52daa8620c65960e1ef882adc1f92061326bd7a
> commit: f27ad8932725f8dd0cd1a46763de4a40377b1ae6 Input: elants_i2c - support palm detection
> date:   4 months ago
> compiler: xtensa-linux-gcc (GCC) 9.3.0
> 
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@intel.com>
> 
> 
> cppcheck warnings: (new ones prefixed by >>)
> 
> >> drivers/input/touchscreen/elants_i2c.c:859:45: warning: Clarify calculation precedence for '&' and '?'. [clarifyCalculation]
>     tool_type = buf[FW_POS_TOOL_TYPE] & BIT(0) ?
>                                                ^

No, there is no need to clarify precedence as it is already clear.

Thanks.

-- 
Dmitry

^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [kbuild-all] Re: drivers/input/touchscreen/elants_i2c.c:859:45: warning: Clarify calculation precedence for '&' and
  2020-08-06 22:31 ` Dmitry Torokhov
@ 2020-08-11  0:27   ` Xia, Hui
  0 siblings, 0 replies; 3+ messages in thread
From: Xia, Hui @ 2020-08-11  0:27 UTC (permalink / raw)
  To: Dmitry Torokhov, lkp
  Cc: Johnny Chuang, kbuild-all, linux-kernel, Peter Hutterer



>-----Original Message-----
>From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
>Sent: 2020年8月7日 6:31
>To: lkp <lkp@intel.com>
>Cc: Johnny Chuang <johnny.chuang@emc.com.tw>; kbuild-all@lists.01.org; linux-
>kernel@vger.kernel.org; Peter Hutterer <peter.hutterer@who-t.net>
>Subject: [kbuild-all] Re: drivers/input/touchscreen/elants_i2c.c:859:45: warning:
>Clarify calculation precedence for '&' and
>
>On Sun, Aug 02, 2020 at 06:18:19AM +0800, kernel test robot wrote:
>> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
>> head:   d52daa8620c65960e1ef882adc1f92061326bd7a
>> commit: f27ad8932725f8dd0cd1a46763de4a40377b1ae6 Input: elants_i2c -
>support palm detection
>> date:   4 months ago
>> compiler: xtensa-linux-gcc (GCC) 9.3.0
>>
>> If you fix the issue, kindly add following tag as appropriate
>> Reported-by: kernel test robot <lkp@intel.com>
>>
>>
>> cppcheck warnings: (new ones prefixed by >>)
>>
>> >> drivers/input/touchscreen/elants_i2c.c:859:45: warning: Clarify
>> >> calculation precedence for '&' and '?'. [clarifyCalculation]
>>     tool_type = buf[FW_POS_TOOL_TYPE] & BIT(0) ?
>>                                                ^
>
>No, there is no need to clarify precedence as it is already clear.

Thanks Dmitry. We will ignore this warning type. Sorry for the noise.

--Hui

>
>Thanks.
>
>--
>Dmitry
>_______________________________________________
>kbuild-all mailing list -- kbuild-all@lists.01.org To unsubscribe send an email to
>kbuild-all-leave@lists.01.org

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-08-11  0:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-01 22:18 drivers/input/touchscreen/elants_i2c.c:859:45: warning: Clarify calculation precedence for '&' and kernel test robot
2020-08-06 22:31 ` Dmitry Torokhov
2020-08-11  0:27   ` [kbuild-all] " Xia, Hui

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).