From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757488AbcIPHYg (ORCPT ); Fri, 16 Sep 2016 03:24:36 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:34668 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754490AbcIPHY1 (ORCPT ); Fri, 16 Sep 2016 03:24:27 -0400 Date: Fri, 16 Sep 2016 09:24:22 +0200 From: Richard Cochran To: Josh Triplett Cc: Nicolas Pitre , John Stultz , Thomas Gleixner , lkml Subject: Re: [PATCH v3) posix-timers: make it configurable Message-ID: <20160916072421.GA14160@localhost.localdomain> References: <20160915210724.GB4245@localhost.localdomain> <20160915211555.GA16992@cloud> <20160915215649.GA17171@cloud> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160915215649.GA17171@cloud> 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 Thu, Sep 15, 2016 at 02:56:49PM -0700, Josh Triplett wrote: > > I suspect there is more of a case for having net drivers _without_ ptp > > support. This could be implemented with a ptp_clock_register() stub > > returning NULL when ptp is not configured. I didn't look at most > > drivers but at least broadcom/tg3.c seems to be fine with such an > > approach. (I wouldn't be suprised if some drivers fail to deal with NULL gracefully, but those can always be fixed ;) > > Alternatively, all those ethernet drivers currently selecting > > PTP_1588_CLOCK could be banned from the kernel config when POSIX_TIMERS > > is not selected. > > > > What do people prefer? > > If the stubs prove as simple as you suggest above (a static inline > returning NULL), that sounds ideal. If this would require a non-trivial > amount of stub code, then preventing those drivers from building without > POSIX_TIMERS seems preferable to that. I agree that stubs are the better solution. There are only five functions that deal with 'struct ptp_clock' at all. The stubs could be: static inline struct ptp_clock *ptp_clock_register(struct ptp_clock_info *info, struct device *parent) { return NULL; } static inline int ptp_clock_unregister(struct ptp_clock *ptp) { return -1; } static inline void ptp_clock_event(struct ptp_clock *ptp, struct ptp_clock_event *event) { } static inline int ptp_clock_index(struct ptp_clock *ptp) { return -1; } static inline int ptp_find_pin(struct ptp_clock *ptp, enum ptp_pin_function func, unsigned int chan) { return -1; } Thanks, Richard