powerpc: always enable RTC_LIB
Subsystems (4)
PATCH 1/5 powerpc: always enable RTC_LIB
In order to use the rtc_tm_to_time64() and rtc_time64_to_tm() helper functions in later patches, we have to ensure that CONFIG_RTC_LIB is always built-in.
Note that this symbol only controls a couple of helper functions, not the actual RTC subsystem, which remains optional and is enabled with CONFIG_RTC_CLASS.
--- arch/powerpc/Kconfig | 1 + 1 file changed, 1 insertion(+)
arch/powerpc/Kconfig +1 -0
@@ -232,6 +232,7 @@ config PPC select OF_RESERVED_MEM select OLD_SIGACTION if PPC32 select OLD_SIGSUSPEND + select RTC_LIB select SPARSE_IRQ select SYSCTL_EXCEPTION_TRACE select VIRT_TO_BUS if !PPC64
Signature · 1 line
2.9.0
PATCH 2/5 powerpc: rtas: clean up time handling
The to_tm() helper function operates on a signed integer for the time, so it will suffer from overflow in 2038, even on 64-bit kernels.
Rather than fix that function, this replaces its use in the rtas procfs implementation with the standard rtc_time64_to_tm() helper that is very similar but is not affected by the overflow.
In order to actually support long times, the parser function gets changed to 64-bit user input and output as well. Note that the tm_mon and tm_year representation is slightly different, so we have to manually add an offset here.
--- arch/powerpc/kernel/rtas-proc.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-)
arch/powerpc/kernel/rtas-proc.c +12 -12
@@ -280,7 +280,7 @@ static int __init proc_rtas_init(void)__initcall (proc_rtas_init); -static int parse_number (const char __user *p,size_t count,unsigned long *val) +static int parse_number (const char __user *p,size_t count,u64 *val) {char buf[40 ];char *end;
@@ -293,7 +293,7 @@ static int parse_number(const char __user *p, size_t count, unsigned long *val) buf[count] =0 ; - *val =simple_strtoul (buf, &end,10 ); + *val =simple_strtoull (buf, &end,10 );if (*end && *end !='\n' )return -EINVAL ;
@@ -307,17 +307,17 @@ static ssize_t ppc_rtas_poweron_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos) { struct rtc_time tm; -unsigned long nowtime; +time64_t nowtime;int error =parse_number (buf, count, &nowtime);if (error)return error; power_on_time = nowtime;/* save the time */ -to_tm (nowtime, &tm); +rtc_time64_to_tm (nowtime,0 , &tm); error =rtas_call (rtas_token ("set-time-for-power-on" ),7 ,1 ,NULL , - tm.tm_year, tm.tm_mon, tm.tm_mday, + tm.tm_year +1900 , tm.tm_mon +1 , tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec,0 /* nano */ ); if (error) printk(KERN_WARNING "error: setting poweron time returned: %s\n",
@@ -373,14 +373,14 @@ static ssize_t ppc_rtas_clock_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos) { struct rtc_time tm; -unsigned long nowtime; +time64_t nowtime;int error =parse_number (buf, count, &nowtime);if (error)return error; -to_tm (nowtime, &tm); +rtc_time64_to_tm (nowtime,0 , &tm); error =rtas_call (rtas_token ("set-time-of-day" ),7 ,1 ,NULL , - tm.tm_year, tm.tm_mon, tm.tm_mday, + tm.tm_year +1900 , tm.tm_mon +1 , tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec,0 ); if (error) printk(KERN_WARNING "error: setting the clock returned: %s\n",
@@ -401,8 +401,8 @@ static int ppc_rtas_clock_show(struct seq_file *m, void *v)unsigned int year, mon, day, hour, min, sec; year = ret[0 ]; mon = ret[1 ]; day = ret[2 ]; hour = ret[3 ]; min = ret[4 ]; sec = ret[5 ]; -seq_printf (m,"%lu\n" , -mktime (year, mon, day, hour, min, sec)); +seq_printf (m,"%lld\n" , +mktime64 (year, mon, day, hour, min, sec)); }return 0 ; }
@@ -731,7 +731,7 @@ static void get_location_code(struct seq_file *m, struct individual_sensor *s,static ssize_t ppc_rtas_tone_freq_write (struct file *file,const char __user *buf,size_t count,loff_t *ppos) { -unsigned long freq; +u64 freq;int error =parse_number (buf, count, &freq);if (error)return error;
@@ -756,7 +756,7 @@ static int ppc_rtas_tone_freq_show(struct seq_file *m, void *v)static ssize_t ppc_rtas_tone_volume_write (struct file *file,const char __user *buf,size_t count,loff_t *ppos) { -unsigned long volume; +u64 volume;int error =parse_number (buf, count, &volume);if (error)return error;
Signature · 1 line
2.9.0
PATCH 3/5 powerpc: use time64_t in read_persistent_clock
In reply to Arnd BergmannLooking through the remaining users of the deprecated mktime() function, I found the powerpc rtc handlers, which use it in place of rtc_tm_to_time64().
To clean this up, I'm changing over the read_persistent_clock() function to the read_persistent_clock64() variant, and change all the platform specific handlers along with it.
--- arch/powerpc/include/asm/machdep.h | 2 +- arch/powerpc/include/asm/opal.h | 2 +- arch/powerpc/include/asm/rtas.h | 2 +- arch/powerpc/kernel/rtas-rtc.c | 4 ++-- arch/powerpc/kernel/time.c | 7 +++---- arch/powerpc/platforms/8xx/m8xx_setup.c | 4 +--- arch/powerpc/platforms/maple/maple.h | 2 +- arch/powerpc/platforms/maple/time.c | 5 ++--- arch/powerpc/platforms/pasemi/pasemi.h | 2 +- arch/powerpc/platforms/pasemi/time.c | 4 ++-- arch/powerpc/platforms/powermac/pmac.h | 2 +- arch/powerpc/platforms/powermac/time.c | 31 +++++++++++-------------------- arch/powerpc/platforms/powernv/opal-rtc.c | 5 ++--- arch/powerpc/platforms/ps3/platform.h | 2 +- arch/powerpc/platforms/ps3/time.c | 2 +- 15 files changed, 31 insertions(+), 45 deletions(-)
arch/powerpc/include/asm/machdep.h +1 -1
@@ -83,7 +83,7 @@ struct machdep_calls {int (*set_rtc_time)(struct rtc_time *);void (*get_rtc_time)(struct rtc_time *); -unsigned long (*get_boot_time)(void ); +time64_t (*get_boot_time)(void);unsigned char (*rtc_read_val)(int addr);void (*rtc_write_val)(int addr,unsigned char val);
arch/powerpc/include/asm/opal.h +1 -1
@@ -325,7 +325,7 @@ extern int opal_async_wait_response_interruptible(uint64_t token,extern int opal_get_sensor_data (u32 sensor_hndl,u32 *sensor_data);struct rtc_time ; -extern unsigned long opal_get_boot_time (void ); +extern time64_t opal_get_boot_time (void );extern void opal_nvram_init (void );extern void opal_flash_update_init (void );extern void opal_flash_update_print_message (void );
arch/powerpc/include/asm/rtas.h +1 -1
@@ -361,7 +361,7 @@ extern int rtas_offline_cpus_mask(cpumask_var_t cpus);extern int rtas_ibm_suspend_me (u64 handle);struct rtc_time ; -extern unsigned long rtas_get_boot_time (void ); +extern time64_t rtas_get_boot_time (void );extern void rtas_get_rtc_time (struct rtc_time *rtc_time);extern int rtas_set_rtc_time (struct rtc_time *rtc_time);
arch/powerpc/kernel/rtas-rtc.c +2 -2
@@ -13,7 +13,7 @@#define MAX_RTC_WAIT 5000/* 5 sec */ #define RTAS_CLOCK_BUSY (-2) -unsigned long __init rtas_get_boot_time (void ) +time64_t __init rtas_get_boot_time (void ) {int ret[8 ];int error;
@@ -38,7 +38,7 @@ unsigned long __init rtas_get_boot_time(void)return 0 ; } -return mktime (ret[0 ], ret[1 ], ret[2 ], ret[3 ], ret[4 ], ret[5 ]); +return mktime64 (ret[0 ], ret[1 ], ret[2 ], ret[3 ], ret[4 ], ret[5 ]); }/* NOTE: get_rtc_time will get an error if executed in interrupt context
arch/powerpc/kernel/time.c +3 -4
@@ -795,7 +795,7 @@ int update_persistent_clock(struct timespec now)return ppc_md.set_rtc_time (&tm); } -static void __read_persistent_clock (struct timespec *ts) +static void __read_persistent_clock (struct timespec64 *ts) {struct rtc_time tm;static int first =1 ;
@@ -819,11 +819,10 @@ static void __read_persistent_clock(struct timespec *ts) } ppc_md.get_rtc_time (&tm); - ts->tv_sec =mktime (tm.tm_year+1900 , tm.tm_mon+1 , tm.tm_mday, - tm.tm_hour, tm.tm_min, tm.tm_sec); + ts->tv_sec =rtc_tm_to_time64 (&tm); } -void read_persistent_clock (struct timespec *ts) +void read_persistent_clock64 (struct timespec64 *ts) {__read_persistent_clock (ts);
arch/powerpc/platforms/8xx/m8xx_setup.c +1 -3
@@ -192,9 +192,7 @@ void mpc8xx_get_rtc_time(struct rtc_time *tm)/* Get time from the RTC. */ data =in_be32 (&sys_tmr->sit_rtc); -to_tm (data, tm); - tm->tm_year -=1900 ; - tm->tm_mon -=1 ; +rtc_time64_to_tm (data, tm);immr_unmap (sys_tmr);return ; }
arch/powerpc/platforms/maple/maple.h +1 -1
@@ -6,7 +6,7 @@*/ extern int maple_set_rtc_time (struct rtc_time *tm);extern void maple_get_rtc_time (struct rtc_time *tm); -extern unsigned long maple_get_boot_time (void ); +extern time64_t maple_get_boot_time (void );extern void maple_calibrate_decr (void );extern void maple_pci_init (void );extern void maple_pci_irq_fixup (struct pci_dev *dev);
arch/powerpc/platforms/maple/time.c +2 -3
@@ -137,7 +137,7 @@ static struct resource rtc_iores = { .flags = IORESOURCE_IO | IORESOURCE_BUSY, }; -unsigned long __init maple_get_boot_time (void ) +time64_t __init maple_get_boot_time (void ) {struct rtc_time tm;struct device_node *rtcs;
@@ -170,7 +170,6 @@ unsigned long __init maple_get_boot_time(void)request_resource (&ioport_resource, &rtc_iores);maple_get_rtc_time (&tm); -return mktime (tm.tm_year+1900 , tm.tm_mon+1 , tm.tm_mday, - tm.tm_hour, tm.tm_min, tm.tm_sec); +return rtc_tm_to_time66 (&tm); }
arch/powerpc/platforms/pasemi/pasemi.h +1 -1
@@ -2,7 +2,7 @@#ifndef _PASEMI_PASEMI_H#define _PASEMI_PASEMI_H -extern unsigned long pas_get_boot_time (void ); +extern time64_t pas_get_boot_time (void );extern void pas_pci_init (void );extern void pas_pci_irq_fixup (struct pci_dev *dev);extern void pas_pci_dma_dev_setup (struct pci_dev *dev);
arch/powerpc/platforms/pasemi/time.c +2 -2
@@ -21,8 +21,8 @@#include <asm/time.h> -unsigned long __init pas_get_boot_time (void ) +time64_t __init pas_get_boot_time (void ) {/* Let's just return a fake date right now */ -return mktime (2006 ,1 ,1 ,12 ,0 ,0 ); +return mktime64 (2006 ,1 ,1 ,12 ,0 ,0 ); }
arch/powerpc/platforms/powermac/pmac.h +1 -1
@@ -15,7 +15,7 @@ struct rtc_time;extern int pmac_newworld;extern long pmac_time_init (void ); -extern unsigned long pmac_get_boot_time (void ); +extern time64_t pmac_get_boot_time (void );extern void pmac_get_rtc_time (struct rtc_time *);extern int pmac_set_rtc_time (struct rtc_time *);extern void pmac_read_rtc_time (void );
arch/powerpc/platforms/powermac/time.c +11 -20
@@ -84,15 +84,6 @@ long __init pmac_time_init(void)return delta; } -#if defined(CONFIG_ADB_CUDA ) || defined(CONFIG_ADB_PMU ) -static void to_rtc_time (unsigned long now,struct rtc_time *tm) -{ -to_tm (now, tm); - tm->tm_year -=1900 ; - tm->tm_mon -=1 ; -} -#endif -#if defined(CONFIG_ADB_CUDA ) || defined(CONFIG_ADB_PMU ) || \ defined(CONFIG_PMAC_SMU )static unsigned long from_rtc_time (struct rtc_time *tm)
@@ -103,10 +94,10 @@ static unsigned long from_rtc_time(struct rtc_time *tm)#endif #ifdef CONFIG_ADB_CUDA -static unsigned long cuda_get_time (void ) +static time64_t cuda_get_time (void ) {struct adb_request req; -unsigned int now; +time64_t now;if (cuda_request (&req,NULL ,2 ,CUDA_PACKET ,CUDA_GET_TIME ) <0 )return 0 ;
@@ -117,10 +108,10 @@ static unsigned long cuda_get_time(void) req.reply_len); now = (req.reply[3 ] <<24 ) + (req.reply[4 ] <<16 ) + (req.reply[5 ] <<8 ) + req.reply[6 ]; -return ((unsigned long )now) -RTC_OFFSET ; +return now -RTC_OFFSET ; } -#define cuda_get_rtc_time (tm) to_rtc_time(cuda_get_time(), (tm)) +#define cuda_get_rtc_time (tm) rtc_time64_to_tm(cuda_get_time(), (tm))static int cuda_set_rtc_time (struct rtc_time *tm) {
@@ -147,10 +138,10 @@ static int cuda_set_rtc_time(struct rtc_time *tm)#endif #ifdef CONFIG_ADB_PMU -static unsigned long pmu_get_time (void ) +static time64_t pmu_get_time (void ) {struct adb_request req; -unsigned int now; +time64_t now;if (pmu_request (&req,NULL ,1 ,PMU_READ_RTC ) <0 )return 0 ;
@@ -160,10 +151,10 @@ static unsigned long pmu_get_time(void) req.reply_len); now = (req.reply[0 ] <<24 ) + (req.reply[1 ] <<16 ) + (req.reply[2 ] <<8 ) + req.reply[3 ]; -return ((unsigned long )now) -RTC_OFFSET ; +return now -RTC_OFFSET ; } -#define pmu_get_rtc_time (tm) to_rtc_time(pmu_get_time(), (tm)) +#define pmu_get_rtc_time (tm) rtc_time64_to_tm(pmu_get_time(), (tm))static int pmu_set_rtc_time (struct rtc_time *tm) {
@@ -188,13 +179,13 @@ static int pmu_set_rtc_time(struct rtc_time *tm)#endif #ifdef CONFIG_PMAC_SMU -static unsigned long smu_get_time (void ) +static time64_t smu_get_time (void ) {struct rtc_time tm;if (smu_get_rtc_time (&tm,1 ))return 0 ; -return from_rtc_time (&tm); +return rtc_tm_to_time64 (&tm); }#else
@@ -204,7 +195,7 @@ static unsigned long smu_get_time(void)#endif /* Can't be __init, it's called when suspending and resuming */ -unsigned long pmac_get_boot_time (void ) +time64_t pmac_get_boot_time (void ) {/* Get the time from the RTC, used only at boot time */ switch (sys_ctrler) {
arch/powerpc/platforms/powernv/opal-rtc.c +2 -3
@@ -34,7 +34,7 @@ static void opal_to_tm(u32 y_m_d, u64 h_m_s_ms, struct rtc_time *tm) tm->tm_wday =-1 ; } -unsigned long __init opal_get_boot_time (void ) +time64_t __init opal_get_boot_time (void ) {struct rtc_time tm;u32 y_m_d;
@@ -59,8 +59,7 @@ unsigned long __init opal_get_boot_time(void) y_m_d =be32_to_cpu (__y_m_d); h_m_s_ms =be64_to_cpu (__h_m_s_ms);opal_to_tm (y_m_d, h_m_s_ms, &tm); -return mktime (tm.tm_year +1900 , tm.tm_mon +1 , tm.tm_mday, - tm.tm_hour, tm.tm_min, tm.tm_sec); +return rtc_tm_to_time64 (&tm); }static __init int opal_time_init (void )
arch/powerpc/platforms/ps3/platform.h +1 -1
@@ -57,7 +57,7 @@ static inline void ps3_smp_cleanup_cpu(int cpu) { }/* time */ void __init ps3_calibrate_decr (void ); -unsigned long __init ps3_get_boot_time (void ); +time64_t __init ps3_get_boot_time (void );void ps3_get_rtc_time (struct rtc_time *time);int ps3_set_rtc_time (struct rtc_time *time);
arch/powerpc/platforms/ps3/time.c +1 -1
@@ -76,7 +76,7 @@ static u64 read_rtc(void)return rtc_val; } -unsigned long __init ps3_get_boot_time (void ) +time64_t __init ps3_get_boot_time (void ) {return read_rtc () +ps3_os_area_get_rtc_diff (); }
Signature · 1 line
2.9.0
PATCH 4/5 powerpc: use time64_t in update_persistent_clock
In reply to Arnd Bergmannupdate_persistent_clock() is deprecated because it suffers from overflow in 2038 on 32-bit architectures. This changes powerpc to use the update_persistent_clock64() replacement, and to pass down 64-bit timestamps consistently.
This is now simpler, as we no longer have to worry about the offset numbers in tm_year and tm_mon that are different between the Linux conventions and RTAS.
--- arch/powerpc/kernel/time.c | 6 ++---- arch/powerpc/platforms/8xx/m8xx_setup.c | 7 +++---- arch/powerpc/platforms/powermac/time.c | 17 ++++------------- 3 files changed, 9 insertions(+), 21 deletions(-)
arch/powerpc/kernel/time.c +2 -4
@@ -781,16 +781,14 @@ void __init generic_calibrate_decr(void) } } -int update_persistent_clock (struct timespec now) +int update_persistent_clock64 (struct timespec64 now) {struct rtc_time tm;if (!ppc_md.set_rtc_time)return -ENODEV ; -to_tm (now.tv_sec +1 + timezone_offset, &tm); - tm.tm_year -=1900 ; - tm.tm_mon -=1 ; +rtc_time64_to_tm (now.tv_sec +1 + timezone_offset, &tm);return ppc_md.set_rtc_time (&tm); }
arch/powerpc/platforms/8xx/m8xx_setup.c +3 -4
@@ -169,15 +169,14 @@ int mpc8xx_set_rtc_time(struct rtc_time *tm) {sitk8xx_t __iomem *sys_tmr1;sit8xx_t __iomem *sys_tmr2; -int time; +time64_t time; sys_tmr1 =immr_map (im_sitk); sys_tmr2 =immr_map (im_sit); - time =mktime (tm->tm_year+1900 , tm->tm_mon+1 , tm->tm_mday, - tm->tm_hour, tm->tm_min, tm->tm_sec); + time =rtc_tm_to_time64 (tm);out_be32 (&sys_tmr1->sitk_rtck,KAPWR_KEY ); -out_be32 (&sys_tmr2->sit_rtc, time); +out_be32 (&sys_tmr2->sit_rtc, (u32 )time);out_be32 (&sys_tmr1->sitk_rtck, ~KAPWR_KEY );immr_unmap (sys_tmr2);
arch/powerpc/platforms/powermac/time.c +4 -13
@@ -84,15 +84,6 @@ long __init pmac_time_init(void)return delta; } -#if defined(CONFIG_ADB_CUDA ) || defined(CONFIG_ADB_PMU ) || \ - defined(CONFIG_PMAC_SMU ) -static unsigned long from_rtc_time (struct rtc_time *tm) -{ -return mktime (tm->tm_year+1900 , tm->tm_mon+1 , tm->tm_mday, - tm->tm_hour, tm->tm_min, tm->tm_sec); -} -#endif -#ifdef CONFIG_ADB_CUDA static time64_t cuda_get_time (void ) {
@@ -115,10 +106,10 @@ static time64_t cuda_get_time(void)static int cuda_set_rtc_time (struct rtc_time *tm) { -unsigned int nowtime; +time64_t nowtime;struct adb_request req; - nowtime =from_rtc_time (tm) +RTC_OFFSET ; + nowtime =rtc_tm_to_time64 (tm) +RTC_OFFSET ;if (cuda_request (&req,NULL ,6 ,CUDA_PACKET ,CUDA_SET_TIME , nowtime >>24 , nowtime >>16 , nowtime >>8 , nowtime) <0 )
@@ -158,10 +149,10 @@ static time64_t pmu_get_time(void)static int pmu_set_rtc_time (struct rtc_time *tm) { -unsigned int nowtime; +time64_t nowtime;struct adb_request req; - nowtime =from_rtc_time (tm) +RTC_OFFSET ; + nowtime =rtc_tm_to_time64 (tm) +RTC_OFFSET ;if (pmu_request (&req,NULL ,5 ,PMU_SET_RTC , nowtime >>24 , nowtime >>16 , nowtime >>8 , nowtime) <0 )return -ENXIO ;
Signature · 1 line
2.9.0
PATCH 5/5 powerpc: remove unused to_tm() helper
In reply to Arnd Bergmannto_tm() is now completely unused, the only reference being in the _dump_time() helper that is also unused. This removes both, leaving the rest of the powerpc RTC code y2038 safe to as far as the hardware supports.
--- arch/powerpc/include/asm/time.h | 2 -- arch/powerpc/kernel/time.c | 50 --------------------------------------- arch/powerpc/platforms/ps3/time.c | 24 ------------------- 3 files changed, 76 deletions(-)
arch/powerpc/include/asm/time.h +0 -2
@@ -26,8 +26,6 @@ extern unsigned long tb_ticks_per_usec;extern unsigned long tb_ticks_per_sec;extern struct clock_event_device decrementer_clockevent; -struct rtc_time ; -extern void to_tm (int tim,struct rtc_time * tm);extern void tick_broadcast_ipi_handler (void );extern void generic_calibrate_decr (void );
arch/powerpc/kernel/time.c +0 -50
56 lines not on this page · raw message
arch/powerpc/platforms/ps3/time.c +0 -24
@@ -28,30 +28,6 @@#include "platform.h" -#define dump_tm (_a) _dump_tm(_a, __func__, __LINE__) -static void _dump_tm (const struct rtc_time *tm,const char * func,int line) -{ -pr_debug ("%s:%d tm_sec %d\n" , func, line, tm->tm_sec); -pr_debug ("%s:%d tm_min %d\n" , func, line, tm->tm_min); -pr_debug ("%s:%d tm_hour %d\n" , func, line, tm->tm_hour); -pr_debug ("%s:%d tm_mday %d\n" , func, line, tm->tm_mday); -pr_debug ("%s:%d tm_mon %d\n" , func, line, tm->tm_mon); -pr_debug ("%s:%d tm_year %d\n" , func, line, tm->tm_year); -pr_debug ("%s:%d tm_wday %d\n" , func, line, tm->tm_wday); -} - -#define dump_time (_a) _dump_time(_a, __func__, __LINE__) -static void __maybe_unused _dump_time (int time,const char *func, -int line) -{ -struct rtc_time tm; - -to_tm (time, &tm); - -pr_debug ("%s:%d time %d\n" , func, line, time); -_dump_tm (&tm, func, line); -} -void __init ps3_calibrate_decr (void ) {int result;
Signature · 1 line
2.9.0
Re: [PATCH 3/5] powerpc: use time64_t in read_persistent_clock
In reply to Arnd Bergmannarch/powerpc/platforms/maple/time.c unsigned long __init maple_get_boot_time(void) · line 174
Quoted 8 lines · Arnd Bergmann
arch/powerpc/platforms/maple/time.c +1
-2@@ -170,7 +170,6 @@ unsigned long __init maple_get_boot_time(void)request_resource (&ioport_resource, &rtc_iores);maple_get_rtc_time (&tm); -return mktime (tm.tm_year+1900 , tm.tm_mon+1 , tm.tm_mday, - tm.tm_hour, tm.tm_min, tm.tm_sec); +return rtc_tm_to_time66 (&tm); }
No, it's not rtc_tm_to_time66 ;(
I did some build testing over the weekend to make sure I find all the stupid bugs, but then sent out the version without the two fixes. Please ignore all five patches, will follow up with v2 that fixes this one and another equally trivial bug.
Arnd
Re: [PATCH 2/5] powerpc: rtas: clean up time handling
In reply to Arnd BergmannQuoted 5 lines · Arnd Bergmann
arch/powerpc/kernel/rtas-proc.c +0
-1@@ -307,17 +307,17 @@ static ssize_t ppc_rtas_poweron_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos) { struct rtc_time tm; -unsigned long nowtime;
arch/powerpc/kernel/rtas-proc.c static ssize_t ppc_rtas_poweron_write(struct file *file, · line 318
Quoted 10 lines
arch/powerpc/kernel/rtas-proc.c +2
-1+time64_t nowtime;int error =parse_number (buf, count, &nowtime);if (error)return error; power_on_time = nowtime;/* save the time */ -to_tm (nowtime, &tm); +rtc_time64_to_tm (nowtime,0 , &tm);
Here was the other obvious typo: I had originally changed this to 'time64_to_tm()', which has slightly different calling conventions to 'rtc_time64_to_tm()', and messed it up when I changed it back after it turned out I needed to select RTC_LIB anyway.
v2 coming.
Arnd
kbuild test robot
build botRe: [PATCH 3/5] powerpc: use time64_t in read_persistent_clock
In reply to Arnd BergmannI love your patch! Yet something to improve:
Hi Arnd,
I love your patch! Yet something to improve:
[auto build test ERROR on powerpc/next]
[also build test ERROR on v4.17-rc2 next-20180423]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Arnd-Bergmann/powerpc-always-enable-RTC_LIB/20180423-223504 base: https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next config: powerpc64-defconfig (attached as .config) compiler: powerpc64-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=powerpc64
All errors (new ones prefixed by >>):
arch/powerpc/platforms/maple/time.c: In function 'maple_get_boot_time':
>> arch/powerpc/platforms/maple/time.c:173:9: error: implicit declaration of function 'rtc_tm_to_time66'; did you mean 'rtc_tm_to_time64'? [-Werror=implicit-function-declaration]
return rtc_tm_to_time66(&tm);
^~~~~~~~~~~~~~~~
rtc_tm_to_time64cc1: all warnings being treated as errors
vim +173 arch/powerpc/platforms/maple/time.c
139
140 time64_t __init maple_get_boot_time(void)
141 {
142 struct rtc_time tm;
143 struct device_node *rtcs;
144
145 rtcs = of_find_compatible_node(NULL, "rtc", "pnpPNP,b00");
146 if (rtcs) {
147 struct resource r;
148 if (of_address_to_resource(rtcs, 0, &r)) {
149 printk(KERN_EMERG "Maple: Unable to translate RTC"
150 " address\n");
151 goto bail;
152 }
153 if (!(r.flags & IORESOURCE_IO)) {
154 printk(KERN_EMERG "Maple: RTC address isn't PIO!\n");
155 goto bail;
156 }
157 maple_rtc_addr = r.start;
158 printk(KERN_INFO "Maple: Found RTC at IO 0x%x\n",
159 maple_rtc_addr);
160 }
161 bail:
162 if (maple_rtc_addr == 0) {
163 maple_rtc_addr = RTC_PORT(0); /* legacy address */
164 printk(KERN_INFO "Maple: No device node for RTC, assuming "
165 "legacy address (0x%x)\n", maple_rtc_addr);
166 }
167
168 rtc_iores.start = maple_rtc_addr;
169 rtc_iores.end = maple_rtc_addr + 7;
170 request_resource(&ioport_resource, &rtc_iores);
171
172 maple_get_rtc_time(&tm);
> 173 return rtc_tm_to_time66(&tm);
174 }
175
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation