Re: [PATCH 3/3] iio: addac: add AD74413R driver

From: kernel test robot
Date: Sun Oct 31 2021 - 18:51:45 EST


Hi Cosmin,

I love your patch! Yet something to improve:

[auto build test ERROR on jic23-iio/togreg]
[also build test ERROR on robh/for-next linus/master v5.15-rc7 next-20211029]
[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/Cosmin-Tanislav/iio-add-adddac-subdirectory/20211028-225639
base: https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git togreg
config: i386-allyesconfig (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce (this is a W=1 build):
# https://github.com/0day-ci/linux/commit/94ef24d0c0f35d99ddebc9dda85e262b70ea87db
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Cosmin-Tanislav/iio-add-adddac-subdirectory/20211028-225639
git checkout 94ef24d0c0f35d99ddebc9dda85e262b70ea87db
# save the attached .config to linux build tree
mkdir build_dir
make W=1 O=build_dir ARCH=i386 SHELL=/bin/bash

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

All errors (new ones prefixed by >>):

drivers/iio/addac/ad74413r.c: In function 'ad74413r_probe':
>> drivers/iio/addac/ad74413r.c:1289:72: error: 'struct iio_dev' has no member named 'id'
1289 | st->trig = devm_iio_trigger_alloc(st->dev, "%s-dev%d", name, indio_dev->id);
| ^~


vim +1289 drivers/iio/addac/ad74413r.c

1202
1203 static int ad74413r_probe(struct spi_device *spi)
1204 {
1205 struct ad74413r_state *st;
1206 struct iio_dev *indio_dev;
1207 unsigned int sillicon_rev_id;
1208 const char *name;
1209 int ret;
1210
1211 indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*st));
1212 if (indio_dev == NULL)
1213 return -ENOMEM;
1214
1215 st = iio_priv(indio_dev);
1216 spi_set_drvdata(spi, st);
1217
1218 st->spi = spi;
1219 st->dev = &spi->dev;
1220 st->config = of_device_get_match_data(&spi->dev);
1221 st->indio_dev = indio_dev;
1222 mutex_init(&st->lock);
1223 init_completion(&st->adc_data_completion);
1224
1225 name = dev_name(st->dev);
1226
1227 st->regmap = devm_regmap_init(st->dev, NULL, &spi->dev, &ad74413r_regmap_config);
1228 if (IS_ERR(st->regmap)) {
1229 ret = PTR_ERR(st->regmap);
1230 dev_err(st->dev, "Failed to create regmap: %d\n", ret);
1231 return ret;
1232 }
1233
1234 ret = regmap_read(st->regmap, AD74413R_REG_SILLICON_REV, &sillicon_rev_id);
1235 if (ret) {
1236 dev_err(st->dev, "Failed to read sillicon rev: %d\n", ret);
1237 return ret;
1238 }
1239
1240 sillicon_rev_id = FIELD_GET(AD74413R_SILLICON_REV_ID_MASK, sillicon_rev_id);
1241 if (sillicon_rev_id != AD74413R_SILLICON_REV_ID_EXPECTED) {
1242 dev_err(st->dev, "Read sillicon rev id %d does not match expected rev id %d\n",
1243 sillicon_rev_id, AD74413R_SILLICON_REV_ID_EXPECTED);
1244 return -EINVAL;
1245 }
1246
1247 st->refin_reg = devm_regulator_get(st->dev, "refin");
1248 if (IS_ERR(st->refin_reg)) {
1249 dev_err(st->dev, "Failed to get refin regulator: %d\n", ret);
1250 return PTR_ERR(st->refin_reg);
1251 }
1252
1253 ret = regulator_enable(st->refin_reg);
1254 if (ret) {
1255 dev_err(st->dev, "Failed to enable refin regulator: %d\n", ret);
1256 return ret;
1257 }
1258
1259 ret = devm_add_action_or_reset(st->dev, ad74413r_regulator_disable,
1260 st->refin_reg);
1261 if (ret) {
1262 dev_err(st->dev, "Failed to add refin regulator disable action: %d\n", ret);
1263 return ret;
1264 }
1265
1266 ret = of_property_read_u32(st->dev->of_node, "adi,rsense-resistance-ohms",
1267 &st->rsense_resistance_ohms);
1268 if (ret) {
1269 dev_err(st->dev, "Failed to get rsense resistance: %d\n", ret);
1270 return ret;
1271 }
1272
1273 st->gpiochip.label = name;
1274 st->gpiochip.base = -1;
1275 st->gpiochip.ngpio = AD74413R_CHANNEL_MAX;
1276 st->gpiochip.parent = st->dev;
1277 st->gpiochip.can_sleep = true;
1278 st->gpiochip.set = ad74413r_gpio_set;
1279 st->gpiochip.set_multiple = ad74413r_gpio_set_multiple;
1280 st->gpiochip.owner = THIS_MODULE;
1281 st->gpiochip.get = ad74413r_gpio_get;
1282
1283 ret = devm_gpiochip_add_data(st->dev, &st->gpiochip, st);
1284 if (ret) {
1285 dev_err(st->dev, "Failed to add gpio chip: %d\n", ret);
1286 return ret;
1287 }
1288
> 1289 st->trig = devm_iio_trigger_alloc(st->dev, "%s-dev%d", name, indio_dev->id);
1290 if (!st->trig)
1291 return -ENOMEM;
1292
1293 st->trig->ops = &ad74413r_trigger_ops;
1294 st->trig->dev.parent = st->dev;
1295 iio_trigger_set_drvdata(st->trig, st);
1296
1297 ret = devm_iio_trigger_register(st->dev, st->trig);
1298 if (ret)
1299 return ret;
1300
1301 indio_dev->dev.parent = st->dev;
1302 indio_dev->name = name;
1303 indio_dev->modes = INDIO_DIRECT_MODE | INDIO_BUFFER_SOFTWARE;
1304 indio_dev->info = &ad74413r_info;
1305 indio_dev->trig = iio_trigger_get(st->trig);
1306
1307 ret = ad74413r_parse_channel_configs(st);
1308 if (ret)
1309 return ret;
1310
1311 ret = ad74413r_count_iio_channels(st);
1312 if (ret)
1313 return ret;
1314
1315 ret = ad74413r_setup_iio_channels(st);
1316 if (ret) {
1317 dev_err(st->dev, "Failed to setup iio channels: %d\n", ret);
1318 return ret;
1319 }
1320
1321 ret = ad74413r_set_adc_conv_seq(st, AD74413R_CONV_SEQ_OFF);
1322 if (ret)
1323 return ret;
1324
1325 ret = devm_request_irq(st->dev, spi->irq, ad74413r_adc_data_interrupt,
1326 IRQF_TRIGGER_FALLING, name, st);
1327 if (ret) {
1328 dev_err(st->dev, "Failed to request threaded irq: %d\n", ret);
1329 return ret;
1330 }
1331
1332 ret = devm_iio_triggered_buffer_setup(st->dev, indio_dev, &iio_pollfunc_store_time,
1333 &ad74413r_trigger_handler, &ad74413r_buffer_ops);
1334 if (ret) {
1335 dev_err(st->dev, "Failed to setup triggered buffer: %d\n", ret);
1336 return ret;
1337 }
1338
1339 return devm_iio_device_register(st->dev, indio_dev);
1340 }
1341

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

Attachment: .config.gz
Description: application/gzip