[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <202012030032.v036FZYj-lkp@intel.com>
Date: Thu, 3 Dec 2020 01:10:00 +0800
From: kernel test robot <lkp@...el.com>
To: Biwen Li <biwen.li@....nxp.com>, leoyang.li@....com,
alexandre.belloni@...tlin.com, anson.huang@....com,
aisheng.dong@....com
Cc: kbuild-all@...ts.01.org, clang-built-linux@...glegroups.com,
linux-kernel@...r.kernel.org, jiafei.pan@....com,
linux-rtc@...r.kernel.org, Biwen Li <biwen.li@....com>
Subject: Re: [PATCH] rtc: pcf2127: clear the flag TSF1 before enabling
interrupt generation
Hi Biwen,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on abelloni/rtc-next]
[also build test WARNING on v5.10-rc6 next-20201201]
[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/Biwen-Li/rtc-pcf2127-clear-the-flag-TSF1-before-enabling-interrupt-generation/20201201-165409
base: https://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux.git rtc-next
config: arm64-randconfig-r014-20201202 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 2671fccf0381769276ca8246ec0499adcb9b0355)
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 arm64 cross compiling tool for clang build
# apt-get install binutils-aarch64-linux-gnu
# https://github.com/0day-ci/linux/commit/54db60db88e4fd3ab6ac26f9a5b4768316347f95
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Biwen-Li/rtc-pcf2127-clear-the-flag-TSF1-before-enabling-interrupt-generation/20201201-165409
git checkout 54db60db88e4fd3ab6ac26f9a5b4768316347f95
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm64
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/rtc/rtc-pcf2127.c:629:16: warning: operator '?:' has lower precedence than '|'; '|' will be evaluated first [-Wbitwise-conditional-parentheses]
has_nvmem ? (PCF2127_BIT_WD_CTL_CD0) : (0) |
~~~~~~~~~ ^
drivers/rtc/rtc-pcf2127.c:629:16: note: place parentheses around the '|' expression to silence this warning
has_nvmem ? (PCF2127_BIT_WD_CTL_CD0) : (0) |
~~~~~~~~~ ^
drivers/rtc/rtc-pcf2127.c:629:16: note: place parentheses around the '?:' expression to evaluate it first
has_nvmem ? (PCF2127_BIT_WD_CTL_CD0) : (0) |
~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
vim +629 drivers/rtc/rtc-pcf2127.c
560
561 static int pcf2127_probe(struct device *dev, struct regmap *regmap,
562 int alarm_irq, const char *name, bool has_nvmem)
563 {
564 struct pcf2127 *pcf2127;
565 int ret = 0;
566
567 dev_dbg(dev, "%s\n", __func__);
568
569 pcf2127 = devm_kzalloc(dev, sizeof(*pcf2127), GFP_KERNEL);
570 if (!pcf2127)
571 return -ENOMEM;
572
573 pcf2127->regmap = regmap;
574
575 dev_set_drvdata(dev, pcf2127);
576
577 pcf2127->rtc = devm_rtc_allocate_device(dev);
578 if (IS_ERR(pcf2127->rtc))
579 return PTR_ERR(pcf2127->rtc);
580
581 pcf2127->rtc->ops = &pcf2127_rtc_ops;
582 pcf2127->rtc->range_min = RTC_TIMESTAMP_BEGIN_2000;
583 pcf2127->rtc->range_max = RTC_TIMESTAMP_END_2099;
584 pcf2127->rtc->set_start_time = true; /* Sets actual start to 1970 */
585 pcf2127->rtc->uie_unsupported = 1;
586
587 if (alarm_irq > 0) {
588 ret = devm_request_threaded_irq(dev, alarm_irq, NULL,
589 pcf2127_rtc_irq,
590 IRQF_TRIGGER_LOW | IRQF_ONESHOT,
591 dev_name(dev), dev);
592 if (ret) {
593 dev_err(dev, "failed to request alarm irq\n");
594 return ret;
595 }
596 }
597
598 if (alarm_irq > 0 || device_property_read_bool(dev, "wakeup-source")) {
599 device_init_wakeup(dev, true);
600 pcf2127->rtc->ops = &pcf2127_rtc_alrm_ops;
601 }
602
603 if (has_nvmem) {
604 struct nvmem_config nvmem_cfg = {
605 .priv = pcf2127,
606 .reg_read = pcf2127_nvmem_read,
607 .reg_write = pcf2127_nvmem_write,
608 .size = 512,
609 };
610
611 ret = devm_rtc_nvmem_register(pcf2127->rtc, &nvmem_cfg);
612 }
613
614 /*
615 * Watchdog timer enabled and reset pin /RST activated when timed out.
616 * Select 1Hz clock source for watchdog timer.
617 * Note: Countdown timer disabled and not available.
618 * For pca2129, pcf2129, only bit[7] is for Symbol WD_CD
619 * of register watchdg_tim_ctl. The bit[6] is labeled
620 * as T. Bits labeled as T must always be written with
621 * logic 0.
622 */
623 ret = regmap_update_bits(pcf2127->regmap, PCF2127_REG_WD_CTL,
624 PCF2127_BIT_WD_CTL_CD1 |
625 PCF2127_BIT_WD_CTL_CD0 |
626 PCF2127_BIT_WD_CTL_TF1 |
627 PCF2127_BIT_WD_CTL_TF0,
628 PCF2127_BIT_WD_CTL_CD1 |
> 629 has_nvmem ? (PCF2127_BIT_WD_CTL_CD0) : (0) |
630 PCF2127_BIT_WD_CTL_TF1);
631 if (ret) {
632 dev_err(dev, "%s: watchdog config (wd_ctl) failed\n", __func__);
633 return ret;
634 }
635
636 pcf2127_watchdog_init(dev, pcf2127);
637
638 /*
639 * Disable battery low/switch-over timestamp and interrupts.
640 * Clear battery interrupt flags which can block new trigger events.
641 * Note: This is the default chip behaviour but added to ensure
642 * correct tamper timestamp and interrupt function.
643 */
644 ret = regmap_update_bits(pcf2127->regmap, PCF2127_REG_CTRL3,
645 PCF2127_BIT_CTRL3_BTSE |
646 PCF2127_BIT_CTRL3_BIE |
647 PCF2127_BIT_CTRL3_BLIE, 0);
648 if (ret) {
649 dev_err(dev, "%s: interrupt config (ctrl3) failed\n",
650 __func__);
651 return ret;
652 }
653
654 /*
655 * Enable timestamp function and store timestamp of first trigger
656 * event until TSF1 and TFS2 interrupt flags are cleared.
657 */
658 ret = regmap_update_bits(pcf2127->regmap, PCF2127_REG_TS_CTRL,
659 PCF2127_BIT_TS_CTRL_TSOFF |
660 PCF2127_BIT_TS_CTRL_TSM,
661 PCF2127_BIT_TS_CTRL_TSM);
662 if (ret) {
663 dev_err(dev, "%s: tamper detection config (ts_ctrl) failed\n",
664 __func__);
665 return ret;
666 }
667
668 /*
669 * Clear TSF1 field of ctrl1 register to clear interrupt
670 * before enabling interrupt generation when
671 * timestamp flag set. Unless the flag TSF1 won't
672 * be cleared and the interrupt(INT pin) is
673 * triggered continueously.
674 */
675 ret = regmap_update_bits(pcf2127->regmap, PCF2127_REG_CTRL1,
676 PCF2127_BIT_CTRL1_TSF1,
677 0);
678 if (ret) {
679 dev_err(dev, "%s: control and status register 1 (ctrl1) failed, ret = 0x%x\n",
680 __func__, ret);
681 return ret;
682 }
683 /*
684 * Enable interrupt generation when TSF1 or TSF2 timestamp flags
685 * are set. Interrupt signal is an open-drain output and can be
686 * left floating if unused.
687 */
688 ret = regmap_update_bits(pcf2127->regmap, PCF2127_REG_CTRL2,
689 PCF2127_BIT_CTRL2_TSIE,
690 PCF2127_BIT_CTRL2_TSIE);
691 if (ret) {
692 dev_err(dev, "%s: tamper detection config (ctrl2) failed\n",
693 __func__);
694 return ret;
695 }
696
697 ret = rtc_add_group(pcf2127->rtc, &pcf2127_attr_group);
698 if (ret) {
699 dev_err(dev, "%s: tamper sysfs registering failed\n",
700 __func__);
701 return ret;
702 }
703
704 return devm_rtc_register_device(pcf2127->rtc);
705 }
706
---
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" (36431 bytes)
Powered by blists - more mailing lists