All of lore.kernel.org
 help / color / mirror / Atom feed
From: Richard Cochran <richardcochran@gmail.com>
To: Josh Triplett <josh@joshtriplett.org>
Cc: Nicolas Pitre <nicolas.pitre@linaro.org>,
	John Stultz <john.stultz@linaro.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	lkml <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v3) posix-timers: make it configurable
Date: Fri, 16 Sep 2016 09:24:22 +0200	[thread overview]
Message-ID: <20160916072421.GA14160@localhost.localdomain> (raw)
In-Reply-To: <20160915215649.GA17171@cloud>

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

  reply	other threads:[~2016-09-16  7:24 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-15  3:47 [PATCH v3) posix-timers: make it configurable Nicolas Pitre
2016-09-15 17:48 ` John Stultz
2016-09-15 17:56   ` Nicolas Pitre
2016-09-15 18:13 ` John Stultz
2016-09-15 18:28   ` Nicolas Pitre
2016-09-15 18:35     ` John Stultz
2016-09-15 18:37       ` Nicolas Pitre
2016-09-15 18:46         ` John Stultz
2016-09-15 19:31           ` Nicolas Pitre
2016-09-15 19:58             ` John Stultz
2016-09-15 21:07               ` Richard Cochran
2016-09-15 21:15                 ` Josh Triplett
2016-09-15 21:35                   ` Nicolas Pitre
2016-09-15 21:56                     ` Josh Triplett
2016-09-16  7:24                       ` Richard Cochran [this message]
2016-09-17  2:57                         ` Nicolas Pitre
2016-09-18 14:35                           ` Richard Cochran
2016-09-18 16:54                             ` Nicolas Pitre
2016-09-18 18:20                               ` Richard Cochran
2016-09-18 18:49                                 ` Nicolas Pitre
2016-09-18 20:22                                   ` Richard Cochran
2016-09-18 20:30                                     ` Nicolas Pitre
2016-09-18 21:11                                       ` Richard Cochran
2016-09-15 21:23               ` Richard Cochran
2016-09-16 14:31 ` kbuild test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160916072421.GA14160@localhost.localdomain \
    --to=richardcochran@gmail.com \
    --cc=john.stultz@linaro.org \
    --cc=josh@joshtriplett.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nicolas.pitre@linaro.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.