Re: [PATCH v6 1/2] drivers: rtc: add max313xx series rtc driver

From: kernel test robot
Date: Sat Feb 03 2024 - 02:08:40 EST


Hi Chris,

kernel test robot noticed the following build warnings:

[auto build test WARNING on abelloni/rtc-next]
[also build test WARNING on robh/for-next linus/master v6.8-rc2 next-20240202]
[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#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Chris-Packham/drivers-rtc-add-max313xx-series-rtc-driver/20240202-105538
base: https://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux.git rtc-next
patch link: https://lore.kernel.org/r/20240202025241.834283-2-chris.packham%40alliedtelesis.co.nz
patch subject: [PATCH v6 1/2] drivers: rtc: add max313xx series rtc driver
config: i386-randconfig-063-20240203 (https://download.01.org/0day-ci/archive/20240203/202402031414.zapkL312-lkp@xxxxxxxxx/config)
compiler: clang version 17.0.6 (https://github.com/llvm/llvm-project 6009708b4367171ccdbf4b5905cb6a803753fe18)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240203/202402031414.zapkL312-lkp@xxxxxxxxx/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202402031414.zapkL312-lkp@xxxxxxxxx/

sparse warnings: (new ones prefixed by >>)
>> drivers/rtc/rtc-max313xx.c:546:21: sparse: sparse: symbol 'max313xx_nvmem_cfg' was not declared. Should it be static?
>> drivers/rtc/rtc-max313xx.c:656:22: sparse: sparse: symbol 'max313xx_clk_init' was not declared. Should it be static?

vim +/max313xx_nvmem_cfg +546 drivers/rtc/rtc-max313xx.c

545
> 546 struct nvmem_config max313xx_nvmem_cfg = {
547 .reg_read = max313xx_nvmem_reg_read,
548 .reg_write = max313xx_nvmem_reg_write,
549 .word_size = 8,
550 };
551
552 static unsigned long max313xx_clkout_recalc_rate(struct clk_hw *hw,
553 unsigned long parent_rate)
554 {
555 struct max313xx *rtc = clk_hw_to_max313xx(hw);
556 const struct clkout_cfg *clkout = rtc->chip->clkout;
557 unsigned int freq_mask;
558 unsigned int reg;
559 int ret;
560
561 ret = regmap_read(rtc->regmap, clkout->reg, &reg);
562 if (ret)
563 return 0;
564
565 freq_mask = __roundup_pow_of_two(clkout->freq_size) - 1;
566
567 return clkout->freq_avail[(reg >> clkout->freq_pos) & freq_mask];
568 }
569
570 static long max313xx_clkout_round_rate(struct clk_hw *hw, unsigned long rate,
571 unsigned long *prate)
572 {
573 struct max313xx *rtc = clk_hw_to_max313xx(hw);
574 struct clkout_cfg *clkout = rtc->chip->clkout;
575 int index;
576
577 index = find_closest(rate, clkout->freq_avail, clkout->freq_size);
578 return clkout->freq_avail[index];
579 }
580
581 static int max313xx_clkout_set_rate(struct clk_hw *hw, unsigned long rate,
582 unsigned long parent_rate)
583 {
584 struct max313xx *rtc = clk_hw_to_max313xx(hw);
585 struct clkout_cfg *clkout = rtc->chip->clkout;
586 unsigned int freq_mask;
587 int index;
588
589 index = find_closest(rate, clkout->freq_avail, clkout->freq_size);
590 freq_mask = __roundup_pow_of_two(clkout->freq_size) - 1;
591
592 return regmap_update_bits(rtc->regmap, clkout->reg,
593 freq_mask << clkout->freq_pos,
594 index << clkout->freq_pos);
595 }
596
597 static int max313xx_clkout_enable(struct clk_hw *hw)
598 {
599 struct max313xx *rtc = clk_hw_to_max313xx(hw);
600 struct clkout_cfg *clkout = rtc->chip->clkout;
601
602 if (clkout->en_invert)
603 return regmap_clear_bits(rtc->regmap, clkout->reg,
604 clkout->en_bit);
605
606 return regmap_set_bits(rtc->regmap, clkout->reg, clkout->en_bit);
607 }
608
609 static void max313xx_clkout_disable(struct clk_hw *hw)
610 {
611 struct max313xx *rtc = clk_hw_to_max313xx(hw);
612 struct clkout_cfg *clkout = rtc->chip->clkout;
613
614 switch (rtc->id) {
615 case ID_MAX31331:
616 case ID_MAX31334:
617 if (rtc->irq > 0) {
618 dev_err(rtc->rtc->dev.parent,
619 "clkout cannot be disabled when IRQ is requested");
620 return;
621 }
622 break;
623 default:
624 break;
625 }
626
627 if (clkout->en_invert)
628 regmap_set_bits(rtc->regmap, clkout->reg, clkout->en_bit);
629 else
630 regmap_clear_bits(rtc->regmap, clkout->reg, clkout->en_bit);
631 }
632
633 static int max313xx_clkout_is_enabled(struct clk_hw *hw)
634 {
635 struct max313xx *rtc = clk_hw_to_max313xx(hw);
636 struct clkout_cfg *clkout = rtc->chip->clkout;
637 unsigned int reg;
638 int ret;
639
640 ret = regmap_read(rtc->regmap, clkout->reg, &reg);
641 if (ret)
642 return ret;
643
644 return !!(reg & clkout->en_bit) ^ clkout->en_invert;
645 }
646
647 static const struct clk_ops max313xx_clkout_ops = {
648 .recalc_rate = max313xx_clkout_recalc_rate,
649 .round_rate = max313xx_clkout_round_rate,
650 .set_rate = max313xx_clkout_set_rate,
651 .enable = max313xx_clkout_enable,
652 .disable = max313xx_clkout_disable,
653 .is_enabled = max313xx_clkout_is_enabled,
654 };
655
> 656 struct clk_init_data max313xx_clk_init = {
657 .name = "max313xx-clkout",
658 .ops = &max313xx_clkout_ops,
659 };
660

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki