From mboxrd@z Thu Jan 1 00:00:00 1970 From: Miroslav Lichvar Subject: Re: [RFC PATCH 3/4] igb: add support for extended PHC gettime Date: Wed, 31 Oct 2018 10:39:35 +0100 Message-ID: <20181031093935.GL31668@localhost> References: <20181026162742.631-1-mlichvar@redhat.com> <20181026162742.631-4-mlichvar@redhat.com> <20181031022916.nuvbjegnn6bsqxss@localhost> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: netdev@vger.kernel.org, intel-wired-lan@lists.osuosl.org, Jacob Keller To: Richard Cochran Return-path: Received: from mx1.redhat.com ([209.132.183.28]:33376 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727436AbeJaShA (ORCPT ); Wed, 31 Oct 2018 14:37:00 -0400 Content-Disposition: inline In-Reply-To: <20181031022916.nuvbjegnn6bsqxss@localhost> Sender: netdev-owner@vger.kernel.org List-ID: On Tue, Oct 30, 2018 at 07:29:16PM -0700, Richard Cochran wrote: > On Fri, Oct 26, 2018 at 06:27:41PM +0200, Miroslav Lichvar wrote: > > +static int igb_ptp_gettimex(struct ptp_clock_info *ptp, > > + struct ptp_system_timestamp *sts) > > +{ > > + struct igb_adapter *igb = container_of(ptp, struct igb_adapter, > > + ptp_caps); > > + struct e1000_hw *hw = &igb->hw; > > + unsigned long flags; > > + u32 lo, hi; > > + u64 ns; > > + > > + spin_lock_irqsave(&igb->tmreg_lock, flags); > > + > > + /* 82576 doesn't have SYSTIMR */ > > + if (igb->hw.mac.type == e1000_82576) { > > Instead of if/then/else, can't you follow the pattern of providing > different function flavors ... I can. I was just trying to minimize the amount of triplicated code. In the next version I'll add a patch to deprecate the old gettime functions, as Jacob suggested, and replace them with the extended versions, so the amount of code will not change that much. Thanks, -- Miroslav Lichvar