public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Rodolfo Giometti <giometti@enneenne.com>
To: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: Andrew Morton <akpm@linux-foundation.org>, linux-kernel@vger.kernel.org
Subject: Re: LinuxPPS low-level IRQs timestamps & ldisc
Date: Mon, 2 Jun 2008 16:56:03 +0200	[thread overview]
Message-ID: <20080602145603.GG26854@enneenne.com> (raw)
In-Reply-To: <20080602150257.54692f35@core>

On Mon, Jun 02, 2008 at 03:02:57PM +0100, Alan Cox wrote:
> > It could be a bit better... I did as above since I supposed that you
> > wished all PPS code should be removed from serial port code.
> 
> Ideally. But if it is genuinely the case that the serial port IRQ handler
> in some cases needs to do
> 
> my_interrupt() {
> 	get_timestamp()
> 	frob_with_hardware()
> 	ld->dcd_change(blah, timestamp)
> }
> 
> then that is still fairly clean and more importantly actually appears to
> work. I'd avoid all the ifdefs with this in the serial drivers that need
> more accuracy:
> 
> {
> 	struct timespec ts;
> 	if (ld->dcd_change)
> 		getnstimeofday(&ts);
> 	existing tty stuff
> 	if (ld->dcd_change)
> 		ld->dcd_change(tty, status, &ts);
> }

I prefere avoid the if clause for getnstimeofday() since each
instruction delay may decrease time precision, so:

{
      struct timespec ts;
      getnstimeofday(&ts);
      existing tty stuff
      if (ld->dcd_change)
              ld->dcd_change(tty, status, &ts);
}

In the wrost case the timestamp is not used.

> And in ld->dcd_change do
> 
> 	struct timespec myts;
> 	/* Caller passed NULL meaning 'do your own timestamp' */
> 	if (ts == NULL) {
> 		ts = &myts;
> 		getnstimeofday(&myts);
> 	}

Ok.

> so for uart that would
> 
> 	uart_dcd_change(struct uart_port *port, unsigned int status,
> 					struct timespec *ts) {
> 	{
> 		...
> 	}
> 
> passing the timestamp from the ttys own IRQ handler

Great!

Thanks,

Rodolfo

-- 

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

  reply	other threads:[~2008-06-02 14:57 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-01 16:15 LinuxPPS low-level IRQs timestamps & ldisc Rodolfo Giometti
2008-06-01 19:26 ` Lennart Sorensen
2008-06-02  6:51 ` Alan Cox
2008-06-02  9:25   ` Rodolfo Giometti
2008-06-02 14:02     ` Alan Cox
2008-06-02 14:56       ` Rodolfo Giometti [this message]
2008-06-02 15:48         ` Alan Cox
2008-06-02 17:22           ` Rodolfo Giometti
2008-06-02 19:35             ` Alan Cox
2008-06-02 20:21             ` Matti Aarnio
2008-06-03 13:40               ` Alan Cox
2008-06-02 17:09         ` Lennart Sorensen
2008-06-02 16:59           ` Alan Cox

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=20080602145603.GG26854@enneenne.com \
    --to=giometti@enneenne.com \
    --cc=akpm@linux-foundation.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=linux-kernel@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