Re: [PATCH v2 3/3] iio: cros_ec_light: Add support for RGB sensor

From: kbuild test robot
Date: Mon May 11 2020 - 02:58:45 EST


Hi Gwendal,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on iio/togreg]
[also build test WARNING on chrome-platform-linux/for-next linus/master v5.7-rc5 next-20200508]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url: https://github.com/0day-ci/linux/commits/Gwendal-Grignou/iio-cros_ec-Add-support-for-RGB-light-sensor/20200507-074251
base: https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git togreg
config: i386-randconfig-a003-20200511 (attached as .config)
compiler: gcc-7 (Ubuntu 7.5.0-6ubuntu2) 7.5.0
reproduce:
# save the attached .config to linux build tree
make ARCH=i386

If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>):

drivers/iio/light/cros_ec_light_prox.c:39:40: warning: left-hand operand of comma expression has no effect [-Wunused-value]
#define CROS_EC_LIGHT_RGB_SPACE_MASK (6, 4)
^
drivers/iio/light/cros_ec_light_prox.c:51:2: note: in expansion of macro 'CROS_EC_LIGHT_RGB_SPACE_MASK'
CROS_EC_LIGHT_RGB_SPACE_MASK,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/iio/light/cros_ec_light_prox.c:39:38: error: initializer element is not constant
#define CROS_EC_LIGHT_RGB_SPACE_MASK (6, 4)
^
drivers/iio/light/cros_ec_light_prox.c:51:2: note: in expansion of macro 'CROS_EC_LIGHT_RGB_SPACE_MASK'
CROS_EC_LIGHT_RGB_SPACE_MASK,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/iio/light/cros_ec_light_prox.c:39:38: note: (near initialization for 'cros_ec_light_prox_bitmasks[3]')
#define CROS_EC_LIGHT_RGB_SPACE_MASK (6, 4)
^
drivers/iio/light/cros_ec_light_prox.c:51:2: note: in expansion of macro 'CROS_EC_LIGHT_RGB_SPACE_MASK'
CROS_EC_LIGHT_RGB_SPACE_MASK,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/iio/light/cros_ec_light_prox.c:39:40: warning: left-hand operand of comma expression has no effect [-Wunused-value]
#define CROS_EC_LIGHT_RGB_SPACE_MASK (6, 4)
^
drivers/iio/light/cros_ec_light_prox.c:52:2: note: in expansion of macro 'CROS_EC_LIGHT_RGB_SPACE_MASK'
CROS_EC_LIGHT_RGB_SPACE_MASK | CROS_EC_LIGHT_CLEAR_OR_PROXIMITY_MASK,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/iio/light/cros_ec_light_prox.c:39:38: error: initializer element is not constant
#define CROS_EC_LIGHT_RGB_SPACE_MASK (6, 4)
^
drivers/iio/light/cros_ec_light_prox.c:52:2: note: in expansion of macro 'CROS_EC_LIGHT_RGB_SPACE_MASK'
CROS_EC_LIGHT_RGB_SPACE_MASK | CROS_EC_LIGHT_CLEAR_OR_PROXIMITY_MASK,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/iio/light/cros_ec_light_prox.c:39:38: note: (near initialization for 'cros_ec_light_prox_bitmasks[4]')
#define CROS_EC_LIGHT_RGB_SPACE_MASK (6, 4)
^
drivers/iio/light/cros_ec_light_prox.c:52:2: note: in expansion of macro 'CROS_EC_LIGHT_RGB_SPACE_MASK'
CROS_EC_LIGHT_RGB_SPACE_MASK | CROS_EC_LIGHT_CLEAR_OR_PROXIMITY_MASK,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from include/linux/dev_printk.h:14:0,
from include/linux/device.h:15,
from drivers/iio/light/cros_ec_light_prox.c:8:
drivers/iio/light/cros_ec_light_prox.c: In function 'cros_ec_light_capture':
drivers/iio/light/cros_ec_light_prox.c:39:40: warning: left-hand operand of comma expression has no effect [-Wunused-value]
#define CROS_EC_LIGHT_RGB_SPACE_MASK (6, 4)
^
include/linux/compiler.h:58:52: note: in definition of macro '__trace_if_var'
#define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
^~~~
>> drivers/iio/light/cros_ec_light_prox.c:403:2: note: in expansion of macro 'if'
if ((scan_mask & CROS_EC_LIGHT_XYZ_SPACE_MASK) ||
^~
drivers/iio/light/cros_ec_light_prox.c:404:19: note: in expansion of macro 'CROS_EC_LIGHT_RGB_SPACE_MASK'
(scan_mask & CROS_EC_LIGHT_RGB_SPACE_MASK)) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/iio/light/cros_ec_light_prox.c:39:40: warning: left-hand operand of comma expression has no effect [-Wunused-value]
#define CROS_EC_LIGHT_RGB_SPACE_MASK (6, 4)
^
include/linux/compiler.h:58:61: note: in definition of macro '__trace_if_var'
#define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
^~~~
>> drivers/iio/light/cros_ec_light_prox.c:403:2: note: in expansion of macro 'if'
if ((scan_mask & CROS_EC_LIGHT_XYZ_SPACE_MASK) ||
^~
drivers/iio/light/cros_ec_light_prox.c:404:19: note: in expansion of macro 'CROS_EC_LIGHT_RGB_SPACE_MASK'
(scan_mask & CROS_EC_LIGHT_RGB_SPACE_MASK)) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/iio/light/cros_ec_light_prox.c:39:40: warning: left-hand operand of comma expression has no effect [-Wunused-value]
#define CROS_EC_LIGHT_RGB_SPACE_MASK (6, 4)
^
include/linux/compiler.h:69:3: note: in definition of macro '__trace_if_value'
(cond) ? \
^~~~
include/linux/compiler.h:56:28: note: in expansion of macro '__trace_if_var'
#define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
^~~~~~~~~~~~~~
>> drivers/iio/light/cros_ec_light_prox.c:403:2: note: in expansion of macro 'if'
if ((scan_mask & CROS_EC_LIGHT_XYZ_SPACE_MASK) ||
^~
drivers/iio/light/cros_ec_light_prox.c:404:19: note: in expansion of macro 'CROS_EC_LIGHT_RGB_SPACE_MASK'
(scan_mask & CROS_EC_LIGHT_RGB_SPACE_MASK)) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/iio/light/cros_ec_light_prox.c: In function 'cros_ec_light_prox_update_scan_mode':
drivers/iio/light/cros_ec_light_prox.c:39:40: warning: left-hand operand of comma expression has no effect [-Wunused-value]
#define CROS_EC_LIGHT_RGB_SPACE_MASK (6, 4)
^
include/linux/compiler.h:58:52: note: in definition of macro '__trace_if_var'
#define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
^~~~
drivers/iio/light/cros_ec_light_prox.c:434:7: note: in expansion of macro 'if'
else if (*scan_mask & CROS_EC_LIGHT_RGB_SPACE_MASK)
^~
drivers/iio/light/cros_ec_light_prox.c:434:24: note: in expansion of macro 'CROS_EC_LIGHT_RGB_SPACE_MASK'
else if (*scan_mask & CROS_EC_LIGHT_RGB_SPACE_MASK)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/iio/light/cros_ec_light_prox.c:39:40: warning: left-hand operand of comma expression has no effect [-Wunused-value]
#define CROS_EC_LIGHT_RGB_SPACE_MASK (6, 4)
^
include/linux/compiler.h:58:61: note: in definition of macro '__trace_if_var'
#define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
^~~~
drivers/iio/light/cros_ec_light_prox.c:434:7: note: in expansion of macro 'if'
else if (*scan_mask & CROS_EC_LIGHT_RGB_SPACE_MASK)
^~
drivers/iio/light/cros_ec_light_prox.c:434:24: note: in expansion of macro 'CROS_EC_LIGHT_RGB_SPACE_MASK'
else if (*scan_mask & CROS_EC_LIGHT_RGB_SPACE_MASK)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/iio/light/cros_ec_light_prox.c:39:40: warning: left-hand operand of comma expression has no effect [-Wunused-value]
#define CROS_EC_LIGHT_RGB_SPACE_MASK (6, 4)
^
include/linux/compiler.h:69:3: note: in definition of macro '__trace_if_value'
(cond) ? \
^~~~
include/linux/compiler.h:56:28: note: in expansion of macro '__trace_if_var'
#define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
^~~~~~~~~~~~~~
drivers/iio/light/cros_ec_light_prox.c:434:7: note: in expansion of macro 'if'
else if (*scan_mask & CROS_EC_LIGHT_RGB_SPACE_MASK)
^~
drivers/iio/light/cros_ec_light_prox.c:434:24: note: in expansion of macro 'CROS_EC_LIGHT_RGB_SPACE_MASK'
else if (*scan_mask & CROS_EC_LIGHT_RGB_SPACE_MASK)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~

vim +/if +403 drivers/iio/light/cros_ec_light_prox.c

378
379 static irqreturn_t cros_ec_light_capture(int irq, void *p)
380 {
381 struct iio_poll_func *pf = p;
382 struct iio_dev *indio_dev = pf->indio_dev;
383 struct cros_ec_sensors_core_state *st = iio_priv(indio_dev);
384 int ret, i, idx = 0;
385 s16 data;
386 const unsigned long scan_mask = *indio_dev->active_scan_mask;
387
388 mutex_lock(&st->cmd_lock);
389
390 /* Clear capture data. */
391 memset(st->samples, 0, indio_dev->scan_bytes);
392
393 /* Read first channel. */
394 ret = cros_ec_sensors_read_cmd(indio_dev, 1, &data);
395 if (ret < 0) {
396 mutex_unlock(&st->cmd_lock);
397 goto done;
398 }
399 if (scan_mask & CROS_EC_LIGHT_CLEAR_OR_PROXIMITY_MASK)
400 ((s16 *)st->samples)[idx++] = data;
401
402 /* Read remaining channels. */
> 403 if ((scan_mask & CROS_EC_LIGHT_XYZ_SPACE_MASK) ||
404 (scan_mask & CROS_EC_LIGHT_RGB_SPACE_MASK)) {
405 ret = cros_ec_light_extra_send_host_cmd(
406 st, 1, sizeof(st->resp->data));
407 if (ret < 0) {
408 mutex_unlock(&st->cmd_lock);
409 goto done;
410 }
411 for (i = 0; i < CROS_EC_SENSOR_MAX_AXIS; i++)
412 ((s16 *)st->samples)[idx++] = st->resp->data.data[i];
413 }
414 mutex_unlock(&st->cmd_lock);
415
416 iio_push_to_buffers_with_timestamp(indio_dev, st->samples,
417 iio_get_time_ns(indio_dev));
418
419 done:
420 iio_trigger_notify_done(indio_dev->trig);
421
422 return IRQ_HANDLED;
423 }
424

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

Attachment: .config.gz
Description: application/gzip