public inbox for linux-iio@vger.kernel.org
 help / color / mirror / Atom feed
From: kbuild test robot <lkp@intel.com>
To: Enric Balletbo i Serra <enric.balletbo@collabora.com>
Cc: kbuild-all@01.org, Jonathan Cameron <jic23@kernel.org>,
	linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
	Gwendal Grignou <gwendal@chromium.org>,
	Peter Meerwald-Stadler <pmeerw@pmeerw.net>,
	Guenter Roeck <groeck@chromium.org>,
	Benson Leung <bleung@chromium.org>,
	Lars-Peter Clausen <lars@metafoo.de>,
	kernel@collabora.com, Hartmut Knaack <knaack.h@gmx.de>
Subject: Re: [PATCH v2] iio: cros_ec: Fix the maths for gyro scale calculation
Date: Sun, 10 Mar 2019 16:40:56 +0800	[thread overview]
Message-ID: <201903101646.EwaDek46%lkp@intel.com> (raw)
In-Reply-To: <20190307151041.10113-1-enric.balletbo@collabora.com>

[-- Attachment #1: Type: text/plain, Size: 4009 bytes --]

Hi Gwendal,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on iio/togreg]
[also build test WARNING on v5.0 next-20190306]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Enric-Balletbo-i-Serra/iio-cros_ec-Fix-the-maths-for-gyro-scale-calculation/20190310-155057
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git togreg
config: i386-randconfig-x005-201910 (attached as .config)
compiler: gcc-8 (Debian 8.3.0-2) 8.3.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All warnings (new ones prefixed by >>):

   drivers/iio/common/cros_ec_sensors/cros_ec_sensors.c: In function 'cros_ec_sensors_read':
>> drivers/iio/common/cros_ec_sensors/cros_ec_sensors.c:107:4: warning: this decimal constant is unsigned only in ISO C90
       *val2 = div_s64(val64 * 3141592653,
       ^

vim +107 drivers/iio/common/cros_ec_sensors/cros_ec_sensors.c

    44	
    45	static int cros_ec_sensors_read(struct iio_dev *indio_dev,
    46				  struct iio_chan_spec const *chan,
    47				  int *val, int *val2, long mask)
    48	{
    49		struct cros_ec_sensors_state *st = iio_priv(indio_dev);
    50		s16 data = 0;
    51		s64 val64;
    52		int i;
    53		int ret;
    54		int idx = chan->scan_index;
    55	
    56		mutex_lock(&st->core.cmd_lock);
    57	
    58		switch (mask) {
    59		case IIO_CHAN_INFO_RAW:
    60			ret = st->core.read_ec_sensors_data(indio_dev, 1 << idx, &data);
    61			if (ret < 0)
    62				break;
    63			ret = IIO_VAL_INT;
    64			*val = data;
    65			break;
    66		case IIO_CHAN_INFO_CALIBBIAS:
    67			st->core.param.cmd = MOTIONSENSE_CMD_SENSOR_OFFSET;
    68			st->core.param.sensor_offset.flags = 0;
    69	
    70			ret = cros_ec_motion_send_host_cmd(&st->core, 0);
    71			if (ret < 0)
    72				break;
    73	
    74			/* Save values */
    75			for (i = CROS_EC_SENSOR_X; i < CROS_EC_SENSOR_MAX_AXIS; i++)
    76				st->core.calib[i] =
    77					st->core.resp->sensor_offset.offset[i];
    78			ret = IIO_VAL_INT;
    79			*val = st->core.calib[idx];
    80			break;
    81		case IIO_CHAN_INFO_SCALE:
    82			st->core.param.cmd = MOTIONSENSE_CMD_SENSOR_RANGE;
    83			st->core.param.sensor_range.data = EC_MOTION_SENSE_NO_VALUE;
    84	
    85			ret = cros_ec_motion_send_host_cmd(&st->core, 0);
    86			if (ret < 0)
    87				break;
    88	
    89			val64 = st->core.resp->sensor_range.ret;
    90			switch (st->core.type) {
    91			case MOTIONSENSE_TYPE_ACCEL:
    92				/*
    93				 * EC returns data in g, iio exepects m/s^2.
    94				 * Do not use IIO_G_TO_M_S_2 to avoid precision loss.
    95				 */
    96				*val = div_s64(val64 * 980665, 10);
    97				*val2 = 10000 << (CROS_EC_SENSOR_BITS - 1);
    98				ret = IIO_VAL_FRACTIONAL;
    99				break;
   100			case MOTIONSENSE_TYPE_GYRO:
   101				/*
   102				 * EC returns data in dps, iio expects rad/s.
   103				 * Do not use IIO_DEGREE_TO_RAD to avoid precision
   104				 * loss. Round to the nearest integer.
   105				 */
   106				*val = 0;
 > 107				*val2 = div_s64(val64 * 3141592653,
   108						180 << (CROS_EC_SENSOR_BITS - 1));
   109				ret = IIO_VAL_INT_PLUS_NANO;
   110				break;
   111			case MOTIONSENSE_TYPE_MAG:
   112				/*
   113				 * EC returns data in 16LSB / uT,
   114				 * iio expects Gauss
   115				 */
   116				*val = val64;
   117				*val2 = 100 << (CROS_EC_SENSOR_BITS - 1);
   118				ret = IIO_VAL_FRACTIONAL;
   119				break;
   120			default:
   121				ret = -EINVAL;
   122			}
   123			break;
   124		default:
   125			ret = cros_ec_sensors_core_read(&st->core, chan, val, val2,
   126							mask);
   127			break;
   128		}
   129		mutex_unlock(&st->core.cmd_lock);
   130	
   131		return ret;
   132	}
   133	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 26701 bytes --]

      reply	other threads:[~2019-03-10  8:41 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-07 15:10 [PATCH v2] iio: cros_ec: Fix the maths for gyro scale calculation Enric Balletbo i Serra
2019-03-10  8:40 ` kbuild test robot [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201903101646.EwaDek46%lkp@intel.com \
    --to=lkp@intel.com \
    --cc=bleung@chromium.org \
    --cc=enric.balletbo@collabora.com \
    --cc=groeck@chromium.org \
    --cc=gwendal@chromium.org \
    --cc=jic23@kernel.org \
    --cc=kbuild-all@01.org \
    --cc=kernel@collabora.com \
    --cc=knaack.h@gmx.de \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pmeerw@pmeerw.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox