Re: [PATCH v6 2/4] iio: adc: Add Xilinx AMS driver

From: kernel test robot
Date: Thu Jul 01 2021 - 04:01:44 EST


Hi Anand,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on iio/togreg]
[also build test WARNING on linus/master v5.13]
[cannot apply to xlnx/master]
[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/Anand-Ashok-Dumbre/Add-Xilinx-AMS-Driver/20210625-023047
base: https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git togreg
config: riscv-randconfig-r022-20210701 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project e7e71e9454ed76c1b3d8140170b5333c28bef1be)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install riscv cross compiling tool for clang build
# apt-get install binutils-riscv64-linux-gnu
# https://github.com/0day-ci/linux/commit/fa0ea7aaf7a9bff3781f19596b07fe33c6ef531d
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Anand-Ashok-Dumbre/Add-Xilinx-AMS-Driver/20210625-023047
git checkout fa0ea7aaf7a9bff3781f19596b07fe33c6ef531d
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=riscv

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

All warnings (new ones prefixed by >>):

>> drivers/iio/adc/xilinx-ams.c:631:10: warning: signed shift result (0x446A60000) requires 36 bits to represent, but 'long' only has 32 bits [-Wshift-overflow]
*val = AMS_TEMP_OFFSET;
^~~~~~~~~~~~~~~
drivers/iio/adc/xilinx-ams.c:151:38: note: expanded from macro 'AMS_TEMP_OFFSET'
#define AMS_TEMP_OFFSET -((280230L << 16) / 509314)
~~~~~~~ ^ ~~
>> drivers/iio/adc/xilinx-ams.c:1126:35: warning: variable 'chan_node' is uninitialized when used here [-Wuninitialized]
num_channels = ams_get_ext_chan(chan_node, channels,
^~~~~~~~~
drivers/iio/adc/xilinx-ams.c:1104:31: note: initialize the variable 'chan_node' to silence this warning
struct device_node *chan_node;
^
= NULL
2 warnings generated.

Kconfig warnings: (for reference only)
WARNING: unmet direct dependencies detected for LOCKDEP
Depends on DEBUG_KERNEL && LOCK_DEBUGGING_SUPPORT && (FRAME_POINTER || MIPS || PPC || S390 || MICROBLAZE || ARM || ARC || X86)
Selected by
- PROVE_LOCKING && DEBUG_KERNEL && LOCK_DEBUGGING_SUPPORT
- DEBUG_LOCK_ALLOC && DEBUG_KERNEL && LOCK_DEBUGGING_SUPPORT


vim +/long +631 drivers/iio/adc/xilinx-ams.c

554
555 static int ams_read_raw(struct iio_dev *indio_dev,
556 struct iio_chan_spec const *chan,
557 int *val, int *val2, long mask)
558 {
559 struct ams *ams = iio_priv(indio_dev);
560 int ret;
561
562 switch (mask) {
563 case IIO_CHAN_INFO_RAW:
564 mutex_lock(&ams->lock);
565 if (chan->scan_index >= (AMS_PS_SEQ_MAX * 3)) {
566 ret = ams_read_vcc_reg(ams, chan->address, val);
567 if (ret) {
568 mutex_unlock(&ams->lock);
569 return -EINVAL;
570 }
571 ams_enable_channel_sequence(indio_dev);
572 } else if (chan->scan_index >= AMS_PS_SEQ_MAX)
573 *val = readl(ams->pl_base + chan->address);
574 else
575 *val = readl(ams->ps_base + chan->address);
576 mutex_unlock(&ams->lock);
577
578 return IIO_VAL_INT;
579 case IIO_CHAN_INFO_SCALE:
580 switch (chan->type) {
581 case IIO_VOLTAGE:
582 switch (chan->address) {
583 case AMS_SUPPLY1:
584 case AMS_SUPPLY2:
585 case AMS_SUPPLY3:
586 case AMS_SUPPLY4:
587 *val = AMS_SUPPLY_SCALE_3VOLT;
588 break;
589 case AMS_SUPPLY5:
590 case AMS_SUPPLY6:
591 if (chan->scan_index < AMS_PS_SEQ_MAX)
592 *val = AMS_SUPPLY_SCALE_6VOLT;
593 else
594 *val = AMS_SUPPLY_SCALE_3VOLT;
595 break;
596 case AMS_SUPPLY7:
597 case AMS_SUPPLY8:
598 *val = AMS_SUPPLY_SCALE_6VOLT;
599 break;
600 case AMS_SUPPLY9:
601 case AMS_SUPPLY10:
602 if (chan->scan_index < AMS_PS_SEQ_MAX)
603 *val = AMS_SUPPLY_SCALE_3VOLT;
604 else
605 *val = AMS_SUPPLY_SCALE_6VOLT;
606 break;
607 case AMS_VCC_PSPLL0:
608 case AMS_VCC_PSPLL3:
609 case AMS_VCCINT:
610 case AMS_VCCBRAM:
611 case AMS_VCCAUX:
612 case AMS_PSDDRPLL:
613 case AMS_PSINTFPDDR:
614 *val = AMS_SUPPLY_SCALE_3VOLT;
615 break;
616 default:
617 *val = AMS_SUPPLY_SCALE_1VOLT;
618 break;
619 }
620 *val2 = AMS_SUPPLY_SCALE_DIV_BIT;
621 return IIO_VAL_FRACTIONAL_LOG2;
622 case IIO_TEMP:
623 *val = AMS_TEMP_SCALE;
624 *val2 = AMS_TEMP_SCALE_DIV_BIT;
625 return IIO_VAL_FRACTIONAL_LOG2;
626 default:
627 return -EINVAL;
628 }
629 case IIO_CHAN_INFO_OFFSET:
630 /* Only the temperature channel has an offset */
> 631 *val = AMS_TEMP_OFFSET;
632 return IIO_VAL_INT;
633 }
634
635 return -EINVAL;
636 }
637

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

Attachment: .config.gz
Description: application/gzip