Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1327805

Re: [PATCH v3 1/3] rtc: Add functions to set and read rtc offset

From Alexandre Belloni <alexandre.belloni@free-electrons.com>
Newsgroups linux.kernel
Subject Re: [PATCH v3 1/3] rtc: Add functions to set and read rtc offset
Date 2016-02-05 15:40 +0100
Message-ID <qYPIf-1t6-27@gated-at.bofh.it> (permalink)
References <qXGGZ-1oC-3@gated-at.bofh.it> <qY9fY-4Sx-9@gated-at.bofh.it> <qYAga-84a-13@gated-at.bofh.it> <qYBFg-u5-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: [PATCH v2 7/8] rtc: implement a sysfs interface for clock offset Alexandre Belloni <alexandre.belloni@free-electrons.com> - 2016-01-31 12:50 +0100
  Re: [PATCH v2 7/8] rtc: implement a sysfs interface for clock  offset Joshua Clayton <stillcompiling@gmail.com> - 2016-02-01 22:00 +0100
    Re: [PATCH v2 7/8] rtc: implement a sysfs interface for clock offset Alexandre Belloni <alexandre.belloni@free-electrons.com> - 2016-02-02 11:50 +0100
      [PATCH v3 1/3] rtc: Add functions to set and read rtc offset Joshua Clayton <stillcompiling@gmail.com> - 2016-02-03 18:20 +0100
        [PATCH v3 3/3] rtc-pcf2123: implement read_offset and set_offset Joshua Clayton <stillcompiling@gmail.com> - 2016-02-03 18:20 +0100
        [PATCH v3 2/3] rtc: implement a sysfs interface for clock offset Joshua Clayton <stillcompiling@gmail.com> - 2016-02-03 18:20 +0100
          Re: [PATCH v3 2/3] rtc: implement a sysfs interface for clock offset Alexandre Belloni <alexandre.belloni@free-electrons.com> - 2016-02-04 23:20 +0100
        Re: [PATCH v3 1/3] rtc: Add functions to set and read rtc offset Alexandre Belloni <alexandre.belloni@free-electrons.com> - 2016-02-04 23:10 +0100
          Re: [PATCH v3 1/3] rtc: Add functions to set and read rtc offset Joshua Clayton <stillcompiling@gmail.com> - 2016-02-05 00:40 +0100
            Re: [PATCH v3 1/3] rtc: Add functions to set and read rtc offset Alexandre Belloni <alexandre.belloni@free-electrons.com> - 2016-02-05 15:40 +0100
              [PATCH v4 1/3] rtc: Add functions to set and read rtc offset Joshua Clayton <stillcompiling@gmail.com> - 2016-02-05 21:50 +0100
                [PATCH v4 2/3] rtc: implement a sysfs interface for clock offset Joshua Clayton <stillcompiling@gmail.com> - 2016-02-05 21:50 +0100
                [PATCH v4 3/3] rtc-pcf2123: implement read_offset and set_offset Joshua Clayton <stillcompiling@gmail.com> - 2016-02-05 21:50 +0100

csiph-web