Re: [PATCH v3 1/3] rtc: Add functions to set and read rtc offset
From: Alexandre Belloni
Date: Fri Feb 05 2016 - 09:39:15 EST
On 04/02/2016 at 15:32:42 -0800, Joshua Clayton wrote :
> > > +int rtc_read_offset(struct rtc_device *rtc, long *offset)
> > > +{
> > > + int ret = 0;
> > > +
> > > + if (!rtc->ops)
> > > + return -ENODEV;
> > > +
> > > + if (!rtc->ops->set_offset) {
> > > + *offset = 0;
> > > + return 0;
> > > + }
> > > +
> >
> > I should have been clearer but this is not necessary anymore since the
> > sysfs interface will not always be present but you
> > should probably test rtc->ops->read_offset instead.
> >
> I left it because the kernel API is still there even if the sysfs
> file is not...
> but yeah, you are right. I'll fix the check, and the formatting
> in the other patch.
>
Yeah but from inside the kernel, I feel that it is more useful to know
that the value doesn't exist instead of having 0.
--
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com