Re: [RFC PATCH v2 5/9] rtc/mc13xxx: Update driver to address y2038/y2106 issues
From: Uwe Kleine-König
Date: Wed Jan 14 2015 - 12:03:53 EST
Hello,
On Wed, Jan 14, 2015 at 11:07:31PM +0800, Xunlei Pang wrote:
> Cc Uwe Kleine-Koenig <u.kleine-koenig@xxxxxxxxxxxxxx>
Thanks, that was useful.
>
> On 13 January 2015 at 23:44, Xunlei Pang <xlpang@xxxxxxx> wrote:
> > From: Xunlei Pang <pang.xunlei@xxxxxxxxxx>
> >
> > This driver has a number of y2038/y2106 issues.
> >
> > This patch resolves them by:
> > - Replace rtc_time_to_tm() with rtc_time64_to_tm()
> > - Change mc13xxx_rtc_set_mmss() to use rtc_class_ops's set_mmss64()
> >
> > After this patch, the driver should not have any remaining
> > y2038/y2106 issues.
> >
> > Signed-off-by: Xunlei Pang <pang.xunlei@xxxxxxxxxx>
> > ---
> > drivers/rtc/rtc-mc13xxx.c | 32 ++++++++++++++------------------
> > 1 file changed, 14 insertions(+), 18 deletions(-)
> >
> > diff --git a/drivers/rtc/rtc-mc13xxx.c b/drivers/rtc/rtc-mc13xxx.c
> > index 5bce904b..32df1d8 100644
> > --- a/drivers/rtc/rtc-mc13xxx.c
> > +++ b/drivers/rtc/rtc-mc13xxx.c
> > @@ -83,20 +83,19 @@ static int mc13xxx_rtc_read_time(struct device *dev, struct rtc_time *tm)
> > return ret;
> > } while (days1 != days2);
> >
> > - rtc_time_to_tm(days1 * SEC_PER_DAY + seconds, tm);
> > + rtc_time64_to_tm((time64_t)days1 * SEC_PER_DAY + seconds, tm);
> >
> > return rtc_valid_tm(tm);
> > }
> >
> > -static int mc13xxx_rtc_set_mmss(struct device *dev, unsigned long secs)
> > +static int mc13xxx_rtc_set_mmss(struct device *dev, time64_t secs)
I don't know if there is a usual conversion rule, but I'd expect that
the function is also renamed to get a suffix 64.
Other than that the patch looks good.
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | http://www.pengutronix.de/ |
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/