Re: [PATCH] rtc: pcf85063: add i2c_device_id name matching support
From: kernel test robot
Date: Thu Nov 04 2021 - 23:05:42 EST
Hi,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on abelloni/rtc-next]
[also build test WARNING on v5.15 next-20211104]
[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/ferlandm-amotus-ca/rtc-pcf85063-add-i2c_device_id-name-matching-support/20211104-214400
base: https://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux.git rtc-next
config: x86_64-randconfig-r034-20211105 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 847a6807332b13f43704327c2d30103ec0347c77)
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
# https://github.com/0day-ci/linux/commit/daa69a83cd9857be2bd3c58bfeb7f028253e6a4f
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review ferlandm-amotus-ca/rtc-pcf85063-add-i2c_device_id-name-matching-support/20211104-214400
git checkout daa69a83cd9857be2bd3c58bfeb7f028253e6a4f
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=x86_64
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/rtc/rtc-pcf85063.c:583:10: warning: cast to smaller integer type 'enum pcf85063_type' from 'const void *' [-Wvoid-pointer-to-enum-cast]
type = (enum pcf85063_type)of_device_get_match_data(&client->dev);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
vim +583 drivers/rtc/rtc-pcf85063.c
559
560 static int pcf85063_probe(struct i2c_client *client)
561 {
562 struct pcf85063 *pcf85063;
563 unsigned int tmp;
564 int err;
565 const struct pcf85063_config *config;
566 enum pcf85063_type type;
567 struct nvmem_config nvmem_cfg = {
568 .name = "pcf85063_nvram",
569 .reg_read = pcf85063_nvmem_read,
570 .reg_write = pcf85063_nvmem_write,
571 .type = NVMEM_TYPE_BATTERY_BACKED,
572 .size = 1,
573 };
574
575 dev_dbg(&client->dev, "%s\n", __func__);
576
577 pcf85063 = devm_kzalloc(&client->dev, sizeof(struct pcf85063),
578 GFP_KERNEL);
579 if (!pcf85063)
580 return -ENOMEM;
581
582 if (client->dev.of_node)
> 583 type = (enum pcf85063_type)of_device_get_match_data(&client->dev);
584 else
585 type = i2c_match_id(pcf85063_ids, client)->driver_data;
586
587 config = &pcf85063_cfg[type];
588
589 pcf85063->regmap = devm_regmap_init_i2c(client, &config->regmap);
590 if (IS_ERR(pcf85063->regmap))
591 return PTR_ERR(pcf85063->regmap);
592
593 i2c_set_clientdata(client, pcf85063);
594
595 err = regmap_read(pcf85063->regmap, PCF85063_REG_CTRL1, &tmp);
596 if (err) {
597 dev_err(&client->dev, "RTC chip is not present\n");
598 return err;
599 }
600
601 pcf85063->rtc = devm_rtc_allocate_device(&client->dev);
602 if (IS_ERR(pcf85063->rtc))
603 return PTR_ERR(pcf85063->rtc);
604
605 err = pcf85063_load_capacitance(pcf85063, client->dev.of_node,
606 config->force_cap_7000 ? 7000 : 0);
607 if (err < 0)
608 dev_warn(&client->dev, "failed to set xtal load capacitance: %d",
609 err);
610
611 pcf85063->rtc->ops = &pcf85063_rtc_ops;
612 pcf85063->rtc->range_min = RTC_TIMESTAMP_BEGIN_2000;
613 pcf85063->rtc->range_max = RTC_TIMESTAMP_END_2099;
614 pcf85063->rtc->uie_unsupported = 1;
615 clear_bit(RTC_FEATURE_ALARM, pcf85063->rtc->features);
616
617 if (config->has_alarms && client->irq > 0) {
618 err = devm_request_threaded_irq(&client->dev, client->irq,
619 NULL, pcf85063_rtc_handle_irq,
620 IRQF_TRIGGER_LOW | IRQF_ONESHOT,
621 "pcf85063", pcf85063);
622 if (err) {
623 dev_warn(&pcf85063->rtc->dev,
624 "unable to request IRQ, alarms disabled\n");
625 } else {
626 set_bit(RTC_FEATURE_ALARM, pcf85063->rtc->features);
627 device_init_wakeup(&client->dev, true);
628 err = dev_pm_set_wake_irq(&client->dev, client->irq);
629 if (err)
630 dev_err(&pcf85063->rtc->dev,
631 "failed to enable irq wake\n");
632 }
633 }
634
635 nvmem_cfg.priv = pcf85063->regmap;
636 devm_rtc_nvmem_register(pcf85063->rtc, &nvmem_cfg);
637
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx
Attachment:
.config.gz
Description: application/gzip