Hi Gene,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on iio/togreg]
[also build test WARNING on v5.9-rc2 next-20200827]
[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/Gene-Chen/iio-adc-mt6360-Add-ADC-driver-for-MT6360/20200824-170948
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git togreg
config: i386-randconfig-s031-20200827 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.2-191-g10164920-dirty
        # save the attached .config to linux build tree
        make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=i386 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email protected]>


sparse warnings: (new ones prefixed by >>)

>> drivers/iio/adc/mt6360-adc.c:125:20: sparse: sparse: incorrect type in 
>> assignment (different base types) @@     expected unsigned short [assigned] 
>> [usertype] adc_enable @@     got restricted __be16 [usertype] @@
>> drivers/iio/adc/mt6360-adc.c:125:20: sparse:     expected unsigned short 
>> [assigned] [usertype] adc_enable
>> drivers/iio/adc/mt6360-adc.c:125:20: sparse:     got restricted __be16 
>> [usertype]
>> drivers/iio/adc/mt6360-adc.c:179:20: sparse: sparse: incorrect type in 
>> assignment (different base types) @@     expected unsigned short 
>> [addressable] [assigned] [usertype] adc_enable @@     got restricted __be16 
>> [usertype] @@
>> drivers/iio/adc/mt6360-adc.c:179:20: sparse:     expected unsigned short 
>> [addressable] [assigned] [usertype] adc_enable
   drivers/iio/adc/mt6360-adc.c:179:20: sparse:     got restricted __be16 
[usertype]

# 
https://github.com/0day-ci/linux/commit/0e757f71bbdf50d4dad3b79e5f30c7f2386ae082
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review 
Gene-Chen/iio-adc-mt6360-Add-ADC-driver-for-MT6360/20200824-170948
git checkout 0e757f71bbdf50d4dad3b79e5f30c7f2386ae082
vim +125 drivers/iio/adc/mt6360-adc.c

   106  
   107  static int mt6360_adc_read_processed(struct mt6360_adc_data *mad, int 
channel, int *val)
   108  {
   109          u16 adc_enable;
   110          u8 rpt[3];
   111          ktime_t start_t, predict_end_t;
   112          long timeout;
   113          int value, ret;
   114  
   115          mutex_lock(&mad->adc_lock);
   116  
   117          /* select preferred channel that we want */
   118          ret = regmap_update_bits(mad->regmap, MT6360_REG_PMUADCRPT1, 
MT6360_PREFERCH_MASK,
   119                                   channel << MT6360_PREFERCH_SHFT);
   120          if (ret)
   121                  goto out_adc;
   122  
   123          /* enable adc channel we want and adc_en */
   124          adc_enable = MT6360_ADCEN_MASK | BIT(channel);
 > 125          adc_enable = cpu_to_be16(adc_enable);
   126          ret = regmap_raw_write(mad->regmap, MT6360_REG_PMUADCCFG, (void 
*)&adc_enable, sizeof(u16));
   127          if (ret)
   128                  goto out_adc;
   129  
   130          start_t = ktime_get();
   131          predict_end_t = ktime_add_ms(mad->last_off_timestamps[channel], 
50);
   132  
   133          if (ktime_after(start_t, predict_end_t))
   134                  predict_end_t = ktime_add_ms(start_t, 25);
   135          else
   136                  predict_end_t = ktime_add_ms(start_t, 75);
   137  
   138          enable_irq(mad->irq);
   139  adc_retry:
   140          reinit_completion(&mad->adc_complete);
   141  
   142          /* wait for conversion to complete */
   143          timeout = wait_for_completion_timeout(&mad->adc_complete, 
msecs_to_jiffies(200));
   144          if (timeout == 0) {
   145                  ret = -ETIMEDOUT;
   146                  goto out_adc_conv;
   147          } else if (timeout < 0) {
   148                  ret = -EINTR;
   149                  goto out_adc_conv;
   150          }
   151  
   152          ret = regmap_raw_read(mad->regmap, MT6360_REG_PMUADCRPT1, rpt, 
sizeof(rpt));
   153          if (ret)
   154                  goto out_adc_conv;
   155  
   156          /* check the current reported channel */
   157          if ((rpt[0] & MT6360_RPTCH_MASK) != channel) {
   158                  dev_dbg(mad->dev, "not wanted channel report [%02x]\n", 
rpt[0]);
   159                  goto adc_retry;
   160          }
   161  
   162          if (!ktime_after(ktime_get(), predict_end_t)) {
   163                  dev_dbg(mad->dev, "time is not after one adc_conv_t\n");
   164                  goto adc_retry;
   165          }
   166  
   167          value = (rpt[1] << 8) | rpt[2];
   168  
   169          ret = mt6360_adc_convert_processed_val(mad, channel, &value);
   170          if (ret)
   171                  goto out_adc_conv;
   172  
   173          *val = value;
   174          ret = IIO_VAL_INT;
   175  
   176  out_adc_conv:
   177          disable_irq(mad->irq);
   178          adc_enable = MT6360_ADCEN_MASK;
 > 179          adc_enable = cpu_to_be16(adc_enable);
   180          regmap_raw_write(mad->regmap, MT6360_REG_PMUADCCFG, (void 
*)&adc_enable, sizeof(u16));
   181          mad->last_off_timestamps[channel] = ktime_get();
   182          /* set prefer channel to 0xf */
   183          regmap_update_bits(mad->regmap, MT6360_REG_PMUADCRPT1, 
MT6360_PREFERCH_MASK,
   184                             0xF << MT6360_PREFERCH_SHFT);
   185  out_adc:
   186          mutex_unlock(&mad->adc_lock);
   187  
   188          return ret;
   189  }
   190  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]

Attachment: .config.gz
Description: application/gzip

Reply via email to