netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Richard Cochran <richardcochran@gmail.com>
To: Christopher Hall <christopher.s.hall@intel.com>
Cc: netdev@vger.kernel.org, jacob.e.keller@intel.com,
	john.ronciak@intel.com, kevin.b.stanton@intel.com
Subject: Re: [PATCH] Added additional callback to ptp_clock_info:
Date: Fri, 26 Jun 2015 08:40:27 +0200	[thread overview]
Message-ID: <20150626064027.GA1511@localhost.localdomain> (raw)
In-Reply-To: <1435275777-3918-2-git-send-email-christopher.s.hall@intel.com>

On Thu, Jun 25, 2015 at 04:42:57PM -0700, Christopher Hall wrote:
> @@ -196,19 +196,31 @@ long ptp_ioctl(struct posix_clock *pc, unsigned int cmd, unsigned long arg)
>  			break;
>  		}
>  		pct = &sysoff->ts[0];
> -		for (i = 0; i < sysoff->n_samples; i++) {
> -			getnstimeofday64(&ts);
> +		if (ptp->info->getsynctime64 && sysoff->n_samples == 1) {
> +			ptp->info->getsynctime64(ptp->info, &ts, &systs);
> +			pct->sec = systs.tv_sec;
> +			pct->nsec = systs.tv_nsec;
> +			++pct;

Please use pct++ for the sake of consistency.

>  			pct->sec = ts.tv_sec;
>  			pct->nsec = ts.tv_nsec;
> -			pct++;
> -			ptp->info->gettime64(ptp->info, &ts);
> +			++pct;
> +			pct->sec = systs.tv_sec;
> +			pct->nsec = systs.tv_nsec;
> +		} else {
> +			for (i = 0; i < sysoff->n_samples; i++) {
> +				getnstimeofday64(&ts);
> +				pct->sec = ts.tv_sec;
> +				pct->nsec = ts.tv_nsec;
> +				pct++;
> +				ptp->info->gettime64(ptp->info, &ts);
> +				pct->sec = ts.tv_sec;
> +				pct->nsec = ts.tv_nsec;
> +				pct++;
> +			}
> +			getnstimeofday64(&ts);
>  			pct->sec = ts.tv_sec;
>  			pct->nsec = ts.tv_nsec;
> -			pct++;
>  		}
> -		getnstimeofday64(&ts);
> -		pct->sec = ts.tv_sec;
> -		pct->nsec = ts.tv_nsec;
>  		if (copy_to_user((void __user *)arg, sysoff, sizeof(*sysoff)))
>  			err = -EFAULT;
>  		break;
> diff --git a/include/linux/ptp_clock_kernel.h b/include/linux/ptp_clock_kernel.h
> index b8b7306..edff9a5 100644
> --- a/include/linux/ptp_clock_kernel.h
> +++ b/include/linux/ptp_clock_kernel.h
> @@ -105,6 +105,9 @@ struct ptp_clock_info {
>  	int (*adjfreq)(struct ptp_clock_info *ptp, s32 delta);
>  	int (*adjtime)(struct ptp_clock_info *ptp, s64 delta);
>  	int (*gettime64)(struct ptp_clock_info *ptp, struct timespec64 *ts);
> +	int (*getsynctime64)
> +		(struct ptp_clock_info *ptp, struct timespec64 *dev,
> +		 struct timespec64 *sys);

The struct's KernelDoc also needs updating.

>  	int (*settime64)(struct ptp_clock_info *p, const struct timespec64 *ts);
>  	int (*enable)(struct ptp_clock_info *ptp,
>  		      struct ptp_clock_request *request, int on);
> -- 
> 1.9.1

Thanks,
Richard

  reply	other threads:[~2015-06-26  6:40 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-25 23:42 [PATCH] Add PTP cross-timestamp to the PTP driver interface Christopher Hall
2015-06-25 23:42 ` [PATCH] Added additional callback to ptp_clock_info: Christopher Hall
2015-06-26  6:40   ` Richard Cochran [this message]
2015-06-26  6:55 ` [PATCH] Add PTP cross-timestamp to the PTP driver interface Richard Cochran
2015-06-26 15:24   ` Keller, Jacob E

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=20150626064027.GA1511@localhost.localdomain \
    --to=richardcochran@gmail.com \
    --cc=christopher.s.hall@intel.com \
    --cc=jacob.e.keller@intel.com \
    --cc=john.ronciak@intel.com \
    --cc=kevin.b.stanton@intel.com \
    --cc=netdev@vger.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).