From: Rodolfo Giometti <giometti@enneenne.com>
To: Alexander Gordeev <lasaine@lvk.cs.msu.su>
Cc: linux-kernel@vger.kernel.org, linuxpps@ml.enneenne.com,
"Nikita V. Youshchenko" <yoush@cs.msu.su>,
stas@lvk.cs.msu.su, john stultz <johnstul@us.ibm.com>,
Andrew Morton <akpm@linux-foundation.org>,
Alan Cox <alan@lxorguk.ukuu.org.uk>,
Reg Clemens <clemens@dwf.com>
Subject: Re: [PATCHv2 2/6] pps: unify timestamp gathering
Date: Mon, 1 Mar 2010 09:18:40 +0100 [thread overview]
Message-ID: <20100301081839.GH3671@enneenne.com> (raw)
In-Reply-To: <c44b39b1a3744ef3e93d5b55324d539f5688a6de.1267008049.git.lasaine@lvk.cs.msu.su>
On Wed, Feb 24, 2010 at 03:28:13PM +0300, Alexander Gordeev wrote:
> Add a helper function to gather timestamps. This way clients don't have
> to duplicate it.
>
> Signed-off-by: Alexander Gordeev <lasaine@lvk.cs.msu.su>
Acked-by: Rodolfo Giometti <giometti@linux.it>
> ---
> drivers/pps/kapi.c | 15 +++++++++------
> include/linux/pps_kernel.h | 23 ++++++++++++++++++++++-
> 2 files changed, 31 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/pps/kapi.c b/drivers/pps/kapi.c
> index 2d414e2..b87f699 100644
> --- a/drivers/pps/kapi.c
> +++ b/drivers/pps/kapi.c
> @@ -267,7 +267,7 @@ EXPORT_SYMBOL(pps_unregister_source);
> * pps->info.echo(source, event, data);
> */
>
> -void pps_event(int source, struct pps_ktime *ts, int event, void *data)
> +void pps_event(int source, struct pps_event_time *ts, int event, void *data)
> {
> struct pps_device *pps;
> unsigned long flags;
> @@ -284,7 +284,8 @@ void pps_event(int source, struct pps_ktime *ts, int event, void *data)
> return;
>
> pr_debug("PPS event on source %d at %llu.%06u\n",
> - pps->id, (unsigned long long) ts->sec, ts->nsec);
> + pps->id, (unsigned long long) ts->ts_real.sec,
> + ts->ts_real.nsec);
>
> spin_lock_irqsave(&pps->lock, flags);
>
> @@ -298,10 +299,11 @@ void pps_event(int source, struct pps_ktime *ts, int event, void *data)
> (pps->params.mode & PPS_CAPTUREASSERT)) {
> /* We have to add an offset? */
> if (pps->params.mode & PPS_OFFSETASSERT)
> - pps_add_offset(ts, &pps->params.assert_off_tu);
> + pps_add_offset(&ts->ts_real,
> + &pps->params.assert_off_tu);
>
> /* Save the time stamp */
> - pps->assert_tu = *ts;
> + pps->assert_tu = ts->ts_real;
> pps->assert_sequence++;
> pr_debug("capture assert seq #%u for source %d\n",
> pps->assert_sequence, source);
> @@ -312,10 +314,11 @@ void pps_event(int source, struct pps_ktime *ts, int event, void *data)
> (pps->params.mode & PPS_CAPTURECLEAR)) {
> /* We have to add an offset? */
> if (pps->params.mode & PPS_OFFSETCLEAR)
> - pps_add_offset(ts, &pps->params.clear_off_tu);
> + pps_add_offset(&ts->ts_real,
> + &pps->params.clear_off_tu);
>
> /* Save the time stamp */
> - pps->clear_tu = *ts;
> + pps->clear_tu = ts->ts_real;
> pps->clear_sequence++;
> pr_debug("capture clear seq #%u for source %d\n",
> pps->clear_sequence, source);
> diff --git a/include/linux/pps_kernel.h b/include/linux/pps_kernel.h
> index e0a193f..a2804c1 100644
> --- a/include/linux/pps_kernel.h
> +++ b/include/linux/pps_kernel.h
> @@ -40,6 +40,10 @@ struct pps_source_info {
> struct device *dev;
> };
>
> +struct pps_event_time {
> + struct pps_ktime ts_real;
> +};
> +
> /* The main struct */
> struct pps_device {
> struct pps_source_info info; /* PSS source info */
> @@ -86,4 +90,21 @@ extern int pps_register_source(struct pps_source_info *info,
> extern void pps_unregister_source(int source);
> extern int pps_register_cdev(struct pps_device *pps);
> extern void pps_unregister_cdev(struct pps_device *pps);
> -extern void pps_event(int source, struct pps_ktime *ts, int event, void *data);
> +extern void pps_event(int source, struct pps_event_time *ts, int event,
> + void *data);
> +
> +static inline void timespec_to_pps_ktime(struct pps_ktime *kt,
> + struct timespec ts)
> +{
> + kt->sec = ts.tv_sec;
> + kt->nsec = ts.tv_nsec;
> +}
> +
> +static inline void pps_get_ts(struct pps_event_time *ts)
> +{
> + struct timespec ts_real;
> +
> + getnstimeofday(&ts_real);
> + timespec_to_pps_ktime(&ts->ts_real, ts_real);
> +}
> +
> --
> 1.6.6.1
>
--
GNU/Linux Solutions e-mail: giometti@enneenne.com
Linux Device Driver giometti@linux.it
Embedded Systems phone: +39 349 2432127
UNIX programming skype: rodolfo.giometti
Freelance ICT Italia - Consulente ICT Italia - www.consulenti-ict.it
next prev parent reply other threads:[~2010-03-01 8:18 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-24 12:28 [PATCHv2 0/6] pps: time synchronization over LPT Alexander Gordeev
2010-02-24 12:28 ` [PATCHv2 1/6] ntp: add hardpps implementation Alexander Gordeev
2010-03-01 8:14 ` Rodolfo Giometti
2010-03-01 10:43 ` Alexander Gordeev
2010-02-24 12:28 ` [PATCHv2 2/6] pps: unify timestamp gathering Alexander Gordeev
2010-03-01 8:18 ` Rodolfo Giometti [this message]
2010-02-24 12:28 ` [PATCHv2 3/6] pps: capture MONOTONIC_RAW timestamps as well Alexander Gordeev
2010-03-01 8:19 ` Rodolfo Giometti
2010-02-24 12:28 ` [PATCHv2 4/6] pps: add kernel consumer support Alexander Gordeev
2010-03-01 8:29 ` Rodolfo Giometti
2010-03-01 10:48 ` Alexander Gordeev
2010-02-24 12:28 ` [PATCHv2 5/6] pps: add parallel port PPS signal generator Alexander Gordeev
2010-03-01 8:38 ` Rodolfo Giometti
2010-03-01 10:51 ` Alexander Gordeev
2010-02-24 12:28 ` [PATCHv2 6/6] pps: add parallel port PPS client Alexander Gordeev
2010-03-01 8:42 ` Rodolfo Giometti
2010-03-09 3:25 ` [PATCHv2 0/6] pps: time synchronization over LPT john stultz
2010-03-22 20:42 ` Alexander Gordeev
2010-03-22 21:01 ` john stultz
2010-03-22 21:37 ` Alexander Gordeev
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=20100301081839.GH3671@enneenne.com \
--to=giometti@enneenne.com \
--cc=akpm@linux-foundation.org \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=clemens@dwf.com \
--cc=johnstul@us.ibm.com \
--cc=lasaine@lvk.cs.msu.su \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxpps@ml.enneenne.com \
--cc=stas@lvk.cs.msu.su \
--cc=yoush@cs.msu.su \
/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