From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751761AbcBEOjL (ORCPT ); Fri, 5 Feb 2016 09:39:11 -0500 Received: from down.free-electrons.com ([37.187.137.238]:55731 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750844AbcBEOjJ (ORCPT ); Fri, 5 Feb 2016 09:39:09 -0500 Date: Fri, 5 Feb 2016 15:39:08 +0100 From: Alexandre Belloni To: Joshua Clayton Cc: Alessandro Zummo , rtc-linux@googlegroups.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3 1/3] rtc: Add functions to set and read rtc offset Message-ID: <20160205143908.GJ4782@piout.net> References: <20160202104111.GU20165@piout.net> <1454519804-13770-1-git-send-email-stillcompiling@gmail.com> <20160204220754.GB4782@piout.net> <20160204153242.566a5a1f@jclayton-pc> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160204153242.566a5a1f@jclayton-pc> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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