Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

powerpc: remove unused to_tm() helper

to_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.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>

authored by

Arnd Bergmann and committed by
Michael Ellerman
34efabe4 5235afa8

-76
-2
arch/powerpc/include/asm/time.h
··· 26 26 extern unsigned long tb_ticks_per_sec; 27 27 extern struct clock_event_device decrementer_clockevent; 28 28 29 - struct rtc_time; 30 - extern void to_tm(int tim, struct rtc_time * tm); 31 29 32 30 extern void generic_calibrate_decr(void); 33 31 extern void hdec_interrupt(struct pt_regs *regs);
-50
arch/powerpc/kernel/time.c
··· 1159 1159 #endif 1160 1160 } 1161 1161 1162 - 1163 - #define FEBRUARY 2 1164 - #define STARTOFTIME 1970 1165 - #define SECDAY 86400L 1166 - #define SECYR (SECDAY * 365) 1167 - #define leapyear(year) ((year) % 4 == 0 && \ 1168 - ((year) % 100 != 0 || (year) % 400 == 0)) 1169 - #define days_in_year(a) (leapyear(a) ? 366 : 365) 1170 - #define days_in_month(a) (month_days[(a) - 1]) 1171 - 1172 - static int month_days[12] = { 1173 - 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 1174 - }; 1175 - 1176 - void to_tm(int tim, struct rtc_time * tm) 1177 - { 1178 - register int i; 1179 - register long hms, day; 1180 - 1181 - day = tim / SECDAY; 1182 - hms = tim % SECDAY; 1183 - 1184 - /* Hours, minutes, seconds are easy */ 1185 - tm->tm_hour = hms / 3600; 1186 - tm->tm_min = (hms % 3600) / 60; 1187 - tm->tm_sec = (hms % 3600) % 60; 1188 - 1189 - /* Number of years in days */ 1190 - for (i = STARTOFTIME; day >= days_in_year(i); i++) 1191 - day -= days_in_year(i); 1192 - tm->tm_year = i; 1193 - 1194 - /* Number of months in days left */ 1195 - if (leapyear(tm->tm_year)) 1196 - days_in_month(FEBRUARY) = 29; 1197 - for (i = 1; day >= days_in_month(i); i++) 1198 - day -= days_in_month(i); 1199 - days_in_month(FEBRUARY) = 28; 1200 - tm->tm_mon = i; 1201 - 1202 - /* Days are what is left over (+1) from all that. */ 1203 - tm->tm_mday = day + 1; 1204 - 1205 - /* 1206 - * No-one uses the day of the week. 1207 - */ 1208 - tm->tm_wday = -1; 1209 - } 1210 - EXPORT_SYMBOL(to_tm); 1211 - 1212 1162 /* 1213 1163 * Divide a 128-bit dividend by a 32-bit divisor, leaving a 128 bit 1214 1164 * result.
-24
arch/powerpc/platforms/ps3/time.c
··· 28 28 29 29 #include "platform.h" 30 30 31 - #define dump_tm(_a) _dump_tm(_a, __func__, __LINE__) 32 - static void _dump_tm(const struct rtc_time *tm, const char* func, int line) 33 - { 34 - pr_debug("%s:%d tm_sec %d\n", func, line, tm->tm_sec); 35 - pr_debug("%s:%d tm_min %d\n", func, line, tm->tm_min); 36 - pr_debug("%s:%d tm_hour %d\n", func, line, tm->tm_hour); 37 - pr_debug("%s:%d tm_mday %d\n", func, line, tm->tm_mday); 38 - pr_debug("%s:%d tm_mon %d\n", func, line, tm->tm_mon); 39 - pr_debug("%s:%d tm_year %d\n", func, line, tm->tm_year); 40 - pr_debug("%s:%d tm_wday %d\n", func, line, tm->tm_wday); 41 - } 42 - 43 - #define dump_time(_a) _dump_time(_a, __func__, __LINE__) 44 - static void __maybe_unused _dump_time(int time, const char *func, 45 - int line) 46 - { 47 - struct rtc_time tm; 48 - 49 - to_tm(time, &tm); 50 - 51 - pr_debug("%s:%d time %d\n", func, line, time); 52 - _dump_tm(&tm, func, line); 53 - } 54 - 55 31 void __init ps3_calibrate_decr(void) 56 32 { 57 33 int result;