public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Christian Eggers <ceggers@arri.de>,
	Rob Herring <robh+dt@kernel.org>,
	Jonathan Cameron <jic23@kernel.org>
Cc: kbuild-all@lists.01.org, Hartmut Knaack <knaack.h@gmx.de>,
	Lars-Peter Clausen <lars@metafoo.de>,
	Peter Meerwald-Stadler <pmeerw@pmeerw.net>,
	linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, Christian Eggers <ceggers@arri.de>
Subject: Re: [PATCH 2/2] iio: light: as73211: New driver
Date: Tue, 28 Jul 2020 12:45:52 +0800	[thread overview]
Message-ID: <202007281229.IO7n9y8a%lkp@intel.com> (raw)
In-Reply-To: <20200727144741.3927-3-ceggers@arri.de>

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

Hi Christian,

I love your patch! Perhaps something to improve:

[auto build test WARNING on iio/togreg]
[also build test WARNING on robh/for-next linux/master linus/master v5.8-rc7 next-20200727]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Christian-Eggers/dt-bindings-iio-light-add-AMS-AS73211-support/20200727-234842
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git togreg
config: sparc64-randconfig-s031-20200728 (attached as .config)
compiler: sparc64-linux-gcc (GCC) 9.3.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # apt-get install sparse
        # sparse version: v0.6.2-94-geb6779f6-dirty
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=sparc64 

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


sparse warnings: (new ones prefixed by >>)

>> drivers/iio/light/as73211.c:473:35: sparse: sparse: cast to restricted __le16
>> drivers/iio/light/as73211.c:473:35: sparse: sparse: cast to restricted __le16
>> drivers/iio/light/as73211.c:473:35: sparse: sparse: cast to restricted __le16
>> drivers/iio/light/as73211.c:473:35: sparse: sparse: cast to restricted __le16
   drivers/iio/light/as73211.c:477:43: sparse: sparse: cast to restricted __le16
   drivers/iio/light/as73211.c:477:43: sparse: sparse: cast to restricted __le16
   drivers/iio/light/as73211.c:477:43: sparse: sparse: cast to restricted __le16
   drivers/iio/light/as73211.c:477:43: sparse: sparse: cast to restricted __le16
   drivers/iio/light/as73211.c:478:43: sparse: sparse: cast to restricted __le16
   drivers/iio/light/as73211.c:478:43: sparse: sparse: cast to restricted __le16
   drivers/iio/light/as73211.c:478:43: sparse: sparse: cast to restricted __le16
   drivers/iio/light/as73211.c:478:43: sparse: sparse: cast to restricted __le16
   drivers/iio/light/as73211.c:479:43: sparse: sparse: cast to restricted __le16
   drivers/iio/light/as73211.c:479:43: sparse: sparse: cast to restricted __le16
   drivers/iio/light/as73211.c:479:43: sparse: sparse: cast to restricted __le16
   drivers/iio/light/as73211.c:479:43: sparse: sparse: cast to restricted __le16
   drivers/iio/light/as73211.c:498:43: sparse: sparse: cast to restricted __le16
   drivers/iio/light/as73211.c:498:43: sparse: sparse: cast to restricted __le16
   drivers/iio/light/as73211.c:498:43: sparse: sparse: cast to restricted __le16
   drivers/iio/light/as73211.c:498:43: sparse: sparse: cast to restricted __le16
   drivers/iio/light/as73211.c:499:43: sparse: sparse: cast to restricted __le16
   drivers/iio/light/as73211.c:499:43: sparse: sparse: cast to restricted __le16
   drivers/iio/light/as73211.c:499:43: sparse: sparse: cast to restricted __le16
   drivers/iio/light/as73211.c:499:43: sparse: sparse: cast to restricted __le16
   drivers/iio/light/as73211.c:500:43: sparse: sparse: cast to restricted __le16
   drivers/iio/light/as73211.c:500:43: sparse: sparse: cast to restricted __le16
   drivers/iio/light/as73211.c:500:43: sparse: sparse: cast to restricted __le16
   drivers/iio/light/as73211.c:500:43: sparse: sparse: cast to restricted __le16

vim +473 drivers/iio/light/as73211.c

   439	
   440	static irqreturn_t as73211_trigger_handler(int irq __always_unused, void *p)
   441	{
   442		struct iio_poll_func *pf = p;
   443		struct iio_dev *indio_dev = pf->indio_dev;
   444		struct as73211_data *data = iio_priv(indio_dev);
   445		int data_result, ret;
   446	
   447		mutex_lock(&data->mutex);
   448	
   449		data_result = as73211_req_data(data);
   450	
   451		/* Optimization for reading all (color + temperature) channels */
   452		if (*indio_dev->active_scan_mask == 0xf) {
   453			u8 addr = as73211_channels[0].address;
   454			struct i2c_msg msgs[] = {
   455				{
   456					.addr = data->client->addr,
   457					.flags = 0,
   458					.len = 1,
   459					.buf = &addr
   460				},
   461				{
   462					.addr = data->client->addr,
   463					.flags = I2C_M_RD,
   464					.len = 4 * sizeof(*data->buffer),
   465					.buf = (u8 *)&data->buffer[0]
   466				},
   467			};
   468			ret = i2c_transfer(data->client->adapter, msgs, ARRAY_SIZE(msgs));
   469			if (ret < 0)
   470				goto done;
   471	
   472			/* Temperature channel is not affected by overflows */
 > 473			data->buffer[0] = le16_to_cpu(data->buffer[0]);
   474	
   475			if (data_result == 0) {
   476				/* convert byte order (AS73211 sends LSB first) */
   477				data->buffer[1] = le16_to_cpu(data->buffer[1]);
   478				data->buffer[2] = le16_to_cpu(data->buffer[2]);
   479				data->buffer[3] = le16_to_cpu(data->buffer[3]);
   480			} else {
   481				/* saturate all channels (useful for overflows) */
   482				data->buffer[1] = 0xffff;
   483				data->buffer[2] = 0xffff;
   484				data->buffer[3] = 0xffff;
   485			}
   486	
   487		}
   488		/* Optimization for reading all color channels */
   489		else if (*indio_dev->active_scan_mask == 0xe) {
   490			/* AS73211 starts reading at address 2 */
   491			ret = i2c_master_recv(data->client,
   492					(char *)&data->buffer[1], 3 * sizeof(*data->buffer));
   493			if (ret < 0)
   494				goto done;
   495	
   496			if (data_result == 0) {
   497				/* convert byte order (as73211 sends LSB first) */
   498				data->buffer[1] = le16_to_cpu(data->buffer[1]);
   499				data->buffer[2] = le16_to_cpu(data->buffer[2]);
   500				data->buffer[3] = le16_to_cpu(data->buffer[3]);
   501			} else {
   502				/* saturate all channels (useful for overflows) */
   503				data->buffer[1] = 0xffff;
   504				data->buffer[2] = 0xffff;
   505				data->buffer[3] = 0xffff;
   506			}
   507		} else {
   508			unsigned int i, j = 0;
   509	
   510			/* generic case */
   511			for_each_set_bit(i, indio_dev->active_scan_mask, indio_dev->masklength) {
   512				struct iio_chan_spec const *channel = &as73211_channels[i];
   513	
   514				/* Read data even on error in order to avoid "result buffer overrun" */
   515				ret = i2c_smbus_read_word_data(data->client,
   516					channel->address);
   517				if (ret < 0)
   518					goto done;
   519	
   520				if (data_result == 0) {
   521					data->buffer[j++] = ret;
   522				} else {
   523					/* saturate all channels (useful for overflows) */
   524					data->buffer[j++] = 0xffff;
   525				}
   526			}
   527		}
   528	
   529		iio_push_to_buffers_with_timestamp(indio_dev, data->buffer,
   530			iio_get_time_ns(indio_dev));
   531	
   532	done:
   533		mutex_unlock(&data->mutex);
   534		iio_trigger_notify_done(indio_dev->trig);
   535	
   536		return IRQ_HANDLED;
   537	}
   538	

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

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

      reply	other threads:[~2020-07-28  4:46 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-27 14:47 [PATCH] iio: light: Support AMS AS73211 digital XYZ sensor Christian Eggers
2020-07-27 14:47 ` [PATCH 1/2] dt-bindings: iio: light: add AMS AS73211 support Christian Eggers
2020-07-27 18:15   ` Rob Herring
2020-07-27 14:47 ` [PATCH 2/2] iio: light: as73211: New driver Christian Eggers
2020-07-28  4:45   ` kernel 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=202007281229.IO7n9y8a%lkp@intel.com \
    --to=lkp@intel.com \
    --cc=ceggers@arri.de \
    --cc=devicetree@vger.kernel.org \
    --cc=jic23@kernel.org \
    --cc=kbuild-all@lists.01.org \
    --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 \
    --cc=robh+dt@kernel.org \
    /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