netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Richard Cochran <richardcochran@gmail.com>
To: "Christopher S. Hall" <christopher.s.hall@intel.com>
Cc: tglx@linutronix.de, mingo@redhat.com, john.stultz@linaro.org,
	hpa@zytor.com, jeffrey.t.kirsher@intel.com, x86@kernel.org,
	linux-kernel@vger.kernel.org, intel-wired-lan@lists.osuosl.org,
	netdev@vger.kernel.org, kevin.b.stanton@intel.com
Subject: Re: [PATCH v6 2/9] Add driver cross timestamp interface for higher precision time synchronization
Date: Wed, 13 Jan 2016 22:30:30 +0100	[thread overview]
Message-ID: <20160113213030.GA20252@localhost.localdomain> (raw)
In-Reply-To: <1452687149-11281-3-git-send-email-christopher.s.hall@intel.com>

The series is a lot easier to follow now.  However, the
sync_device_time_cb structure isn't serving any useful purpose:

> +/*
> + * struct get_sync_device_time_cb - Provides method to capture device time
> + *	synchronized with raw system counter value
> + * @get_time:	Callback providing synchronized capture of device time
> + *		and system counter. Returns 0 on success, < 0 on failure
> + * @ctx:	Context provided to callback function
> + */
> +struct sync_device_time_cb {
> +	int	(*get_time)(ktime_t *device_time,
> +			    struct system_counterval_t *system_counterval,
> +			    void *ctx);
> +	void	 *ctx;
> +};

Why not simply pass the function and context pointers as separate
arguments to get_device_system_crosststamp?

> +/*
> + * Get cross timestamp between system clock and device clock
> + */
> +extern int get_device_system_crosststamp(struct sync_device_time_cb *cb,
> +					 struct system_device_crosststamp *ts);

Here is how it looks at the call site (from the last patch):

> +static int e1000e_phc_getcrosststamp(struct ptp_clock_info *ptp,
> +				     struct system_device_crosststamp *xtstamp)
> +{
> +	struct e1000_adapter *adapter = container_of(ptp, struct e1000_adapter,
> +						     ptp_clock_info);
> +	struct sync_device_time_cb sync_devicetime;
> +	int ret;
> +
> +	sync_devicetime.get_time = e1000e_phc_get_syncdevicetime;
> +	sync_devicetime.ctx = adapter;
> +	ret = get_device_system_crosststamp(&sync_devicetime, NULL, xtstamp);
> +	return ret;
> +}

It is really just busy work to assign the fields of 'sync_devicetime'.
If you don't foresee the need of storing the sync_device_time_cb
object, then I would just remove the structure altogether.  Then the
call site will be cleaner, for example:

static int e1000e_phc_getcrosststamp(struct ptp_clock_info *ptp,
				     struct system_device_crosststamp *xtstamp)
{
	struct e1000_adapter *adapter = container_of(ptp, struct e1000_adapter,
						     ptp_clock_info);

	return get_device_system_crosststamp(e1000e_phc_get_syncdevicetime,
					     adapter, NULL, xtstamp);
}

Thanks,
Richard

  reply	other threads:[~2016-01-13 21:30 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-13 12:12 [PATCH v6 0/9] Patchset enabling hardware based cross-timestamps for next gen Intel platforms Christopher S. Hall
2016-01-13 12:12 ` [PATCH v6 1/9] Add cycles to nanoseconds translation Christopher S. Hall
2016-01-13 12:12 ` [PATCH v6 2/9] Add driver cross timestamp interface for higher precision time synchronization Christopher S. Hall
2016-01-13 21:30   ` Richard Cochran [this message]
2016-01-13 12:12 ` [PATCH v6 3/9] Add correlated clocksource relating aliased auxiliary and system clocks Christopher S. Hall
2016-01-15  0:24   ` John Stultz
2016-01-15 10:29     ` Thomas Gleixner
2016-01-13 12:12 ` [PATCH v6 4/9] Always Running Timer (ART) correlated clocksource Christopher S. Hall
2016-01-14 22:00   ` John Stultz
2016-01-13 12:12 ` [PATCH v6 5/9] Add timekeeping snapshot code capturing system time and counter Christopher S. Hall
2016-01-13 12:12 ` [PATCH v6 6/9] Add history to cross timestamp interface supporting slower devices Christopher S. Hall
2016-01-13 12:12 ` [PATCH v6 7/9] Remove duplicated code in ktime_get_raw_and_real() Christopher S. Hall
2016-01-13 12:12 ` [PATCH v6 8/9] Add PTP_SYS_OFFSET_PRECISE for driver crosstimestamping Christopher S. Hall
2016-01-13 21:31   ` Richard Cochran
2016-01-13 12:12 ` [PATCH v6 9/9] Adds hardware supported cross timestamp Christopher S. Hall
2016-01-15  0:49 ` [PATCH v6 0/9] Patchset enabling hardware based cross-timestamps for next gen Intel platforms John Stultz

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=20160113213030.GA20252@localhost.localdomain \
    --to=richardcochran@gmail.com \
    --cc=christopher.s.hall@intel.com \
    --cc=hpa@zytor.com \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=jeffrey.t.kirsher@intel.com \
    --cc=john.stultz@linaro.org \
    --cc=kevin.b.stanton@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).