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

rtc: stop validating rtc_time in .read_time

The RTC core is always calling rtc_valid_tm after the read_time callback.
It is not necessary to call it just before returning from the callback.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>

+48 -53
+1 -1
drivers/rtc/rtc-ac100.c
··· 387 387 rtc_tm->tm_year = bcd2bin(reg[6] & AC100_RTC_YEA_MASK) + 388 388 AC100_YEAR_OFF; 389 389 390 - return rtc_valid_tm(rtc_tm); 390 + return 0; 391 391 } 392 392 393 393 static int ac100_rtc_set_time(struct device *dev, struct rtc_time *rtc_tm)
+1 -1
drivers/rtc/rtc-au1xxx.c
··· 36 36 37 37 rtc_time_to_tm(t, tm); 38 38 39 - return rtc_valid_tm(tm); 39 + return 0; 40 40 } 41 41 42 42 static int au1xtoy_rtc_set_time(struct device *dev, struct rtc_time *tm)
+1 -1
drivers/rtc/rtc-bq32k.c
··· 110 110 tm->tm_year = bcd2bin(regs.years) + 111 111 ((regs.cent_hours & BQ32K_CENT) ? 100 : 0); 112 112 113 - return rtc_valid_tm(tm); 113 + return 0; 114 114 } 115 115 116 116 static int bq32k_rtc_set_time(struct device *dev, struct rtc_time *tm)
+1 -1
drivers/rtc/rtc-ds1216.c
··· 99 99 if (tm->tm_year < 70) 100 100 tm->tm_year += 100; 101 101 102 - return rtc_valid_tm(tm); 102 + return 0; 103 103 } 104 104 105 105 static int ds1216_rtc_set_time(struct device *dev, struct rtc_time *tm)
+1 -1
drivers/rtc/rtc-ds1286.c
··· 211 211 212 212 tm->tm_mon--; 213 213 214 - return rtc_valid_tm(tm); 214 + return 0; 215 215 } 216 216 217 217 static int ds1286_set_time(struct device *dev, struct rtc_time *tm)
+1 -2
drivers/rtc/rtc-ds1302.c
··· 98 98 time->tm_mon = bcd2bin(buf[RTC_ADDR_MON]) - 1; 99 99 time->tm_year = bcd2bin(buf[RTC_ADDR_YEAR]) + 100; 100 100 101 - /* Time may not be set */ 102 - return rtc_valid_tm(time); 101 + return 0; 103 102 } 104 103 105 104 static const struct rtc_class_ops ds1302_rtc_ops = {
+1 -2
drivers/rtc/rtc-ds1305.c
··· 203 203 time->tm_hour, time->tm_mday, 204 204 time->tm_mon, time->tm_year, time->tm_wday); 205 205 206 - /* Time may not be set */ 207 - return rtc_valid_tm(time); 206 + return 0; 208 207 } 209 208 210 209 static int ds1305_set_time(struct device *dev, struct rtc_time *time)
+1 -2
drivers/rtc/rtc-ds1307.c
··· 437 437 t->tm_hour, t->tm_mday, 438 438 t->tm_mon, t->tm_year, t->tm_wday); 439 439 440 - /* initial clock setting can be undefined */ 441 - return rtc_valid_tm(t); 440 + return 0; 442 441 } 443 442 444 443 static int ds1307_set_time(struct device *dev, struct rtc_time *t)
+1 -1
drivers/rtc/rtc-ds1343.c
··· 254 254 dt->tm_mon = bcd2bin(buf[5] & 0x1F) - 1; 255 255 dt->tm_year = bcd2bin(buf[6]) + 100; /* year offset from 1900 */ 256 256 257 - return rtc_valid_tm(dt); 257 + return 0; 258 258 } 259 259 260 260 static int ds1343_set_time(struct device *dev, struct rtc_time *dt)
+1 -1
drivers/rtc/rtc-ds1347.c
··· 66 66 dt->tm_wday = bcd2bin(buf[5]) - 1; 67 67 dt->tm_year = bcd2bin(buf[6]) + 100; 68 68 69 - return rtc_valid_tm(dt); 69 + return 0; 70 70 } 71 71 72 72 static int ds1347_set_time(struct device *dev, struct rtc_time *dt)
+1 -1
drivers/rtc/rtc-ds1390.c
··· 153 153 /* adjust for century bit */ 154 154 dt->tm_year = bcd2bin(chip->txrx_buf[6]) + ((chip->txrx_buf[5] & 0x80) ? 100 : 0); 155 155 156 - return rtc_valid_tm(dt); 156 + return 0; 157 157 } 158 158 159 159 static int ds1390_set_time(struct device *dev, struct rtc_time *dt)
+1 -1
drivers/rtc/rtc-ds1685.c
··· 306 306 tm->tm_yday = rtc_year_days(tm->tm_mday, tm->tm_mon, tm->tm_year); 307 307 tm->tm_isdst = 0; /* RTC has hardcoded timezone, so don't use. */ 308 308 309 - return rtc_valid_tm(tm); 309 + return 0; 310 310 } 311 311 312 312 /**
+1 -1
drivers/rtc/rtc-ds1742.c
··· 112 112 /* year is 1900 + tm->tm_year */ 113 113 tm->tm_year = bcd2bin(year) + bcd2bin(century) * 100 - 1900; 114 114 115 - return rtc_valid_tm(tm); 115 + return 0; 116 116 } 117 117 118 118 static const struct rtc_class_ops ds1742_rtc_ops = {
+1 -1
drivers/rtc/rtc-ds2404.c
··· 207 207 time = le32_to_cpu(time); 208 208 209 209 rtc_time_to_tm(time, dt); 210 - return rtc_valid_tm(dt); 210 + return 0; 211 211 } 212 212 213 213 static int ds2404_set_mmss(struct device *dev, unsigned long secs)
+1 -1
drivers/rtc/rtc-ds3232.c
··· 145 145 146 146 time->tm_year = bcd2bin(year) + add_century; 147 147 148 - return rtc_valid_tm(time); 148 + return 0; 149 149 } 150 150 151 151 static int ds3232_set_time(struct device *dev, struct rtc_time *time)
+1 -1
drivers/rtc/rtc-efi.c
··· 176 176 if (!convert_from_efi_time(&eft, tm)) 177 177 return -EIO; 178 178 179 - return rtc_valid_tm(tm); 179 + return 0; 180 180 } 181 181 182 182 static int efi_set_time(struct device *dev, struct rtc_time *tm)
+1 -2
drivers/rtc/rtc-fm3130.c
··· 136 136 t->tm_hour, t->tm_mday, 137 137 t->tm_mon, t->tm_year, t->tm_wday); 138 138 139 - /* initial clock setting can be undefined */ 140 - return rtc_valid_tm(t); 139 + return 0; 141 140 } 142 141 143 142
+1 -1
drivers/rtc/rtc-isl12022.c
··· 149 149 tm->tm_sec, tm->tm_min, tm->tm_hour, 150 150 tm->tm_mday, tm->tm_mon, tm->tm_year, tm->tm_wday); 151 151 152 - return rtc_valid_tm(tm); 152 + return 0; 153 153 } 154 154 155 155 static int isl12022_set_datetime(struct i2c_client *client, struct rtc_time *tm)
+1 -1
drivers/rtc/rtc-lpc24xx.c
··· 110 110 tm->tm_year = CT1_YEAR(ct1); 111 111 tm->tm_yday = CT2_DOY(ct2); 112 112 113 - return rtc_valid_tm(tm); 113 + return 0; 114 114 } 115 115 116 116 static int lpc24xx_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *wkalrm)
+1 -1
drivers/rtc/rtc-m41t80.c
··· 230 230 231 231 /* assume 20YY not 19YY, and ignore the Century Bit */ 232 232 tm->tm_year = bcd2bin(buf[M41T80_REG_YEAR]) + 100; 233 - return rtc_valid_tm(tm); 233 + return 0; 234 234 } 235 235 236 236 /* Sets the given date and time to the real time clock. */
+1 -2
drivers/rtc/rtc-m41t94.c
··· 99 99 tm->tm_hour, tm->tm_mday, 100 100 tm->tm_mon, tm->tm_year, tm->tm_wday); 101 101 102 - /* initial clock setting can be undefined */ 103 - return rtc_valid_tm(tm); 102 + return 0; 104 103 } 105 104 106 105 static const struct rtc_class_ops m41t94_rtc_ops = {
+1 -1
drivers/rtc/rtc-m48t35.c
··· 84 84 tm->tm_year += 100; 85 85 86 86 tm->tm_mon--; 87 - return rtc_valid_tm(tm); 87 + return 0; 88 88 } 89 89 90 90 static int m48t35_set_time(struct device *dev, struct rtc_time *tm)
+1 -1
drivers/rtc/rtc-m48t59.c
··· 105 105 dev_dbg(dev, "RTC read time %04d-%02d-%02d %02d/%02d/%02d\n", 106 106 tm->tm_year + 1900, tm->tm_mon, tm->tm_mday, 107 107 tm->tm_hour, tm->tm_min, tm->tm_sec); 108 - return rtc_valid_tm(tm); 108 + return 0; 109 109 } 110 110 111 111 static int m48t59_rtc_set_time(struct device *dev, struct rtc_time *tm)
+1 -1
drivers/rtc/rtc-m48t86.c
··· 100 100 if (m48t86_readb(dev, M48T86_HOUR) & 0x80) 101 101 tm->tm_hour += 12; 102 102 103 - return rtc_valid_tm(tm); 103 + return 0; 104 104 } 105 105 106 106 static int m48t86_rtc_set_time(struct device *dev, struct rtc_time *tm)
+1 -1
drivers/rtc/rtc-max6902.c
··· 85 85 dt->tm_year += century; 86 86 dt->tm_year -= 1900; 87 87 88 - return rtc_valid_tm(dt); 88 + return 0; 89 89 } 90 90 91 91 static int max6902_set_time(struct device *dev, struct rtc_time *dt)
+1 -1
drivers/rtc/rtc-max6916.c
··· 75 75 dt->tm_wday = bcd2bin(buf[5]) - 1; 76 76 dt->tm_year = bcd2bin(buf[6]) + 100; 77 77 78 - return rtc_valid_tm(dt); 78 + return 0; 79 79 } 80 80 81 81 static int max6916_set_time(struct device *dev, struct rtc_time *dt)
+1 -1
drivers/rtc/rtc-max8997.c
··· 153 153 154 154 max8997_rtc_data_to_tm(data, tm, info->rtc_24hr_mode); 155 155 156 - return rtc_valid_tm(tm); 156 + return 0; 157 157 } 158 158 159 159 static int max8997_rtc_set_time(struct device *dev, struct rtc_time *tm)
+1 -1
drivers/rtc/rtc-max8998.c
··· 120 120 121 121 max8998_data_to_tm(data, tm); 122 122 123 - return rtc_valid_tm(tm); 123 + return 0; 124 124 } 125 125 126 126 static int max8998_rtc_set_time(struct device *dev, struct rtc_time *tm)
+1 -1
drivers/rtc/rtc-mcp795.c
··· 262 262 tim->tm_year + 1900, tim->tm_mon, tim->tm_mday, 263 263 tim->tm_wday, tim->tm_hour, tim->tm_min, tim->tm_sec); 264 264 265 - return rtc_valid_tm(tim); 265 + return 0; 266 266 } 267 267 268 268 static int mcp795_set_alarm(struct device *dev, struct rtc_wkalrm *alm)
+1 -1
drivers/rtc/rtc-mrst.c
··· 105 105 /* Adjust for the 1972/1900 */ 106 106 time->tm_year += 72; 107 107 time->tm_mon--; 108 - return rtc_valid_tm(time); 108 + return 0; 109 109 } 110 110 111 111 static int mrst_set_time(struct device *dev, struct rtc_time *time)
+1 -1
drivers/rtc/rtc-msm6242.c
··· 155 155 156 156 msm6242_unlock(priv); 157 157 158 - return rtc_valid_tm(tm); 158 + return 0; 159 159 } 160 160 161 161 static int msm6242_set_time(struct device *dev, struct rtc_time *tm)
+1 -1
drivers/rtc/rtc-mt7622.c
··· 232 232 233 233 mtk_rtc_get_alarm_or_time(hw, tm, MTK_TC); 234 234 235 - return rtc_valid_tm(tm); 235 + return 0; 236 236 } 237 237 238 238 static int mtk_rtc_settime(struct device *dev, struct rtc_time *tm)
+1 -1
drivers/rtc/rtc-mv.c
··· 94 94 /* hw counts from year 2000, but tm_year is relative to 1900 */ 95 95 tm->tm_year = bcd2bin(year) + 100; 96 96 97 - return rtc_valid_tm(tm); 97 + return 0; 98 98 } 99 99 100 100 static int mv_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alm)
+1 -1
drivers/rtc/rtc-pcf2123.c
··· 289 289 tm->tm_sec, tm->tm_min, tm->tm_hour, 290 290 tm->tm_mday, tm->tm_mon, tm->tm_year, tm->tm_wday); 291 291 292 - return rtc_valid_tm(tm); 292 + return 0; 293 293 } 294 294 295 295 static int pcf2123_rtc_set_time(struct device *dev, struct rtc_time *tm)
+1 -1
drivers/rtc/rtc-pcf2127.c
··· 111 111 tm->tm_sec, tm->tm_min, tm->tm_hour, 112 112 tm->tm_mday, tm->tm_mon, tm->tm_year, tm->tm_wday); 113 113 114 - return rtc_valid_tm(tm); 114 + return 0; 115 115 } 116 116 117 117 static int pcf2127_rtc_set_time(struct device *dev, struct rtc_time *tm)
+1 -1
drivers/rtc/rtc-pcf50633.c
··· 135 135 tm->tm_mday, tm->tm_mon, tm->tm_year, 136 136 tm->tm_hour, tm->tm_min, tm->tm_sec); 137 137 138 - return rtc_valid_tm(tm); 138 + return 0; 139 139 } 140 140 141 141 static int pcf50633_rtc_set_time(struct device *dev, struct rtc_time *tm)
+1 -1
drivers/rtc/rtc-pcf8523.c
··· 192 192 tm->tm_mon = bcd2bin(regs[5] & 0x1f) - 1; 193 193 tm->tm_year = bcd2bin(regs[6]) + 100; 194 194 195 - return rtc_valid_tm(tm); 195 + return 0; 196 196 } 197 197 198 198 static int pcf8523_rtc_set_time(struct device *dev, struct rtc_time *tm)
+1 -1
drivers/rtc/rtc-pic32.c
··· 175 175 rtc_tm->tm_hour, rtc_tm->tm_min, rtc_tm->tm_sec); 176 176 177 177 clk_disable(pdata->clk); 178 - return rtc_valid_tm(rtc_tm); 178 + return 0; 179 179 } 180 180 181 181 static int pic32_rtc_settime(struct device *dev, struct rtc_time *tm)
+1 -1
drivers/rtc/rtc-r9701.c
··· 92 92 * according to the data sheet. make sure they are valid. 93 93 */ 94 94 95 - return rtc_valid_tm(dt); 95 + return 0; 96 96 } 97 97 98 98 static int r9701_set_datetime(struct device *dev, struct rtc_time *dt)
+1 -1
drivers/rtc/rtc-rp5c01.c
··· 115 115 rp5c01_unlock(priv); 116 116 spin_unlock_irq(&priv->lock); 117 117 118 - return rtc_valid_tm(tm); 118 + return 0; 119 119 } 120 120 121 121 static int rp5c01_set_time(struct device *dev, struct rtc_time *tm)
+1 -1
drivers/rtc/rtc-rx6110.c
··· 252 252 tm->tm_sec, tm->tm_min, tm->tm_hour, 253 253 tm->tm_mday, tm->tm_mon, tm->tm_year); 254 254 255 - return rtc_valid_tm(tm); 255 + return 0; 256 256 } 257 257 258 258 static const struct reg_sequence rx6110_default_regs[] = {
+1 -1
drivers/rtc/rtc-rx8010.c
··· 138 138 dt->tm_year = bcd2bin(date[RX8010_YEAR - RX8010_SEC]) + 100; 139 139 dt->tm_wday = ffs(date[RX8010_WDAY - RX8010_SEC] & 0x7f); 140 140 141 - return rtc_valid_tm(dt); 141 + return 0; 142 142 } 143 143 144 144 static int rx8010_set_time(struct device *dev, struct rtc_time *dt)
+1 -1
drivers/rtc/rtc-rx8025.c
··· 214 214 dt->tm_sec, dt->tm_min, dt->tm_hour, 215 215 dt->tm_mday, dt->tm_mon, dt->tm_year); 216 216 217 - return rtc_valid_tm(dt); 217 + return 0; 218 218 } 219 219 220 220 static int rx8025_set_time(struct device *dev, struct rtc_time *dt)
+1 -1
drivers/rtc/rtc-s3c.c
··· 232 232 233 233 rtc_tm->tm_mon -= 1; 234 234 235 - return rtc_valid_tm(rtc_tm); 235 + return 0; 236 236 } 237 237 238 238 static int s3c_rtc_settime(struct device *dev, struct rtc_time *tm)
+1 -1
drivers/rtc/rtc-s5m.c
··· 407 407 1900 + tm->tm_year, 1 + tm->tm_mon, tm->tm_mday, 408 408 tm->tm_hour, tm->tm_min, tm->tm_sec, tm->tm_wday); 409 409 410 - return rtc_valid_tm(tm); 410 + return 0; 411 411 } 412 412 413 413 static int s5m_rtc_set_time(struct device *dev, struct rtc_time *tm)
+1 -1
drivers/rtc/rtc-sh.c
··· 414 414 tm->tm_sec, tm->tm_min, tm->tm_hour, 415 415 tm->tm_mday, tm->tm_mon + 1, tm->tm_year, tm->tm_wday); 416 416 417 - return rtc_valid_tm(tm); 417 + return 0; 418 418 } 419 419 420 420 static int sh_rtc_set_time(struct device *dev, struct rtc_time *tm)
+1 -1
drivers/rtc/rtc-sun6i.c
··· 349 349 */ 350 350 rtc_tm->tm_year += SUN6I_YEAR_OFF; 351 351 352 - return rtc_valid_tm(rtc_tm); 352 + return 0; 353 353 } 354 354 355 355 static int sun6i_rtc_getalarm(struct device *dev, struct rtc_wkalrm *wkalrm)
+1 -1
drivers/rtc/rtc-sunxi.c
··· 261 261 */ 262 262 rtc_tm->tm_year += SUNXI_YEAR_OFF(chip->data_year); 263 263 264 - return rtc_valid_tm(rtc_tm); 264 + return 0; 265 265 } 266 266 267 267 static int sunxi_rtc_setalarm(struct device *dev, struct rtc_wkalrm *wkalrm)