Re: [PATCH v11 3/5] iio: adc: Add Xilinx AMS driver

From: Jonathan Cameron
Date: Sat Nov 27 2021 - 12:47:39 EST


On Sat, 27 Nov 2021 10:43:11 +0800
kernel test robot <lkp@xxxxxxxxx> wrote:

> Hi Anand,
>
> Thank you for the patch! Perhaps something to improve:
>
> [auto build test WARNING on jic23-iio/togreg]
> [also build test WARNING on linux/master linus/master v5.16-rc2 next-20211126]
> [cannot apply to xilinx-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/20211125-065614
> base: https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git togreg
> config: powerpc64-randconfig-s032-20211126 (https://download.01.org/0day-ci/archive/20211127/202111271041.Cdu0In2E-lkp@xxxxxxxxx/config)
> compiler: powerpc64-linux-gcc (GCC) 11.2.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.4-dirty
> # https://github.com/0day-ci/linux/commit/9b07fe52c07c2e9f6eccd2f2050f69558904ed64
> git remote add linux-review https://github.com/0day-ci/linux
> git fetch --no-tags linux-review Anand-Ashok-Dumbre/Add-Xilinx-AMS-Driver/20211125-065614
> git checkout 9b07fe52c07c2e9f6eccd2f2050f69558904ed64
> # save the config file to linux build tree
> COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=powerpc SHELL=/bin/bash drivers/clk/ drivers/iio/adc/ drivers/pci/controller/
>
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@xxxxxxxxx>
>
>
> sparse warnings: (new ones prefixed by >>)
> >> drivers/iio/adc/xilinx-ams.c:1175:17: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void volatile [noderef] __iomem *addr @@ got void *data @@
> drivers/iio/adc/xilinx-ams.c:1175:17: sparse: expected void volatile [noderef] __iomem *addr
> drivers/iio/adc/xilinx-ams.c:1175:17: sparse: got void *data
> >> drivers/iio/adc/xilinx-ams.c:1192:69: sparse: sparse: incorrect type in argument 3 (different address spaces) @@ expected void *data @@ got void [noderef] __iomem *ps_base @@
> drivers/iio/adc/xilinx-ams.c:1192:69: sparse: expected void *data
> drivers/iio/adc/xilinx-ams.c:1192:69: sparse: got void [noderef] __iomem *ps_base
> >> drivers/iio/adc/xilinx-ams.c:1206:69: sparse: sparse: incorrect type in argument 3 (different address spaces) @@ expected void *data @@ got void [noderef] __iomem *pl_base @@
> drivers/iio/adc/xilinx-ams.c:1206:69: sparse: expected void *data
> drivers/iio/adc/xilinx-ams.c:1206:69: sparse: got void [noderef] __iomem *pl_base
>
> vim +1175 drivers/iio/adc/xilinx-ams.c
>
> 1172
> 1173 static void ams_iounmap(void *data)
> 1174 {
> > 1175 iounmap(data);
I guess you probably already fixed this, but I'd do it by passing the
containing structure in as the *data and then use
ams->pl_base to access it here.

It's a bit more code than we'd normally need but cleaner than force
changes to and from iomem via forcing the pointer conversions.

> 1176 }
> 1177
> 1178 static int ams_init_module(struct iio_dev *indio_dev,
> 1179 struct fwnode_handle *fwnode,
> 1180 struct iio_chan_spec *channels)
> 1181 {
> 1182 struct device *dev = indio_dev->dev.parent;
> 1183 struct ams *ams = iio_priv(indio_dev);
> 1184 int num_channels = 0;
> 1185 int ret;
> 1186
> 1187 if (fwnode_property_match_string(fwnode, "compatible",
> 1188 "xlnx,zynqmp-ams-ps") == 0) {
> 1189 ams->ps_base = fwnode_iomap(fwnode, 0);
> 1190 if (!ams->ps_base)
> 1191 return -ENXIO;
> > 1192 ret = devm_add_action_or_reset(dev, ams_iounmap, ams->ps_base);
> 1193 if (ret < 0)
> 1194 return ret;
> 1195
> 1196 /* add PS channels to iio device channels */
> 1197 memcpy(channels, ams_ps_channels,
> 1198 sizeof(ams_ps_channels));
> 1199 num_channels += ARRAY_SIZE(ams_ps_channels);
> 1200 } else if (fwnode_property_match_string(fwnode, "compatible",
> 1201 "xlnx,zynqmp-ams-pl") == 0) {
> 1202 ams->pl_base = fwnode_iomap(fwnode, 0);
> 1203 if (!ams->pl_base)
> 1204 return -ENXIO;
> 1205
> > 1206 ret = devm_add_action_or_reset(dev, ams_iounmap, ams->pl_base);
> 1207 if (ret < 0)
> 1208 return ret;
> 1209
> 1210 /* Copy only first 10 fix channels */
> 1211 memcpy(channels, ams_pl_channels,
> 1212 AMS_PL_MAX_FIXED_CHANNEL * sizeof(*channels));
> 1213 num_channels += AMS_PL_MAX_FIXED_CHANNEL;
> 1214
> 1215 num_channels = ams_get_ext_chan(fwnode, channels,
> 1216 num_channels);
> 1217 } else if (fwnode_property_match_string(fwnode, "compatible",
> 1218 "xlnx,zynqmp-ams") == 0) {
> 1219 /* add AMS channels to iio device channels */
> 1220 memcpy(channels, ams_ctrl_channels,
> 1221 sizeof(ams_ctrl_channels));
> 1222 num_channels += ARRAY_SIZE(ams_ctrl_channels);
> 1223 } else {
> 1224 return -EINVAL;
> 1225 }
> 1226
> 1227 return num_channels;
> 1228 }
> 1229
>
> ---
> 0-DAY CI Kernel Test Service, Intel Corporation
> https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx