diff mbox series

[v11,3/5] rtc: goldfish: use gf_ioread32()/gf_iowrite32()

Message ID 20220120080347.1595379-4-laurent@vivier.eu
State Superseded
Headers show
Series m68k: Add Virtual M68k Machine | expand

Commit Message

Laurent Vivier Jan. 20, 2022, 8:03 a.m. UTC
replace readl()/writel() by gf_ioread32()/gf_iowrite32()
as done for goldfish-tty.

Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
 drivers/rtc/rtc-goldfish.c | 30 +++++++++++++++---------------
 1 file changed, 15 insertions(+), 15 deletions(-)

Comments

kernel test robot Jan. 20, 2022, 5:35 p.m. UTC | #1
Hi Laurent,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on tip/timers/core]
[also build test ERROR on linux/master linus/master v5.16 next-20220120]
[cannot apply to geert-m68k/for-next]
[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/Laurent-Vivier/m68k-Add-Virtual-M68k-Machine/20220120-160832
base:   https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git 35e13e9da9afbce13c1d36465504ece4e65f24fe
config: riscv-randconfig-r042-20220120 (https://download.01.org/0day-ci/archive/20220121/202201210103.XWJt8hcA-lkp@intel.com/config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project f7b7138a62648f4019c55e4671682af1f851f295)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install riscv cross compiling tool for clang build
        # apt-get install binutils-riscv64-linux-gnu
        # https://github.com/0day-ci/linux/commit/82ea64fc7cab43e258085769ed1d90b0685bf091
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Laurent-Vivier/m68k-Add-Virtual-M68k-Machine/20220120-160832
        git checkout 82ea64fc7cab43e258085769ed1d90b0685bf091
        # save the config file to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=riscv SHELL=/bin/bash drivers/rtc/

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

All errors (new ones prefixed by >>):

>> drivers/rtc/rtc-goldfish.c:44:18: error: implicit declaration of function 'gf_ioread32' [-Werror,-Wimplicit-function-declaration]
           rtc_alarm_low = gf_ioread32(base + TIMER_ALARM_LOW);
                           ^
   drivers/rtc/rtc-goldfish.c:44:18: note: did you mean 'ioread32'?
   include/asm-generic/io.h:726:19: note: 'ioread32' declared here
   static inline u32 ioread32(const volatile void __iomem *addr)
                     ^
   include/asm-generic/io.h:725:18: note: expanded from macro 'ioread32'
   #define ioread32 ioread32
                    ^
>> drivers/rtc/rtc-goldfish.c:74:3: error: implicit declaration of function 'gf_iowrite32' [-Werror,-Wimplicit-function-declaration]
                   gf_iowrite32((rtc_alarm64 >> 32), base + TIMER_ALARM_HIGH);
                   ^
   drivers/rtc/rtc-goldfish.c:74:3: note: did you mean 'iowrite32'?
   include/asm-generic/io.h:760:20: note: 'iowrite32' declared here
   static inline void iowrite32(u32 value, volatile void __iomem *addr)
                      ^
   include/asm-generic/io.h:759:19: note: expanded from macro 'iowrite32'
   #define iowrite32 iowrite32
                     ^
   drivers/rtc/rtc-goldfish.c:83:20: error: implicit declaration of function 'gf_ioread32' [-Werror,-Wimplicit-function-declaration]
                   rtc_status_reg = gf_ioread32(base + TIMER_ALARM_STATUS);
                                    ^
   drivers/rtc/rtc-goldfish.c:85:4: error: implicit declaration of function 'gf_iowrite32' [-Werror,-Wimplicit-function-declaration]
                           gf_iowrite32(1, base + TIMER_CLEAR_ALARM);
                           ^
   drivers/rtc/rtc-goldfish.c:101:3: error: implicit declaration of function 'gf_iowrite32' [-Werror,-Wimplicit-function-declaration]
                   gf_iowrite32(1, base + TIMER_IRQ_ENABLED);
                   ^
   drivers/rtc/rtc-goldfish.c:113:2: error: implicit declaration of function 'gf_iowrite32' [-Werror,-Wimplicit-function-declaration]
           gf_iowrite32(1, base + TIMER_CLEAR_INTERRUPT);
           ^
   drivers/rtc/rtc-goldfish.c:131:13: error: implicit declaration of function 'gf_ioread32' [-Werror,-Wimplicit-function-declaration]
           time_low = gf_ioread32(base + TIMER_TIME_LOW);
                      ^
   drivers/rtc/rtc-goldfish.c:152:2: error: implicit declaration of function 'gf_iowrite32' [-Werror,-Wimplicit-function-declaration]
           gf_iowrite32((now64 >> 32), base + TIMER_TIME_HIGH);
           ^
   8 errors generated.


vim +/gf_ioread32 +44 drivers/rtc/rtc-goldfish.c

    31	
    32	static int goldfish_rtc_read_alarm(struct device *dev,
    33					   struct rtc_wkalrm *alrm)
    34	{
    35		u64 rtc_alarm;
    36		u64 rtc_alarm_low;
    37		u64 rtc_alarm_high;
    38		void __iomem *base;
    39		struct goldfish_rtc *rtcdrv;
    40	
    41		rtcdrv = dev_get_drvdata(dev);
    42		base = rtcdrv->base;
    43	
  > 44		rtc_alarm_low = gf_ioread32(base + TIMER_ALARM_LOW);
    45		rtc_alarm_high = gf_ioread32(base + TIMER_ALARM_HIGH);
    46		rtc_alarm = (rtc_alarm_high << 32) | rtc_alarm_low;
    47	
    48		do_div(rtc_alarm, NSEC_PER_SEC);
    49		memset(alrm, 0, sizeof(struct rtc_wkalrm));
    50	
    51		rtc_time64_to_tm(rtc_alarm, &alrm->time);
    52	
    53		if (gf_ioread32(base + TIMER_ALARM_STATUS))
    54			alrm->enabled = 1;
    55		else
    56			alrm->enabled = 0;
    57	
    58		return 0;
    59	}
    60	
    61	static int goldfish_rtc_set_alarm(struct device *dev,
    62					  struct rtc_wkalrm *alrm)
    63	{
    64		struct goldfish_rtc *rtcdrv;
    65		u64 rtc_alarm64;
    66		u64 rtc_status_reg;
    67		void __iomem *base;
    68	
    69		rtcdrv = dev_get_drvdata(dev);
    70		base = rtcdrv->base;
    71	
    72		if (alrm->enabled) {
    73			rtc_alarm64 = rtc_tm_to_time64(&alrm->time) * NSEC_PER_SEC;
  > 74			gf_iowrite32((rtc_alarm64 >> 32), base + TIMER_ALARM_HIGH);
    75			gf_iowrite32(rtc_alarm64, base + TIMER_ALARM_LOW);
    76			gf_iowrite32(1, base + TIMER_IRQ_ENABLED);
    77		} else {
    78			/*
    79			 * if this function was called with enabled=0
    80			 * then it could mean that the application is
    81			 * trying to cancel an ongoing alarm
    82			 */
    83			rtc_status_reg = gf_ioread32(base + TIMER_ALARM_STATUS);
    84			if (rtc_status_reg)
    85				gf_iowrite32(1, base + TIMER_CLEAR_ALARM);
    86		}
    87	
    88		return 0;
    89	}
    90	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
kernel test robot Jan. 20, 2022, 5:35 p.m. UTC | #2
Hi Laurent,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on tip/timers/core]
[also build test ERROR on linux/master linus/master v5.16 next-20220120]
[cannot apply to geert-m68k/for-next]
[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/Laurent-Vivier/m68k-Add-Virtual-M68k-Machine/20220120-160832
base:   https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git 35e13e9da9afbce13c1d36465504ece4e65f24fe
config: nds32-randconfig-r014-20220120 (https://download.01.org/0day-ci/archive/20220121/202201210131.XfhBEwfV-lkp@intel.com/config)
compiler: nds32le-linux-gcc (GCC) 11.2.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/82ea64fc7cab43e258085769ed1d90b0685bf091
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Laurent-Vivier/m68k-Add-Virtual-M68k-Machine/20220120-160832
        git checkout 82ea64fc7cab43e258085769ed1d90b0685bf091
        # save the config file to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=nds32 SHELL=/bin/bash drivers/

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

All errors (new ones prefixed by >>):

   drivers/rtc/rtc-goldfish.c: In function 'goldfish_rtc_read_alarm':
>> drivers/rtc/rtc-goldfish.c:44:25: error: implicit declaration of function 'gf_ioread32'; did you mean 'ioread32'? [-Werror=implicit-function-declaration]
      44 |         rtc_alarm_low = gf_ioread32(base + TIMER_ALARM_LOW);
         |                         ^~~~~~~~~~~
         |                         ioread32
   drivers/rtc/rtc-goldfish.c: In function 'goldfish_rtc_set_alarm':
>> drivers/rtc/rtc-goldfish.c:74:17: error: implicit declaration of function 'gf_iowrite32'; did you mean 'iowrite32'? [-Werror=implicit-function-declaration]
      74 |                 gf_iowrite32((rtc_alarm64 >> 32), base + TIMER_ALARM_HIGH);
         |                 ^~~~~~~~~~~~
         |                 iowrite32
   cc1: some warnings being treated as errors


vim +44 drivers/rtc/rtc-goldfish.c

    31	
    32	static int goldfish_rtc_read_alarm(struct device *dev,
    33					   struct rtc_wkalrm *alrm)
    34	{
    35		u64 rtc_alarm;
    36		u64 rtc_alarm_low;
    37		u64 rtc_alarm_high;
    38		void __iomem *base;
    39		struct goldfish_rtc *rtcdrv;
    40	
    41		rtcdrv = dev_get_drvdata(dev);
    42		base = rtcdrv->base;
    43	
  > 44		rtc_alarm_low = gf_ioread32(base + TIMER_ALARM_LOW);
    45		rtc_alarm_high = gf_ioread32(base + TIMER_ALARM_HIGH);
    46		rtc_alarm = (rtc_alarm_high << 32) | rtc_alarm_low;
    47	
    48		do_div(rtc_alarm, NSEC_PER_SEC);
    49		memset(alrm, 0, sizeof(struct rtc_wkalrm));
    50	
    51		rtc_time64_to_tm(rtc_alarm, &alrm->time);
    52	
    53		if (gf_ioread32(base + TIMER_ALARM_STATUS))
    54			alrm->enabled = 1;
    55		else
    56			alrm->enabled = 0;
    57	
    58		return 0;
    59	}
    60	
    61	static int goldfish_rtc_set_alarm(struct device *dev,
    62					  struct rtc_wkalrm *alrm)
    63	{
    64		struct goldfish_rtc *rtcdrv;
    65		u64 rtc_alarm64;
    66		u64 rtc_status_reg;
    67		void __iomem *base;
    68	
    69		rtcdrv = dev_get_drvdata(dev);
    70		base = rtcdrv->base;
    71	
    72		if (alrm->enabled) {
    73			rtc_alarm64 = rtc_tm_to_time64(&alrm->time) * NSEC_PER_SEC;
  > 74			gf_iowrite32((rtc_alarm64 >> 32), base + TIMER_ALARM_HIGH);
    75			gf_iowrite32(rtc_alarm64, base + TIMER_ALARM_LOW);
    76			gf_iowrite32(1, base + TIMER_IRQ_ENABLED);
    77		} else {
    78			/*
    79			 * if this function was called with enabled=0
    80			 * then it could mean that the application is
    81			 * trying to cancel an ongoing alarm
    82			 */
    83			rtc_status_reg = gf_ioread32(base + TIMER_ALARM_STATUS);
    84			if (rtc_status_reg)
    85				gf_iowrite32(1, base + TIMER_CLEAR_ALARM);
    86		}
    87	
    88		return 0;
    89	}
    90	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
diff mbox series

Patch

diff --git a/drivers/rtc/rtc-goldfish.c b/drivers/rtc/rtc-goldfish.c
index 7ab95d052644..a3a556f6a3e0 100644
--- a/drivers/rtc/rtc-goldfish.c
+++ b/drivers/rtc/rtc-goldfish.c
@@ -41,8 +41,8 @@  static int goldfish_rtc_read_alarm(struct device *dev,
 	rtcdrv = dev_get_drvdata(dev);
 	base = rtcdrv->base;
 
-	rtc_alarm_low = readl(base + TIMER_ALARM_LOW);
-	rtc_alarm_high = readl(base + TIMER_ALARM_HIGH);
+	rtc_alarm_low = gf_ioread32(base + TIMER_ALARM_LOW);
+	rtc_alarm_high = gf_ioread32(base + TIMER_ALARM_HIGH);
 	rtc_alarm = (rtc_alarm_high << 32) | rtc_alarm_low;
 
 	do_div(rtc_alarm, NSEC_PER_SEC);
@@ -50,7 +50,7 @@  static int goldfish_rtc_read_alarm(struct device *dev,
 
 	rtc_time64_to_tm(rtc_alarm, &alrm->time);
 
-	if (readl(base + TIMER_ALARM_STATUS))
+	if (gf_ioread32(base + TIMER_ALARM_STATUS))
 		alrm->enabled = 1;
 	else
 		alrm->enabled = 0;
@@ -71,18 +71,18 @@  static int goldfish_rtc_set_alarm(struct device *dev,
 
 	if (alrm->enabled) {
 		rtc_alarm64 = rtc_tm_to_time64(&alrm->time) * NSEC_PER_SEC;
-		writel((rtc_alarm64 >> 32), base + TIMER_ALARM_HIGH);
-		writel(rtc_alarm64, base + TIMER_ALARM_LOW);
-		writel(1, base + TIMER_IRQ_ENABLED);
+		gf_iowrite32((rtc_alarm64 >> 32), base + TIMER_ALARM_HIGH);
+		gf_iowrite32(rtc_alarm64, base + TIMER_ALARM_LOW);
+		gf_iowrite32(1, base + TIMER_IRQ_ENABLED);
 	} else {
 		/*
 		 * if this function was called with enabled=0
 		 * then it could mean that the application is
 		 * trying to cancel an ongoing alarm
 		 */
-		rtc_status_reg = readl(base + TIMER_ALARM_STATUS);
+		rtc_status_reg = gf_ioread32(base + TIMER_ALARM_STATUS);
 		if (rtc_status_reg)
-			writel(1, base + TIMER_CLEAR_ALARM);
+			gf_iowrite32(1, base + TIMER_CLEAR_ALARM);
 	}
 
 	return 0;
@@ -98,9 +98,9 @@  static int goldfish_rtc_alarm_irq_enable(struct device *dev,
 	base = rtcdrv->base;
 
 	if (enabled)
-		writel(1, base + TIMER_IRQ_ENABLED);
+		gf_iowrite32(1, base + TIMER_IRQ_ENABLED);
 	else
-		writel(0, base + TIMER_IRQ_ENABLED);
+		gf_iowrite32(0, base + TIMER_IRQ_ENABLED);
 
 	return 0;
 }
@@ -110,7 +110,7 @@  static irqreturn_t goldfish_rtc_interrupt(int irq, void *dev_id)
 	struct goldfish_rtc *rtcdrv = dev_id;
 	void __iomem *base = rtcdrv->base;
 
-	writel(1, base + TIMER_CLEAR_INTERRUPT);
+	gf_iowrite32(1, base + TIMER_CLEAR_INTERRUPT);
 
 	rtc_update_irq(rtcdrv->rtc, 1, RTC_IRQF | RTC_AF);
 
@@ -128,8 +128,8 @@  static int goldfish_rtc_read_time(struct device *dev, struct rtc_time *tm)
 	rtcdrv = dev_get_drvdata(dev);
 	base = rtcdrv->base;
 
-	time_low = readl(base + TIMER_TIME_LOW);
-	time_high = readl(base + TIMER_TIME_HIGH);
+	time_low = gf_ioread32(base + TIMER_TIME_LOW);
+	time_high = gf_ioread32(base + TIMER_TIME_HIGH);
 	time = (time_high << 32) | time_low;
 
 	do_div(time, NSEC_PER_SEC);
@@ -149,8 +149,8 @@  static int goldfish_rtc_set_time(struct device *dev, struct rtc_time *tm)
 	base = rtcdrv->base;
 
 	now64 = rtc_tm_to_time64(tm) * NSEC_PER_SEC;
-	writel((now64 >> 32), base + TIMER_TIME_HIGH);
-	writel(now64, base + TIMER_TIME_LOW);
+	gf_iowrite32((now64 >> 32), base + TIMER_TIME_HIGH);
+	gf_iowrite32(now64, base + TIMER_TIME_LOW);
 
 	return 0;
 }