[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <202106170221.fGCSlK4p-lkp@intel.com>
Date: Thu, 17 Jun 2021 02:59:48 +0800
From: kernel test robot <lkp@...el.com>
To: Jiri Prchal <jiri.prchal@...ignal.cz>, devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org
Cc: kbuild-all@...ts.01.org, clang-built-linux@...glegroups.com,
Rob Herring <robh+dt@...nel.org>,
Christian Eggers <ceggers@...i.de>,
Arnd Bergmann <arnd@...db.de>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Jiri Prchal <jiri.prchal@...ignal.cz>,
kernel test robot <lkp@...el.com>
Subject: Re: [PATCH v10 2/4] nvmem: eeprom: at25: add support for FRAM
Hi Jiri,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on robh/for-next]
[also build test WARNING on linux/master linus/master v5.13-rc6]
[cannot apply to char-misc/char-misc-testing next-20210616]
[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/Jiri-Prchal/add-support-for-FRAM/20210616-203024
base: https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next
config: x86_64-randconfig-a015-20210615 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 64720f57bea6a6bf033feef4a5751ab9c0c3b401)
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 x86_64 cross compiling tool for clang build
# apt-get install binutils-x86-64-linux-gnu
# https://github.com/0day-ci/linux/commit/663658b01091a6ef4239088cc41d96821ab6d43e
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Jiri-Prchal/add-support-for-FRAM/20210616-203024
git checkout 663658b01091a6ef4239088cc41d96821ab6d43e
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@...el.com>
All warnings (new ones prefixed by >>):
>> drivers/misc/eeprom/at25.c:367:13: warning: cast to smaller integer type 'int' from 'const void *' [-Wvoid-pointer-to-int-cast]
is_fram = (int)match->data;
^~~~~~~~~~~~~~~~
1 warning generated.
vim +367 drivers/misc/eeprom/at25.c
354
355 static int at25_probe(struct spi_device *spi)
356 {
357 struct at25_data *at25 = NULL;
358 struct spi_eeprom chip;
359 int err;
360 int sr;
361 u8 id[FM25_ID_LEN];
362 const struct of_device_id *match;
363 int is_fram = 0;
364
365 match = of_match_device(of_match_ptr(at25_of_match), &spi->dev);
366 if (match)
> 367 is_fram = (int)match->data;
368
369 /* Chip description */
370 if (!spi->dev.platform_data) {
371 if (!is_fram) {
372 err = at25_fw_to_chip(&spi->dev, &chip);
373 if (err)
374 return err;
375 }
376 } else
377 chip = *(struct spi_eeprom *)spi->dev.platform_data;
378
379 /* Ping the chip ... the status register is pretty portable,
380 * unlike probing manufacturer IDs. We do expect that system
381 * firmware didn't write it in the past few milliseconds!
382 */
383 sr = spi_w8r8(spi, AT25_RDSR);
384 if (sr < 0 || sr & AT25_SR_nRDY) {
385 dev_dbg(&spi->dev, "rdsr --> %d (%02x)\n", sr, sr);
386 return -ENXIO;
387 }
388
389 at25 = devm_kzalloc(&spi->dev, sizeof(struct at25_data), GFP_KERNEL);
390 if (!at25)
391 return -ENOMEM;
392
393 mutex_init(&at25->lock);
394 at25->chip = chip;
395 at25->spi = spi;
396 spi_set_drvdata(spi, at25);
397
398 if (is_fram) {
399 /* Get ID of chip */
400 fm25_aux_read(at25, id, FM25_RDID, FM25_ID_LEN);
401 if (id[6] != 0xc2) {
402 dev_err(&spi->dev,
403 "Error: no Cypress FRAM (id %02x)\n", id[6]);
404 return -ENODEV;
405 }
406 /* set size found in ID */
407 if (id[7] < 0x21 || id[7] > 0x26) {
408 dev_err(&spi->dev, "Error: unsupported size (id %02x)\n", id[7]);
409 return -ENODEV;
410 }
411 chip.byte_len = int_pow(2, id[7] - 0x21 + 4) * 1024;
412
413 if (at25->chip.byte_len > 64 * 1024)
414 at25->chip.flags |= EE_ADDR3;
415 else
416 at25->chip.flags |= EE_ADDR2;
417
418 at25->chip.page_size = PAGE_SIZE;
419 strncpy(at25->chip.name, "fm25", sizeof(at25->chip.name));
420 }
421
422 /* For now we only support 8/16/24 bit addressing */
423 if (at25->chip.flags & EE_ADDR1)
424 at25->addrlen = 1;
425 else if (at25->chip.flags & EE_ADDR2)
426 at25->addrlen = 2;
427 else if (at25->chip.flags & EE_ADDR3)
428 at25->addrlen = 3;
429 else {
430 dev_dbg(&spi->dev, "unsupported address type\n");
431 return -EINVAL;
432 }
433
434 at25->nvmem_config.type = is_fram ? NVMEM_TYPE_FRAM : NVMEM_TYPE_EEPROM;
435 at25->nvmem_config.name = dev_name(&spi->dev);
436 at25->nvmem_config.dev = &spi->dev;
437 at25->nvmem_config.read_only = chip.flags & EE_READONLY;
438 at25->nvmem_config.root_only = true;
439 at25->nvmem_config.owner = THIS_MODULE;
440 at25->nvmem_config.compat = true;
441 at25->nvmem_config.base_dev = &spi->dev;
442 at25->nvmem_config.reg_read = at25_ee_read;
443 at25->nvmem_config.reg_write = at25_ee_write;
444 at25->nvmem_config.priv = at25;
445 at25->nvmem_config.stride = 1;
446 at25->nvmem_config.word_size = 1;
447 at25->nvmem_config.size = chip.byte_len;
448
449 at25->nvmem = devm_nvmem_register(&spi->dev, &at25->nvmem_config);
450 if (IS_ERR(at25->nvmem))
451 return PTR_ERR(at25->nvmem);
452
453 dev_info(&spi->dev, "%d %s %s %s%s, pagesize %u\n",
454 (chip.byte_len < 1024) ? chip.byte_len : (chip.byte_len / 1024),
455 (chip.byte_len < 1024) ? "Byte" : "KByte",
456 at25->chip.name, is_fram ? "fram" : "eeprom",
457 (chip.flags & EE_READONLY) ? " (readonly)" : "",
458 at25->chip.page_size);
459 return 0;
460 }
461
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Download attachment ".config.gz" of type "application/gzip" (40655 bytes)
Powered by blists - more mailing lists