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>
This commit is contained in:
Alexandre Belloni 2018-02-19 16:23:56 +01:00
parent ab62670e57
commit 22652ba724
48 changed files with 48 additions and 53 deletions

View File

@ -387,7 +387,7 @@ static int ac100_rtc_get_time(struct device *dev, struct rtc_time *rtc_tm)
rtc_tm->tm_year = bcd2bin(reg[6] & AC100_RTC_YEA_MASK) +
AC100_YEAR_OFF;
return rtc_valid_tm(rtc_tm);
return 0;
}
static int ac100_rtc_set_time(struct device *dev, struct rtc_time *rtc_tm)

View File

@ -36,7 +36,7 @@ static int au1xtoy_rtc_read_time(struct device *dev, struct rtc_time *tm)
rtc_time_to_tm(t, tm);
return rtc_valid_tm(tm);
return 0;
}
static int au1xtoy_rtc_set_time(struct device *dev, struct rtc_time *tm)

View File

@ -110,7 +110,7 @@ static int bq32k_rtc_read_time(struct device *dev, struct rtc_time *tm)
tm->tm_year = bcd2bin(regs.years) +
((regs.cent_hours & BQ32K_CENT) ? 100 : 0);
return rtc_valid_tm(tm);
return 0;
}
static int bq32k_rtc_set_time(struct device *dev, struct rtc_time *tm)

View File

@ -99,7 +99,7 @@ static int ds1216_rtc_read_time(struct device *dev, struct rtc_time *tm)
if (tm->tm_year < 70)
tm->tm_year += 100;
return rtc_valid_tm(tm);
return 0;
}
static int ds1216_rtc_set_time(struct device *dev, struct rtc_time *tm)

View File

@ -211,7 +211,7 @@ static int ds1286_read_time(struct device *dev, struct rtc_time *tm)
tm->tm_mon--;
return rtc_valid_tm(tm);
return 0;
}
static int ds1286_set_time(struct device *dev, struct rtc_time *tm)

View File

@ -98,8 +98,7 @@ static int ds1302_rtc_get_time(struct device *dev, struct rtc_time *time)
time->tm_mon = bcd2bin(buf[RTC_ADDR_MON]) - 1;
time->tm_year = bcd2bin(buf[RTC_ADDR_YEAR]) + 100;
/* Time may not be set */
return rtc_valid_tm(time);
return 0;
}
static const struct rtc_class_ops ds1302_rtc_ops = {

View File

@ -203,8 +203,7 @@ static int ds1305_get_time(struct device *dev, struct rtc_time *time)
time->tm_hour, time->tm_mday,
time->tm_mon, time->tm_year, time->tm_wday);
/* Time may not be set */
return rtc_valid_tm(time);
return 0;
}
static int ds1305_set_time(struct device *dev, struct rtc_time *time)

View File

@ -437,8 +437,7 @@ static int ds1307_get_time(struct device *dev, struct rtc_time *t)
t->tm_hour, t->tm_mday,
t->tm_mon, t->tm_year, t->tm_wday);
/* initial clock setting can be undefined */
return rtc_valid_tm(t);
return 0;
}
static int ds1307_set_time(struct device *dev, struct rtc_time *t)

View File

@ -254,7 +254,7 @@ static int ds1343_read_time(struct device *dev, struct rtc_time *dt)
dt->tm_mon = bcd2bin(buf[5] & 0x1F) - 1;
dt->tm_year = bcd2bin(buf[6]) + 100; /* year offset from 1900 */
return rtc_valid_tm(dt);
return 0;
}
static int ds1343_set_time(struct device *dev, struct rtc_time *dt)

View File

@ -66,7 +66,7 @@ static int ds1347_read_time(struct device *dev, struct rtc_time *dt)
dt->tm_wday = bcd2bin(buf[5]) - 1;
dt->tm_year = bcd2bin(buf[6]) + 100;
return rtc_valid_tm(dt);
return 0;
}
static int ds1347_set_time(struct device *dev, struct rtc_time *dt)

View File

@ -153,7 +153,7 @@ static int ds1390_read_time(struct device *dev, struct rtc_time *dt)
/* adjust for century bit */
dt->tm_year = bcd2bin(chip->txrx_buf[6]) + ((chip->txrx_buf[5] & 0x80) ? 100 : 0);
return rtc_valid_tm(dt);
return 0;
}
static int ds1390_set_time(struct device *dev, struct rtc_time *dt)

View File

@ -306,7 +306,7 @@ ds1685_rtc_read_time(struct device *dev, struct rtc_time *tm)
tm->tm_yday = rtc_year_days(tm->tm_mday, tm->tm_mon, tm->tm_year);
tm->tm_isdst = 0; /* RTC has hardcoded timezone, so don't use. */
return rtc_valid_tm(tm);
return 0;
}
/**

View File

@ -112,7 +112,7 @@ static int ds1742_rtc_read_time(struct device *dev, struct rtc_time *tm)
/* year is 1900 + tm->tm_year */
tm->tm_year = bcd2bin(year) + bcd2bin(century) * 100 - 1900;
return rtc_valid_tm(tm);
return 0;
}
static const struct rtc_class_ops ds1742_rtc_ops = {

View File

@ -207,7 +207,7 @@ static int ds2404_read_time(struct device *dev, struct rtc_time *dt)
time = le32_to_cpu(time);
rtc_time_to_tm(time, dt);
return rtc_valid_tm(dt);
return 0;
}
static int ds2404_set_mmss(struct device *dev, unsigned long secs)

View File

@ -145,7 +145,7 @@ static int ds3232_read_time(struct device *dev, struct rtc_time *time)
time->tm_year = bcd2bin(year) + add_century;
return rtc_valid_tm(time);
return 0;
}
static int ds3232_set_time(struct device *dev, struct rtc_time *time)

View File

@ -176,7 +176,7 @@ static int efi_read_time(struct device *dev, struct rtc_time *tm)
if (!convert_from_efi_time(&eft, tm))
return -EIO;
return rtc_valid_tm(tm);
return 0;
}
static int efi_set_time(struct device *dev, struct rtc_time *tm)

View File

@ -136,8 +136,7 @@ static int fm3130_get_time(struct device *dev, struct rtc_time *t)
t->tm_hour, t->tm_mday,
t->tm_mon, t->tm_year, t->tm_wday);
/* initial clock setting can be undefined */
return rtc_valid_tm(t);
return 0;
}

View File

@ -149,7 +149,7 @@ static int isl12022_get_datetime(struct i2c_client *client, struct rtc_time *tm)
tm->tm_sec, tm->tm_min, tm->tm_hour,
tm->tm_mday, tm->tm_mon, tm->tm_year, tm->tm_wday);
return rtc_valid_tm(tm);
return 0;
}
static int isl12022_set_datetime(struct i2c_client *client, struct rtc_time *tm)

View File

@ -110,7 +110,7 @@ static int lpc24xx_rtc_read_time(struct device *dev, struct rtc_time *tm)
tm->tm_year = CT1_YEAR(ct1);
tm->tm_yday = CT2_DOY(ct2);
return rtc_valid_tm(tm);
return 0;
}
static int lpc24xx_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *wkalrm)

View File

@ -230,7 +230,7 @@ static int m41t80_get_datetime(struct i2c_client *client,
/* assume 20YY not 19YY, and ignore the Century Bit */
tm->tm_year = bcd2bin(buf[M41T80_REG_YEAR]) + 100;
return rtc_valid_tm(tm);
return 0;
}
/* Sets the given date and time to the real time clock. */

View File

@ -99,8 +99,7 @@ static int m41t94_read_time(struct device *dev, struct rtc_time *tm)
tm->tm_hour, tm->tm_mday,
tm->tm_mon, tm->tm_year, tm->tm_wday);
/* initial clock setting can be undefined */
return rtc_valid_tm(tm);
return 0;
}
static const struct rtc_class_ops m41t94_rtc_ops = {

View File

@ -84,7 +84,7 @@ static int m48t35_read_time(struct device *dev, struct rtc_time *tm)
tm->tm_year += 100;
tm->tm_mon--;
return rtc_valid_tm(tm);
return 0;
}
static int m48t35_set_time(struct device *dev, struct rtc_time *tm)

View File

@ -105,7 +105,7 @@ static int m48t59_rtc_read_time(struct device *dev, struct rtc_time *tm)
dev_dbg(dev, "RTC read time %04d-%02d-%02d %02d/%02d/%02d\n",
tm->tm_year + 1900, tm->tm_mon, tm->tm_mday,
tm->tm_hour, tm->tm_min, tm->tm_sec);
return rtc_valid_tm(tm);
return 0;
}
static int m48t59_rtc_set_time(struct device *dev, struct rtc_time *tm)

View File

@ -100,7 +100,7 @@ static int m48t86_rtc_read_time(struct device *dev, struct rtc_time *tm)
if (m48t86_readb(dev, M48T86_HOUR) & 0x80)
tm->tm_hour += 12;
return rtc_valid_tm(tm);
return 0;
}
static int m48t86_rtc_set_time(struct device *dev, struct rtc_time *tm)

View File

@ -85,7 +85,7 @@ static int max6902_read_time(struct device *dev, struct rtc_time *dt)
dt->tm_year += century;
dt->tm_year -= 1900;
return rtc_valid_tm(dt);
return 0;
}
static int max6902_set_time(struct device *dev, struct rtc_time *dt)

View File

@ -75,7 +75,7 @@ static int max6916_read_time(struct device *dev, struct rtc_time *dt)
dt->tm_wday = bcd2bin(buf[5]) - 1;
dt->tm_year = bcd2bin(buf[6]) + 100;
return rtc_valid_tm(dt);
return 0;
}
static int max6916_set_time(struct device *dev, struct rtc_time *dt)

View File

@ -153,7 +153,7 @@ static int max8997_rtc_read_time(struct device *dev, struct rtc_time *tm)
max8997_rtc_data_to_tm(data, tm, info->rtc_24hr_mode);
return rtc_valid_tm(tm);
return 0;
}
static int max8997_rtc_set_time(struct device *dev, struct rtc_time *tm)

View File

@ -120,7 +120,7 @@ static int max8998_rtc_read_time(struct device *dev, struct rtc_time *tm)
max8998_data_to_tm(data, tm);
return rtc_valid_tm(tm);
return 0;
}
static int max8998_rtc_set_time(struct device *dev, struct rtc_time *tm)

View File

@ -262,7 +262,7 @@ static int mcp795_read_time(struct device *dev, struct rtc_time *tim)
tim->tm_year + 1900, tim->tm_mon, tim->tm_mday,
tim->tm_wday, tim->tm_hour, tim->tm_min, tim->tm_sec);
return rtc_valid_tm(tim);
return 0;
}
static int mcp795_set_alarm(struct device *dev, struct rtc_wkalrm *alm)

View File

@ -105,7 +105,7 @@ static int mrst_read_time(struct device *dev, struct rtc_time *time)
/* Adjust for the 1972/1900 */
time->tm_year += 72;
time->tm_mon--;
return rtc_valid_tm(time);
return 0;
}
static int mrst_set_time(struct device *dev, struct rtc_time *time)

View File

@ -155,7 +155,7 @@ static int msm6242_read_time(struct device *dev, struct rtc_time *tm)
msm6242_unlock(priv);
return rtc_valid_tm(tm);
return 0;
}
static int msm6242_set_time(struct device *dev, struct rtc_time *tm)

View File

@ -232,7 +232,7 @@ static int mtk_rtc_gettime(struct device *dev, struct rtc_time *tm)
mtk_rtc_get_alarm_or_time(hw, tm, MTK_TC);
return rtc_valid_tm(tm);
return 0;
}
static int mtk_rtc_settime(struct device *dev, struct rtc_time *tm)

View File

@ -94,7 +94,7 @@ static int mv_rtc_read_time(struct device *dev, struct rtc_time *tm)
/* hw counts from year 2000, but tm_year is relative to 1900 */
tm->tm_year = bcd2bin(year) + 100;
return rtc_valid_tm(tm);
return 0;
}
static int mv_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alm)

View File

@ -289,7 +289,7 @@ static int pcf2123_rtc_read_time(struct device *dev, struct rtc_time *tm)
tm->tm_sec, tm->tm_min, tm->tm_hour,
tm->tm_mday, tm->tm_mon, tm->tm_year, tm->tm_wday);
return rtc_valid_tm(tm);
return 0;
}
static int pcf2123_rtc_set_time(struct device *dev, struct rtc_time *tm)

View File

@ -111,7 +111,7 @@ static int pcf2127_rtc_read_time(struct device *dev, struct rtc_time *tm)
tm->tm_sec, tm->tm_min, tm->tm_hour,
tm->tm_mday, tm->tm_mon, tm->tm_year, tm->tm_wday);
return rtc_valid_tm(tm);
return 0;
}
static int pcf2127_rtc_set_time(struct device *dev, struct rtc_time *tm)

View File

@ -135,7 +135,7 @@ static int pcf50633_rtc_read_time(struct device *dev, struct rtc_time *tm)
tm->tm_mday, tm->tm_mon, tm->tm_year,
tm->tm_hour, tm->tm_min, tm->tm_sec);
return rtc_valid_tm(tm);
return 0;
}
static int pcf50633_rtc_set_time(struct device *dev, struct rtc_time *tm)

View File

@ -192,7 +192,7 @@ static int pcf8523_rtc_read_time(struct device *dev, struct rtc_time *tm)
tm->tm_mon = bcd2bin(regs[5] & 0x1f) - 1;
tm->tm_year = bcd2bin(regs[6]) + 100;
return rtc_valid_tm(tm);
return 0;
}
static int pcf8523_rtc_set_time(struct device *dev, struct rtc_time *tm)

View File

@ -175,7 +175,7 @@ static int pic32_rtc_gettime(struct device *dev, struct rtc_time *rtc_tm)
rtc_tm->tm_hour, rtc_tm->tm_min, rtc_tm->tm_sec);
clk_disable(pdata->clk);
return rtc_valid_tm(rtc_tm);
return 0;
}
static int pic32_rtc_settime(struct device *dev, struct rtc_time *tm)

View File

@ -92,7 +92,7 @@ static int r9701_get_datetime(struct device *dev, struct rtc_time *dt)
* according to the data sheet. make sure they are valid.
*/
return rtc_valid_tm(dt);
return 0;
}
static int r9701_set_datetime(struct device *dev, struct rtc_time *dt)

View File

@ -115,7 +115,7 @@ static int rp5c01_read_time(struct device *dev, struct rtc_time *tm)
rp5c01_unlock(priv);
spin_unlock_irq(&priv->lock);
return rtc_valid_tm(tm);
return 0;
}
static int rp5c01_set_time(struct device *dev, struct rtc_time *tm)

View File

@ -252,7 +252,7 @@ static int rx6110_get_time(struct device *dev, struct rtc_time *tm)
tm->tm_sec, tm->tm_min, tm->tm_hour,
tm->tm_mday, tm->tm_mon, tm->tm_year);
return rtc_valid_tm(tm);
return 0;
}
static const struct reg_sequence rx6110_default_regs[] = {

View File

@ -138,7 +138,7 @@ static int rx8010_get_time(struct device *dev, struct rtc_time *dt)
dt->tm_year = bcd2bin(date[RX8010_YEAR - RX8010_SEC]) + 100;
dt->tm_wday = ffs(date[RX8010_WDAY - RX8010_SEC] & 0x7f);
return rtc_valid_tm(dt);
return 0;
}
static int rx8010_set_time(struct device *dev, struct rtc_time *dt)

View File

@ -214,7 +214,7 @@ static int rx8025_get_time(struct device *dev, struct rtc_time *dt)
dt->tm_sec, dt->tm_min, dt->tm_hour,
dt->tm_mday, dt->tm_mon, dt->tm_year);
return rtc_valid_tm(dt);
return 0;
}
static int rx8025_set_time(struct device *dev, struct rtc_time *dt)

View File

@ -232,7 +232,7 @@ retry_get_time:
rtc_tm->tm_mon -= 1;
return rtc_valid_tm(rtc_tm);
return 0;
}
static int s3c_rtc_settime(struct device *dev, struct rtc_time *tm)

View File

@ -407,7 +407,7 @@ static int s5m_rtc_read_time(struct device *dev, struct rtc_time *tm)
1900 + tm->tm_year, 1 + tm->tm_mon, tm->tm_mday,
tm->tm_hour, tm->tm_min, tm->tm_sec, tm->tm_wday);
return rtc_valid_tm(tm);
return 0;
}
static int s5m_rtc_set_time(struct device *dev, struct rtc_time *tm)

View File

@ -414,7 +414,7 @@ static int sh_rtc_read_time(struct device *dev, struct rtc_time *tm)
tm->tm_sec, tm->tm_min, tm->tm_hour,
tm->tm_mday, tm->tm_mon + 1, tm->tm_year, tm->tm_wday);
return rtc_valid_tm(tm);
return 0;
}
static int sh_rtc_set_time(struct device *dev, struct rtc_time *tm)

View File

@ -349,7 +349,7 @@ static int sun6i_rtc_gettime(struct device *dev, struct rtc_time *rtc_tm)
*/
rtc_tm->tm_year += SUN6I_YEAR_OFF;
return rtc_valid_tm(rtc_tm);
return 0;
}
static int sun6i_rtc_getalarm(struct device *dev, struct rtc_wkalrm *wkalrm)

View File

@ -261,7 +261,7 @@ static int sunxi_rtc_gettime(struct device *dev, struct rtc_time *rtc_tm)
*/
rtc_tm->tm_year += SUNXI_YEAR_OFF(chip->data_year);
return rtc_valid_tm(rtc_tm);
return 0;
}
static int sunxi_rtc_setalarm(struct device *dev, struct rtc_wkalrm *wkalrm)