[PATCH] rtc: at91sma9: Simplify using devm_clk_get_enabled()

kernel test robot lkp at intel.com
Thu Mar 25 01:11:49 GMT 2021


Hi "Uwe,

I love your patch! Perhaps something to improve:

[auto build test WARNING on abelloni/rtc-next]
[also build test WARNING on v5.12-rc4 next-20210324]
[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/Uwe-Kleine-K-nig/rtc-at91sma9-Simplify-using-devm_clk_get_enabled/20210325-042956
base:   https://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux.git rtc-next
config: arc-allyesconfig (attached as .config)
compiler: arceb-elf-gcc (GCC) 9.3.0
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/782e62ed210e25e760c5607b2ac2dbf16f56ea0f
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Uwe-Kleine-K-nig/rtc-at91sma9-Simplify-using-devm_clk_get_enabled/20210325-042956
        git checkout 782e62ed210e25e760c5607b2ac2dbf16f56ea0f
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=arc 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp at intel.com>

All warnings (new ones prefixed by >>):

   drivers/rtc/rtc-at91sam9.c: In function 'at91_rtc_probe':
   drivers/rtc/rtc-at91sam9.c:377:14: error: implicit declaration of function 'devm_clk_get_enabled'; did you mean 'memcg_kmem_enabled'? [-Werror=implicit-function-declaration]
     377 |  rtc->sclk = devm_clk_get_enabled(&pdev->dev, NULL);
         |              ^~~~~~~~~~~~~~~~~~~~
         |              memcg_kmem_enabled
>> drivers/rtc/rtc-at91sam9.c:377:12: warning: assignment to 'struct clk *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     377 |  rtc->sclk = devm_clk_get_enabled(&pdev->dev, NULL);
         |            ^
   cc1: some warnings being treated as errors


vim +377 drivers/rtc/rtc-at91sam9.c

   331	
   332	/*
   333	 * Initialize and install RTC driver
   334	 */
   335	static int at91_rtc_probe(struct platform_device *pdev)
   336	{
   337		struct sam9_rtc	*rtc;
   338		int		ret, irq;
   339		u32		mr;
   340		unsigned int	sclk_rate;
   341		struct of_phandle_args args;
   342	
   343		irq = platform_get_irq(pdev, 0);
   344		if (irq < 0)
   345			return irq;
   346	
   347		rtc = devm_kzalloc(&pdev->dev, sizeof(*rtc), GFP_KERNEL);
   348		if (!rtc)
   349			return -ENOMEM;
   350	
   351		spin_lock_init(&rtc->lock);
   352		rtc->irq = irq;
   353	
   354		/* platform setup code should have handled this; sigh */
   355		if (!device_can_wakeup(&pdev->dev))
   356			device_init_wakeup(&pdev->dev, 1);
   357	
   358		platform_set_drvdata(pdev, rtc);
   359	
   360		rtc->rtt = devm_platform_ioremap_resource(pdev, 0);
   361		if (IS_ERR(rtc->rtt))
   362			return PTR_ERR(rtc->rtt);
   363	
   364		ret = of_parse_phandle_with_fixed_args(pdev->dev.of_node,
   365						       "atmel,rtt-rtc-time-reg", 1, 0,
   366						       &args);
   367		if (ret)
   368			return ret;
   369	
   370		rtc->gpbr = syscon_node_to_regmap(args.np);
   371		rtc->gpbr_offset = args.args[0];
   372		if (IS_ERR(rtc->gpbr)) {
   373			dev_err(&pdev->dev, "failed to retrieve gpbr regmap, aborting.\n");
   374			return -ENOMEM;
   375		}
   376	
 > 377		rtc->sclk = devm_clk_get_enabled(&pdev->dev, NULL);
   378		if (IS_ERR(rtc->sclk))
   379			return PTR_ERR(rtc->sclk);
   380	
   381		sclk_rate = clk_get_rate(rtc->sclk);
   382		if (!sclk_rate || sclk_rate > AT91_RTT_RTPRES) {
   383			dev_err(&pdev->dev, "Invalid slow clock rate\n");
   384			return -EINVAL;
   385		}
   386	
   387		mr = rtt_readl(rtc, MR);
   388	
   389		/* unless RTT is counting at 1 Hz, re-initialize it */
   390		if ((mr & AT91_RTT_RTPRES) != sclk_rate) {
   391			mr = AT91_RTT_RTTRST | (sclk_rate & AT91_RTT_RTPRES);
   392			gpbr_writel(rtc, 0);
   393		}
   394	
   395		/* disable all interrupts (same as on shutdown path) */
   396		mr &= ~(AT91_RTT_ALMIEN | AT91_RTT_RTTINCIEN);
   397		rtt_writel(rtc, MR, mr);
   398	
   399		rtc->rtcdev = devm_rtc_allocate_device(&pdev->dev);
   400		if (IS_ERR(rtc->rtcdev)) {
   401			ret = PTR_ERR(rtc->rtcdev);
   402			return ret;
   403		}
   404	
   405		rtc->rtcdev->ops = &at91_rtc_ops;
   406		rtc->rtcdev->range_max = U32_MAX;
   407	
   408		/* register irq handler after we know what name we'll use */
   409		ret = devm_request_irq(&pdev->dev, rtc->irq, at91_rtc_interrupt,
   410				       IRQF_SHARED | IRQF_COND_SUSPEND,
   411				       dev_name(&rtc->rtcdev->dev), rtc);
   412		if (ret) {
   413			dev_dbg(&pdev->dev, "can't share IRQ %d?\n", rtc->irq);
   414			return ret;
   415		}
   416	
   417		/* NOTE:  sam9260 rev A silicon has a ROM bug which resets the
   418		 * RTT on at least some reboots.  If you have that chip, you must
   419		 * initialize the time from some external source like a GPS, wall
   420		 * clock, discrete RTC, etc
   421		 */
   422	
   423		if (gpbr_readl(rtc) == 0)
   424			dev_warn(&pdev->dev, "%s: SET TIME!\n",
   425				 dev_name(&rtc->rtcdev->dev));
   426	
   427		return devm_rtc_register_device(rtc->rtcdev);
   428	}
   429	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 67452 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20210325/92acfc06/attachment-0001.gz>


More information about the linux-arm-kernel mailing list