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 <l...@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-...@lists.01.org

Attachment: .config.gz
Description: application/gzip

Reply via email to