rtc: cpcap: convert to devm_rtc_allocate_device
Alexandre Belloni
maintainerPATCH 1/3 rtc: cpcap: convert to devm_rtc_allocate_device
This allows further improvement of the driver.
Signed-off-by Alexandre Belloni <[email protected]>
--- drivers/rtc/rtc-cpcap.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/rtc/rtc-cpcap.c +4 -4
@@ -256,12 +256,12 @@ static int cpcap_rtc_probe(struct platform_device *pdev)return -ENODEV ;platform_set_drvdata (pdev, rtc); - rtc->rtc_dev =devm_rtc_device_register (dev,"cpcap_rtc" , - &cpcap_rtc_ops,THIS_MODULE ); - + rtc->rtc_dev =devm_rtc_allocate_device (dev);if (IS_ERR (rtc->rtc_dev))return PTR_ERR (rtc->rtc_dev); + rtc->rtc_dev->ops = &cpcap_rtc_ops; + err =cpcap_get_vendor (dev, rtc->regmap, &rtc->vendor);if (err)return err;
@@ -298,7 +298,7 @@ static int cpcap_rtc_probe(struct platform_device *pdev)/* ignore error and continue without wakeup support */ } -return 0 ; +return rtc_register_device (rtc->rtc_dev); }static const struct of_device_id cpcap_rtc_of_match[] = {
Signature · 1 line
2.24.1
Alexandre Belloni
maintainerPATCH 2/3 rtc: cpcap: set range
The CPCAP rtc is a 14bit day counter plus a 17bit seconds counter.
Note that this failed on Nov 10 2014 so it is very likely this driver as never been used since.
Signed-off-by Alexandre Belloni <[email protected]>
--- drivers/rtc/rtc-cpcap.c | 1 + 1 file changed, 1 insertion(+)
drivers/rtc/rtc-cpcap.c +1 -0
@@ -261,6 +261,7 @@ static int cpcap_rtc_probe(struct platform_device *pdev)return PTR_ERR (rtc->rtc_dev); rtc->rtc_dev->ops = &cpcap_rtc_ops; + rtc->rtc_dev->range_max = (1 <<14 ) *SECS_PER_DAY -1 ; err =cpcap_get_vendor (dev, rtc->regmap, &rtc->vendor);if (err)
Signature · 1 line
2.24.1
Alexandre Belloni
maintainerPATCH 3/3 rtc: cpcap: switch to rtc_time64_to_tm/rtc_tm_to_time64
In reply to Alexandre BelloniCall the 64bit versions of rtc_tm time conversion.
Signed-off-by Alexandre Belloni <[email protected]>
--- drivers/rtc/rtc-cpcap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/rtc/rtc-cpcap.c +2 -2
@@ -56,14 +56,14 @@ static void cpcap2rtc_time(struct rtc_time *rtc, struct cpcap_time *cpcap) tod = (cpcap->tod1 &TOD1_MASK ) | ((cpcap->tod2 &TOD2_MASK ) <<8 ); time = tod + ((cpcap->day &DAY_MASK ) *SECS_PER_DAY ); -rtc_time_to_tm (time, rtc); +rtc_time64_to_tm (time, rtc); }static void rtc2cpcap_time (struct cpcap_time *cpcap,struct rtc_time *rtc) {unsigned long time; -rtc_tm_to_time (rtc, &time); + time =rtc_tm_to_time64 (rtc); cpcap->day = time /SECS_PER_DAY ; time %=SECS_PER_DAY ;
Signature · 1 line
2.24.1