Re: [PATCH] rtc: rtc-generic: use correct header file

From: kbuild test robot
Date: Tue Mar 01 2016 - 08:01:26 EST


Hi Sudip,

[auto build test ERROR on abelloni/rtc-next]
[also build test ERROR on v4.5-rc6 next-20160301]
[if your patch is applied to the wrong git tree, please drop us a note to help improving the system]

url: https://github.com/0day-ci/linux/commits/Sudip-Mukherjee/rtc-rtc-generic-use-correct-header-file/20160301-204926
base: https://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux.git rtc-next
config: parisc-allmodconfig (attached as .config)
reproduce:
wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=parisc

All errors (new ones prefixed by >>):

In file included from drivers/rtc/rtc-generic.c:12:0:
include/asm-generic/rtc.h: In function 'rtc_is_updating':
>> include/asm-generic/rtc.h:43:2: error: implicit declaration of function 'CMOS_READ' [-Werror=implicit-function-declaration]
uip = (CMOS_READ(RTC_FREQ_SELECT) & RTC_UIP);
^
include/asm-generic/rtc.h: In function '__get_rtc_time':
>> include/asm-generic/rtc.h:94:33: error: 'RTC_ALWAYS_BCD' undeclared (first use in this function)
if (!(ctrl & RTC_DM_BINARY) || RTC_ALWAYS_BCD)
^
include/asm-generic/rtc.h:94:33: note: each undeclared identifier is reported only once for each function it appears in
include/asm-generic/rtc.h: In function '__set_rtc_time':
include/asm-generic/rtc.h:188:9: error: 'RTC_ALWAYS_BCD' undeclared (first use in this function)
|| RTC_ALWAYS_BCD) {
^
>> include/asm-generic/rtc.h:199:2: error: implicit declaration of function 'CMOS_WRITE' [-Werror=implicit-function-declaration]
CMOS_WRITE((save_control|RTC_SET), RTC_CONTROL);
^
cc1: some warnings being treated as errors

vim +/CMOS_READ +43 include/asm-generic/rtc.h

^1da177e Linus Torvalds 2005-04-16 37 static inline unsigned char rtc_is_updating(void)
^1da177e Linus Torvalds 2005-04-16 38 {
^1da177e Linus Torvalds 2005-04-16 39 unsigned char uip;
795d45b2 Andrew Morton 2008-02-04 40 unsigned long flags;
^1da177e Linus Torvalds 2005-04-16 41
795d45b2 Andrew Morton 2008-02-04 42 spin_lock_irqsave(&rtc_lock, flags);
^1da177e Linus Torvalds 2005-04-16 @43 uip = (CMOS_READ(RTC_FREQ_SELECT) & RTC_UIP);
795d45b2 Andrew Morton 2008-02-04 44 spin_unlock_irqrestore(&rtc_lock, flags);
^1da177e Linus Torvalds 2005-04-16 45 return uip;
^1da177e Linus Torvalds 2005-04-16 46 }
^1da177e Linus Torvalds 2005-04-16 47
5f7dc5d7 Ivan Kokshaysky 2009-01-15 48 static inline unsigned int __get_rtc_time(struct rtc_time *time)
^1da177e Linus Torvalds 2005-04-16 49 {
^1da177e Linus Torvalds 2005-04-16 50 unsigned char ctrl;
795d45b2 Andrew Morton 2008-02-04 51 unsigned long flags;
3c217e51 Sylvain Chouleur 2015-06-08 52 unsigned char century = 0;
795d45b2 Andrew Morton 2008-02-04 53
^1da177e Linus Torvalds 2005-04-16 54 #ifdef CONFIG_MACH_DECSTATION
^1da177e Linus Torvalds 2005-04-16 55 unsigned int real_year;
^1da177e Linus Torvalds 2005-04-16 56 #endif
^1da177e Linus Torvalds 2005-04-16 57
^1da177e Linus Torvalds 2005-04-16 58 /*
^1da177e Linus Torvalds 2005-04-16 59 * read RTC once any update in progress is done. The update
38c052f8 Ingo Molnar 2008-08-23 60 * can take just over 2ms. We wait 20ms. There is no need to
^1da177e Linus Torvalds 2005-04-16 61 * to poll-wait (up to 1s - eeccch) for the falling edge of RTC_UIP.
^1da177e Linus Torvalds 2005-04-16 62 * If you need to know *exactly* when a second has started, enable
^1da177e Linus Torvalds 2005-04-16 63 * periodic update complete interrupts, (via ioctl) and then
^1da177e Linus Torvalds 2005-04-16 64 * immediately read /dev/rtc which will block until you get the IRQ.
^1da177e Linus Torvalds 2005-04-16 65 * Once the read clears, read the RTC time (again via ioctl). Easy.
^1da177e Linus Torvalds 2005-04-16 66 */
38c052f8 Ingo Molnar 2008-08-23 67 if (rtc_is_updating())
38c052f8 Ingo Molnar 2008-08-23 68 mdelay(20);
^1da177e Linus Torvalds 2005-04-16 69
^1da177e Linus Torvalds 2005-04-16 70 /*
^1da177e Linus Torvalds 2005-04-16 71 * Only the values that we read from the RTC are set. We leave
^1da177e Linus Torvalds 2005-04-16 72 * tm_wday, tm_yday and tm_isdst untouched. Even though the
^1da177e Linus Torvalds 2005-04-16 73 * RTC has RTC_DAY_OF_WEEK, we ignore it, as it is only updated
^1da177e Linus Torvalds 2005-04-16 74 * by the RTC when initially set to a non-zero value.
^1da177e Linus Torvalds 2005-04-16 75 */
795d45b2 Andrew Morton 2008-02-04 76 spin_lock_irqsave(&rtc_lock, flags);
^1da177e Linus Torvalds 2005-04-16 77 time->tm_sec = CMOS_READ(RTC_SECONDS);
^1da177e Linus Torvalds 2005-04-16 78 time->tm_min = CMOS_READ(RTC_MINUTES);
^1da177e Linus Torvalds 2005-04-16 79 time->tm_hour = CMOS_READ(RTC_HOURS);
^1da177e Linus Torvalds 2005-04-16 80 time->tm_mday = CMOS_READ(RTC_DAY_OF_MONTH);
^1da177e Linus Torvalds 2005-04-16 81 time->tm_mon = CMOS_READ(RTC_MONTH);
^1da177e Linus Torvalds 2005-04-16 82 time->tm_year = CMOS_READ(RTC_YEAR);
^1da177e Linus Torvalds 2005-04-16 83 #ifdef CONFIG_MACH_DECSTATION
^1da177e Linus Torvalds 2005-04-16 84 real_year = CMOS_READ(RTC_DEC_YEAR);
^1da177e Linus Torvalds 2005-04-16 85 #endif
3c217e51 Sylvain Chouleur 2015-06-08 86 #ifdef CONFIG_ACPI
3c217e51 Sylvain Chouleur 2015-06-08 87 if (acpi_gbl_FADT.header.revision >= FADT2_REVISION_ID &&
3c217e51 Sylvain Chouleur 2015-06-08 88 acpi_gbl_FADT.century)
3c217e51 Sylvain Chouleur 2015-06-08 89 century = CMOS_READ(acpi_gbl_FADT.century);
3c217e51 Sylvain Chouleur 2015-06-08 90 #endif
^1da177e Linus Torvalds 2005-04-16 91 ctrl = CMOS_READ(RTC_CONTROL);
795d45b2 Andrew Morton 2008-02-04 92 spin_unlock_irqrestore(&rtc_lock, flags);
^1da177e Linus Torvalds 2005-04-16 93
^1da177e Linus Torvalds 2005-04-16 @94 if (!(ctrl & RTC_DM_BINARY) || RTC_ALWAYS_BCD)
^1da177e Linus Torvalds 2005-04-16 95 {
357c6e63 Adrian Bunk 2008-10-18 96 time->tm_sec = bcd2bin(time->tm_sec);
357c6e63 Adrian Bunk 2008-10-18 97 time->tm_min = bcd2bin(time->tm_min);
357c6e63 Adrian Bunk 2008-10-18 98 time->tm_hour = bcd2bin(time->tm_hour);
357c6e63 Adrian Bunk 2008-10-18 99 time->tm_mday = bcd2bin(time->tm_mday);
357c6e63 Adrian Bunk 2008-10-18 100 time->tm_mon = bcd2bin(time->tm_mon);
357c6e63 Adrian Bunk 2008-10-18 101 time->tm_year = bcd2bin(time->tm_year);
3c217e51 Sylvain Chouleur 2015-06-08 102 century = bcd2bin(century);
^1da177e Linus Torvalds 2005-04-16 103 }
^1da177e Linus Torvalds 2005-04-16 104
^1da177e Linus Torvalds 2005-04-16 105 #ifdef CONFIG_MACH_DECSTATION
^1da177e Linus Torvalds 2005-04-16 106 time->tm_year += real_year - 72;
^1da177e Linus Torvalds 2005-04-16 107 #endif
^1da177e Linus Torvalds 2005-04-16 108
3c217e51 Sylvain Chouleur 2015-06-08 109 if (century)
3c217e51 Sylvain Chouleur 2015-06-08 110 time->tm_year += (century - 19) * 100;
3c217e51 Sylvain Chouleur 2015-06-08 111
^1da177e Linus Torvalds 2005-04-16 112 /*
^1da177e Linus Torvalds 2005-04-16 113 * Account for differences between how the RTC uses the values
^1da177e Linus Torvalds 2005-04-16 114 * and how they are defined in a struct rtc_time;
^1da177e Linus Torvalds 2005-04-16 115 */
^1da177e Linus Torvalds 2005-04-16 116 if (time->tm_year <= 69)
^1da177e Linus Torvalds 2005-04-16 117 time->tm_year += 100;
^1da177e Linus Torvalds 2005-04-16 118
^1da177e Linus Torvalds 2005-04-16 119 time->tm_mon--;
^1da177e Linus Torvalds 2005-04-16 120
^1da177e Linus Torvalds 2005-04-16 121 return RTC_24H;
^1da177e Linus Torvalds 2005-04-16 122 }
^1da177e Linus Torvalds 2005-04-16 123
5f7dc5d7 Ivan Kokshaysky 2009-01-15 124 #ifndef get_rtc_time
5f7dc5d7 Ivan Kokshaysky 2009-01-15 125 #define get_rtc_time __get_rtc_time
5f7dc5d7 Ivan Kokshaysky 2009-01-15 126 #endif
5f7dc5d7 Ivan Kokshaysky 2009-01-15 127
^1da177e Linus Torvalds 2005-04-16 128 /* Set the current date and time in the real time clock. */
5f7dc5d7 Ivan Kokshaysky 2009-01-15 129 static inline int __set_rtc_time(struct rtc_time *time)
^1da177e Linus Torvalds 2005-04-16 130 {
eb71c87a Linus Torvalds 2006-06-24 131 unsigned long flags;
^1da177e Linus Torvalds 2005-04-16 132 unsigned char mon, day, hrs, min, sec;
^1da177e Linus Torvalds 2005-04-16 133 unsigned char save_control, save_freq_select;
^1da177e Linus Torvalds 2005-04-16 134 unsigned int yrs;
^1da177e Linus Torvalds 2005-04-16 135 #ifdef CONFIG_MACH_DECSTATION
^1da177e Linus Torvalds 2005-04-16 136 unsigned int real_yrs, leap_yr;
^1da177e Linus Torvalds 2005-04-16 137 #endif
3c217e51 Sylvain Chouleur 2015-06-08 138 unsigned char century = 0;
^1da177e Linus Torvalds 2005-04-16 139
^1da177e Linus Torvalds 2005-04-16 140 yrs = time->tm_year;
^1da177e Linus Torvalds 2005-04-16 141 mon = time->tm_mon + 1; /* tm_mon starts at zero */
^1da177e Linus Torvalds 2005-04-16 142 day = time->tm_mday;
^1da177e Linus Torvalds 2005-04-16 143 hrs = time->tm_hour;
^1da177e Linus Torvalds 2005-04-16 144 min = time->tm_min;
^1da177e Linus Torvalds 2005-04-16 145 sec = time->tm_sec;
^1da177e Linus Torvalds 2005-04-16 146
^1da177e Linus Torvalds 2005-04-16 147 if (yrs > 255) /* They are unsigned */
^1da177e Linus Torvalds 2005-04-16 148 return -EINVAL;
^1da177e Linus Torvalds 2005-04-16 149
eb71c87a Linus Torvalds 2006-06-24 150 spin_lock_irqsave(&rtc_lock, flags);
^1da177e Linus Torvalds 2005-04-16 151 #ifdef CONFIG_MACH_DECSTATION
^1da177e Linus Torvalds 2005-04-16 152 real_yrs = yrs;
^1da177e Linus Torvalds 2005-04-16 153 leap_yr = ((!((yrs + 1900) % 4) && ((yrs + 1900) % 100)) ||
^1da177e Linus Torvalds 2005-04-16 154 !((yrs + 1900) % 400));
^1da177e Linus Torvalds 2005-04-16 155 yrs = 72;
^1da177e Linus Torvalds 2005-04-16 156
^1da177e Linus Torvalds 2005-04-16 157 /*
^1da177e Linus Torvalds 2005-04-16 158 * We want to keep the year set to 73 until March
^1da177e Linus Torvalds 2005-04-16 159 * for non-leap years, so that Feb, 29th is handled
^1da177e Linus Torvalds 2005-04-16 160 * correctly.
^1da177e Linus Torvalds 2005-04-16 161 */
^1da177e Linus Torvalds 2005-04-16 162 if (!leap_yr && mon < 3) {
^1da177e Linus Torvalds 2005-04-16 163 real_yrs--;
^1da177e Linus Torvalds 2005-04-16 164 yrs = 73;
^1da177e Linus Torvalds 2005-04-16 165 }
^1da177e Linus Torvalds 2005-04-16 166 #endif
3c217e51 Sylvain Chouleur 2015-06-08 167
3c217e51 Sylvain Chouleur 2015-06-08 168 #ifdef CONFIG_ACPI
3c217e51 Sylvain Chouleur 2015-06-08 169 if (acpi_gbl_FADT.header.revision >= FADT2_REVISION_ID &&
3c217e51 Sylvain Chouleur 2015-06-08 170 acpi_gbl_FADT.century) {
3c217e51 Sylvain Chouleur 2015-06-08 171 century = (yrs + 1900) / 100;
3c217e51 Sylvain Chouleur 2015-06-08 172 yrs %= 100;
3c217e51 Sylvain Chouleur 2015-06-08 173 }
3c217e51 Sylvain Chouleur 2015-06-08 174 #endif
3c217e51 Sylvain Chouleur 2015-06-08 175
^1da177e Linus Torvalds 2005-04-16 176 /* These limits and adjustments are independent of
^1da177e Linus Torvalds 2005-04-16 177 * whether the chip is in binary mode or not.
^1da177e Linus Torvalds 2005-04-16 178 */
^1da177e Linus Torvalds 2005-04-16 179 if (yrs > 169) {
eb71c87a Linus Torvalds 2006-06-24 180 spin_unlock_irqrestore(&rtc_lock, flags);
^1da177e Linus Torvalds 2005-04-16 181 return -EINVAL;
^1da177e Linus Torvalds 2005-04-16 182 }
^1da177e Linus Torvalds 2005-04-16 183
^1da177e Linus Torvalds 2005-04-16 184 if (yrs >= 100)
^1da177e Linus Torvalds 2005-04-16 185 yrs -= 100;
^1da177e Linus Torvalds 2005-04-16 186
^1da177e Linus Torvalds 2005-04-16 187 if (!(CMOS_READ(RTC_CONTROL) & RTC_DM_BINARY)
^1da177e Linus Torvalds 2005-04-16 188 || RTC_ALWAYS_BCD) {
357c6e63 Adrian Bunk 2008-10-18 189 sec = bin2bcd(sec);
357c6e63 Adrian Bunk 2008-10-18 190 min = bin2bcd(min);
357c6e63 Adrian Bunk 2008-10-18 191 hrs = bin2bcd(hrs);
357c6e63 Adrian Bunk 2008-10-18 192 day = bin2bcd(day);
357c6e63 Adrian Bunk 2008-10-18 193 mon = bin2bcd(mon);
357c6e63 Adrian Bunk 2008-10-18 194 yrs = bin2bcd(yrs);
3c217e51 Sylvain Chouleur 2015-06-08 195 century = bin2bcd(century);
^1da177e Linus Torvalds 2005-04-16 196 }
^1da177e Linus Torvalds 2005-04-16 197
^1da177e Linus Torvalds 2005-04-16 198 save_control = CMOS_READ(RTC_CONTROL);
^1da177e Linus Torvalds 2005-04-16 @199 CMOS_WRITE((save_control|RTC_SET), RTC_CONTROL);
^1da177e Linus Torvalds 2005-04-16 200 save_freq_select = CMOS_READ(RTC_FREQ_SELECT);
^1da177e Linus Torvalds 2005-04-16 201 CMOS_WRITE((save_freq_select|RTC_DIV_RESET2), RTC_FREQ_SELECT);
^1da177e Linus Torvalds 2005-04-16 202

:::::: The code at line 43 was first introduced by commit
:::::: 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 Linux-2.6.12-rc2

:::::: TO: Linus Torvalds <torvalds@xxxxxxxxxxxxxxx>
:::::: CC: Linus Torvalds <torvalds@xxxxxxxxxxxxxxx>

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

Attachment: .config.gz
Description: Binary data