rtc: remove cargo culted code
Subsystems (19)
Alexandre Belloni
maintainercover rtc: remove cargo culted code
Hello,
This series:
- removes useless calls to rtc_valid_tm in .read_time, .set_time and .set_alarm
- removes code setting default values for RTCs (and lets the core handle it)
- removes useless "time is invalid" messages at probe time
- removes useless indirect calls
Those were mostly copy pasted from other drivers
Alexandre Belloni (100):
rtc: ds1511: let the core handle invalid time
rtc: ds1553: let the core handle invalid time
rtc: cmos: let the core handle invalid time
rtc: rs5c348: let the core handle invalid time
rtc: stk17ta8: let the core handle invalid time
rtc: ab-b5ze-s3: stop validating rtc_time in .read_time
rtc: ab3100: stop validating rtc_time in .read_time
rtc: ab8500: stop validating rtc_time in .read_time
rtc: ac100: stop validating rtc_time in .read_time
rtc: au1xxx: stop validating rtc_time in .read_time
rtc: bq32k: stop validating rtc_time in .read_time
rtc: coh901331: stop validating rtc_time in .read_time
rtc: cpcap: stop validating rtc_time in .read_time
rtc: da9052: stop validating rtc_time in .read_time
rtc: da9055: stop validating rtc_time in .read_time
rtc: da9063: stop validating rtc_time in .read_time
rtc: ds1216: stop validating rtc_time in .read_time
rtc: ds1286: stop validating rtc_time in .read_time
rtc: ds1302: stop validating rtc_time in .read_time
rtc: ds1305: stop validating rtc_time in .read_time
rtc: ds1307: stop validating rtc_time in .read_time
rtc: ds1343: stop validating rtc_time in .read_time
rtc: ds1347: stop validating rtc_time in .read_time
rtc: ds1390: stop validating rtc_time in .read_time
rtc: ds1685: stop validating rtc_time in .read_time
rtc: ds1742: stop validating rtc_time in .read_time
rtc: ds2404: stop validating rtc_time in .read_time
rtc: ds3232: stop validating rtc_time in .read_time
rtc: efi: stop validating rtc_time in .read_time
rtc: fm3130: stop validating rtc_time in .read_time
rtc: jz4740: stop validating rtc_time in .read_time
rtc: lpc24xx: stop validating rtc_time in .read_time
rtc: lpc32xx: stop validating rtc_time in .read_time
rtc: ls1x: stop validating rtc_time in .read_time
rtc: m41t94: stop validating rtc_time in .read_time
rtc: m48t35: stop validating rtc_time in .read_time
rtc: m48t59: stop validating rtc_time in .read_time
rtc: m48t86: stop validating rtc_time in .read_time
rtc: max6902: stop validating rtc_time in .read_time
rtc: max6916: stop validating rtc_time in .read_time
rtc: max8997: stop validating rtc_time in .read_time
rtc: max8998: stop validating rtc_time in .read_time
rtc: mc13xxx: stop validating rtc_time in .read_time
rtc: mcp795: stop validating rtc_time in .read_time
rtc: mpc5121: stop validating rtc_time in .read_time
rtc: mrst: stop validating rtc_time in .read_time
rtc: msm6242: stop validating rtc_time in .read_time
rtc: mt7622: stop validating rtc_time in .read_time
rtc: mv: stop validating rtc_time in .read_time
rtc: nuc900: stop validating rtc_time in .read_time
rtc: pcap: stop validating rtc_time in .read_time
rtc: pcf2123: stop validating rtc_time in .read_time
rtc: pcf2127: stop validating rtc_time in .read_time
rtc: pcf50633: stop validating rtc_time in .read_time
rtc: pcf8523: stop validating rtc_time in .read_time
rtc: pic32: stop validating rtc_time in .read_time
rtc: ps3: stop validating rtc_time in .read_time
rtc: r7301: stop validating rtc_time in .read_time
rtc: r9701: stop validating rtc_time in .read_time
rtc: rp5c01: stop validating rtc_time in .read_time
rtc: rx6110: stop validating rtc_time in .read_time
rtc: rx8010: stop validating rtc_time in .read_time
rtc: rx8025: stop validating rtc_time in .read_time
rtc: s3c: stop validating rtc_time in .read_time
rtc: s5m: stop validating rtc_time in .read_time
rtc: sc27xx: stop validating rtc_time in .read_time
rtc: sh: stop validating rtc_time in .read_time
rtc: starfire: stop validating rtc_time in .read_time
rtc: sun6i: stop validating rtc_time in .read_time
rtc: sunxi: stop validating rtc_time in .read_time
rtc: tps6586x: stop validating rtc_time in .read_time
rtc: tx4939: stop validating rtc_time in .read_time
rtc: wm831x: stop validating rtc_time in .read_time
rtc: xgene: stop validating rtc_time in .read_time
rtc: zynqmp: stop validating rtc_time in .read_time
rtc: isl12022: stop validating rtc_time in .read_time
rtc: isl12022: remove useless indirection
rtc: m41t80: stop validating rtc_time in .read_time
rtc: m41t93: stop validating rtc_time in .read_time
rtc: max77686: stop validating rtc_time in .read_time
rtc: omap: stop validating rtc_time in .set_time and .set_alarm
rtc: spear: stop validating rtc_time in .set_time and .set_alarm
rtc: tegra: stop validating rtc_time in .set_time
rtc: abx80x: remove useless message
rtc: pm8xxx: remove useless message
rtc: rx4581: remove useless message
rtc: rx8581: remove useless message
rtc: tile: remove useless message
rtc: rk808: remove useless debug message
rtc: rk808: fix possible race condition
rtc: s35390a: remove useless message
rtc: s35390a: stop validating rtc_time in .read_time
rtc: s35390a: remove useless indirection
rtc: rs5c372: remove useless message
rtc: rs5c372: stop validating rtc_time in .read_time
rtc: rs5c372: remove useless indirection
rtc: max6900: stop validating rtc_time in .read_time
rtc: max6900: remove useless indirection
rtc: pcf85063: stop validating rtc_time in .read_time
rtc: pcf85063: remove useless indirection
drivers/rtc/rtc-ab-b5ze-s3.c | 4 +--- drivers/rtc/rtc-ab3100.c | 2 +- drivers/rtc/rtc-ab8500.c | 2 +- drivers/rtc/rtc-abx80x.c | 6 +----- drivers/rtc/rtc-ac100.c | 2 +- drivers/rtc/rtc-au1xxx.c | 2 +- drivers/rtc/rtc-bq32k.c | 2 +- drivers/rtc/rtc-cmos.c | 12 ------------ drivers/rtc/rtc-coh901331.c | 2 +- drivers/rtc/rtc-cpcap.c | 2 +- drivers/rtc/rtc-da9052.c | 3 +-- drivers/rtc/rtc-da9055.c | 2 +- drivers/rtc/rtc-da9063.c | 2 +- drivers/rtc/rtc-ds1216.c | 2 +- drivers/rtc/rtc-ds1286.c | 2 +- drivers/rtc/rtc-ds1302.c | 3 +-- drivers/rtc/rtc-ds1305.c | 3 +-- drivers/rtc/rtc-ds1307.c | 3 +-- drivers/rtc/rtc-ds1343.c | 2 +- drivers/rtc/rtc-ds1347.c | 2 +- drivers/rtc/rtc-ds1390.c | 2 +- drivers/rtc/rtc-ds1511.c | 4 ---- drivers/rtc/rtc-ds1553.c | 4 ---- drivers/rtc/rtc-ds1685.c | 2 +- drivers/rtc/rtc-ds1742.c | 2 +- drivers/rtc/rtc-ds2404.c | 2 +- drivers/rtc/rtc-ds3232.c | 2 +- drivers/rtc/rtc-efi.c | 2 +- drivers/rtc/rtc-fm3130.c | 3 +-- drivers/rtc/rtc-isl12022.c | 18 +++++------------- drivers/rtc/rtc-jz4740.c | 2 +- drivers/rtc/rtc-lpc24xx.c | 2 +- drivers/rtc/rtc-lpc32xx.c | 2 +- drivers/rtc/rtc-ls1x.c | 2 +- drivers/rtc/rtc-m41t80.c | 2 +- drivers/rtc/rtc-m41t93.c | 2 +- drivers/rtc/rtc-m41t94.c | 3 +-- drivers/rtc/rtc-m48t35.c | 2 +- drivers/rtc/rtc-m48t59.c | 2 +- drivers/rtc/rtc-m48t86.c | 2 +- drivers/rtc/rtc-max6900.c | 19 +++++-------------- drivers/rtc/rtc-max6902.c | 2 +- drivers/rtc/rtc-max6916.c | 2 +- drivers/rtc/rtc-max77686.c | 4 +--- drivers/rtc/rtc-max8997.c | 2 +- drivers/rtc/rtc-max8998.c | 2 +- drivers/rtc/rtc-mc13xxx.c | 2 +- drivers/rtc/rtc-mcp795.c | 2 +- drivers/rtc/rtc-mpc5121.c | 2 +- drivers/rtc/rtc-mrst.c | 2 +- drivers/rtc/rtc-msm6242.c | 2 +- drivers/rtc/rtc-mt7622.c | 2 +- drivers/rtc/rtc-mv.c | 2 +- drivers/rtc/rtc-nuc900.c | 14 ++++++++------ drivers/rtc/rtc-omap.c | 3 --- drivers/rtc/rtc-pcap.c | 2 +- drivers/rtc/rtc-pcf2123.c | 2 +- drivers/rtc/rtc-pcf2127.c | 2 +- drivers/rtc/rtc-pcf50633.c | 2 +- drivers/rtc/rtc-pcf85063.c | 18 +++++------------- drivers/rtc/rtc-pcf8523.c | 2 +- drivers/rtc/rtc-pic32.c | 2 +- drivers/rtc/rtc-pm8xxx.c | 6 ------ drivers/rtc/rtc-ps3.c | 2 +- drivers/rtc/rtc-r7301.c | 2 +- drivers/rtc/rtc-r9701.c | 2 +- drivers/rtc/rtc-rk808.c | 25 +++++++------------------ drivers/rtc/rtc-rp5c01.c | 2 +- drivers/rtc/rtc-rs5c348.c | 5 ----- drivers/rtc/rtc-rs5c372.c | 24 +++++------------------- drivers/rtc/rtc-rx4581.c | 6 +----- drivers/rtc/rtc-rx6110.c | 2 +- drivers/rtc/rtc-rx8010.c | 2 +- drivers/rtc/rtc-rx8025.c | 2 +- drivers/rtc/rtc-rx8581.c | 6 +----- drivers/rtc/rtc-s35390a.c | 38 +++++++++----------------------------- drivers/rtc/rtc-s3c.c | 2 +- drivers/rtc/rtc-s5m.c | 2 +- drivers/rtc/rtc-sc27xx.c | 2 +- drivers/rtc/rtc-sh.c | 2 +- drivers/rtc/rtc-spear.c | 12 +++--------- drivers/rtc/rtc-starfire.c | 2 +- drivers/rtc/rtc-stk17ta8.c | 4 ---- drivers/rtc/rtc-sun6i.c | 2 +- drivers/rtc/rtc-sunxi.c | 2 +- drivers/rtc/rtc-tegra.c | 4 ---- drivers/rtc/rtc-tile.c | 3 --- drivers/rtc/rtc-tps6586x.c | 2 +- drivers/rtc/rtc-tx4939.c | 2 +- drivers/rtc/rtc-wm831x.c | 2 +- drivers/rtc/rtc-xgene.c | 2 +- drivers/rtc/rtc-zynqmp.c | 2 +- 92 files changed, 122 insertions(+), 263 deletions(-)
Signature · 1 line
2.16.1
Alexandre Belloni
maintainerPATCH 1/100 rtc: ds1511: let the core handle invalid time
Returning a valid time when the time is invalid is a bad practice, because then userspace is not able to react on the information. Also, it doesn't make sense to return epoch because it is already the default time.
--- drivers/rtc/rtc-ds1511.c | 4 ---- 1 file changed, 4 deletions(-)
drivers/rtc/rtc-ds1511.c +0 -4
@@ -277,10 +277,6 @@ static int ds1511_rtc_read_time(struct device *dev, struct rtc_time *rtc_tm) rtc_tm->tm_mon--; -if (rtc_valid_tm (rtc_tm) <0 ) { -dev_err (dev,"retrieved date/time is not valid.\n" ); -rtc_time_to_tm (0 , rtc_tm); - }return 0 ; }
Signature · 1 line
2.16.1
Alexandre Belloni
maintainerPATCH 2/100 rtc: ds1553: let the core handle invalid time
In reply to Alexandre BelloniReturning a valid time when the time is invalid is a bad practice, because then userspace is not able to react on the information. Also, it doesn't make sense to return epoch because it is already the default time.
--- drivers/rtc/rtc-ds1553.c | 4 ---- 1 file changed, 4 deletions(-)
drivers/rtc/rtc-ds1553.c +0 -4
@@ -127,10 +127,6 @@ static int ds1553_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 ; -if (rtc_valid_tm (tm) <0 ) { -dev_err (dev,"retrieved date/time is not valid.\n" ); -rtc_time_to_tm (0 , tm); - }return 0 ; }
Signature · 1 line
2.16.1
Alexandre Belloni
maintainerPATCH 3/100 rtc: cmos: let the core handle invalid time
In reply to Alexandre BelloniSetting the rtc to a valid time when the time is invalid is a bad practice, because then userspace doesn't know it shouldn't trust the RTC.
--- drivers/rtc/rtc-cmos.c | 12 ------------ 1 file changed, 12 deletions(-)
drivers/rtc/rtc-cmos.c +0 -12
@@ -1262,8 +1262,6 @@ MODULE_DEVICE_TABLE(of, of_cmos_match);static __init void cmos_of_init (struct platform_device *pdev) {struct device_node *node = pdev->dev.of_node; -struct rtc_time time; -int ret;const __be32 *val;if (!node)
@@ -1276,16 +1274,6 @@ static __init void cmos_of_init(struct platform_device *pdev) val =of_get_property (node,"freq-reg" ,NULL );if (val) CMOS_WRITE(be32_to_cpup(val), RTC_FREQ_SELECT); - -cmos_read_time (&pdev->dev, &time); - ret =rtc_valid_tm (&time); -if (ret) { -struct rtc_time def_time = { - .tm_year =1 , - .tm_mday =1 , - }; -cmos_set_time (&pdev->dev, &def_time); - } }#else static inline void cmos_of_init (struct platform_device *pdev) {}
Signature · 1 line
2.16.1
Alexandre Belloni
maintainerPATCH 4/100 rtc: rs5c348: let the core handle invalid time
In reply to Alexandre BelloniReturning a valid time when the time is invalid is a bad practice, because then userspace is not able to react on the information. Also, it doesn't make sense to return epoch because it is already the default time.
--- drivers/rtc/rtc-rs5c348.c | 5 ----- 1 file changed, 5 deletions(-)
drivers/rtc/rtc-rs5c348.c +0 -5
@@ -135,11 +135,6 @@ rs5c348_rtc_read_time(struct device *dev, struct rtc_time *tm) tm->tm_year =bcd2bin (rxbuf[RS5C348_REG_YEAR ]) + ((rxbuf[RS5C348_REG_MONTH ] &RS5C348_BIT_Y2K ) ?100 :0 ); -if (rtc_valid_tm (tm) <0 ) { -dev_err (&spi->dev,"retrieved date/time is not valid.\n" ); -rtc_time_to_tm (0 , tm); - } -return 0 ; }
Signature · 1 line
2.16.1
Alexandre Belloni
maintainerPATCH 5/100 rtc: stk17ta8: let the core handle invalid time
In reply to Alexandre BelloniReturning a valid time when the time is invalid is a bad practice, because then userspace is not able to react on the information. Also, it doesn't make sense to return epoch because it is already the default time.
--- drivers/rtc/rtc-stk17ta8.c | 4 ---- 1 file changed, 4 deletions(-)
drivers/rtc/rtc-stk17ta8.c +0 -4
@@ -129,10 +129,6 @@ static int stk17ta8_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 ; -if (rtc_valid_tm (tm) <0 ) { -dev_err (dev,"retrieved date/time is not valid.\n" ); -rtc_time_to_tm (0 , tm); - }return 0 ; }
Signature · 1 line
2.16.1
Alexandre Belloni
maintainerPATCH 6/100 rtc: ab-b5ze-s3: stop validating rtc_time in .read_time
In reply to Alexandre BelloniThe 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.
--- drivers/rtc/rtc-ab-b5ze-s3.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/rtc/rtc-ab-b5ze-s3.c +1 -3
@@ -217,7 +217,7 @@ static int _abb5zes3_rtc_read_time(struct device *dev, struct rtc_time *tm) {struct abb5zes3_rtc_data *data =dev_get_drvdata (dev);u8 regs[ABB5ZES3_REG_RTC_SC +ABB5ZES3_RTC_SEC_LEN ]; -int ret; +int ret =0 ;/* * As we need to read CTRL1 register anyway to access 24/12h
@@ -255,8 +255,6 @@ static int _abb5zes3_rtc_read_time(struct device *dev, struct rtc_time *tm) tm->tm_mon =bcd2bin (regs[ABB5ZES3_REG_RTC_MO ]) -1 ;/* starts at 1 */ tm->tm_year =bcd2bin (regs[ABB5ZES3_REG_RTC_YR ]) +100 ; - ret =rtc_valid_tm (tm); - err:return ret; }
Signature · 1 line
2.16.1
Alexandre Belloni
maintainerPATCH 7/100 rtc: ab3100: stop validating rtc_time in .read_time
In reply to Alexandre Bellonirtc_time64_to_tm never generates an invalid tm. It is not necessary to validate it. Also, the RTC core is always calling rtc_valid_tm after the read_time callback.
--- drivers/rtc/rtc-ab3100.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/rtc/rtc-ab3100.c +1 -1
@@ -106,7 +106,7 @@ static int ab3100_rtc_read_time(struct device *dev, struct rtc_time *tm)rtc_time64_to_tm (time, tm); -return rtc_valid_tm (tm); +return 0 ; }static int ab3100_rtc_read_alarm (struct device *dev,struct rtc_wkalrm *alarm)
Signature · 1 line
2.16.1
Alexandre Belloni
maintainerPATCH 8/100 rtc: ab8500: stop validating rtc_time in .read_time
In reply to Alexandre Bellonirtc_time_to_tm never generates an invalid tm. It is not necessary to validate it. Also, the RTC core is always calling rtc_valid_tm after the read_time callback.
--- drivers/rtc/rtc-ab8500.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/rtc/rtc-ab8500.c +1 -1
@@ -131,7 +131,7 @@ static int ab8500_rtc_read_time(struct device *dev, struct rtc_time *tm) secs +=get_elapsed_seconds (AB8500_RTC_EPOCH );rtc_time_to_tm (secs, tm); -return rtc_valid_tm (tm); +return 0 ; }static int ab8500_rtc_set_time (struct device *dev,struct rtc_time *tm)
Signature · 1 line
2.16.1
Alexandre Belloni
maintainerPATCH 9/100 rtc: ac100: stop validating rtc_time in .read_time
In reply to Alexandre BelloniThe 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.
--- drivers/rtc/rtc-ac100.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/rtc/rtc-ac100.c +1 -1
@@ -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)
Signature · 1 line
2.16.1
Alexandre Belloni
maintainerPATCH 10/100 rtc: au1xxx: stop validating rtc_time in .read_time
In reply to Alexandre Bellonirtc_time_to_tm never generates an invalid tm. It is not necessary to validate it. Also, the RTC core is always calling rtc_valid_tm after the read_time callback.
--- drivers/rtc/rtc-au1xxx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/rtc/rtc-au1xxx.c +1 -1
@@ -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)
Signature · 1 line
2.16.1
Alexandre Belloni
maintainerPATCH 11/100 rtc: bq32k: stop validating rtc_time in .read_time
In reply to Alexandre BelloniThe 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.
--- drivers/rtc/rtc-bq32k.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/rtc/rtc-bq32k.c +1 -1
@@ -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)
Signature · 1 line
2.16.1
Alexandre Belloni
maintainerPATCH 12/100 rtc: coh901331: stop validating rtc_time in .read_time
In reply to Alexandre Bellonirtc_time_to_tm never generates an invalid tm. It is not necessary to validate it. Also, the RTC core is always calling rtc_valid_tm after the read_time callback.
--- drivers/rtc/rtc-coh901331.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/rtc/rtc-coh901331.c +1 -1
@@ -82,7 +82,7 @@ static int coh901331_read_time(struct device *dev, struct rtc_time *tm)if (readl (rtap->virtbase +COH901331_VALID )) {rtc_time_to_tm (readl (rtap->virtbase +COH901331_CUR_TIME ), tm);clk_disable (rtap->clk); -return rtc_valid_tm (tm); +return 0 ; }clk_disable (rtap->clk);return -EINVAL ;
Signature · 1 line
2.16.1
Alexandre Belloni
maintainerPATCH 13/100 rtc: cpcap: stop validating rtc_time in .read_time
In reply to Alexandre BelloniThe 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.
--- drivers/rtc/rtc-cpcap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/rtc/rtc-cpcap.c +1 -1
@@ -119,7 +119,7 @@ static int cpcap_rtc_read_time(struct device *dev, struct rtc_time *tm)cpcap2rtc_time (tm, &cpcap_tm); -return rtc_valid_tm (tm); +return 0 ; }static int cpcap_rtc_set_time (struct device *dev,struct rtc_time *tm)
Signature · 1 line
2.16.1
Re: [PATCH 013/100] rtc: cpcap: stop validating rtc_time in .read_time
Hi,
Quoted 13 lines · Alexandre Belloni
The RTC core is always calling
rtc_valid_tmafter theread_timecallback. It is not necessary to call it just before returning from the callback.Signed-off-by Alexandre Belloni <[email protected]>--- drivers/rtc/rtc-cpcap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/rtc/rtc-cpcap.c +0
-0
drivers/rtc/rtc-cpcap.c static int cpcap_rtc_read_time(struct device *dev, struct rtc_time *tm) · line 125
Quoted 8 lines
drivers/rtc/rtc-cpcap.c +1
-1@@ -119,7 +119,7 @@ static int cpcap_rtc_read_time(struct device *dev, struct rtc_time *tm)cpcap2rtc_time (tm, &cpcap_tm); -return rtc_valid_tm (tm); +return 0 ; }static int cpcap_rtc_set_time (struct device *dev,struct rtc_time *tm)
-- Sebastian
Alexandre Belloni
maintainerPATCH 14/100 rtc: da9052: stop validating rtc_time in .read_time
In reply to Alexandre BelloniThe 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.
--- drivers/rtc/rtc-da9052.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/rtc/rtc-da9052.c +1 -2
@@ -187,8 +187,7 @@ static int da9052_rtc_read_time(struct device *dev, struct rtc_time *rtc_tm) rtc_tm->tm_min = v[0 ][1 ] &DA9052_RTC_MIN ; rtc_tm->tm_sec = v[0 ][0 ] &DA9052_RTC_SEC ; - ret =rtc_valid_tm (rtc_tm); -return ret; +return 0 ; } idx = (1 -idx);
Signature · 1 line
2.16.1
Alexandre Belloni
maintainerPATCH 15/100 rtc: da9055: stop validating rtc_time in .read_time
In reply to Alexandre BelloniThe 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.
--- drivers/rtc/rtc-da9055.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/rtc/rtc-da9055.c +1 -1
@@ -158,7 +158,7 @@ static int da9055_rtc_read_time(struct device *dev, struct rtc_time *rtc_tm) rtc_tm->tm_min = v[1 ] &DA9055_RTC_MIN ; rtc_tm->tm_sec = v[0 ] &DA9055_RTC_SEC ; -return rtc_valid_tm (rtc_tm); +return 0 ; }static int da9055_rtc_set_time (struct device *dev,struct rtc_time *tm)
Signature · 1 line
2.16.1
Alexandre Belloni
maintainerPATCH 16/100 rtc: da9063: stop validating rtc_time in .read_time
In reply to Alexandre BelloniThe 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.
--- drivers/rtc/rtc-da9063.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/rtc/rtc-da9063.c +1 -1
@@ -256,7 +256,7 @@ static int da9063_rtc_read_time(struct device *dev, struct rtc_time *tm)else rtc->rtc_sync = false; -return rtc_valid_tm (tm); +return 0 ; }static int da9063_rtc_set_time (struct device *dev,struct rtc_time *tm)
Signature · 1 line
2.16.1
Alexandre Belloni
maintainerPATCH 17/100 rtc: ds1216: stop validating rtc_time in .read_time
In reply to Alexandre BelloniThe 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.
--- drivers/rtc/rtc-ds1216.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/rtc/rtc-ds1216.c +1 -1
@@ -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)
Signature · 1 line
2.16.1
Alexandre Belloni
maintainerPATCH 18/100 rtc: ds1286: stop validating rtc_time in .read_time
In reply to Alexandre BelloniThe 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.
--- drivers/rtc/rtc-ds1286.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/rtc/rtc-ds1286.c +1 -1
@@ -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)
Signature · 1 line
2.16.1
Alexandre Belloni
maintainerPATCH 19/100 rtc: ds1302: stop validating rtc_time in .read_time
In reply to Alexandre BelloniThe 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.
--- drivers/rtc/rtc-ds1302.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/rtc/rtc-ds1302.c +1 -2
@@ -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 = {
Signature · 1 line
2.16.1
Alexandre Belloni
maintainerPATCH 20/100 rtc: ds1305: stop validating rtc_time in .read_time
In reply to Alexandre BelloniThe 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.
--- drivers/rtc/rtc-ds1305.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/rtc/rtc-ds1305.c +1 -2
@@ -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)
Signature · 1 line
2.16.1
Alexandre Belloni
maintainerPATCH 21/100 rtc: ds1307: stop validating rtc_time in .read_time
In reply to Alexandre BelloniThe 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.
--- drivers/rtc/rtc-ds1307.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/rtc/rtc-ds1307.c +1 -2
@@ -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)
Signature · 1 line
2.16.1
Alexandre Belloni
maintainerPATCH 22/100 rtc: ds1343: stop validating rtc_time in .read_time
In reply to Alexandre BelloniThe 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.
--- drivers/rtc/rtc-ds1343.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/rtc/rtc-ds1343.c +1 -1
@@ -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)
Signature · 1 line
2.16.1
Alexandre Belloni
maintainerPATCH 23/100 rtc: ds1347: stop validating rtc_time in .read_time
In reply to Alexandre BelloniThe 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.
--- drivers/rtc/rtc-ds1347.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/rtc/rtc-ds1347.c +1 -1
@@ -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)
Signature · 1 line
2.16.1
Alexandre Belloni
maintainerPATCH 24/100 rtc: ds1390: stop validating rtc_time in .read_time
In reply to Alexandre BelloniThe 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.
--- drivers/rtc/rtc-ds1390.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/rtc/rtc-ds1390.c +1 -1
@@ -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)
Signature · 1 line
2.16.1
Alexandre Belloni
maintainerPATCH 25/100 rtc: ds1685: stop validating rtc_time in .read_time
In reply to Alexandre BelloniThe 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.
--- drivers/rtc/rtc-ds1685.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/rtc/rtc-ds1685.c +1 -1
@@ -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 ; }/**
Signature · 1 line
2.16.1
Alexandre Belloni
maintainerPATCH 26/100 rtc: ds1742: stop validating rtc_time in .read_time
In reply to Alexandre BelloniThe 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.
--- drivers/rtc/rtc-ds1742.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/rtc/rtc-ds1742.c +1 -1
@@ -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 = {
Signature · 1 line
2.16.1
Alexandre Belloni
maintainerPATCH 27/100 rtc: ds2404: stop validating rtc_time in .read_time
In reply to Alexandre BelloniThe 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.
--- drivers/rtc/rtc-ds2404.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/rtc/rtc-ds2404.c +1 -1
@@ -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)
Signature · 1 line
2.16.1
Alexandre Belloni
maintainerPATCH 28/100 rtc: ds3232: stop validating rtc_time in .read_time
In reply to Alexandre BelloniThe 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.
--- drivers/rtc/rtc-ds3232.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/rtc/rtc-ds3232.c +1 -1
@@ -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)
Signature · 1 line
2.16.1
Alexandre Belloni
maintainerPATCH 29/100 rtc: efi: stop validating rtc_time in .read_time
In reply to Alexandre BelloniThe 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.
--- drivers/rtc/rtc-efi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/rtc/rtc-efi.c +1 -1
@@ -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)
Signature · 1 line
2.16.1
Alexandre Belloni
maintainerPATCH 30/100 rtc: fm3130: stop validating rtc_time in .read_time
In reply to Alexandre BelloniThe 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.
--- drivers/rtc/rtc-fm3130.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/rtc/rtc-fm3130.c +1 -2
@@ -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 ; }
Signature · 1 line
2.16.1
Alexandre Belloni
maintainerPATCH 31/100 rtc: jz4740: stop validating rtc_time in .read_time
In reply to Alexandre Bellonirtc_time_to_tm never generates an invalid tm. It is not necessary to validate it. Also, the RTC core is always calling rtc_valid_tm after the read_time callback.
--- drivers/rtc/rtc-jz4740.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/rtc/rtc-jz4740.c +1 -1
@@ -173,7 +173,7 @@ static int jz4740_rtc_read_time(struct device *dev, struct rtc_time *time)rtc_time_to_tm (secs, time); -return rtc_valid_tm (time); +return 0 ; }static int jz4740_rtc_set_mmss (struct device *dev,unsigned long secs)
Signature · 1 line
2.16.1
Alexandre Belloni
maintainerPATCH 32/100 rtc: lpc24xx: stop validating rtc_time in .read_time
In reply to Alexandre BelloniThe 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.
--- drivers/rtc/rtc-lpc24xx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/rtc/rtc-lpc24xx.c +1 -1
@@ -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)
Signature · 1 line
2.16.1
Alexandre Belloni
maintainerPATCH 33/100 rtc: lpc32xx: stop validating rtc_time in .read_time
In reply to Alexandre Bellonirtc_time_to_tm never generates an invalid tm. It is not necessary to validate it. Also, the RTC core is always calling rtc_valid_tm after the read_time callback.
--- drivers/rtc/rtc-lpc32xx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/rtc/rtc-lpc32xx.c +1 -1
@@ -70,7 +70,7 @@ static int lpc32xx_rtc_read_time(struct device *dev, struct rtc_time *time) elapsed_sec =rtc_readl (rtc,LPC32XX_RTC_UCOUNT );rtc_time_to_tm (elapsed_sec, time); -return rtc_valid_tm (time); +return 0 ; }static int lpc32xx_rtc_set_mmss (struct device *dev,unsigned long secs)
Signature · 1 line
2.16.1
Alexandre Belloni
maintainerPATCH 34/100 rtc: ls1x: stop validating rtc_time in .read_time
In reply to Alexandre Bellonirtc_time_to_tm never generates an invalid tm. It is not necessary to validate it. Also, the RTC core is always calling rtc_valid_tm after the read_time callback.
--- drivers/rtc/rtc-ls1x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/rtc/rtc-ls1x.c +1 -1
@@ -98,7 +98,7 @@ static int ls1x_rtc_read_time(struct device *dev, struct rtc_time *rtm) ls1x_get_min(v), ls1x_get_sec(v));rtc_time_to_tm (t, rtm); -return rtc_valid_tm (rtm); +return 0 ; }static int ls1x_rtc_set_time (struct device *dev,struct rtc_time *rtm)
Signature · 1 line
2.16.1
Alexandre Belloni
maintainerPATCH 35/100 rtc: m41t94: stop validating rtc_time in .read_time
In reply to Alexandre BelloniThe 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.
--- drivers/rtc/rtc-m41t94.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/rtc/rtc-m41t94.c +1 -2
@@ -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 = {
Signature · 1 line
2.16.1
Alexandre Belloni
maintainerPATCH 36/100 rtc: m48t35: stop validating rtc_time in .read_time
In reply to Alexandre BelloniThe 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.
--- drivers/rtc/rtc-m48t35.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/rtc/rtc-m48t35.c +1 -1
@@ -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)
Signature · 1 line
2.16.1
Alexandre Belloni
maintainerPATCH 37/100 rtc: m48t59: stop validating rtc_time in .read_time
In reply to Alexandre BelloniThe 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.
--- drivers/rtc/rtc-m48t59.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/rtc/rtc-m48t59.c +1 -1
@@ -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)
Signature · 1 line
2.16.1
Alexandre Belloni
maintainerPATCH 38/100 rtc: m48t86: stop validating rtc_time in .read_time
In reply to Alexandre BelloniThe 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.
--- drivers/rtc/rtc-m48t86.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/rtc/rtc-m48t86.c +1 -1
@@ -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)
Signature · 1 line
2.16.1
Alexandre Belloni
maintainerPATCH 39/100 rtc: max6902: stop validating rtc_time in .read_time
In reply to Alexandre BelloniThe 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.
--- drivers/rtc/rtc-max6902.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/rtc/rtc-max6902.c +1 -1
@@ -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)
Signature · 1 line
2.16.1
Alexandre Belloni
maintainerPATCH 40/100 rtc: max6916: stop validating rtc_time in .read_time
In reply to Alexandre BelloniThe 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.
--- drivers/rtc/rtc-max6916.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/rtc/rtc-max6916.c +1 -1
@@ -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)
Signature · 1 line
2.16.1
Alexandre Belloni
maintainerPATCH 41/100 rtc: max8997: stop validating rtc_time in .read_time
In reply to Alexandre BelloniThe 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.
--- drivers/rtc/rtc-max8997.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/rtc/rtc-max8997.c +1 -1
@@ -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)
Signature · 1 line
2.16.1
Alexandre Belloni
maintainerPATCH 42/100 rtc: max8998: stop validating rtc_time in .read_time
In reply to Alexandre BelloniThe 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.
--- drivers/rtc/rtc-max8998.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/rtc/rtc-max8998.c +1 -1
@@ -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)
Signature · 1 line
2.16.1
Alexandre Belloni
maintainerPATCH 43/100 rtc: mc13xxx: stop validating rtc_time in .read_time
In reply to Alexandre Bellonirtc_time64_to_tm never generates an invalid tm. It is not necessary to validate it. Also, the RTC core is always calling rtc_valid_tm after the read_time callback.
--- drivers/rtc/rtc-mc13xxx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/rtc/rtc-mc13xxx.c +1 -1
@@ -85,7 +85,7 @@ static int mc13xxx_rtc_read_time(struct device *dev, struct rtc_time *tm)rtc_time64_to_tm ((time64_t )days1 *SEC_PER_DAY + seconds, tm); -return rtc_valid_tm (tm); +return 0 ; }static int mc13xxx_rtc_set_mmss (struct device *dev,time64_t secs)
Signature · 1 line
2.16.1
Alexandre Belloni
maintainerPATCH 44/100 rtc: mcp795: stop validating rtc_time in .read_time
In reply to Alexandre BelloniThe 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.
--- drivers/rtc/rtc-mcp795.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/rtc/rtc-mcp795.c +1 -1
@@ -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)
Signature · 1 line
2.16.1
Alexandre Belloni
maintainerPATCH 45/100 rtc: mpc5121: stop validating rtc_time in .read_time
In reply to Alexandre Bellonirtc_time_to_tm never generates an invalid tm. It is not necessary to validate it. Also, the RTC core is always calling rtc_valid_tm after the read_time callback.
--- drivers/rtc/rtc-mpc5121.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/rtc/rtc-mpc5121.c +1 -1
@@ -122,7 +122,7 @@ static int mpc5121_rtc_read_time(struct device *dev, struct rtc_time *tm)*/ mpc5121_rtc_update_smh (regs, tm); -return rtc_valid_tm (tm); +return 0 ; }static int mpc5121_rtc_set_time (struct device *dev,struct rtc_time *tm)
Signature · 1 line
2.16.1
Alexandre Belloni
maintainerPATCH 46/100 rtc: mrst: stop validating rtc_time in .read_time
In reply to Alexandre BelloniThe 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.
--- drivers/rtc/rtc-mrst.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/rtc/rtc-mrst.c +1 -1
@@ -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)
Signature · 1 line
2.16.1
Alexandre Belloni
maintainerPATCH 47/100 rtc: msm6242: stop validating rtc_time in .read_time
In reply to Alexandre BelloniThe 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.
--- drivers/rtc/rtc-msm6242.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/rtc/rtc-msm6242.c +1 -1
@@ -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)
Signature · 1 line
2.16.1
Alexandre Belloni
maintainerPATCH 48/100 rtc: mt7622: stop validating rtc_time in .read_time
In reply to Alexandre BelloniThe 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.
--- drivers/rtc/rtc-mt7622.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/rtc/rtc-mt7622.c +1 -1
@@ -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)
Signature · 1 line
2.16.1
Alexandre Belloni
maintainerPATCH 49/100 rtc: mv: stop validating rtc_time in .read_time
In reply to Alexandre BelloniThe 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.
--- drivers/rtc/rtc-mv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/rtc/rtc-mv.c +1 -1
@@ -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)
Signature · 1 line
2.16.1
Alexandre Belloni
maintainerPATCH 50/100 rtc: nuc900: stop validating rtc_time in .read_time
In reply to Alexandre BelloniThe RTC core is always calling rtc_valid_tm after the read_time callback. It is not necessary to call it before returning from the callback.
--- drivers/rtc/rtc-nuc900.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
drivers/rtc/rtc-nuc900.c +8 -6
@@ -102,8 +102,8 @@ static int *check_rtc_access_enable(struct nuc900_rtc *nuc900_rtc)return NULL ; } -static int nuc900_rtc_bcd2bin (unsigned int timereg, -unsigned int calreg,struct rtc_time *tm) +static void nuc900_rtc_bcd2bin (unsigned int timereg, +unsigned int calreg,struct rtc_time *tm) { tm->tm_mday =bcd2bin (calreg >>0 ); tm->tm_mon =bcd2bin (calreg >>8 );
@@ -112,8 +112,6 @@ static int nuc900_rtc_bcd2bin(unsigned int timereg, tm->tm_sec =bcd2bin (timereg >>0 ); tm->tm_min =bcd2bin (timereg >>8 ); tm->tm_hour =bcd2bin (timereg >>16 ); - -return rtc_valid_tm (tm); } static void nuc900_rtc_bin2bcd(struct device *dev, struct rtc_time *settm,
@@ -156,7 +154,9 @@ static int nuc900_rtc_read_time(struct device *dev, struct rtc_time *tm) timeval =__raw_readl (rtc->rtc_reg +REG_RTC_TLR ); clrval =__raw_readl (rtc->rtc_reg +REG_RTC_CLR ); -return nuc900_rtc_bcd2bin (timeval, clrval, tm); +nuc900_rtc_bcd2bin (timeval, clrval, tm); + +return 0 ; }static int nuc900_rtc_set_time (struct device *dev,struct rtc_time *tm)
@@ -189,7 +189,9 @@ static int nuc900_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm) timeval =__raw_readl (rtc->rtc_reg +REG_RTC_TAR ); carval =__raw_readl (rtc->rtc_reg +REG_RTC_CAR ); -return nuc900_rtc_bcd2bin (timeval, carval, &alrm->time); +nuc900_rtc_bcd2bin (timeval, carval, &alrm->time); + +return rtc_valid_tm (&alrm->time); }static int nuc900_rtc_set_alarm (struct device *dev,struct rtc_wkalrm *alrm)
Signature · 1 line
2.16.1
Alexandre Belloni
maintainerPATCH 51/100 rtc: pcap: stop validating rtc_time in .read_time
In reply to Alexandre Bellonirtc_time64_to_tm never generates an invalid tm. It is not necessary to validate it. Also, the RTC core is always calling rtc_valid_tm after the read_time callback.
--- drivers/rtc/rtc-pcap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/rtc/rtc-pcap.c +1 -1
@@ -95,7 +95,7 @@ static int pcap_rtc_read_time(struct device *dev, struct rtc_time *tm)rtc_time_to_tm (secs, tm); -return rtc_valid_tm (tm); +return 0 ; }static int pcap_rtc_set_mmss (struct device *dev,unsigned long secs)
Signature · 1 line
2.16.1
Alexandre Belloni
maintainerPATCH 52/100 rtc: pcf2123: stop validating rtc_time in .read_time
In reply to Alexandre BelloniThe 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.
--- drivers/rtc/rtc-pcf2123.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/rtc/rtc-pcf2123.c +1 -1
@@ -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)
Signature · 1 line
2.16.1
Alexandre Belloni
maintainerPATCH 53/100 rtc: pcf2127: stop validating rtc_time in .read_time
In reply to Alexandre BelloniThe 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.
--- drivers/rtc/rtc-pcf2127.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/rtc/rtc-pcf2127.c +1 -1
@@ -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)
Signature · 1 line
2.16.1
Alexandre Belloni
maintainerPATCH 54/100 rtc: pcf50633: stop validating rtc_time in .read_time
In reply to Alexandre BelloniThe 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.
--- drivers/rtc/rtc-pcf50633.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/rtc/rtc-pcf50633.c +1 -1
@@ -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)
Signature · 1 line
2.16.1
Alexandre Belloni
maintainerPATCH 55/100 rtc: pcf8523: stop validating rtc_time in .read_time
In reply to Alexandre BelloniThe 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.
--- drivers/rtc/rtc-pcf8523.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/rtc/rtc-pcf8523.c +1 -1
@@ -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)
Signature · 1 line
2.16.1
Alexandre Belloni
maintainerPATCH 56/100 rtc: pic32: stop validating rtc_time in .read_time
In reply to Alexandre BelloniThe 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.
--- drivers/rtc/rtc-pic32.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/rtc/rtc-pic32.c +1 -1
@@ -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)
Signature · 1 line
2.16.1
Alexandre Belloni
maintainerPATCH 57/100 rtc: ps3: stop validating rtc_time in .read_time
In reply to Alexandre Bellonirtc_time_to_tm never generates an invalid tm. It is not necessary to validate it. Also, the RTC core is always calling rtc_valid_tm after the read_time callback.
--- drivers/rtc/rtc-ps3.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/rtc/rtc-ps3.c +1 -1
@@ -41,7 +41,7 @@ static u64 read_rtc(void)static int ps3_get_time (struct device *dev,struct rtc_time *tm) {rtc_time_to_tm (read_rtc () +ps3_os_area_get_rtc_diff (), tm); -return rtc_valid_tm (tm); +return 0 ; }static int ps3_set_time (struct device *dev,struct rtc_time *tm)
Signature · 1 line
2.16.1
Alexandre Belloni
maintainerPATCH 58/100 rtc: r7301: stop validating rtc_time in .read_time
In reply to Alexandre BelloniThe 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.
--- drivers/rtc/rtc-r7301.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/rtc/rtc-r7301.c +1 -1
@@ -224,7 +224,7 @@ static int rtc7301_read_time(struct device *dev, struct rtc_time *tm)spin_unlock_irqrestore (&priv->lock, flags); -return err ? err :rtc_valid_tm (tm); +return err; }static int rtc7301_set_time (struct device *dev,struct rtc_time *tm)
Signature · 1 line
2.16.1
Alexandre Belloni
maintainerPATCH 59/100 rtc: r9701: stop validating rtc_time in .read_time
In reply to Alexandre BelloniThe 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.
--- drivers/rtc/rtc-r9701.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/rtc/rtc-r9701.c +1 -1
@@ -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)
Signature · 1 line
2.16.1
Alexandre Belloni
maintainerPATCH 60/100 rtc: rp5c01: stop validating rtc_time in .read_time
In reply to Alexandre BelloniThe 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.
--- drivers/rtc/rtc-rp5c01.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/rtc/rtc-rp5c01.c +1 -1
@@ -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)
Signature · 1 line
2.16.1
Alexandre Belloni
maintainerPATCH 61/100 rtc: rx6110: stop validating rtc_time in .read_time
In reply to Alexandre BelloniThe 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.
--- drivers/rtc/rtc-rx6110.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/rtc/rtc-rx6110.c +1 -1
@@ -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[] = {
Signature · 1 line
2.16.1
Alexandre Belloni
maintainerPATCH 62/100 rtc: rx8010: stop validating rtc_time in .read_time
In reply to Alexandre BelloniThe 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.
--- drivers/rtc/rtc-rx8010.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/rtc/rtc-rx8010.c +1 -1
@@ -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)
Signature · 1 line
2.16.1
Alexandre Belloni
maintainerPATCH 63/100 rtc: rx8025: stop validating rtc_time in .read_time
In reply to Alexandre BelloniThe 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.
--- drivers/rtc/rtc-rx8025.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/rtc/rtc-rx8025.c +1 -1
@@ -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)
Signature · 1 line
2.16.1
Alexandre Belloni
maintainerPATCH 64/100 rtc: s3c: stop validating rtc_time in .read_time
In reply to Alexandre BelloniThe 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.
--- drivers/rtc/rtc-s3c.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/rtc/rtc-s3c.c +1 -1
@@ -232,7 +232,7 @@ static int s3c_rtc_gettime(struct device *dev, struct rtc_time *rtc_tm) 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)
Signature · 1 line
2.16.1
Alexandre Belloni
maintainerPATCH 65/100 rtc: s5m: stop validating rtc_time in .read_time
In reply to Alexandre BelloniThe 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.
--- drivers/rtc/rtc-s5m.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/rtc/rtc-s5m.c +1 -1
@@ -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)
Signature · 1 line
2.16.1
Alexandre Belloni
maintainerPATCH 66/100 rtc: sc27xx: stop validating rtc_time in .read_time
In reply to Alexandre Bellonirtc_time64_to_tm never generates an invalid tm. It is not necessary to validate it. Also, the RTC core is always calling rtc_valid_tm after the read_time callback.
--- drivers/rtc/rtc-sc27xx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/rtc/rtc-sc27xx.c +1 -1
@@ -376,7 +376,7 @@ static int sprd_rtc_read_time(struct device *dev, struct rtc_time *tm)return ret;rtc_time64_to_tm (secs, tm); -return rtc_valid_tm (tm); +return 0 ; }static int sprd_rtc_set_time (struct device *dev,struct rtc_time *tm)
Signature · 1 line
2.16.1
Re: [PATCH 066/100] rtc: sc27xx: stop validating rtc_time in .read_time
Hi Alexandre,
Quoted 5 lines · Alexandre Belloni
rtc_time64_to_tmnever generates an invalid tm. It is not necessary to validate it. Also, the RTC core is always callingrtc_valid_tmafter theread_timecallback.Signed-off-by Alexandre Belloni <[email protected]>
Thanks for fixing this, and please add my tag if it helps.
Quoted 20 lines
--- drivers/rtc/rtc-sc27xx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/rtc/rtc-sc27xx.c +1
-2@@ -376,7 +376,7 @@ static int sprd_rtc_read_time(struct device *dev, struct rtc_time *tm)return ret;rtc_time64_to_tm (secs, tm); -return rtc_valid_tm (tm); +return 0 ; }static int sprd_rtc_set_time (struct device *dev,struct rtc_time *tm) --2.16.1
Signature · 2 lines
Baolin.wang Best Regards
Alexandre Belloni
maintainerPATCH 67/100 rtc: sh: stop validating rtc_time in .read_time
In reply to Alexandre BelloniThe 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.
--- drivers/rtc/rtc-sh.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/rtc/rtc-sh.c +1 -1
@@ -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)
Signature · 1 line
2.16.1
Alexandre Belloni
maintainerPATCH 68/100 rtc: starfire: stop validating rtc_time in .read_time
In reply to Alexandre Bellonirtc_time_to_tm never generates an invalid tm. It is not necessary to validate it. Also, the RTC core is always calling rtc_valid_tm after the read_time callback.
--- drivers/rtc/rtc-starfire.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/rtc/rtc-starfire.c +1 -1
@@ -28,7 +28,7 @@ static u32 starfire_get_time(void)static int starfire_read_time (struct device *dev,struct rtc_time *tm) {rtc_time_to_tm (starfire_get_time (), tm); -return rtc_valid_tm (tm); +return 0 ; }static const struct rtc_class_ops starfire_rtc_ops = {
Signature · 1 line
2.16.1
Alexandre Belloni
maintainerPATCH 69/100 rtc: sun6i: stop validating rtc_time in .read_time
In reply to Alexandre BelloniThe 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.
--- drivers/rtc/rtc-sun6i.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/rtc/rtc-sun6i.c +1 -1
@@ -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)
Signature · 1 line
2.16.1
Alexandre Belloni
maintainerPATCH 70/100 rtc: sunxi: stop validating rtc_time in .read_time
In reply to Alexandre BelloniThe 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.
--- drivers/rtc/rtc-sunxi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/rtc/rtc-sunxi.c +1 -1
@@ -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)
Signature · 1 line
2.16.1
Alexandre Belloni
maintainerPATCH 71/100 rtc: tps6586x: stop validating rtc_time in .read_time
In reply to Alexandre Bellonirtc_time_to_tm never generates an invalid tm. It is not necessary to validate it. Also, the RTC core is always calling rtc_valid_tm after the read_time callback.
--- drivers/rtc/rtc-tps6586x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/rtc/rtc-tps6586x.c +1 -1
@@ -90,7 +90,7 @@ static int tps6586x_rtc_read_time(struct device *dev, struct rtc_time *tm) seconds = ticks >>10 ; seconds += rtc->epoch_start;rtc_time_to_tm (seconds, tm); -return rtc_valid_tm (tm); +return 0 ; }static int tps6586x_rtc_set_time (struct device *dev,struct rtc_time *tm)
Signature · 1 line
2.16.1
Alexandre Belloni
maintainerPATCH 72/100 rtc: tx4939: stop validating rtc_time in .read_time
In reply to Alexandre Bellonirtc_time_to_tm never generates an invalid tm. It is not necessary to validate it. Also, the RTC core is always calling rtc_valid_tm after the read_time callback.
--- drivers/rtc/rtc-tx4939.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/rtc/rtc-tx4939.c +1 -1
@@ -112,7 +112,7 @@ static int tx4939_rtc_read_time(struct device *dev, struct rtc_time *tm) sec = ((unsigned long )buf[5 ] <<24 ) | (buf[4 ] <<16 ) | (buf[3 ] <<8 ) | buf[2 ];rtc_time_to_tm (sec, tm); -return rtc_valid_tm (tm); +return 0 ; }static int tx4939_rtc_set_alarm (struct device *dev,struct rtc_wkalrm *alrm)
Signature · 1 line
2.16.1
Alexandre Belloni
maintainerPATCH 73/100 rtc: wm831x: stop validating rtc_time in .read_time
In reply to Alexandre Bellonirtc_time_to_tm never generates an invalid tm. It is not necessary to validate it. Also, the RTC core is always calling rtc_valid_tm after the read_time callback.
--- drivers/rtc/rtc-wm831x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/rtc/rtc-wm831x.c +1 -1
@@ -156,7 +156,7 @@ static int wm831x_rtc_readtime(struct device *dev, struct rtc_time *tm)u32 time = (time1[0 ] <<16 ) | time1[1 ];rtc_time_to_tm (time, tm); -return rtc_valid_tm (tm); +return 0 ; } }while (++count <WM831X_GET_TIME_RETRIES );
Signature · 1 line
2.16.1
Alexandre Belloni
maintainerPATCH 74/100 rtc: xgene: stop validating rtc_time in .read_time
In reply to Alexandre Bellonirtc_time_to_tm never generates an invalid tm. It is not necessary to validate it. Also, the RTC core is always calling rtc_valid_tm after the read_time callback.
--- drivers/rtc/rtc-xgene.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/rtc/rtc-xgene.c +1 -1
@@ -60,7 +60,7 @@ static int xgene_rtc_read_time(struct device *dev, struct rtc_time *tm)struct xgene_rtc_dev *pdata =dev_get_drvdata (dev);rtc_time_to_tm (readl (pdata->csr_base +RTC_CCVR ), tm); -return rtc_valid_tm (tm); +return 0 ; }static int xgene_rtc_set_mmss (struct device *dev,unsigned long secs)
Signature · 1 line
2.16.1
Alexandre Belloni
maintainerPATCH 75/100 rtc: zynqmp: stop validating rtc_time in .read_time
In reply to Alexandre Bellonirtc_time64_to_tm never generates an invalid tm. It is not necessary to validate it. Also, the RTC core is always calling rtc_valid_tm after the read_time callback.
--- drivers/rtc/rtc-zynqmp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/rtc/rtc-zynqmp.c +1 -1
@@ -122,7 +122,7 @@ static int xlnx_rtc_read_time(struct device *dev, struct rtc_time *tm)rtc_time64_to_tm (read_time, tm); } -return rtc_valid_tm (tm); +return 0 ; }static int xlnx_rtc_read_alarm (struct device *dev,struct rtc_wkalrm *alrm)
Signature · 1 line
2.16.1
Alexandre Belloni
maintainerPATCH 76/100 rtc: isl12022: stop validating rtc_time in .read_time
In reply to Alexandre BelloniThe 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.
--- drivers/rtc/rtc-isl12022.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/rtc/rtc-isl12022.c +1 -1
@@ -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)
Signature · 1 line
2.16.1
Alexandre Belloni
maintainerPATCH 77/100 rtc: isl12022: remove useless indirection
In reply to Alexandre Belloniisl12022_get_datetime and isl12022_set_datetime are only used after casting dev to an i2c_client. Remove that useless indirection.
--- drivers/rtc/rtc-isl12022.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-)
drivers/rtc/rtc-isl12022.c +4 -12
@@ -104,8 +104,9 @@ static int isl12022_write_reg(struct i2c_client *client,* In the routines that deal directly with the isl12022 hardware, we use * rtc_time -- month 0-11, hour 0-23, yr = calendar year-epoch. */ -static int isl12022_get_datetime (struct i2c_client *client,struct rtc_time *tm) +static int isl12022_rtc_read_time (struct device *dev,struct rtc_time *tm) { +struct i2c_client *client =to_i2c_client (dev);uint8_t buf[ISL12022_REG_INT +1 ];int ret;
@@ -152,8 +153,9 @@ static int isl12022_get_datetime(struct i2c_client *client, struct rtc_time *tm)return 0 ; } -static int isl12022_set_datetime (struct i2c_client *client,struct rtc_time *tm) +static int isl12022_rtc_set_time (struct device *dev,struct rtc_time *tm) { +struct i2c_client *client =to_i2c_client (dev);struct isl12022 *isl12022 =i2c_get_clientdata (client);size_t i;int ret;
@@ -228,16 +230,6 @@ static int isl12022_set_datetime(struct i2c_client *client, struct rtc_time *tm)return 0 ; } -static int isl12022_rtc_read_time (struct device *dev,struct rtc_time *tm) -{ -return isl12022_get_datetime (to_i2c_client (dev), tm); -} - -static int isl12022_rtc_set_time (struct device *dev,struct rtc_time *tm) -{ -return isl12022_set_datetime (to_i2c_client (dev), tm); -} -static const struct rtc_class_ops isl12022_rtc_ops = { .read_time = isl12022_rtc_read_time, .set_time = isl12022_rtc_set_time,
Signature · 1 line
2.16.1
Alexandre Belloni
maintainerPATCH 78/100 rtc: m41t80: stop validating rtc_time in .read_time
In reply to Alexandre BelloniThe 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.
--- drivers/rtc/rtc-m41t80.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/rtc/rtc-m41t80.c +1 -1
@@ -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. */
Signature · 1 line
2.16.1
Alexandre Belloni
maintainerPATCH 79/100 rtc: m41t93: stop validating rtc_time in .read_time
In reply to Alexandre BelloniThe 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.
--- drivers/rtc/rtc-m41t93.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/rtc/rtc-m41t93.c +1 -1
@@ -159,7 +159,7 @@ static int m41t93_get_time(struct device *dev, struct rtc_time *tm) tm->tm_hour, tm->tm_mday, tm->tm_mon, tm->tm_year, tm->tm_wday); -return ret <0 ? ret :rtc_valid_tm (tm); +return ret; }
Signature · 1 line
2.16.1
Alexandre Belloni
maintainerPATCH 80/100 rtc: max77686: stop validating rtc_time in .read_time
In reply to Alexandre BelloniThe 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.
--- drivers/rtc/rtc-max77686.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/rtc/rtc-max77686.c +1 -3
@@ -364,11 +364,9 @@ static int max77686_rtc_read_time(struct device *dev, struct rtc_time *tm)max77686_rtc_data_to_tm (data, tm, info); - ret =rtc_valid_tm (tm); - out:mutex_unlock (&info->lock); -return ret; +return 0 ; }static int max77686_rtc_set_time (struct device *dev,struct rtc_time *tm)
Signature · 1 line
2.16.1
Alexandre Belloni
maintainerPATCH 81/100 rtc: omap: stop validating rtc_time in .set_time and .set_alarm
In reply to Alexandre BelloniThe RTC core is always validating the rtc_time struct before calling .set_time or .set_alarm. It is not necessary to do it again. Also, rtc_time_to_tm never generates an invalid rtc_tm (it can be out of range though).
--- drivers/rtc/rtc-omap.c | 3 --- 1 file changed, 3 deletions(-)
drivers/rtc/rtc-omap.c +0 -3
@@ -273,9 +273,6 @@ static int omap_rtc_alarm_irq_enable(struct device *dev, unsigned int enabled)/* this hardware doesn't support "don't care" alarm fields */ static int tm2bcd (struct rtc_time *tm) { -if (rtc_valid_tm (tm) !=0 ) -return -EINVAL ; - tm->tm_sec =bin2bcd (tm->tm_sec); tm->tm_min =bin2bcd (tm->tm_min); tm->tm_hour =bin2bcd (tm->tm_hour);
Signature · 1 line
2.16.1
Alexandre Belloni
maintainerPATCH 82/100 rtc: spear: stop validating rtc_time in .set_time and .set_alarm
In reply to Alexandre BelloniThe RTC core is always validating the rtc_time struct before calling .set_time or .set_alarm. It is not necessary to do it again.
--- drivers/rtc/rtc-spear.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-)
drivers/rtc/rtc-spear.c +3 -9
@@ -170,18 +170,14 @@ static irqreturn_t spear_rtc_irq(int irq, void *dev_id) } -static int tm2bcd (struct rtc_time *tm) +static void tm2bcd (struct rtc_time *tm) { -if (rtc_valid_tm (tm) !=0 ) -return -EINVAL ; tm->tm_sec =bin2bcd (tm->tm_sec); tm->tm_min =bin2bcd (tm->tm_min); tm->tm_hour =bin2bcd (tm->tm_hour); tm->tm_mday =bin2bcd (tm->tm_mday); tm->tm_mon =bin2bcd (tm->tm_mon +1 ); tm->tm_year =bin2bcd (tm->tm_year); - -return 0 ; }static void bcd2tm (struct rtc_time *tm)
@@ -237,8 +233,7 @@ static int spear_rtc_set_time(struct device *dev, struct rtc_time *tm)struct spear_rtc_config *config =dev_get_drvdata (dev);unsigned int time, date; -if (tm2bcd (tm) <0 ) -return -EINVAL ; +tm2bcd (tm);rtc_wait_not_busy (config); time = (tm->tm_sec << SECOND_SHIFT) | (tm->tm_min << MINUTE_SHIFT) |
@@ -295,8 +290,7 @@ static int spear_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alm)unsigned int time, date;int err; -if (tm2bcd (&alm->time) <0 ) -return -EINVAL ; +tm2bcd (&alm->time);rtc_wait_not_busy (config);
Signature · 1 line
2.16.1
Alexandre Belloni
maintainerPATCH 83/100 rtc: tegra: stop validating rtc_time in .set_time
In reply to Alexandre BelloniThe RTC core is always validating the rtc_time struct before calling .set_time. It is not necessary to do it again in .set_time.
--- drivers/rtc/rtc-tegra.c | 4 ---- 1 file changed, 4 deletions(-)
drivers/rtc/rtc-tegra.c +0 -4
@@ -144,10 +144,6 @@ static int tegra_rtc_set_time(struct device *dev, struct rtc_time *tm)int ret;/* convert tm to seconds. */ - ret =rtc_valid_tm (tm); -if (ret) -return ret; -rtc_tm_to_time (tm, &sec); dev_vdbg(dev, "time set to %lu. %d/%d/%d %d:%02u:%02u\n",
Signature · 1 line
2.16.1
Alexandre Belloni
maintainerPATCH 84/100 rtc: abx80x: remove useless message
In reply to Alexandre BelloniIt is not necessary to print a message when the time is invalid as userspace will already get an error (and an optional dev_dbg message).
--- drivers/rtc/rtc-abx80x.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/rtc/rtc-abx80x.c +1 -5
@@ -172,11 +172,7 @@ static int abx80x_rtc_read_time(struct device *dev, struct rtc_time *tm) tm->tm_mon =bcd2bin (buf[ABX8XX_REG_MO ] &0x1F ) -1 ; tm->tm_year =bcd2bin (buf[ABX8XX_REG_YR ]) +100 ; - err =rtc_valid_tm (tm); -if (err <0 ) -dev_err (&client->dev,"retrieved date/time is not valid.\n" ); - -return err; +return 0 ; }static int abx80x_rtc_set_time (struct device *dev,struct rtc_time *tm)
Signature · 1 line
2.16.1
Alexandre Belloni
maintainerPATCH 85/100 rtc: pm8xxx: remove useless message
In reply to Alexandre BelloniIt is not necessary to print a message when the time is invalid as userspace will already get an error (and an optional dev_dbg message).
--- drivers/rtc/rtc-pm8xxx.c | 6 ------ 1 file changed, 6 deletions(-)
drivers/rtc/rtc-pm8xxx.c +0 -6
@@ -190,12 +190,6 @@ static int pm8xxx_rtc_read_time(struct device *dev, struct rtc_time *tm)rtc_time_to_tm (secs, tm); - rc =rtc_valid_tm (tm); -if (rc <0 ) { -dev_err (dev,"Invalid time read from RTC\n" ); -return rc; - } -dev_dbg (dev,"secs = %lu, h:m:s == %d:%d:%d, d/m/y = %d/%d/%d\n" , secs, tm->tm_hour, tm->tm_min, tm->tm_sec, tm->tm_mday, tm->tm_mon, tm->tm_year);
Signature · 1 line
2.16.1
Alexandre Belloni
maintainerPATCH 86/100 rtc: rx4581: remove useless message
In reply to Alexandre BelloniIt is not necessary to print a message when the time is invalid as userspace will already get an error (and an optional dev_dbg message).
--- drivers/rtc/rtc-rx4581.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/rtc/rtc-rx4581.c +1 -5
@@ -172,11 +172,7 @@ static int rx4581_get_datetime(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); - err =rtc_valid_tm (tm); -if (err <0 ) -dev_err (dev,"retrieved date/time is not valid.\n" ); - -return err; +return 0 ; }static int rx4581_set_datetime (struct device *dev,struct rtc_time *tm)
Signature · 1 line
2.16.1
Alexandre Belloni
maintainerPATCH 87/100 rtc: rx8581: remove useless message
In reply to Alexandre BelloniIt is not necessary to print a message when the time is invalid as userspace will already get an error (and an optional dev_dbg message).
--- drivers/rtc/rtc-rx8581.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/rtc/rtc-rx8581.c +1 -5
@@ -164,11 +164,7 @@ static int rx8581_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); - err =rtc_valid_tm (tm); -if (err <0 ) -dev_err (&client->dev,"retrieved date/time is not valid.\n" ); - -return err; +return 0 ; }static int rx8581_set_datetime (struct i2c_client *client,struct rtc_time *tm)
Signature · 1 line
2.16.1
Alexandre Belloni
maintainerPATCH 88/100 rtc: tile: remove useless message
In reply to Alexandre BelloniIt is not necessary to print a message when the time is invalid as userspace will already get an error (and an optional dev_dbg message).
--- drivers/rtc/rtc-tile.c | 3 --- 1 file changed, 3 deletions(-)
drivers/rtc/rtc-tile.c +0 -3
@@ -39,9 +39,6 @@ static int read_rtc_time(struct device *dev, struct rtc_time *tm) tm->tm_yday =0 ; tm->tm_isdst =0 ; -if (rtc_valid_tm (tm) <0 ) -dev_warn (dev,"Read invalid date/time from RTC\n" ); -return 0 ; }
Signature · 1 line
2.16.1
Alexandre Belloni
maintainerPATCH 89/100 rtc: rk808: remove useless debug message
In reply to Alexandre BelloniAt probe time, printing a message when the time is invalid doesn't have much value. Also, as the comment suggest, this is a leftover from development wherhe this was used to set the RTc to a default time.
--- drivers/rtc/rtc-rk808.c | 11 ----------- 1 file changed, 11 deletions(-)
drivers/rtc/rtc-rk808.c +0 -11
@@ -375,7 +375,6 @@ static int rk808_rtc_probe(struct platform_device *pdev) {struct rk808 *rk808 =dev_get_drvdata (pdev->dev.parent);struct rk808_rtc *rk808_rtc; -struct rtc_time tm;int ret; rk808_rtc =devm_kzalloc (&pdev->dev,sizeof (*rk808_rtc),GFP_KERNEL );
@@ -404,16 +403,6 @@ static int rk808_rtc_probe(struct platform_device *pdev)return ret; } -/* set init time */ - ret =rk808_rtc_readtime (&pdev->dev, &tm); -if (ret) { -dev_err (&pdev->dev,"Failed to read RTC time\n" ); -return ret; - } - ret =rtc_valid_tm (&tm); -if (ret) -dev_warn (&pdev->dev,"invalid date/time\n" ); -device_init_wakeup (&pdev->dev,1 ); rk808_rtc->rtc = devm_rtc_device_register(&pdev->dev, "rk808-rtc",
Signature · 1 line
2.16.1
Alexandre Belloni
maintainerPATCH 90/100 rtc: rk808: fix possible race condition
In reply to Alexandre BelloniThe probe function is not allowed to fail after registering the RTC because the following may happen:
CPU0: CPU1:sys_load_module()
do_init_module()
do_one_initcall()
cmos_do_probe()
rtc_device_register()
__register_chrdev()
cdev->owner = struct module*
open("/dev/rtc0")
rtc_device_unregister()
module_put()
free_module()
module_free(mod->module_core)
/* struct module *module is now
freed */
chrdev_open()
spin_lock(cdev_lock)
cdev_get()
try_module_get()
module_is_live()
/* dereferences already
freed struct module* */Switch to devm_rtc_allocate_device/rtc_register_device to register the rtc as late as possible.
--- drivers/rtc/rtc-rk808.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/rtc/rtc-rk808.c +7 -7
@@ -405,12 +405,11 @@ static int rk808_rtc_probe(struct platform_device *pdev)device_init_wakeup (&pdev->dev,1 ); - rk808_rtc->rtc =devm_rtc_device_register (&pdev->dev,"rk808-rtc" , - &rk808_rtc_ops,THIS_MODULE ); -if (IS_ERR (rk808_rtc->rtc)) { - ret =PTR_ERR (rk808_rtc->rtc); -return ret; - } + rk808_rtc->rtc =devm_rtc_allocate_device (&pdev->dev); +if (IS_ERR (rk808_rtc->rtc)) +return PTR_ERR (rk808_rtc->rtc); + + rk808_rtc->rtc->ops = &rk808_rtc_ops; rk808_rtc->irq =platform_get_irq (pdev,0 );if (rk808_rtc->irq <0 ) {
@@ -427,9 +426,10 @@ static int rk808_rtc_probe(struct platform_device *pdev)if (ret) {dev_err (&pdev->dev,"Failed to request alarm IRQ %d: %d\n" , rk808_rtc->irq, ret); +return ret; } -return ret; +return rtc_register_device (rk808_rtc->rtc); }static struct platform_driver rk808_rtc_driver = {
Signature · 1 line
2.16.1
Alexandre Belloni
maintainerPATCH 91/100 rtc: s35390a: remove useless message
In reply to Alexandre BelloniIt is not necessary to print a message when the time is invalid as userspace will already get an error (and an optional dev_dbg message).
--- drivers/rtc/rtc-s35390a.c | 4 ---- 1 file changed, 4 deletions(-)
drivers/rtc/rtc-s35390a.c +0 -4
@@ -450,7 +450,6 @@ static int s35390a_probe(struct i2c_client *client,int err, err_read;unsigned int i;struct s35390a *s35390a; -struct rtc_time tm;char buf, status1;if (!i2c_check_functionality (client->adapter,I2C_FUNC_I2C )) {
@@ -508,9 +507,6 @@ static int s35390a_probe(struct i2c_client *client, } } -if (err_read >0 ||s35390a_get_datetime (client, &tm) <0 ) -dev_warn (&client->dev,"clock needs to be set\n" ); -device_set_wakeup_capable (&client->dev,1 ); s35390a->rtc = devm_rtc_device_register(&client->dev,
Signature · 1 line
2.16.1
Alexandre Belloni
maintainerPATCH 92/100 rtc: s35390a: stop validating rtc_time in .read_time
In reply to Alexandre BelloniThe RTC core is always calling rtc_valid_tm after the read_time callback. It is not necessary to call it before returning from the callback.
--- drivers/rtc/rtc-s35390a.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/rtc/rtc-s35390a.c +1 -1
@@ -271,7 +271,7 @@ static int s35390a_get_datetime(struct i2c_client *client, struct rtc_time *tm) 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 s35390a_set_alarm (struct i2c_client *client,struct rtc_wkalrm *alm)
Signature · 1 line
2.16.1
Alexandre Belloni
maintainerPATCH 93/100 rtc: s35390a: remove useless indirection
In reply to Alexandre Bellonis35390a_set_datetime, s35390a_get_datetime, s35390a_set_alarm and s35390a_read_alarm are only used after casting dev to an i2c_client. Remove that useless indirection.
--- drivers/rtc/rtc-s35390a.c | 32 ++++++++------------------------ 1 file changed, 8 insertions(+), 24 deletions(-)
drivers/rtc/rtc-s35390a.c +8 -24
@@ -210,8 +210,9 @@ static int s35390a_reg2hr(struct s35390a *s35390a, char reg)return hour; } -static int s35390a_set_datetime (struct i2c_client *client,struct rtc_time *tm) +static int s35390a_rtc_set_time (struct device *dev,struct rtc_time *tm) { +struct i2c_client *client =to_i2c_client (dev);struct s35390a *s35390a =i2c_get_clientdata (client);int i, err;char buf[7 ], status;
@@ -241,8 +242,9 @@ static int s35390a_set_datetime(struct i2c_client *client, struct rtc_time *tm)return err; } -static int s35390a_get_datetime (struct i2c_client *client,struct rtc_time *tm) +static int s35390a_rtc_read_time (struct device *dev,struct rtc_time *tm) { +struct i2c_client *client =to_i2c_client (dev);struct s35390a *s35390a =i2c_get_clientdata (client);char buf[7 ], status;int i, err;
@@ -274,8 +276,9 @@ static int s35390a_get_datetime(struct i2c_client *client, struct rtc_time *tm)return 0 ; } -static int s35390a_set_alarm (struct i2c_client *client,struct rtc_wkalrm *alm) +static int s35390a_rtc_set_alarm (struct device *dev,struct rtc_wkalrm *alm) { +struct i2c_client *client =to_i2c_client (dev);struct s35390a *s35390a =i2c_get_clientdata (client);char buf[3 ], sts =0 ;int err, i;
@@ -329,8 +332,9 @@ static int s35390a_set_alarm(struct i2c_client *client, struct rtc_wkalrm *alm)return err; } -static int s35390a_read_alarm (struct i2c_client *client,struct rtc_wkalrm *alm) +static int s35390a_rtc_read_alarm (struct device *dev,struct rtc_wkalrm *alm) { +struct i2c_client *client =to_i2c_client (dev);struct s35390a *s35390a =i2c_get_clientdata (client);char buf[3 ], sts;int i, err;
@@ -384,26 +388,6 @@ static int s35390a_read_alarm(struct i2c_client *client, struct rtc_wkalrm *alm)return 0 ; } -static int s35390a_rtc_read_alarm (struct device *dev,struct rtc_wkalrm *alm) -{ -return s35390a_read_alarm (to_i2c_client (dev), alm); -} - -static int s35390a_rtc_set_alarm (struct device *dev,struct rtc_wkalrm *alm) -{ -return s35390a_set_alarm (to_i2c_client (dev), alm); -} - -static int s35390a_rtc_read_time (struct device *dev,struct rtc_time *tm) -{ -return s35390a_get_datetime (to_i2c_client (dev), tm); -} - -static int s35390a_rtc_set_time (struct device *dev,struct rtc_time *tm) -{ -return s35390a_set_datetime (to_i2c_client (dev), tm); -} -static int s35390a_rtc_ioctl (struct device *dev,unsigned int cmd,unsigned long arg) {
Signature · 1 line
2.16.1
Alexandre Belloni
maintainerPATCH 94/100 rtc: rs5c372: remove useless message
In reply to Alexandre BelloniIt is not necessary to print a message when the time is invalid as userspace will already get an error (and an optional dev_dbg message).
--- drivers/rtc/rtc-rs5c372.c | 4 ---- 1 file changed, 4 deletions(-)
drivers/rtc/rtc-rs5c372.c +0 -4
@@ -581,7 +581,6 @@ static int rs5c372_probe(struct i2c_client *client,int err =0 ;int smbus_mode =0 ;struct rs5c372 *rs5c372; -struct rtc_time tm;dev_dbg (&client->dev,"%s\n" , __func__);
@@ -662,9 +661,6 @@ static int rs5c372_probe(struct i2c_client *client, goto exit; } -if (rs5c372_get_datetime (client, &tm) <0 ) -dev_warn (&client->dev,"clock needs to be set\n" ); - dev_info(&client->dev, "%s found, %s\n", ({ char *s; switch (rs5c372->type) { case rtc_r2025sd: s = "r2025sd"; break;
Signature · 1 line
2.16.1
Alexandre Belloni
maintainerPATCH 95/100 rtc: rs5c372: stop validating rtc_time in .read_time
In reply to Alexandre BelloniThe RTC core is always calling rtc_valid_tm after the read_time callback. It is not necessary to call it before returning from the callback.
--- drivers/rtc/rtc-rs5c372.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/rtc/rtc-rs5c372.c +1 -2
@@ -234,8 +234,7 @@ static int rs5c372_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); -/* rtc might need initialization */ -return rtc_valid_tm (tm); +return 0 ; }static int rs5c372_set_datetime (struct i2c_client *client,struct rtc_time *tm)
Signature · 1 line
2.16.1
Alexandre Belloni
maintainerPATCH 96/100 rtc: rs5c372: remove useless indirection
In reply to Alexandre Bellonirs5c372_get_datetime and rs5c372_set_datetime are only used after casting dev to an i2c_client. Remove that useless indirection.
--- drivers/rtc/rtc-rs5c372.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-)
drivers/rtc/rtc-rs5c372.c +4 -13
@@ -207,8 +207,9 @@ static unsigned rs5c_hr2reg(struct rs5c372 *rs5c, unsigned hour)return bin2bcd (hour); } -static int rs5c372_get_datetime (struct i2c_client *client,struct rtc_time *tm) +static int rs5c372_rtc_read_time (struct device *dev,struct rtc_time *tm) { +struct i2c_client *client =to_i2c_client (dev);struct rs5c372 *rs5c =i2c_get_clientdata (client);int status =rs5c_get_regs (rs5c);
@@ -237,8 +238,9 @@ static int rs5c372_get_datetime(struct i2c_client *client, struct rtc_time *tm)return 0 ; } -static int rs5c372_set_datetime (struct i2c_client *client,struct rtc_time *tm) +static int rs5c372_rtc_set_time (struct device *dev,struct rtc_time *tm) { +struct i2c_client *client =to_i2c_client (dev);struct rs5c372 *rs5c =i2c_get_clientdata (client);unsigned char buf[7 ];int addr;
@@ -304,17 +306,6 @@ static int rs5c372_get_trim(struct i2c_client *client, int *osc, int *trim) }#endif -static int rs5c372_rtc_read_time (struct device *dev,struct rtc_time *tm) -{ -return rs5c372_get_datetime (to_i2c_client (dev), tm); -} - -static int rs5c372_rtc_set_time (struct device *dev,struct rtc_time *tm) -{ -return rs5c372_set_datetime (to_i2c_client (dev), tm); -} - -static int rs5c_rtc_alarm_irq_enable (struct device *dev,unsigned int enabled) {struct i2c_client *client =to_i2c_client (dev);
Signature · 1 line
2.16.1
Alexandre Belloni
maintainerPATCH 97/100 rtc: max6900: stop validating rtc_time in .read_time
In reply to Alexandre BelloniThe RTC core is always calling rtc_valid_tm after the read_time callback. It is not necessary to call it before returning from the callback.
--- drivers/rtc/rtc-max6900.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/rtc/rtc-max6900.c +1 -1
@@ -157,7 +157,7 @@ static int max6900_i2c_read_time(struct i2c_client *client, struct rtc_time *tm)bcd2bin (regs[MAX6900_REG_CENTURY ]) *100 -1900 ; tm->tm_wday =bcd2bin (regs[MAX6900_REG_DW ]); -return rtc_valid_tm (tm); +return 0 ; }static int max6900_i2c_clear_write_protect (struct i2c_client *client)
Signature · 1 line
2.16.1
Alexandre Belloni
maintainerPATCH 98/100 rtc: max6900: remove useless indirection
In reply to Alexandre Bellonimax6900_i2c_read_time and max6900_i2c_set_time are only used after casting dev to an i2c_client. Remove that useless indirection.
--- drivers/rtc/rtc-max6900.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-)
drivers/rtc/rtc-max6900.c +4 -13
@@ -139,8 +139,9 @@ static int max6900_i2c_write_regs(struct i2c_client *client, u8 const *buf)return -EIO ; } -static int max6900_i2c_read_time (struct i2c_client *client,struct rtc_time *tm) +static int max6900_rtc_read_time (struct device *dev,struct rtc_time *tm) { +struct i2c_client *client =to_i2c_client (dev);int rc;u8 regs[MAX6900_REG_LEN ];
@@ -165,9 +166,9 @@ static int max6900_i2c_clear_write_protect(struct i2c_client *client)return i2c_smbus_write_byte_data (client,MAX6900_REG_CONTROL_WRITE ,0 ); } -static int -max6900_i2c_set_time (struct i2c_client *client,struct rtc_time const *tm) +static int max6900_rtc_set_time (struct device *dev,struct rtc_time *tm) { +struct i2c_client *client =to_i2c_client (dev);u8 regs[MAX6900_REG_LEN ];int rc;
@@ -193,16 +194,6 @@ max6900_i2c_set_time(struct i2c_client *client, struct rtc_time const *tm)return 0 ; } -static int max6900_rtc_read_time (struct device *dev,struct rtc_time *tm) -{ -return max6900_i2c_read_time (to_i2c_client (dev), tm); -} - -static int max6900_rtc_set_time (struct device *dev,struct rtc_time *tm) -{ -return max6900_i2c_set_time (to_i2c_client (dev), tm); -} -static const struct rtc_class_ops max6900_rtc_ops = { .read_time = max6900_rtc_read_time, .set_time = max6900_rtc_set_time,
Signature · 1 line
2.16.1
Alexandre Belloni
maintainerPATCH 99/100 rtc: pcf85063: stop validating rtc_time in .read_time
In reply to Alexandre BelloniThe RTC core is always calling rtc_valid_tm after the read_time callback. It is not necessary to call it before returning from the callback.
--- drivers/rtc/rtc-pcf85063.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/rtc/rtc-pcf85063.c +1 -1
@@ -114,7 +114,7 @@ static int pcf85063_get_datetime(struct i2c_client *client, struct rtc_time *tm) tm->tm_year =bcd2bin (regs[6 ]); tm->tm_year +=100 ; -return rtc_valid_tm (tm); +return 0 ; }static int pcf85063_set_datetime (struct i2c_client *client,struct rtc_time *tm)
Signature · 1 line
2.16.1
Alexandre Belloni
maintainerPATCH 100/100 rtc: pcf85063: remove useless indirection
In reply to Alexandre Bellonipcf85063_get_datetime and pcf85063_set_datetime are only used after casting dev to an i2c_client. Remove that useless indirection.
--- drivers/rtc/rtc-pcf85063.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-)
drivers/rtc/rtc-pcf85063.c +4 -12
@@ -81,8 +81,9 @@ static int pcf85063_start_clock(struct i2c_client *client, u8 ctrl1)return 0 ; } -static int pcf85063_get_datetime (struct i2c_client *client,struct rtc_time *tm) +static int pcf85063_rtc_read_time (struct device *dev,struct rtc_time *tm) { +struct i2c_client *client =to_i2c_client (dev);int rc;u8 regs[7 ];
@@ -117,8 +118,9 @@ static int pcf85063_get_datetime(struct i2c_client *client, struct rtc_time *tm)return 0 ; } -static int pcf85063_set_datetime (struct i2c_client *client,struct rtc_time *tm) +static int pcf85063_rtc_set_time (struct device *dev,struct rtc_time *tm) { +struct i2c_client *client =to_i2c_client (dev);int rc;u8 regs[7 ];u8 ctrl1;
@@ -172,16 +174,6 @@ static int pcf85063_set_datetime(struct i2c_client *client, struct rtc_time *tm)return 0 ; } -static int pcf85063_rtc_read_time (struct device *dev,struct rtc_time *tm) -{ -return pcf85063_get_datetime (to_i2c_client (dev), tm); -} - -static int pcf85063_rtc_set_time (struct device *dev,struct rtc_time *tm) -{ -return pcf85063_set_datetime (to_i2c_client (dev), tm); -} -static const struct rtc_class_ops pcf85063_rtc_ops = { .read_time = pcf85063_rtc_read_time, .set_time = pcf85063_rtc_set_time
Signature · 1 line
2.16.1
Quoted 9 lines · Alexandre Belloni
Hello,
This series:
- removes useless calls tortc_valid_tmin .read_time, .set_time and .set_alarm
- removes code setting default values for RTCs (and lets the core handle it)
- removes useless "time is invalid" messages at probe time
- removes useless indirect calls
Seems like this could be just one patch for each of the issues..
Alexandre Belloni
maintainerQuoted 11 lines · Christoph Hellwig
Quoted 9 lines · Alexandre Belloni
Hello,
This series:
- removes useless calls tortc_valid_tmin .read_time, .set_time and .set_alarm
- removes code setting default values for RTCs (and lets the core handle it)
- removes useless "time is invalid" messages at probe time
- removes useless indirect calls
Quoted 1 line
Seems like this could be just one patch for each of the issues..
I'll probably squash the simpler ones before sending to Linus.
Signature · 3 lines
Alexandre Belloni, Bootlin (formerly Free Electrons) Embedded Linux and Kernel engineering https://bootlin.com