[PATCH 1/7] rtc:rtc-at91rm9200:Use devm_clk_get_enabled() helpers

Liao Yuanhong posted 7 patches 1 year, 5 months ago
There is a newer version of this series
[PATCH 1/7] rtc:rtc-at91rm9200:Use devm_clk_get_enabled() helpers
Posted by Liao Yuanhong 1 year, 5 months ago
Use devm_clk_get_enabled() instead of clk functions in rtc-at91rm9200.

Signed-off-by: Liao Yuanhong <liaoyuanhong@vivo.com>
---
 drivers/rtc/rtc-at91rm9200.c | 18 +++---------------
 1 file changed, 3 insertions(+), 15 deletions(-)

diff --git a/drivers/rtc/rtc-at91rm9200.c b/drivers/rtc/rtc-at91rm9200.c
index c16fe711a0d9..81b2556930bb 100644
--- a/drivers/rtc/rtc-at91rm9200.c
+++ b/drivers/rtc/rtc-at91rm9200.c
@@ -498,14 +498,9 @@ static int __init at91_rtc_probe(struct platform_device *pdev)
 		return PTR_ERR(rtc);
 	platform_set_drvdata(pdev, rtc);
 
-	sclk = devm_clk_get(&pdev->dev, NULL);
+	sclk = devm_clk_get_enabled(&pdev->dev, NULL);
 	if (IS_ERR(sclk))
 		return PTR_ERR(sclk);
-
-	ret = clk_prepare_enable(sclk);
-	if (ret) {
-		dev_err(&pdev->dev, "Could not enable slow clock\n");
-		return ret;
 	}
 
 	at91_rtc_write(AT91_RTC_CR, 0);
@@ -521,7 +516,7 @@ static int __init at91_rtc_probe(struct platform_device *pdev)
 			       "at91_rtc", pdev);
 	if (ret) {
 		dev_err(&pdev->dev, "IRQ %d already in use.\n", irq);
-		goto err_clk;
+		return ret;
 	}
 
 	/* cpu init code should really have flagged this device as
@@ -539,7 +534,7 @@ static int __init at91_rtc_probe(struct platform_device *pdev)
 	rtc->range_max = RTC_TIMESTAMP_END_2099;
 	ret = devm_rtc_register_device(rtc);
 	if (ret)
-		goto err_clk;
+		return ret;
 
 	/* enable SECEV interrupt in order to initialize at91_rtc_upd_rdy
 	 * completion.
@@ -548,11 +543,6 @@ static int __init at91_rtc_probe(struct platform_device *pdev)
 
 	dev_info(&pdev->dev, "AT91 Real Time Clock driver.\n");
 	return 0;
-
-err_clk:
-	clk_disable_unprepare(sclk);
-
-	return ret;
 }
 
 /*
@@ -564,8 +554,6 @@ static void __exit at91_rtc_remove(struct platform_device *pdev)
 	at91_rtc_write_idr(AT91_RTC_ACKUPD | AT91_RTC_ALARM |
 					AT91_RTC_SECEV | AT91_RTC_TIMEV |
 					AT91_RTC_CALEV);
-
-	clk_disable_unprepare(sclk);
 }
 
 static void at91_rtc_shutdown(struct platform_device *pdev)
-- 
2.25.1
Re: [PATCH 1/7] rtc:rtc-at91rm9200:Use devm_clk_get_enabled() helpers
Posted by kernel test robot 1 year, 5 months ago
Hi Liao,

kernel test robot noticed the following build errors:

[auto build test ERROR on abelloni/rtc-next]
[also build test ERROR on tegra/for-next linus/master v6.11-rc4 next-20240823]
[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/Liao-Yuanhong/rtc-rtc-at91rm9200-Use-devm_clk_get_enabled-helpers/20240822-150754
base:   https://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux.git rtc-next
patch link:    https://lore.kernel.org/r/20240821092846.20138-2-liaoyuanhong%40vivo.com
patch subject: [PATCH 1/7] rtc:rtc-at91rm9200:Use devm_clk_get_enabled() helpers
config: sh-allmodconfig (https://download.01.org/0day-ci/archive/20240823/202408231607.RHujmOKI-lkp@intel.com/config)
compiler: sh4-linux-gcc (GCC) 14.1.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240823/202408231607.RHujmOKI-lkp@intel.com/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@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202408231607.RHujmOKI-lkp@intel.com/

All errors (new ones prefixed by >>):

   drivers/rtc/rtc-at91rm9200.c: In function 'at91_rtc_probe':
   drivers/rtc/rtc-at91rm9200.c:473:13: warning: unused variable 'ret' [-Wunused-variable]
     473 |         int ret = 0;
         |             ^~~
   In file included from include/linux/io.h:14,
                    from include/linux/irq.h:20,
                    from include/asm-generic/hardirq.h:17,
                    from arch/sh/include/asm/hardirq.h:9,
                    from include/linux/hardirq.h:11,
                    from include/linux/interrupt.h:11,
                    from drivers/rtc/rtc-at91rm9200.c:20:
   drivers/rtc/rtc-at91rm9200.c: At top level:
>> arch/sh/include/asm/io.h:46:35: error: expected identifier or '(' before 'void'
      46 | #define writel_relaxed(v,c)     ((void)__raw_writel((__force u32)ioswabl(v),c))
         |                                   ^~~~
   drivers/rtc/rtc-at91rm9200.c:89:9: note: in expansion of macro 'writel_relaxed'
      89 |         writel_relaxed((val), at91_rtc_regs + field)
         |         ^~~~~~~~~~~~~~
   drivers/rtc/rtc-at91rm9200.c:506:9: note: in expansion of macro 'at91_rtc_write'
     506 |         at91_rtc_write(AT91_RTC_CR, 0);
         |         ^~~~~~~~~~~~~~
>> arch/sh/include/asm/io.h:31:33: error: expected ')' before '(' token
      31 | #define __raw_writel(v,a)       (__chk_io_ptr(a), *(volatile u32 __force *)(a) = (v))
         |                                 ^
   arch/sh/include/asm/io.h:46:40: note: in expansion of macro '__raw_writel'
      46 | #define writel_relaxed(v,c)     ((void)__raw_writel((__force u32)ioswabl(v),c))
         |                                        ^~~~~~~~~~~~
   drivers/rtc/rtc-at91rm9200.c:89:9: note: in expansion of macro 'writel_relaxed'
      89 |         writel_relaxed((val), at91_rtc_regs + field)
         |         ^~~~~~~~~~~~~~
   drivers/rtc/rtc-at91rm9200.c:506:9: note: in expansion of macro 'at91_rtc_write'
     506 |         at91_rtc_write(AT91_RTC_CR, 0);
         |         ^~~~~~~~~~~~~~
>> arch/sh/include/asm/io.h:46:35: error: expected identifier or '(' before 'void'
      46 | #define writel_relaxed(v,c)     ((void)__raw_writel((__force u32)ioswabl(v),c))
         |                                   ^~~~
   drivers/rtc/rtc-at91rm9200.c:89:9: note: in expansion of macro 'writel_relaxed'
      89 |         writel_relaxed((val), at91_rtc_regs + field)
         |         ^~~~~~~~~~~~~~
   drivers/rtc/rtc-at91rm9200.c:507:9: note: in expansion of macro 'at91_rtc_write'
     507 |         at91_rtc_write(AT91_RTC_MR, at91_rtc_read(AT91_RTC_MR) & ~AT91_RTC_HRMOD);
         |         ^~~~~~~~~~~~~~
>> arch/sh/include/asm/io.h:31:33: error: expected ')' before '(' token
      31 | #define __raw_writel(v,a)       (__chk_io_ptr(a), *(volatile u32 __force *)(a) = (v))
         |                                 ^
   arch/sh/include/asm/io.h:46:40: note: in expansion of macro '__raw_writel'
      46 | #define writel_relaxed(v,c)     ((void)__raw_writel((__force u32)ioswabl(v),c))
         |                                        ^~~~~~~~~~~~
   drivers/rtc/rtc-at91rm9200.c:89:9: note: in expansion of macro 'writel_relaxed'
      89 |         writel_relaxed((val), at91_rtc_regs + field)
         |         ^~~~~~~~~~~~~~
   drivers/rtc/rtc-at91rm9200.c:507:9: note: in expansion of macro 'at91_rtc_write'
     507 |         at91_rtc_write(AT91_RTC_MR, at91_rtc_read(AT91_RTC_MR) & ~AT91_RTC_HRMOD);
         |         ^~~~~~~~~~~~~~
   In file included from include/linux/bits.h:6,
                    from include/linux/bitops.h:6,
                    from include/linux/kernel.h:23,
                    from include/linux/clk.h:13,
                    from drivers/rtc/rtc-at91rm9200.c:18:
   include/vdso/bits.h:7:33: error: expected declaration specifiers or '...' before '(' token
       7 | #define BIT(nr)                 (UL(1) << (nr))
         |                                 ^
   drivers/rtc/rtc-at91rm9200.c:66:41: note: in expansion of macro 'BIT'
      66 | #define         AT91_RTC_ACKUPD         BIT(0)          /* Acknowledge for Update */
         |                                         ^~~
   drivers/rtc/rtc-at91rm9200.c:510:28: note: in expansion of macro 'AT91_RTC_ACKUPD'
     510 |         at91_rtc_write_idr(AT91_RTC_ACKUPD | AT91_RTC_ALARM |
         |                            ^~~~~~~~~~~~~~~
   drivers/rtc/rtc-at91rm9200.c:514:9: warning: data definition has no type or storage class
     514 |         ret = devm_request_irq(&pdev->dev, irq, at91_rtc_interrupt,
         |         ^~~
   drivers/rtc/rtc-at91rm9200.c:514:9: error: type defaults to 'int' in declaration of 'ret' [-Wimplicit-int]
   drivers/rtc/rtc-at91rm9200.c:514:33: error: 'pdev' undeclared here (not in a function); did you mean 'cdev'?
     514 |         ret = devm_request_irq(&pdev->dev, irq, at91_rtc_interrupt,
         |                                 ^~~~
         |                                 cdev
   drivers/rtc/rtc-at91rm9200.c:517:9: error: expected identifier or '(' before 'if'
     517 |         if (ret) {
         |         ^~
   drivers/rtc/rtc-at91rm9200.c:525:9: error: expected identifier or '(' before 'if'
     525 |         if (!device_can_wakeup(&pdev->dev))
         |         ^~
   drivers/rtc/rtc-at91rm9200.c:528:9: error: expected identifier or '(' before 'if'
     528 |         if (at91_rtc_config->has_correction)
         |         ^~
   drivers/rtc/rtc-at91rm9200.c:530:9: error: expected identifier or '(' before 'else'
     530 |         else
         |         ^~~~
   drivers/rtc/rtc-at91rm9200.c:533:12: error: expected '=', ',', ';', 'asm' or '__attribute__' before '->' token
     533 |         rtc->range_min = RTC_TIMESTAMP_BEGIN_1900;
         |            ^~
   drivers/rtc/rtc-at91rm9200.c:534:12: error: expected '=', ',', ';', 'asm' or '__attribute__' before '->' token
     534 |         rtc->range_max = RTC_TIMESTAMP_END_2099;
         |            ^~
   drivers/rtc/rtc-at91rm9200.c:535:9: warning: data definition has no type or storage class
     535 |         ret = devm_rtc_register_device(rtc);
         |         ^~~
   drivers/rtc/rtc-at91rm9200.c:535:9: error: type defaults to 'int' in declaration of 'ret' [-Wimplicit-int]
   drivers/rtc/rtc-at91rm9200.c:535:9: error: redefinition of 'ret'
   drivers/rtc/rtc-at91rm9200.c:514:9: note: previous definition of 'ret' with type 'int'
     514 |         ret = devm_request_irq(&pdev->dev, irq, at91_rtc_interrupt,
         |         ^~~
   In file included from drivers/rtc/rtc-at91rm9200.c:27:
   drivers/rtc/rtc-at91rm9200.c:535:40: error: 'rtc' undeclared here (not in a function)
     535 |         ret = devm_rtc_register_device(rtc);
         |                                        ^~~
   include/linux/rtc.h:246:49: note: in definition of macro 'devm_rtc_register_device'
     246 |         __devm_rtc_register_device(THIS_MODULE, device)
         |                                                 ^~~~~~
   drivers/rtc/rtc-at91rm9200.c:536:9: error: expected identifier or '(' before 'if'
     536 |         if (ret)
         |         ^~
   include/vdso/bits.h:7:33: error: expected declaration specifiers or '...' before '(' token
       7 | #define BIT(nr)                 (UL(1) << (nr))
         |                                 ^
   drivers/rtc/rtc-at91rm9200.c:68:41: note: in expansion of macro 'BIT'
      68 | #define         AT91_RTC_SECEV          BIT(2)          /* Second Event */
         |                                         ^~~
   drivers/rtc/rtc-at91rm9200.c:542:28: note: in expansion of macro 'AT91_RTC_SECEV'
     542 |         at91_rtc_write_ier(AT91_RTC_SECEV);
         |                            ^~~~~~~~~~~~~~
   In file included from include/linux/device.h:15,
                    from include/linux/platform_device.h:13,
                    from drivers/rtc/rtc-at91rm9200.c:26:
   include/linux/dev_printk.h:108:10: error: expected identifier or '(' before '{' token
     108 |         ({                                                              \
         |          ^
   include/linux/dev_printk.h:160:9: note: in expansion of macro 'dev_printk_index_wrap'
     160 |         dev_printk_index_wrap(_dev_info, KERN_INFO, dev, dev_fmt(fmt), ##__VA_ARGS__)
         |         ^~~~~~~~~~~~~~~~~~~~~
   drivers/rtc/rtc-at91rm9200.c:544:9: note: in expansion of macro 'dev_info'
     544 |         dev_info(&pdev->dev, "AT91 Real Time Clock driver.\n");
         |         ^~~~~~~~
   drivers/rtc/rtc-at91rm9200.c:545:9: error: expected identifier or '(' before 'return'
     545 |         return 0;
         |         ^~~~~~
   drivers/rtc/rtc-at91rm9200.c:546:1: error: expected identifier or '(' before '}' token
     546 | }
         | ^
   drivers/rtc/rtc-at91rm9200.c: In function 'at91_rtc_probe':
   drivers/rtc/rtc-at91rm9200.c:504:9: warning: control reaches end of non-void function [-Wreturn-type]
     504 |         }
         |         ^


vim +46 arch/sh/include/asm/io.h

b66c1a3919abb4 include/asm-sh/io.h      Paul Mundt 2006-01-16  28  
14866543ad2201 arch/sh/include/asm/io.h Paul Mundt 2008-10-04  29  #define __raw_writeb(v,a)	(__chk_io_ptr(a), *(volatile u8  __force *)(a) = (v))
14866543ad2201 arch/sh/include/asm/io.h Paul Mundt 2008-10-04  30  #define __raw_writew(v,a)	(__chk_io_ptr(a), *(volatile u16 __force *)(a) = (v))
14866543ad2201 arch/sh/include/asm/io.h Paul Mundt 2008-10-04 @31  #define __raw_writel(v,a)	(__chk_io_ptr(a), *(volatile u32 __force *)(a) = (v))
14866543ad2201 arch/sh/include/asm/io.h Paul Mundt 2008-10-04  32  #define __raw_writeq(v,a)	(__chk_io_ptr(a), *(volatile u64 __force *)(a) = (v))
14866543ad2201 arch/sh/include/asm/io.h Paul Mundt 2008-10-04  33  
14866543ad2201 arch/sh/include/asm/io.h Paul Mundt 2008-10-04  34  #define __raw_readb(a)		(__chk_io_ptr(a), *(volatile u8  __force *)(a))
14866543ad2201 arch/sh/include/asm/io.h Paul Mundt 2008-10-04  35  #define __raw_readw(a)		(__chk_io_ptr(a), *(volatile u16 __force *)(a))
14866543ad2201 arch/sh/include/asm/io.h Paul Mundt 2008-10-04  36  #define __raw_readl(a)		(__chk_io_ptr(a), *(volatile u32 __force *)(a))
14866543ad2201 arch/sh/include/asm/io.h Paul Mundt 2008-10-04  37  #define __raw_readq(a)		(__chk_io_ptr(a), *(volatile u64 __force *)(a))
14866543ad2201 arch/sh/include/asm/io.h Paul Mundt 2008-10-04  38  
b7e68d6876dfba arch/sh/include/asm/io.h Paul Mundt 2012-03-29  39  #define readb_relaxed(c)	({ u8  __v = ioswabb(__raw_readb(c)); __v; })
b7e68d6876dfba arch/sh/include/asm/io.h Paul Mundt 2012-03-29  40  #define readw_relaxed(c)	({ u16 __v = ioswabw(__raw_readw(c)); __v; })
b7e68d6876dfba arch/sh/include/asm/io.h Paul Mundt 2012-03-29  41  #define readl_relaxed(c)	({ u32 __v = ioswabl(__raw_readl(c)); __v; })
b7e68d6876dfba arch/sh/include/asm/io.h Paul Mundt 2012-03-29  42  #define readq_relaxed(c)	({ u64 __v = ioswabq(__raw_readq(c)); __v; })
b7e68d6876dfba arch/sh/include/asm/io.h Paul Mundt 2012-03-29  43  
b7e68d6876dfba arch/sh/include/asm/io.h Paul Mundt 2012-03-29  44  #define writeb_relaxed(v,c)	((void)__raw_writeb((__force  u8)ioswabb(v),c))
b7e68d6876dfba arch/sh/include/asm/io.h Paul Mundt 2012-03-29  45  #define writew_relaxed(v,c)	((void)__raw_writew((__force u16)ioswabw(v),c))
b7e68d6876dfba arch/sh/include/asm/io.h Paul Mundt 2012-03-29 @46  #define writel_relaxed(v,c)	((void)__raw_writel((__force u32)ioswabl(v),c))
b7e68d6876dfba arch/sh/include/asm/io.h Paul Mundt 2012-03-29  47  #define writeq_relaxed(v,c)	((void)__raw_writeq((__force u64)ioswabq(v),c))
37b7a97884ba64 arch/sh/include/asm/io.h Paul Mundt 2010-11-01  48  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
Re: [PATCH 1/7] rtc:rtc-at91rm9200:Use devm_clk_get_enabled() helpers
Posted by kernel test robot 1 year, 5 months ago
Hi Liao,

kernel test robot noticed the following build errors:

[auto build test ERROR on abelloni/rtc-next]
[also build test ERROR on tegra/for-next linus/master v6.11-rc4 next-20240823]
[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/Liao-Yuanhong/rtc-rtc-at91rm9200-Use-devm_clk_get_enabled-helpers/20240822-150754
base:   https://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux.git rtc-next
patch link:    https://lore.kernel.org/r/20240821092846.20138-2-liaoyuanhong%40vivo.com
patch subject: [PATCH 1/7] rtc:rtc-at91rm9200:Use devm_clk_get_enabled() helpers
config: sparc64-randconfig-r064-20240823 (https://download.01.org/0day-ci/archive/20240823/202408231657.ZitX62vV-lkp@intel.com/config)
compiler: sparc64-linux-gcc (GCC) 14.1.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240823/202408231657.ZitX62vV-lkp@intel.com/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@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202408231657.ZitX62vV-lkp@intel.com/

All errors (new ones prefixed by >>):

   drivers/rtc/rtc-at91rm9200.c: In function 'at91_rtc_probe':
   drivers/rtc/rtc-at91rm9200.c:473:13: warning: unused variable 'ret' [-Wunused-variable]
     473 |         int ret = 0;
         |             ^~~
   drivers/rtc/rtc-at91rm9200.c: At top level:
   drivers/rtc/rtc-at91rm9200.c:89:24: error: expected declaration specifiers or '...' before '(' token
      89 |         writel_relaxed((val), at91_rtc_regs + field)
         |                        ^
   drivers/rtc/rtc-at91rm9200.c:506:9: note: in expansion of macro 'at91_rtc_write'
     506 |         at91_rtc_write(AT91_RTC_CR, 0);
         |         ^~~~~~~~~~~~~~
   drivers/rtc/rtc-at91rm9200.c:89:31: error: expected declaration specifiers or '...' before 'at91_rtc_regs'
      89 |         writel_relaxed((val), at91_rtc_regs + field)
         |                               ^~~~~~~~~~~~~
   drivers/rtc/rtc-at91rm9200.c:506:9: note: in expansion of macro 'at91_rtc_write'
     506 |         at91_rtc_write(AT91_RTC_CR, 0);
         |         ^~~~~~~~~~~~~~
   drivers/rtc/rtc-at91rm9200.c:89:24: error: expected declaration specifiers or '...' before '(' token
      89 |         writel_relaxed((val), at91_rtc_regs + field)
         |                        ^
   drivers/rtc/rtc-at91rm9200.c:507:9: note: in expansion of macro 'at91_rtc_write'
     507 |         at91_rtc_write(AT91_RTC_MR, at91_rtc_read(AT91_RTC_MR) & ~AT91_RTC_HRMOD);
         |         ^~~~~~~~~~~~~~
   drivers/rtc/rtc-at91rm9200.c:89:31: error: expected declaration specifiers or '...' before 'at91_rtc_regs'
      89 |         writel_relaxed((val), at91_rtc_regs + field)
         |                               ^~~~~~~~~~~~~
   drivers/rtc/rtc-at91rm9200.c:507:9: note: in expansion of macro 'at91_rtc_write'
     507 |         at91_rtc_write(AT91_RTC_MR, at91_rtc_read(AT91_RTC_MR) & ~AT91_RTC_HRMOD);
         |         ^~~~~~~~~~~~~~
   In file included from include/linux/bits.h:6,
                    from include/linux/bitops.h:6,
                    from include/linux/kernel.h:23,
                    from include/linux/clk.h:13,
                    from drivers/rtc/rtc-at91rm9200.c:18:
   include/vdso/bits.h:7:33: error: expected declaration specifiers or '...' before '(' token
       7 | #define BIT(nr)                 (UL(1) << (nr))
         |                                 ^
   drivers/rtc/rtc-at91rm9200.c:66:41: note: in expansion of macro 'BIT'
      66 | #define         AT91_RTC_ACKUPD         BIT(0)          /* Acknowledge for Update */
         |                                         ^~~
   drivers/rtc/rtc-at91rm9200.c:510:28: note: in expansion of macro 'AT91_RTC_ACKUPD'
     510 |         at91_rtc_write_idr(AT91_RTC_ACKUPD | AT91_RTC_ALARM |
         |                            ^~~~~~~~~~~~~~~
   drivers/rtc/rtc-at91rm9200.c:514:9: warning: data definition has no type or storage class
     514 |         ret = devm_request_irq(&pdev->dev, irq, at91_rtc_interrupt,
         |         ^~~
   drivers/rtc/rtc-at91rm9200.c:514:9: error: type defaults to 'int' in declaration of 'ret' [-Wimplicit-int]
   drivers/rtc/rtc-at91rm9200.c:514:33: error: 'pdev' undeclared here (not in a function); did you mean 'cdev'?
     514 |         ret = devm_request_irq(&pdev->dev, irq, at91_rtc_interrupt,
         |                                 ^~~~
         |                                 cdev
   In file included from include/linux/bcd.h:5,
                    from drivers/rtc/rtc-at91rm9200.c:16:
>> include/linux/compiler.h:55:23: error: expected identifier or '(' before 'if'
      55 | #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
         |                       ^~
   drivers/rtc/rtc-at91rm9200.c:517:9: note: in expansion of macro 'if'
     517 |         if (ret) {
         |         ^~
>> include/linux/compiler.h:71:2: error: expected identifier or '(' before ')' token
      71 | })
         |  ^
   include/linux/compiler.h:57:69: note: in expansion of macro '__trace_if_value'
      57 | #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
         |                                                                     ^~~~~~~~~~~~~~~~
   include/linux/compiler.h:55:28: note: in expansion of macro '__trace_if_var'
      55 | #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
         |                            ^~~~~~~~~~~~~~
   drivers/rtc/rtc-at91rm9200.c:517:9: note: in expansion of macro 'if'
     517 |         if (ret) {
         |         ^~
>> include/linux/compiler.h:55:23: error: expected identifier or '(' before 'if'
      55 | #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
         |                       ^~
   drivers/rtc/rtc-at91rm9200.c:525:9: note: in expansion of macro 'if'
     525 |         if (!device_can_wakeup(&pdev->dev))
         |         ^~
>> include/linux/compiler.h:71:2: error: expected identifier or '(' before ')' token
      71 | })
         |  ^
   include/linux/compiler.h:57:69: note: in expansion of macro '__trace_if_value'
      57 | #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
         |                                                                     ^~~~~~~~~~~~~~~~
   include/linux/compiler.h:55:28: note: in expansion of macro '__trace_if_var'
      55 | #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
         |                            ^~~~~~~~~~~~~~
   drivers/rtc/rtc-at91rm9200.c:525:9: note: in expansion of macro 'if'
     525 |         if (!device_can_wakeup(&pdev->dev))
         |         ^~
>> include/linux/compiler.h:55:23: error: expected identifier or '(' before 'if'
      55 | #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
         |                       ^~
   drivers/rtc/rtc-at91rm9200.c:528:9: note: in expansion of macro 'if'
     528 |         if (at91_rtc_config->has_correction)
         |         ^~
>> include/linux/compiler.h:71:2: error: expected identifier or '(' before ')' token
      71 | })
         |  ^
   include/linux/compiler.h:57:69: note: in expansion of macro '__trace_if_value'
      57 | #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
         |                                                                     ^~~~~~~~~~~~~~~~
   include/linux/compiler.h:55:28: note: in expansion of macro '__trace_if_var'
      55 | #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
         |                            ^~~~~~~~~~~~~~
   drivers/rtc/rtc-at91rm9200.c:528:9: note: in expansion of macro 'if'
     528 |         if (at91_rtc_config->has_correction)
         |         ^~
   drivers/rtc/rtc-at91rm9200.c:530:9: error: expected identifier or '(' before 'else'
     530 |         else
         |         ^~~~
   drivers/rtc/rtc-at91rm9200.c:533:12: error: expected '=', ',', ';', 'asm' or '__attribute__' before '->' token
     533 |         rtc->range_min = RTC_TIMESTAMP_BEGIN_1900;
         |            ^~
   drivers/rtc/rtc-at91rm9200.c:534:12: error: expected '=', ',', ';', 'asm' or '__attribute__' before '->' token
     534 |         rtc->range_max = RTC_TIMESTAMP_END_2099;
         |            ^~
   drivers/rtc/rtc-at91rm9200.c:535:9: warning: data definition has no type or storage class
     535 |         ret = devm_rtc_register_device(rtc);
         |         ^~~
   drivers/rtc/rtc-at91rm9200.c:535:9: error: type defaults to 'int' in declaration of 'ret' [-Wimplicit-int]
   drivers/rtc/rtc-at91rm9200.c:535:9: error: redefinition of 'ret'
   drivers/rtc/rtc-at91rm9200.c:514:9: note: previous definition of 'ret' with type 'int'
     514 |         ret = devm_request_irq(&pdev->dev, irq, at91_rtc_interrupt,
         |         ^~~
   In file included from drivers/rtc/rtc-at91rm9200.c:27:
   drivers/rtc/rtc-at91rm9200.c:535:40: error: 'rtc' undeclared here (not in a function)
     535 |         ret = devm_rtc_register_device(rtc);
         |                                        ^~~
   include/linux/rtc.h:246:49: note: in definition of macro 'devm_rtc_register_device'
     246 |         __devm_rtc_register_device(THIS_MODULE, device)
         |                                                 ^~~~~~
>> include/linux/compiler.h:55:23: error: expected identifier or '(' before 'if'
      55 | #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
         |                       ^~
   drivers/rtc/rtc-at91rm9200.c:536:9: note: in expansion of macro 'if'
     536 |         if (ret)
         |         ^~
>> include/linux/compiler.h:71:2: error: expected identifier or '(' before ')' token
      71 | })
         |  ^
   include/linux/compiler.h:57:69: note: in expansion of macro '__trace_if_value'
      57 | #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
         |                                                                     ^~~~~~~~~~~~~~~~
   include/linux/compiler.h:55:28: note: in expansion of macro '__trace_if_var'
      55 | #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
         |                            ^~~~~~~~~~~~~~
   drivers/rtc/rtc-at91rm9200.c:536:9: note: in expansion of macro 'if'
     536 |         if (ret)
         |         ^~
   include/vdso/bits.h:7:33: error: expected declaration specifiers or '...' before '(' token
       7 | #define BIT(nr)                 (UL(1) << (nr))
         |                                 ^
   drivers/rtc/rtc-at91rm9200.c:68:41: note: in expansion of macro 'BIT'
      68 | #define         AT91_RTC_SECEV          BIT(2)          /* Second Event */
         |                                         ^~~
   drivers/rtc/rtc-at91rm9200.c:542:28: note: in expansion of macro 'AT91_RTC_SECEV'
     542 |         at91_rtc_write_ier(AT91_RTC_SECEV);
         |                            ^~~~~~~~~~~~~~
   In file included from include/linux/device.h:15,
                    from include/linux/platform_device.h:13,
                    from drivers/rtc/rtc-at91rm9200.c:26:
   include/linux/dev_printk.h:108:10: error: expected identifier or '(' before '{' token
     108 |         ({                                                              \
         |          ^
   include/linux/dev_printk.h:160:9: note: in expansion of macro 'dev_printk_index_wrap'
     160 |         dev_printk_index_wrap(_dev_info, KERN_INFO, dev, dev_fmt(fmt), ##__VA_ARGS__)
         |         ^~~~~~~~~~~~~~~~~~~~~
   drivers/rtc/rtc-at91rm9200.c:544:9: note: in expansion of macro 'dev_info'
     544 |         dev_info(&pdev->dev, "AT91 Real Time Clock driver.\n");
         |         ^~~~~~~~
   drivers/rtc/rtc-at91rm9200.c:545:9: error: expected identifier or '(' before 'return'
     545 |         return 0;
         |         ^~~~~~
   drivers/rtc/rtc-at91rm9200.c:546:1: error: expected identifier or '(' before '}' token
     546 | }
         | ^
   drivers/rtc/rtc-at91rm9200.c: In function 'at91_rtc_probe':
   drivers/rtc/rtc-at91rm9200.c:504:9: warning: control reaches end of non-void function [-Wreturn-type]
     504 |         }
         |         ^
   drivers/rtc/rtc-at91rm9200.c: At top level:
   drivers/rtc/rtc-at91rm9200.c:456:35: warning: 'sama5d4_rtc_ops' defined but not used [-Wunused-const-variable=]
     456 | static const struct rtc_class_ops sama5d4_rtc_ops = {
         |                                   ^~~~~~~~~~~~~~~
   drivers/rtc/rtc-at91rm9200.c:448:35: warning: 'at91_rtc_ops' defined but not used [-Wunused-const-variable=]
     448 | static const struct rtc_class_ops at91_rtc_ops = {
         |                                   ^~~~~~~~~~~~


vim +55 include/linux/compiler.h

2bcd521a684cc9 Steven Rostedt 2008-11-21  49  
2bcd521a684cc9 Steven Rostedt 2008-11-21  50  #ifdef CONFIG_PROFILE_ALL_BRANCHES
2bcd521a684cc9 Steven Rostedt 2008-11-21  51  /*
2bcd521a684cc9 Steven Rostedt 2008-11-21  52   * "Define 'is'", Bill Clinton
2bcd521a684cc9 Steven Rostedt 2008-11-21  53   * "Define 'if'", Steven Rostedt
2bcd521a684cc9 Steven Rostedt 2008-11-21  54   */
a15fd609ad53a6 Linus Torvalds 2019-03-20 @55  #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
a15fd609ad53a6 Linus Torvalds 2019-03-20  56  
a15fd609ad53a6 Linus Torvalds 2019-03-20  57  #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
a15fd609ad53a6 Linus Torvalds 2019-03-20  58  
a15fd609ad53a6 Linus Torvalds 2019-03-20  59  #define __trace_if_value(cond) ({			\
2bcd521a684cc9 Steven Rostedt 2008-11-21  60  	static struct ftrace_branch_data		\
e04462fb82f8dd Miguel Ojeda   2018-09-03  61  		__aligned(4)				\
33def8498fdde1 Joe Perches    2020-10-21  62  		__section("_ftrace_branch")		\
a15fd609ad53a6 Linus Torvalds 2019-03-20  63  		__if_trace = {				\
2bcd521a684cc9 Steven Rostedt 2008-11-21  64  			.func = __func__,		\
2bcd521a684cc9 Steven Rostedt 2008-11-21  65  			.file = __FILE__,		\
2bcd521a684cc9 Steven Rostedt 2008-11-21  66  			.line = __LINE__,		\
2bcd521a684cc9 Steven Rostedt 2008-11-21  67  		};					\
a15fd609ad53a6 Linus Torvalds 2019-03-20  68  	(cond) ?					\
a15fd609ad53a6 Linus Torvalds 2019-03-20  69  		(__if_trace.miss_hit[1]++,1) :		\
a15fd609ad53a6 Linus Torvalds 2019-03-20  70  		(__if_trace.miss_hit[0]++,0);		\
a15fd609ad53a6 Linus Torvalds 2019-03-20 @71  })
a15fd609ad53a6 Linus Torvalds 2019-03-20  72  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
Re: [PATCH 1/7] rtc:rtc-at91rm9200:Use devm_clk_get_enabled() helpers
Posted by kernel test robot 1 year, 5 months ago
Hi Liao,

kernel test robot noticed the following build errors:

[auto build test ERROR on abelloni/rtc-next]
[also build test ERROR on tegra/for-next linus/master v6.11-rc4 next-20240821]
[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/Liao-Yuanhong/rtc-rtc-at91rm9200-Use-devm_clk_get_enabled-helpers/20240821-190257
base:   https://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux.git rtc-next
patch link:    https://lore.kernel.org/r/20240821092846.20138-2-liaoyuanhong%40vivo.com
patch subject: [PATCH 1/7] rtc:rtc-at91rm9200:Use devm_clk_get_enabled() helpers
config: arm-defconfig (https://download.01.org/0day-ci/archive/20240822/202408221130.3Kw5w51m-lkp@intel.com/config)
compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project f28c006a5895fc0e329fe15fead81e37457cb1d1)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240822/202408221130.3Kw5w51m-lkp@intel.com/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@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202408221130.3Kw5w51m-lkp@intel.com/

All error/warnings (new ones prefixed by >>):

   drivers/rtc/rtc-at91rm9200.c:473:6: warning: unused variable 'ret' [-Wunused-variable]
           int ret = 0;
               ^
>> drivers/rtc/rtc-at91rm9200.c:504:2: warning: non-void function does not return a value in all control paths [-Wreturn-type]
           }
           ^
>> drivers/rtc/rtc-at91rm9200.c:506:30: error: expected ')'
           at91_rtc_write(AT91_RTC_CR, 0);
                                       ^
   drivers/rtc/rtc-at91rm9200.c:506:2: note: to match this '('
           at91_rtc_write(AT91_RTC_CR, 0);
           ^
   drivers/rtc/rtc-at91rm9200.c:89:17: note: expanded from macro 'at91_rtc_write'
           writel_relaxed((val), at91_rtc_regs + field)
                          ^
>> drivers/rtc/rtc-at91rm9200.c:506:30: error: type specifier missing, defaults to 'int' [-Werror,-Wimplicit-int]
           at91_rtc_write(AT91_RTC_CR, 0);
                                       ^
   drivers/rtc/rtc-at91rm9200.c:506:2: error: type specifier missing, defaults to 'int' [-Werror,-Wimplicit-int]
           at91_rtc_write(AT91_RTC_CR, 0);
           ^
   drivers/rtc/rtc-at91rm9200.c:89:2: note: expanded from macro 'at91_rtc_write'
           writel_relaxed((val), at91_rtc_regs + field)
           ^
   arch/arm/include/asm/io.h:282:56: note: expanded from macro 'writel_relaxed'
   #define writel_relaxed(v,c)     __raw_writel((__force u32) cpu_to_le32(v),c)
                                                              ^
   include/linux/byteorder/generic.h:88:21: note: expanded from macro 'cpu_to_le32'
   #define cpu_to_le32 __cpu_to_le32
                       ^
   include/uapi/linux/byteorder/little_endian.h:34:36: note: expanded from macro '__cpu_to_le32'
   #define __cpu_to_le32(x) ((__force __le32)(__u32)(x))
                                      ^
>> drivers/rtc/rtc-at91rm9200.c:506:2: error: function cannot return function type 'int (int)'
   drivers/rtc/rtc-at91rm9200.c:89:2: note: expanded from macro 'at91_rtc_write'
           writel_relaxed((val), at91_rtc_regs + field)
           ^
   arch/arm/include/asm/io.h:282:56: note: expanded from macro 'writel_relaxed'
   #define writel_relaxed(v,c)     __raw_writel((__force u32) cpu_to_le32(v),c)
                                                              ^
   include/linux/byteorder/generic.h:88:21: note: expanded from macro 'cpu_to_le32'
   #define cpu_to_le32 __cpu_to_le32
                       ^
   include/uapi/linux/byteorder/little_endian.h:34:43: note: expanded from macro '__cpu_to_le32'
   #define __cpu_to_le32(x) ((__force __le32)(__u32)(x))
                                             ^
   drivers/rtc/rtc-at91rm9200.c:506:2: error: type specifier missing, defaults to 'int' [-Werror,-Wimplicit-int]
   drivers/rtc/rtc-at91rm9200.c:89:2: note: expanded from macro 'at91_rtc_write'
           writel_relaxed((val), at91_rtc_regs + field)
           ^
   arch/arm/include/asm/io.h:282:51: note: expanded from macro 'writel_relaxed'
   #define writel_relaxed(v,c)     __raw_writel((__force u32) cpu_to_le32(v),c)
                                                         ^
>> drivers/rtc/rtc-at91rm9200.c:506:2: error: function cannot return function type 'int (int ((*)(__le32))(__u32))' (aka 'int (int ((*)(unsigned int))(unsigned int))')
   drivers/rtc/rtc-at91rm9200.c:89:2: note: expanded from macro 'at91_rtc_write'
           writel_relaxed((val), at91_rtc_regs + field)
           ^
   arch/arm/include/asm/io.h:282:42: note: expanded from macro 'writel_relaxed'
   #define writel_relaxed(v,c)     __raw_writel((__force u32) cpu_to_le32(v),c)
                                                ^
>> drivers/rtc/rtc-at91rm9200.c:506:2: error: unknown type name 'at91_rtc_regs'
   drivers/rtc/rtc-at91rm9200.c:89:24: note: expanded from macro 'at91_rtc_write'
           writel_relaxed((val), at91_rtc_regs + field)
                                 ^
   drivers/rtc/rtc-at91rm9200.c:506:2: error: expected ')'
   drivers/rtc/rtc-at91rm9200.c:89:38: note: expanded from macro 'at91_rtc_write'
           writel_relaxed((val), at91_rtc_regs + field)
                                               ^
   drivers/rtc/rtc-at91rm9200.c:506:2: note: to match this '('
   drivers/rtc/rtc-at91rm9200.c:89:2: note: expanded from macro 'at91_rtc_write'
           writel_relaxed((val), at91_rtc_regs + field)
           ^
   arch/arm/include/asm/io.h:282:41: note: expanded from macro 'writel_relaxed'
   #define writel_relaxed(v,c)     __raw_writel((__force u32) cpu_to_le32(v),c)
                                               ^
   drivers/rtc/rtc-at91rm9200.c:506:2: error: type specifier missing, defaults to 'int' [-Werror,-Wimplicit-int]
           at91_rtc_write(AT91_RTC_CR, 0);
           ^
   drivers/rtc/rtc-at91rm9200.c:89:2: note: expanded from macro 'at91_rtc_write'
           writel_relaxed((val), at91_rtc_regs + field)
           ^
   arch/arm/include/asm/io.h:282:29: note: expanded from macro 'writel_relaxed'
   #define writel_relaxed(v,c)     __raw_writel((__force u32) cpu_to_le32(v),c)
                                   ^
   arch/arm/include/asm/io.h:92:22: note: expanded from macro '__raw_writel'
   #define __raw_writel __raw_writel
                        ^
   drivers/rtc/rtc-at91rm9200.c:507:30: error: expected ')'
           at91_rtc_write(AT91_RTC_MR, at91_rtc_read(AT91_RTC_MR) & ~AT91_RTC_HRMOD);
                                       ^
   drivers/rtc/rtc-at91rm9200.c:87:2: note: expanded from macro 'at91_rtc_read'
           readl_relaxed(at91_rtc_regs + field)
           ^
   arch/arm/include/asm/io.h:277:27: note: expanded from macro 'readl_relaxed'
   #define readl_relaxed(c) ({ u32 __r = le32_to_cpu((__force __le32) \
                             ^
   drivers/rtc/rtc-at91rm9200.c:507:30: note: to match this '('
   drivers/rtc/rtc-at91rm9200.c:87:2: note: expanded from macro 'at91_rtc_read'
           readl_relaxed(at91_rtc_regs + field)
           ^
   arch/arm/include/asm/io.h:277:26: note: expanded from macro 'readl_relaxed'
   #define readl_relaxed(c) ({ u32 __r = le32_to_cpu((__force __le32) \
                            ^
   drivers/rtc/rtc-at91rm9200.c:507:57: error: expected ')'
           at91_rtc_write(AT91_RTC_MR, at91_rtc_read(AT91_RTC_MR) & ~AT91_RTC_HRMOD);
                                                                  ^
   drivers/rtc/rtc-at91rm9200.c:507:2: note: to match this '('
           at91_rtc_write(AT91_RTC_MR, at91_rtc_read(AT91_RTC_MR) & ~AT91_RTC_HRMOD);
           ^
   drivers/rtc/rtc-at91rm9200.c:89:17: note: expanded from macro 'at91_rtc_write'
           writel_relaxed((val), at91_rtc_regs + field)
                          ^
   drivers/rtc/rtc-at91rm9200.c:507:30: error: type specifier missing, defaults to 'int' [-Werror,-Wimplicit-int]
           at91_rtc_write(AT91_RTC_MR, at91_rtc_read(AT91_RTC_MR) & ~AT91_RTC_HRMOD);
                                       ^
   drivers/rtc/rtc-at91rm9200.c:87:2: note: expanded from macro 'at91_rtc_read'
           readl_relaxed(at91_rtc_regs + field)
           ^
   arch/arm/include/asm/io.h:277:27: note: expanded from macro 'readl_relaxed'
   #define readl_relaxed(c) ({ u32 __r = le32_to_cpu((__force __le32) \
                             ^
   drivers/rtc/rtc-at91rm9200.c:507:2: error: type specifier missing, defaults to 'int' [-Werror,-Wimplicit-int]
           at91_rtc_write(AT91_RTC_MR, at91_rtc_read(AT91_RTC_MR) & ~AT91_RTC_HRMOD);
           ^
   drivers/rtc/rtc-at91rm9200.c:89:2: note: expanded from macro 'at91_rtc_write'
           writel_relaxed((val), at91_rtc_regs + field)
           ^
   arch/arm/include/asm/io.h:282:56: note: expanded from macro 'writel_relaxed'
   #define writel_relaxed(v,c)     __raw_writel((__force u32) cpu_to_le32(v),c)
                                                              ^
   include/linux/byteorder/generic.h:88:21: note: expanded from macro 'cpu_to_le32'
   #define cpu_to_le32 __cpu_to_le32
                       ^
   include/uapi/linux/byteorder/little_endian.h:34:36: note: expanded from macro '__cpu_to_le32'
   #define __cpu_to_le32(x) ((__force __le32)(__u32)(x))
                                      ^
   drivers/rtc/rtc-at91rm9200.c:507:2: error: function cannot return function type 'int (int)'
   drivers/rtc/rtc-at91rm9200.c:89:2: note: expanded from macro 'at91_rtc_write'
           writel_relaxed((val), at91_rtc_regs + field)
           ^
   arch/arm/include/asm/io.h:282:56: note: expanded from macro 'writel_relaxed'
   #define writel_relaxed(v,c)     __raw_writel((__force u32) cpu_to_le32(v),c)
                                                              ^
   include/linux/byteorder/generic.h:88:21: note: expanded from macro 'cpu_to_le32'
   #define cpu_to_le32 __cpu_to_le32
                       ^
   include/uapi/linux/byteorder/little_endian.h:34:43: note: expanded from macro '__cpu_to_le32'
   #define __cpu_to_le32(x) ((__force __le32)(__u32)(x))
                                             ^
   drivers/rtc/rtc-at91rm9200.c:507:2: error: type specifier missing, defaults to 'int' [-Werror,-Wimplicit-int]
   drivers/rtc/rtc-at91rm9200.c:89:2: note: expanded from macro 'at91_rtc_write'
           writel_relaxed((val), at91_rtc_regs + field)
           ^
   arch/arm/include/asm/io.h:282:51: note: expanded from macro 'writel_relaxed'
   #define writel_relaxed(v,c)     __raw_writel((__force u32) cpu_to_le32(v),c)
                                                         ^
   drivers/rtc/rtc-at91rm9200.c:507:2: error: function cannot return function type 'int (int ((*)(__le32))(__u32))' (aka 'int (int ((*)(unsigned int))(unsigned int))')
   drivers/rtc/rtc-at91rm9200.c:89:2: note: expanded from macro 'at91_rtc_write'
           writel_relaxed((val), at91_rtc_regs + field)
           ^
   arch/arm/include/asm/io.h:282:42: note: expanded from macro 'writel_relaxed'


vim +506 drivers/rtc/rtc-at91rm9200.c

f6a46f8b302d9b drivers/rtc/rtc-at91rm9200.c Alexandre Belloni                2020-11-09  465  
788b1fc619a31e drivers/rtc/rtc-at91.c       Andrew Victor                    2006-06-25  466  /*
788b1fc619a31e drivers/rtc/rtc-at91.c       Andrew Victor                    2006-06-25  467   * Initialize and install RTC driver
788b1fc619a31e drivers/rtc/rtc-at91.c       Andrew Victor                    2006-06-25  468   */
788b1fc619a31e drivers/rtc/rtc-at91.c       Andrew Victor                    2006-06-25  469  static int __init at91_rtc_probe(struct platform_device *pdev)
788b1fc619a31e drivers/rtc/rtc-at91.c       Andrew Victor                    2006-06-25  470  {
788b1fc619a31e drivers/rtc/rtc-at91.c       Andrew Victor                    2006-06-25  471  	struct rtc_device *rtc;
d28bdfc5c80fb6 drivers/rtc/rtc-at91rm9200.c Jean-Christophe PLAGNIOL-VILLARD 2011-11-14  472  	struct resource *regs;
d28bdfc5c80fb6 drivers/rtc/rtc-at91rm9200.c Jean-Christophe PLAGNIOL-VILLARD 2011-11-14 @473  	int ret = 0;
788b1fc619a31e drivers/rtc/rtc-at91.c       Andrew Victor                    2006-06-25  474  
288d9cf1764a25 drivers/rtc/rtc-at91rm9200.c Claudiu Beznea                   2019-09-26  475  	at91_rtc_config = of_device_get_match_data(&pdev->dev);
de645475913f67 drivers/rtc/rtc-at91rm9200.c Johan Hovold                     2013-06-12  476  	if (!at91_rtc_config)
de645475913f67 drivers/rtc/rtc-at91rm9200.c Johan Hovold                     2013-06-12  477  		return -ENODEV;
de645475913f67 drivers/rtc/rtc-at91rm9200.c Johan Hovold                     2013-06-12  478  
d28bdfc5c80fb6 drivers/rtc/rtc-at91rm9200.c Jean-Christophe PLAGNIOL-VILLARD 2011-11-14  479  	regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
d28bdfc5c80fb6 drivers/rtc/rtc-at91rm9200.c Jean-Christophe PLAGNIOL-VILLARD 2011-11-14  480  	if (!regs) {
d28bdfc5c80fb6 drivers/rtc/rtc-at91rm9200.c Jean-Christophe PLAGNIOL-VILLARD 2011-11-14  481  		dev_err(&pdev->dev, "no mmio resource defined\n");
d28bdfc5c80fb6 drivers/rtc/rtc-at91rm9200.c Jean-Christophe PLAGNIOL-VILLARD 2011-11-14  482  		return -ENXIO;
d28bdfc5c80fb6 drivers/rtc/rtc-at91rm9200.c Jean-Christophe PLAGNIOL-VILLARD 2011-11-14  483  	}
d28bdfc5c80fb6 drivers/rtc/rtc-at91rm9200.c Jean-Christophe PLAGNIOL-VILLARD 2011-11-14  484  
d28bdfc5c80fb6 drivers/rtc/rtc-at91rm9200.c Jean-Christophe PLAGNIOL-VILLARD 2011-11-14  485  	irq = platform_get_irq(pdev, 0);
faac910201e9be drivers/rtc/rtc-at91rm9200.c Stephen Boyd                     2019-07-30  486  	if (irq < 0)
d28bdfc5c80fb6 drivers/rtc/rtc-at91rm9200.c Jean-Christophe PLAGNIOL-VILLARD 2011-11-14  487  		return -ENXIO;
d28bdfc5c80fb6 drivers/rtc/rtc-at91rm9200.c Jean-Christophe PLAGNIOL-VILLARD 2011-11-14  488  
f3766250b2e9f2 drivers/rtc/rtc-at91rm9200.c Sachin Kamat                     2013-11-12  489  	at91_rtc_regs = devm_ioremap(&pdev->dev, regs->start,
f3766250b2e9f2 drivers/rtc/rtc-at91rm9200.c Sachin Kamat                     2013-11-12  490  				     resource_size(regs));
d28bdfc5c80fb6 drivers/rtc/rtc-at91rm9200.c Jean-Christophe PLAGNIOL-VILLARD 2011-11-14  491  	if (!at91_rtc_regs) {
d28bdfc5c80fb6 drivers/rtc/rtc-at91rm9200.c Jean-Christophe PLAGNIOL-VILLARD 2011-11-14  492  		dev_err(&pdev->dev, "failed to map registers, aborting.\n");
d28bdfc5c80fb6 drivers/rtc/rtc-at91rm9200.c Jean-Christophe PLAGNIOL-VILLARD 2011-11-14  493  		return -ENOMEM;
d28bdfc5c80fb6 drivers/rtc/rtc-at91rm9200.c Jean-Christophe PLAGNIOL-VILLARD 2011-11-14  494  	}
d28bdfc5c80fb6 drivers/rtc/rtc-at91rm9200.c Jean-Christophe PLAGNIOL-VILLARD 2011-11-14  495  
735ae2056b3c72 drivers/rtc/rtc-at91rm9200.c Alexandre Belloni                2017-07-06  496  	rtc = devm_rtc_allocate_device(&pdev->dev);
735ae2056b3c72 drivers/rtc/rtc-at91rm9200.c Alexandre Belloni                2017-07-06  497  	if (IS_ERR(rtc))
735ae2056b3c72 drivers/rtc/rtc-at91rm9200.c Alexandre Belloni                2017-07-06  498  		return PTR_ERR(rtc);
735ae2056b3c72 drivers/rtc/rtc-at91rm9200.c Alexandre Belloni                2017-07-06  499  	platform_set_drvdata(pdev, rtc);
735ae2056b3c72 drivers/rtc/rtc-at91rm9200.c Alexandre Belloni                2017-07-06  500  
40844cea20a5f8 drivers/rtc/rtc-at91rm9200.c Liao Yuanhong                    2024-08-21  501  	sclk = devm_clk_get_enabled(&pdev->dev, NULL);
11f67a8bbf6587 drivers/rtc/rtc-at91rm9200.c Alexandre Belloni                2015-07-31  502  	if (IS_ERR(sclk))
11f67a8bbf6587 drivers/rtc/rtc-at91rm9200.c Alexandre Belloni                2015-07-31  503  		return PTR_ERR(sclk);
11f67a8bbf6587 drivers/rtc/rtc-at91rm9200.c Alexandre Belloni                2015-07-31 @504  	}
11f67a8bbf6587 drivers/rtc/rtc-at91rm9200.c Alexandre Belloni                2015-07-31  505  
d28bdfc5c80fb6 drivers/rtc/rtc-at91rm9200.c Jean-Christophe PLAGNIOL-VILLARD 2011-11-14 @506  	at91_rtc_write(AT91_RTC_CR, 0);
f6a46f8b302d9b drivers/rtc/rtc-at91rm9200.c Alexandre Belloni                2020-11-09  507  	at91_rtc_write(AT91_RTC_MR, at91_rtc_read(AT91_RTC_MR) & ~AT91_RTC_HRMOD);
788b1fc619a31e drivers/rtc/rtc-at91.c       Andrew Victor                    2006-06-25  508  
788b1fc619a31e drivers/rtc/rtc-at91.c       Andrew Victor                    2006-06-25  509  	/* Disable all interrupts */
e304fcd075a0e9 drivers/rtc/rtc-at91rm9200.c Johan Hovold                     2013-06-12  510  	at91_rtc_write_idr(AT91_RTC_ACKUPD | AT91_RTC_ALARM |
e7a8bb12c24af8 drivers/rtc/rtc-at91.c       Andrew Morton                    2006-06-25  511  					AT91_RTC_SECEV | AT91_RTC_TIMEV |
e7a8bb12c24af8 drivers/rtc/rtc-at91.c       Andrew Morton                    2006-06-25  512  					AT91_RTC_CALEV);
788b1fc619a31e drivers/rtc/rtc-at91.c       Andrew Victor                    2006-06-25  513  
f3766250b2e9f2 drivers/rtc/rtc-at91rm9200.c Sachin Kamat                     2013-11-12  514  	ret = devm_request_irq(&pdev->dev, irq, at91_rtc_interrupt,
dd1f1f391dd7f3 drivers/rtc/rtc-at91rm9200.c Boris Brezillon                  2015-03-02  515  			       IRQF_SHARED | IRQF_COND_SUSPEND,
d728b1e69fd582 drivers/rtc/rtc-at91.c       David Brownell                   2006-11-25  516  			       "at91_rtc", pdev);
788b1fc619a31e drivers/rtc/rtc-at91.c       Andrew Victor                    2006-06-25  517  	if (ret) {
6588208cb2be4a drivers/rtc/rtc-at91rm9200.c Jingoo Han                       2013-02-21  518  		dev_err(&pdev->dev, "IRQ %d already in use.\n", irq);
40844cea20a5f8 drivers/rtc/rtc-at91rm9200.c Liao Yuanhong                    2024-08-21  519  		return ret;
788b1fc619a31e drivers/rtc/rtc-at91.c       Andrew Victor                    2006-06-25  520  	}
788b1fc619a31e drivers/rtc/rtc-at91.c       Andrew Victor                    2006-06-25  521  
5d4675a811fb71 drivers/rtc/rtc-at91rm9200.c David Brownell                   2007-02-20  522  	/* cpu init code should really have flagged this device as
5d4675a811fb71 drivers/rtc/rtc-at91rm9200.c David Brownell                   2007-02-20  523  	 * being wake-capable; if it didn't, do that here.
5d4675a811fb71 drivers/rtc/rtc-at91rm9200.c David Brownell                   2007-02-20  524  	 */
5d4675a811fb71 drivers/rtc/rtc-at91rm9200.c David Brownell                   2007-02-20  525  	if (!device_can_wakeup(&pdev->dev))
5d4675a811fb71 drivers/rtc/rtc-at91rm9200.c David Brownell                   2007-02-20  526  		device_init_wakeup(&pdev->dev, 1);
5d4675a811fb71 drivers/rtc/rtc-at91rm9200.c David Brownell                   2007-02-20  527  
f6a46f8b302d9b drivers/rtc/rtc-at91rm9200.c Alexandre Belloni                2020-11-09  528  	if (at91_rtc_config->has_correction)
f6a46f8b302d9b drivers/rtc/rtc-at91rm9200.c Alexandre Belloni                2020-11-09  529  		rtc->ops = &sama5d4_rtc_ops;
f6a46f8b302d9b drivers/rtc/rtc-at91rm9200.c Alexandre Belloni                2020-11-09  530  	else
735ae2056b3c72 drivers/rtc/rtc-at91rm9200.c Alexandre Belloni                2017-07-06  531  		rtc->ops = &at91_rtc_ops;
f6a46f8b302d9b drivers/rtc/rtc-at91rm9200.c Alexandre Belloni                2020-11-09  532  
6c78a872a673c4 drivers/rtc/rtc-at91rm9200.c Alexandre Belloni                2018-05-17  533  	rtc->range_min = RTC_TIMESTAMP_BEGIN_1900;
6c78a872a673c4 drivers/rtc/rtc-at91rm9200.c Alexandre Belloni                2018-05-17  534  	rtc->range_max = RTC_TIMESTAMP_END_2099;
fdcfd854333be5 drivers/rtc/rtc-at91rm9200.c Bartosz Golaszewski              2020-11-09  535  	ret = devm_rtc_register_device(rtc);
735ae2056b3c72 drivers/rtc/rtc-at91rm9200.c Alexandre Belloni                2017-07-06  536  	if (ret)
40844cea20a5f8 drivers/rtc/rtc-at91rm9200.c Liao Yuanhong                    2024-08-21  537  		return ret;
788b1fc619a31e drivers/rtc/rtc-at91.c       Andrew Victor                    2006-06-25  538  
2fe121e1f5aa3b drivers/rtc/rtc-at91rm9200.c Boris Brezillon                  2014-06-06  539  	/* enable SECEV interrupt in order to initialize at91_rtc_upd_rdy
2fe121e1f5aa3b drivers/rtc/rtc-at91rm9200.c Boris Brezillon                  2014-06-06  540  	 * completion.
2fe121e1f5aa3b drivers/rtc/rtc-at91rm9200.c Boris Brezillon                  2014-06-06  541  	 */
2fe121e1f5aa3b drivers/rtc/rtc-at91rm9200.c Boris Brezillon                  2014-06-06  542  	at91_rtc_write_ier(AT91_RTC_SECEV);
2fe121e1f5aa3b drivers/rtc/rtc-at91rm9200.c Boris Brezillon                  2014-06-06  543  
6588208cb2be4a drivers/rtc/rtc-at91rm9200.c Jingoo Han                       2013-02-21  544  	dev_info(&pdev->dev, "AT91 Real Time Clock driver.\n");
788b1fc619a31e drivers/rtc/rtc-at91.c       Andrew Victor                    2006-06-25  545  	return 0;
788b1fc619a31e drivers/rtc/rtc-at91.c       Andrew Victor                    2006-06-25  546  }
788b1fc619a31e drivers/rtc/rtc-at91.c       Andrew Victor                    2006-06-25  547  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
Re: [PATCH 1/7] rtc:rtc-at91rm9200:Use devm_clk_get_enabled() helpers
Posted by kernel test robot 1 year, 5 months ago
Hi Liao,

kernel test robot noticed the following build errors:

[auto build test ERROR on abelloni/rtc-next]
[also build test ERROR on tegra/for-next linus/master v6.11-rc4 next-20240821]
[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/Liao-Yuanhong/rtc-rtc-at91rm9200-Use-devm_clk_get_enabled-helpers/20240821-190257
base:   https://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux.git rtc-next
patch link:    https://lore.kernel.org/r/20240821092846.20138-2-liaoyuanhong%40vivo.com
patch subject: [PATCH 1/7] rtc:rtc-at91rm9200:Use devm_clk_get_enabled() helpers
config: m68k-allmodconfig (https://download.01.org/0day-ci/archive/20240822/202408221124.2hKATpa8-lkp@intel.com/config)
compiler: m68k-linux-gcc (GCC) 14.1.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240822/202408221124.2hKATpa8-lkp@intel.com/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@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202408221124.2hKATpa8-lkp@intel.com/

All errors (new ones prefixed by >>):

   drivers/rtc/rtc-at91rm9200.c: In function 'at91_rtc_probe':
   drivers/rtc/rtc-at91rm9200.c:473:13: warning: unused variable 'ret' [-Wunused-variable]
     473 |         int ret = 0;
         |             ^~~
   In file included from arch/m68k/include/asm/io_mm.h:25,
                    from arch/m68k/include/asm/io.h:8,
                    from include/linux/io.h:14,
                    from include/linux/irq.h:20,
                    from include/asm-generic/hardirq.h:17,
                    from ./arch/m68k/include/generated/asm/hardirq.h:1,
                    from include/linux/hardirq.h:11,
                    from include/linux/interrupt.h:11,
                    from drivers/rtc/rtc-at91rm9200.c:20:
   drivers/rtc/rtc-at91rm9200.c: At top level:
>> arch/m68k/include/asm/raw_io.h:34:27: error: expected identifier or '(' before 'void'
      34 | #define out_le32(addr,l) (void)((*(__force volatile __le32 *) (unsigned long)(addr)) = cpu_to_le32(l))
         |                           ^~~~
   arch/m68k/include/asm/io_mm.h:373:26: note: in expansion of macro 'out_le32'
     373 | #define writel(val,addr) out_le32((addr),(val))
         |                          ^~~~~~~~
   arch/m68k/include/asm/io_mm.h:398:33: note: in expansion of macro 'writel'
     398 | #define writel_relaxed(b, addr) writel(b, addr)
         |                                 ^~~~~~
   drivers/rtc/rtc-at91rm9200.c:89:9: note: in expansion of macro 'writel_relaxed'
      89 |         writel_relaxed((val), at91_rtc_regs + field)
         |         ^~~~~~~~~~~~~~
   drivers/rtc/rtc-at91rm9200.c:506:9: note: in expansion of macro 'at91_rtc_write'
     506 |         at91_rtc_write(AT91_RTC_CR, 0);
         |         ^~~~~~~~~~~~~~
>> arch/m68k/include/asm/raw_io.h:34:27: error: expected identifier or '(' before 'void'
      34 | #define out_le32(addr,l) (void)((*(__force volatile __le32 *) (unsigned long)(addr)) = cpu_to_le32(l))
         |                           ^~~~
   arch/m68k/include/asm/io_mm.h:373:26: note: in expansion of macro 'out_le32'
     373 | #define writel(val,addr) out_le32((addr),(val))
         |                          ^~~~~~~~
   arch/m68k/include/asm/io_mm.h:398:33: note: in expansion of macro 'writel'
     398 | #define writel_relaxed(b, addr) writel(b, addr)
         |                                 ^~~~~~
   drivers/rtc/rtc-at91rm9200.c:89:9: note: in expansion of macro 'writel_relaxed'
      89 |         writel_relaxed((val), at91_rtc_regs + field)
         |         ^~~~~~~~~~~~~~
   drivers/rtc/rtc-at91rm9200.c:507:9: note: in expansion of macro 'at91_rtc_write'
     507 |         at91_rtc_write(AT91_RTC_MR, at91_rtc_read(AT91_RTC_MR) & ~AT91_RTC_HRMOD);
         |         ^~~~~~~~~~~~~~
   In file included from include/linux/swab.h:5,
                    from include/uapi/linux/byteorder/big_endian.h:14,
                    from include/linux/byteorder/big_endian.h:5,
                    from arch/m68k/include/uapi/asm/byteorder.h:5,
                    from include/linux/bitfield.h:11,
                    from drivers/rtc/rtc-at91rm9200.c:17:
>> arch/m68k/include/asm/raw_io.h:28:95: error: expected identifier or '(' before ')' token
      28 |     ({ u32 __v = le32_to_cpu(*(__force const volatile __le32 *) (unsigned long)(addr)); __v; })
         |                                                                                               ^
   include/uapi/linux/swab.h:118:38: note: in definition of macro '__swab32'
     118 |         (__u32)(__builtin_constant_p(x) ?       \
         |                                      ^
   include/linux/byteorder/generic.h:88:21: note: in expansion of macro '__cpu_to_le32'
      88 | #define cpu_to_le32 __cpu_to_le32
         |                     ^~~~~~~~~~~~~
   arch/m68k/include/asm/io_mm.h:373:26: note: in expansion of macro 'out_le32'
     373 | #define writel(val,addr) out_le32((addr),(val))
         |                          ^~~~~~~~
   arch/m68k/include/asm/io_mm.h:398:33: note: in expansion of macro 'writel'
     398 | #define writel_relaxed(b, addr) writel(b, addr)
         |                                 ^~~~~~
   drivers/rtc/rtc-at91rm9200.c:89:9: note: in expansion of macro 'writel_relaxed'
      89 |         writel_relaxed((val), at91_rtc_regs + field)
         |         ^~~~~~~~~~~~~~
   drivers/rtc/rtc-at91rm9200.c:507:9: note: in expansion of macro 'at91_rtc_write'
     507 |         at91_rtc_write(AT91_RTC_MR, at91_rtc_read(AT91_RTC_MR) & ~AT91_RTC_HRMOD);
         |         ^~~~~~~~~~~~~~
   arch/m68k/include/asm/io_mm.h:372:26: note: in expansion of macro 'in_le32'
     372 | #define readl(addr)      in_le32(addr)
         |                          ^~~~~~~
   arch/m68k/include/asm/io_mm.h:394:33: note: in expansion of macro 'readl'
     394 | #define readl_relaxed(addr)     readl(addr)
         |                                 ^~~~~
   drivers/rtc/rtc-at91rm9200.c:87:9: note: in expansion of macro 'readl_relaxed'
      87 |         readl_relaxed(at91_rtc_regs + field)
         |         ^~~~~~~~~~~~~
   drivers/rtc/rtc-at91rm9200.c:507:37: note: in expansion of macro 'at91_rtc_read'
     507 |         at91_rtc_write(AT91_RTC_MR, at91_rtc_read(AT91_RTC_MR) & ~AT91_RTC_HRMOD);
         |                                     ^~~~~~~~~~~~~
>> arch/m68k/include/asm/raw_io.h:28:95: error: expected identifier or '(' before ')' token
      28 |     ({ u32 __v = le32_to_cpu(*(__force const volatile __le32 *) (unsigned long)(addr)); __v; })
         |                                                                                               ^
   include/uapi/linux/swab.h:19:19: note: in definition of macro '___constant_swab32'
      19 |         (((__u32)(x) & (__u32)0x000000ffUL) << 24) |            \
         |                   ^
   include/uapi/linux/byteorder/big_endian.h:34:43: note: in expansion of macro '__swab32'
      34 | #define __cpu_to_le32(x) ((__force __le32)__swab32((x)))
         |                                           ^~~~~~~~
   include/linux/byteorder/generic.h:88:21: note: in expansion of macro '__cpu_to_le32'
      88 | #define cpu_to_le32 __cpu_to_le32
         |                     ^~~~~~~~~~~~~
   arch/m68k/include/asm/io_mm.h:373:26: note: in expansion of macro 'out_le32'
     373 | #define writel(val,addr) out_le32((addr),(val))
         |                          ^~~~~~~~
   arch/m68k/include/asm/io_mm.h:398:33: note: in expansion of macro 'writel'
     398 | #define writel_relaxed(b, addr) writel(b, addr)
         |                                 ^~~~~~
   drivers/rtc/rtc-at91rm9200.c:89:9: note: in expansion of macro 'writel_relaxed'
      89 |         writel_relaxed((val), at91_rtc_regs + field)
         |         ^~~~~~~~~~~~~~
   drivers/rtc/rtc-at91rm9200.c:507:9: note: in expansion of macro 'at91_rtc_write'
     507 |         at91_rtc_write(AT91_RTC_MR, at91_rtc_read(AT91_RTC_MR) & ~AT91_RTC_HRMOD);
         |         ^~~~~~~~~~~~~~
   arch/m68k/include/asm/io_mm.h:372:26: note: in expansion of macro 'in_le32'
     372 | #define readl(addr)      in_le32(addr)
         |                          ^~~~~~~
   arch/m68k/include/asm/io_mm.h:394:33: note: in expansion of macro 'readl'
     394 | #define readl_relaxed(addr)     readl(addr)
         |                                 ^~~~~
   drivers/rtc/rtc-at91rm9200.c:87:9: note: in expansion of macro 'readl_relaxed'
      87 |         readl_relaxed(at91_rtc_regs + field)
         |         ^~~~~~~~~~~~~
   drivers/rtc/rtc-at91rm9200.c:507:37: note: in expansion of macro 'at91_rtc_read'
     507 |         at91_rtc_write(AT91_RTC_MR, at91_rtc_read(AT91_RTC_MR) & ~AT91_RTC_HRMOD);
         |                                     ^~~~~~~~~~~~~
>> arch/m68k/include/asm/raw_io.h:28:95: error: expected identifier or '(' before ')' token
      28 |     ({ u32 __v = le32_to_cpu(*(__force const volatile __le32 *) (unsigned long)(addr)); __v; })
         |                                                                                               ^
   include/uapi/linux/swab.h:20:19: note: in definition of macro '___constant_swab32'
      20 |         (((__u32)(x) & (__u32)0x0000ff00UL) <<  8) |            \
         |                   ^
   include/uapi/linux/byteorder/big_endian.h:34:43: note: in expansion of macro '__swab32'
      34 | #define __cpu_to_le32(x) ((__force __le32)__swab32((x)))
         |                                           ^~~~~~~~
   include/linux/byteorder/generic.h:88:21: note: in expansion of macro '__cpu_to_le32'
      88 | #define cpu_to_le32 __cpu_to_le32
         |                     ^~~~~~~~~~~~~
   arch/m68k/include/asm/io_mm.h:373:26: note: in expansion of macro 'out_le32'
     373 | #define writel(val,addr) out_le32((addr),(val))
         |                          ^~~~~~~~
   arch/m68k/include/asm/io_mm.h:398:33: note: in expansion of macro 'writel'
     398 | #define writel_relaxed(b, addr) writel(b, addr)
         |                                 ^~~~~~
   drivers/rtc/rtc-at91rm9200.c:89:9: note: in expansion of macro 'writel_relaxed'
      89 |         writel_relaxed((val), at91_rtc_regs + field)
         |         ^~~~~~~~~~~~~~
   drivers/rtc/rtc-at91rm9200.c:507:9: note: in expansion of macro 'at91_rtc_write'
     507 |         at91_rtc_write(AT91_RTC_MR, at91_rtc_read(AT91_RTC_MR) & ~AT91_RTC_HRMOD);
         |         ^~~~~~~~~~~~~~
   arch/m68k/include/asm/io_mm.h:372:26: note: in expansion of macro 'in_le32'
     372 | #define readl(addr)      in_le32(addr)
         |                          ^~~~~~~
   arch/m68k/include/asm/io_mm.h:394:33: note: in expansion of macro 'readl'
     394 | #define readl_relaxed(addr)     readl(addr)
         |                                 ^~~~~
   drivers/rtc/rtc-at91rm9200.c:87:9: note: in expansion of macro 'readl_relaxed'
      87 |         readl_relaxed(at91_rtc_regs + field)
         |         ^~~~~~~~~~~~~
   drivers/rtc/rtc-at91rm9200.c:507:37: note: in expansion of macro 'at91_rtc_read'
     507 |         at91_rtc_write(AT91_RTC_MR, at91_rtc_read(AT91_RTC_MR) & ~AT91_RTC_HRMOD);
         |                                     ^~~~~~~~~~~~~
>> arch/m68k/include/asm/raw_io.h:28:95: error: expected identifier or '(' before ')' token
      28 |     ({ u32 __v = le32_to_cpu(*(__force const volatile __le32 *) (unsigned long)(addr)); __v; })
         |                                                                                               ^
   include/uapi/linux/swab.h:21:19: note: in definition of macro '___constant_swab32'
      21 |         (((__u32)(x) & (__u32)0x00ff0000UL) >>  8) |            \
         |                   ^
   include/uapi/linux/byteorder/big_endian.h:34:43: note: in expansion of macro '__swab32'
      34 | #define __cpu_to_le32(x) ((__force __le32)__swab32((x)))
         |                                           ^~~~~~~~
   include/linux/byteorder/generic.h:88:21: note: in expansion of macro '__cpu_to_le32'
      88 | #define cpu_to_le32 __cpu_to_le32
         |                     ^~~~~~~~~~~~~
   arch/m68k/include/asm/io_mm.h:373:26: note: in expansion of macro 'out_le32'
     373 | #define writel(val,addr) out_le32((addr),(val))
         |                          ^~~~~~~~
   arch/m68k/include/asm/io_mm.h:398:33: note: in expansion of macro 'writel'
     398 | #define writel_relaxed(b, addr) writel(b, addr)
         |                                 ^~~~~~
   drivers/rtc/rtc-at91rm9200.c:89:9: note: in expansion of macro 'writel_relaxed'
      89 |         writel_relaxed((val), at91_rtc_regs + field)
         |         ^~~~~~~~~~~~~~
   drivers/rtc/rtc-at91rm9200.c:507:9: note: in expansion of macro 'at91_rtc_write'
     507 |         at91_rtc_write(AT91_RTC_MR, at91_rtc_read(AT91_RTC_MR) & ~AT91_RTC_HRMOD);
         |         ^~~~~~~~~~~~~~
   arch/m68k/include/asm/io_mm.h:372:26: note: in expansion of macro 'in_le32'
     372 | #define readl(addr)      in_le32(addr)
         |                          ^~~~~~~
   arch/m68k/include/asm/io_mm.h:394:33: note: in expansion of macro 'readl'
     394 | #define readl_relaxed(addr)     readl(addr)
         |                                 ^~~~~
   drivers/rtc/rtc-at91rm9200.c:87:9: note: in expansion of macro 'readl_relaxed'
      87 |         readl_relaxed(at91_rtc_regs + field)
         |         ^~~~~~~~~~~~~
   drivers/rtc/rtc-at91rm9200.c:507:37: note: in expansion of macro 'at91_rtc_read'
     507 |         at91_rtc_write(AT91_RTC_MR, at91_rtc_read(AT91_RTC_MR) & ~AT91_RTC_HRMOD);
         |                                     ^~~~~~~~~~~~~
>> arch/m68k/include/asm/raw_io.h:28:95: error: expected identifier or '(' before ')' token
      28 |     ({ u32 __v = le32_to_cpu(*(__force const volatile __le32 *) (unsigned long)(addr)); __v; })
         |                                                                                               ^
   include/uapi/linux/swab.h:22:19: note: in definition of macro '___constant_swab32'
      22 |         (((__u32)(x) & (__u32)0xff000000UL) >> 24)))
         |                   ^
   include/uapi/linux/byteorder/big_endian.h:34:43: note: in expansion of macro '__swab32'
      34 | #define __cpu_to_le32(x) ((__force __le32)__swab32((x)))
         |                                           ^~~~~~~~
   include/linux/byteorder/generic.h:88:21: note: in expansion of macro '__cpu_to_le32'
      88 | #define cpu_to_le32 __cpu_to_le32
         |                     ^~~~~~~~~~~~~
   arch/m68k/include/asm/io_mm.h:373:26: note: in expansion of macro 'out_le32'
     373 | #define writel(val,addr) out_le32((addr),(val))
         |                          ^~~~~~~~
   arch/m68k/include/asm/io_mm.h:398:33: note: in expansion of macro 'writel'
     398 | #define writel_relaxed(b, addr) writel(b, addr)
         |                                 ^~~~~~
   drivers/rtc/rtc-at91rm9200.c:89:9: note: in expansion of macro 'writel_relaxed'
      89 |         writel_relaxed((val), at91_rtc_regs + field)
         |         ^~~~~~~~~~~~~~
   drivers/rtc/rtc-at91rm9200.c:507:9: note: in expansion of macro 'at91_rtc_write'
     507 |         at91_rtc_write(AT91_RTC_MR, at91_rtc_read(AT91_RTC_MR) & ~AT91_RTC_HRMOD);
         |         ^~~~~~~~~~~~~~
   arch/m68k/include/asm/io_mm.h:372:26: note: in expansion of macro 'in_le32'
     372 | #define readl(addr)      in_le32(addr)
         |                          ^~~~~~~
   arch/m68k/include/asm/io_mm.h:394:33: note: in expansion of macro 'readl'
     394 | #define readl_relaxed(addr)     readl(addr)
         |                                 ^~~~~
   drivers/rtc/rtc-at91rm9200.c:87:9: note: in expansion of macro 'readl_relaxed'
      87 |         readl_relaxed(at91_rtc_regs + field)
         |         ^~~~~~~~~~~~~
   drivers/rtc/rtc-at91rm9200.c:507:37: note: in expansion of macro 'at91_rtc_read'
     507 |         at91_rtc_write(AT91_RTC_MR, at91_rtc_read(AT91_RTC_MR) & ~AT91_RTC_HRMOD);
         |                                     ^~~~~~~~~~~~~
>> arch/m68k/include/asm/raw_io.h:28:95: error: expected identifier or '(' before ')' token
      28 |     ({ u32 __v = le32_to_cpu(*(__force const volatile __le32 *) (unsigned long)(addr)); __v; })
         |                                                                                               ^
   include/uapi/linux/swab.h:120:19: note: in definition of macro '__swab32'
     120 |         __fswab32(x))
         |                   ^
   include/linux/byteorder/generic.h:88:21: note: in expansion of macro '__cpu_to_le32'
      88 | #define cpu_to_le32 __cpu_to_le32
         |                     ^~~~~~~~~~~~~
   arch/m68k/include/asm/io_mm.h:373:26: note: in expansion of macro 'out_le32'
     373 | #define writel(val,addr) out_le32((addr),(val))
         |                          ^~~~~~~~
   arch/m68k/include/asm/io_mm.h:398:33: note: in expansion of macro 'writel'
     398 | #define writel_relaxed(b, addr) writel(b, addr)
         |                                 ^~~~~~
   drivers/rtc/rtc-at91rm9200.c:89:9: note: in expansion of macro 'writel_relaxed'
      89 |         writel_relaxed((val), at91_rtc_regs + field)
         |         ^~~~~~~~~~~~~~
   drivers/rtc/rtc-at91rm9200.c:507:9: note: in expansion of macro 'at91_rtc_write'
     507 |         at91_rtc_write(AT91_RTC_MR, at91_rtc_read(AT91_RTC_MR) & ~AT91_RTC_HRMOD);
         |         ^~~~~~~~~~~~~~
   arch/m68k/include/asm/io_mm.h:372:26: note: in expansion of macro 'in_le32'
     372 | #define readl(addr)      in_le32(addr)
         |                          ^~~~~~~
   arch/m68k/include/asm/io_mm.h:394:33: note: in expansion of macro 'readl'
     394 | #define readl_relaxed(addr)     readl(addr)
         |                                 ^~~~~
   drivers/rtc/rtc-at91rm9200.c:87:9: note: in expansion of macro 'readl_relaxed'
      87 |         readl_relaxed(at91_rtc_regs + field)
         |         ^~~~~~~~~~~~~
   drivers/rtc/rtc-at91rm9200.c:507:37: note: in expansion of macro 'at91_rtc_read'
     507 |         at91_rtc_write(AT91_RTC_MR, at91_rtc_read(AT91_RTC_MR) & ~AT91_RTC_HRMOD);
         |                                     ^~~~~~~~~~~~~
   In file included from include/linux/bits.h:6,
                    from include/linux/bitops.h:6,
                    from include/linux/kernel.h:23,
                    from include/linux/clk.h:13,
                    from drivers/rtc/rtc-at91rm9200.c:18:
   include/vdso/bits.h:7:33: error: expected declaration specifiers or '...' before '(' token
       7 | #define BIT(nr)                 (UL(1) << (nr))
         |                                 ^
   drivers/rtc/rtc-at91rm9200.c:66:41: note: in expansion of macro 'BIT'
      66 | #define         AT91_RTC_ACKUPD         BIT(0)          /* Acknowledge for Update */
         |                                         ^~~
   drivers/rtc/rtc-at91rm9200.c:510:28: note: in expansion of macro 'AT91_RTC_ACKUPD'
     510 |         at91_rtc_write_idr(AT91_RTC_ACKUPD | AT91_RTC_ALARM |
         |                            ^~~~~~~~~~~~~~~
   drivers/rtc/rtc-at91rm9200.c:514:9: warning: data definition has no type or storage class
     514 |         ret = devm_request_irq(&pdev->dev, irq, at91_rtc_interrupt,
         |         ^~~
   drivers/rtc/rtc-at91rm9200.c:514:9: error: type defaults to 'int' in declaration of 'ret' [-Wimplicit-int]
   drivers/rtc/rtc-at91rm9200.c:514:33: error: 'pdev' undeclared here (not in a function); did you mean 'cdev'?
     514 |         ret = devm_request_irq(&pdev->dev, irq, at91_rtc_interrupt,
         |                                 ^~~~
         |                                 cdev
   drivers/rtc/rtc-at91rm9200.c:517:9: error: expected identifier or '(' before 'if'
     517 |         if (ret) {
         |         ^~
   drivers/rtc/rtc-at91rm9200.c:525:9: error: expected identifier or '(' before 'if'
     525 |         if (!device_can_wakeup(&pdev->dev))
         |         ^~
   drivers/rtc/rtc-at91rm9200.c:528:9: error: expected identifier or '(' before 'if'
     528 |         if (at91_rtc_config->has_correction)
         |         ^~
   drivers/rtc/rtc-at91rm9200.c:530:9: error: expected identifier or '(' before 'else'
     530 |         else
         |         ^~~~
   drivers/rtc/rtc-at91rm9200.c:533:12: error: expected '=', ',', ';', 'asm' or '__attribute__' before '->' token
     533 |         rtc->range_min = RTC_TIMESTAMP_BEGIN_1900;
         |            ^~
   drivers/rtc/rtc-at91rm9200.c:534:12: error: expected '=', ',', ';', 'asm' or '__attribute__' before '->' token
     534 |         rtc->range_max = RTC_TIMESTAMP_END_2099;
         |            ^~
   drivers/rtc/rtc-at91rm9200.c:535:9: warning: data definition has no type or storage class
     535 |         ret = devm_rtc_register_device(rtc);
         |         ^~~
   drivers/rtc/rtc-at91rm9200.c:535:9: error: type defaults to 'int' in declaration of 'ret' [-Wimplicit-int]
   drivers/rtc/rtc-at91rm9200.c:535:9: error: redefinition of 'ret'
   drivers/rtc/rtc-at91rm9200.c:514:9: note: previous definition of 'ret' with type 'int'
     514 |         ret = devm_request_irq(&pdev->dev, irq, at91_rtc_interrupt,
         |         ^~~
   In file included from drivers/rtc/rtc-at91rm9200.c:27:
   drivers/rtc/rtc-at91rm9200.c:535:40: error: 'rtc' undeclared here (not in a function)
     535 |         ret = devm_rtc_register_device(rtc);
         |                                        ^~~
   include/linux/rtc.h:246:49: note: in definition of macro 'devm_rtc_register_device'
     246 |         __devm_rtc_register_device(THIS_MODULE, device)
         |                                                 ^~~~~~
   drivers/rtc/rtc-at91rm9200.c:536:9: error: expected identifier or '(' before 'if'
     536 |         if (ret)
         |         ^~
   include/vdso/bits.h:7:33: error: expected declaration specifiers or '...' before '(' token
       7 | #define BIT(nr)                 (UL(1) << (nr))
         |                                 ^
   drivers/rtc/rtc-at91rm9200.c:68:41: note: in expansion of macro 'BIT'
      68 | #define         AT91_RTC_SECEV          BIT(2)          /* Second Event */
         |                                         ^~~
   drivers/rtc/rtc-at91rm9200.c:542:28: note: in expansion of macro 'AT91_RTC_SECEV'
     542 |         at91_rtc_write_ier(AT91_RTC_SECEV);
         |                            ^~~~~~~~~~~~~~
   In file included from include/linux/device.h:15,


vim +34 arch/m68k/include/asm/raw_io.h

^1da177e4c3f41 include/asm-m68k/raw_io.h      Linus Torvalds 2005-04-16  15  
^1da177e4c3f41 include/asm-m68k/raw_io.h      Linus Torvalds 2005-04-16  16  /* ++roman: The assignments to temp. vars avoid that gcc sometimes generates
^1da177e4c3f41 include/asm-m68k/raw_io.h      Linus Torvalds 2005-04-16  17   * two accesses to memory, which may be undesirable for some devices.
^1da177e4c3f41 include/asm-m68k/raw_io.h      Linus Torvalds 2005-04-16  18   */
^1da177e4c3f41 include/asm-m68k/raw_io.h      Linus Torvalds 2005-04-16  19  #define in_8(addr) \
c7db3832ff19a9 arch/m68k/include/asm/raw_io.h Arnd Bergmann  2023-09-25  20      ({ u8 __v = (*(__force const volatile u8 *) (unsigned long)(addr)); __v; })
^1da177e4c3f41 include/asm-m68k/raw_io.h      Linus Torvalds 2005-04-16  21  #define in_be16(addr) \
c7db3832ff19a9 arch/m68k/include/asm/raw_io.h Arnd Bergmann  2023-09-25  22      ({ u16 __v = (*(__force const volatile u16 *) (unsigned long)(addr)); __v; })
^1da177e4c3f41 include/asm-m68k/raw_io.h      Linus Torvalds 2005-04-16  23  #define in_be32(addr) \
c7db3832ff19a9 arch/m68k/include/asm/raw_io.h Arnd Bergmann  2023-09-25  24      ({ u32 __v = (*(__force const volatile u32 *) (unsigned long)(addr)); __v; })
^1da177e4c3f41 include/asm-m68k/raw_io.h      Linus Torvalds 2005-04-16  25  #define in_le16(addr) \
c7db3832ff19a9 arch/m68k/include/asm/raw_io.h Arnd Bergmann  2023-09-25  26      ({ u16 __v = le16_to_cpu(*(__force const volatile __le16 *) (unsigned long)(addr)); __v; })
^1da177e4c3f41 include/asm-m68k/raw_io.h      Linus Torvalds 2005-04-16  27  #define in_le32(addr) \
c7db3832ff19a9 arch/m68k/include/asm/raw_io.h Arnd Bergmann  2023-09-25 @28      ({ u32 __v = le32_to_cpu(*(__force const volatile __le32 *) (unsigned long)(addr)); __v; })
^1da177e4c3f41 include/asm-m68k/raw_io.h      Linus Torvalds 2005-04-16  29  
b1a89856fbf63f arch/m68k/include/asm/raw_io.h Guenter Roeck  2021-09-06  30  #define out_8(addr,b) (void)((*(__force volatile u8 *) (unsigned long)(addr)) = (b))
b1a89856fbf63f arch/m68k/include/asm/raw_io.h Guenter Roeck  2021-09-06  31  #define out_be16(addr,w) (void)((*(__force volatile u16 *) (unsigned long)(addr)) = (w))
b1a89856fbf63f arch/m68k/include/asm/raw_io.h Guenter Roeck  2021-09-06  32  #define out_be32(addr,l) (void)((*(__force volatile u32 *) (unsigned long)(addr)) = (l))
b1a89856fbf63f arch/m68k/include/asm/raw_io.h Guenter Roeck  2021-09-06  33  #define out_le16(addr,w) (void)((*(__force volatile __le16 *) (unsigned long)(addr)) = cpu_to_le16(w))
b1a89856fbf63f arch/m68k/include/asm/raw_io.h Guenter Roeck  2021-09-06 @34  #define out_le32(addr,l) (void)((*(__force volatile __le32 *) (unsigned long)(addr)) = cpu_to_le32(l))
^1da177e4c3f41 include/asm-m68k/raw_io.h      Linus Torvalds 2005-04-16  35  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
Re: [PATCH 1/7] rtc:rtc-at91rm9200:Use devm_clk_get_enabled() helpers
Posted by Christophe JAILLET 1 year, 5 months ago
Le 21/08/2024 à 11:28, Liao Yuanhong a écrit :
> Use devm_clk_get_enabled() instead of clk functions in rtc-at91rm9200.
> 
> Signed-off-by: Liao Yuanhong <liaoyuanhong@vivo.com>
> ---
>   drivers/rtc/rtc-at91rm9200.c | 18 +++---------------
>   1 file changed, 3 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/rtc/rtc-at91rm9200.c b/drivers/rtc/rtc-at91rm9200.c
> index c16fe711a0d9..81b2556930bb 100644
> --- a/drivers/rtc/rtc-at91rm9200.c
> +++ b/drivers/rtc/rtc-at91rm9200.c
> @@ -498,14 +498,9 @@ static int __init at91_rtc_probe(struct platform_device *pdev)
>   		return PTR_ERR(rtc);
>   	platform_set_drvdata(pdev, rtc);
>   
> -	sclk = devm_clk_get(&pdev->dev, NULL);
> +	sclk = devm_clk_get_enabled(&pdev->dev, NULL);

Hi,

so now the global sclk variable could easily be removed as well.

CJ

>   	if (IS_ERR(sclk))
>   		return PTR_ERR(sclk);
> -
> -	ret = clk_prepare_enable(sclk);
> -	if (ret) {
> -		dev_err(&pdev->dev, "Could not enable slow clock\n");
> -		return ret;
>   	}
>   
>   	at91_rtc_write(AT91_RTC_CR, 0);
> @@ -521,7 +516,7 @@ static int __init at91_rtc_probe(struct platform_device *pdev)
>   			       "at91_rtc", pdev);
>   	if (ret) {
>   		dev_err(&pdev->dev, "IRQ %d already in use.\n", irq);
> -		goto err_clk;
> +		return ret;
>   	}
>   
>   	/* cpu init code should really have flagged this device as
> @@ -539,7 +534,7 @@ static int __init at91_rtc_probe(struct platform_device *pdev)
>   	rtc->range_max = RTC_TIMESTAMP_END_2099;
>   	ret = devm_rtc_register_device(rtc);
>   	if (ret)
> -		goto err_clk;
> +		return ret;
>   
>   	/* enable SECEV interrupt in order to initialize at91_rtc_upd_rdy
>   	 * completion.
> @@ -548,11 +543,6 @@ static int __init at91_rtc_probe(struct platform_device *pdev)
>   
>   	dev_info(&pdev->dev, "AT91 Real Time Clock driver.\n");
>   	return 0;
> -
> -err_clk:
> -	clk_disable_unprepare(sclk);
> -
> -	return ret;
>   }
>   
>   /*
> @@ -564,8 +554,6 @@ static void __exit at91_rtc_remove(struct platform_device *pdev)
>   	at91_rtc_write_idr(AT91_RTC_ACKUPD | AT91_RTC_ALARM |
>   					AT91_RTC_SECEV | AT91_RTC_TIMEV |
>   					AT91_RTC_CALEV);
> -
> -	clk_disable_unprepare(sclk);
>   }
>   
>   static void at91_rtc_shutdown(struct platform_device *pdev)

[PATCH v3 1/7] rtc:rtc-at91rm9200:Use devm_clk_get_enabled() helpers
Posted by Liao Yuanhong 1 year, 5 months ago
Use devm_clk_get_enabled() instead of clk functions in rtc-at91rm9200.

Signed-off-by: Liao Yuanhong <liaoyuanhong@vivo.com>
---
v3:fix the missing bracket.
v2:remove the global sclk variable.
---
 drivers/rtc/rtc-at91rm9200.c | 21 ++++-----------------
 1 file changed, 4 insertions(+), 17 deletions(-)

diff --git a/drivers/rtc/rtc-at91rm9200.c b/drivers/rtc/rtc-at91rm9200.c
index c16fe711a0d9..4d909b840515 100644
--- a/drivers/rtc/rtc-at91rm9200.c
+++ b/drivers/rtc/rtc-at91rm9200.c
@@ -104,7 +104,6 @@ static bool suspended;
 static DEFINE_SPINLOCK(suspended_lock);
 static unsigned long cached_events;
 static u32 at91_rtc_imr;
-static struct clk *sclk;
 
 static void at91_rtc_write_ier(u32 mask)
 {
@@ -471,6 +470,7 @@ static int __init at91_rtc_probe(struct platform_device *pdev)
 	struct rtc_device *rtc;
 	struct resource *regs;
 	int ret = 0;
+	struct clk *sclk;
 
 	at91_rtc_config = of_device_get_match_data(&pdev->dev);
 	if (!at91_rtc_config)
@@ -498,16 +498,10 @@ static int __init at91_rtc_probe(struct platform_device *pdev)
 		return PTR_ERR(rtc);
 	platform_set_drvdata(pdev, rtc);
 
-	sclk = devm_clk_get(&pdev->dev, NULL);
+	sclk = devm_clk_get_enabled(&pdev->dev, NULL);
 	if (IS_ERR(sclk))
 		return PTR_ERR(sclk);
 
-	ret = clk_prepare_enable(sclk);
-	if (ret) {
-		dev_err(&pdev->dev, "Could not enable slow clock\n");
-		return ret;
-	}
-
 	at91_rtc_write(AT91_RTC_CR, 0);
 	at91_rtc_write(AT91_RTC_MR, at91_rtc_read(AT91_RTC_MR) & ~AT91_RTC_HRMOD);
 
@@ -521,7 +515,7 @@ static int __init at91_rtc_probe(struct platform_device *pdev)
 			       "at91_rtc", pdev);
 	if (ret) {
 		dev_err(&pdev->dev, "IRQ %d already in use.\n", irq);
-		goto err_clk;
+		return ret;
 	}
 
 	/* cpu init code should really have flagged this device as
@@ -539,7 +533,7 @@ static int __init at91_rtc_probe(struct platform_device *pdev)
 	rtc->range_max = RTC_TIMESTAMP_END_2099;
 	ret = devm_rtc_register_device(rtc);
 	if (ret)
-		goto err_clk;
+		return ret;
 
 	/* enable SECEV interrupt in order to initialize at91_rtc_upd_rdy
 	 * completion.
@@ -548,11 +542,6 @@ static int __init at91_rtc_probe(struct platform_device *pdev)
 
 	dev_info(&pdev->dev, "AT91 Real Time Clock driver.\n");
 	return 0;
-
-err_clk:
-	clk_disable_unprepare(sclk);
-
-	return ret;
 }
 
 /*
@@ -564,8 +553,6 @@ static void __exit at91_rtc_remove(struct platform_device *pdev)
 	at91_rtc_write_idr(AT91_RTC_ACKUPD | AT91_RTC_ALARM |
 					AT91_RTC_SECEV | AT91_RTC_TIMEV |
 					AT91_RTC_CALEV);
-
-	clk_disable_unprepare(sclk);
 }
 
 static void at91_rtc_shutdown(struct platform_device *pdev)
-- 
2.25.1