From: Wolfgang Grandegger <wg@grandegger.com>
To: Richard Cochran <richardcochran@gmail.com>
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH 1/3] ptp: Added a brand new class driver for ptp clocks.
Date: Sun, 02 May 2010 12:50:56 +0200 [thread overview]
Message-ID: <4BDD5910.1040604@grandegger.com> (raw)
In-Reply-To: <20100429091936.GA6703@riccoc20.at.omicron.at>
Hi Richard,
Richard Cochran wrote:
> This patch adds an infrastructure for hardware clocks that implement
> IEEE 1588, the Precision Time Protocol (PTP). A class driver offers a
> registration method to particular hardware clock drivers. Each clock is
> exposed to user space as a character device with ioctls that allow tuning
> of the PTP clock.
>
> Signed-off-by: Richard Cochran <richard.cochran@omicron.at>
> ---
...
> diff --git a/drivers/ptp/ptp_clock.c b/drivers/ptp/ptp_clock.c
> new file mode 100644
> index 0000000..a5acac4
> --- /dev/null
> +++ b/drivers/ptp/ptp_clock.c
...
> +static int ptp_open(struct inode *inode, struct file *fp)
> +{
> + struct ptp_clock *ptp;
> + ptp = container_of(inode->i_cdev, struct ptp_clock, cdev);
> +
> + if (mutex_lock_interruptible(&ptp->mux))
> + return -ERESTARTSYS;
> +
> + fp->private_data = ptp;
> +
> + return 0;
> +}
...
> +static int ptp_release(struct inode *inode, struct file *fp)
> +{
> + struct ptp_clock *ptp = fp->private_data;
> + mutex_unlock(&ptp->mux);
> + return 0;
> +}
As long as the device is in use by an application, no other can access
it, because the mutex is locked. Other application may want to read the
PTP clock time while ptpd is running, though.
Wolfgang.
next prev parent reply other threads:[~2010-05-02 10:52 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-29 9:19 [PATCH 1/3] ptp: Added a brand new class driver for ptp clocks Richard Cochran
2010-04-30 17:58 ` Wolfgang Grandegger
2010-05-01 14:08 ` Richard Cochran
2010-05-01 14:09 ` Wolfgang Grandegger
2010-05-02 10:50 ` Wolfgang Grandegger [this message]
2010-05-03 10:07 ` Richard Cochran
2010-05-04 7:57 ` Wolfgang Grandegger
-- strict thread matches above, loose matches on Subject: below --
2010-04-27 9:14 Richard Cochran
2010-04-27 20:07 ` David Miller
2010-04-27 22:32 ` Randy Dunlap
2010-04-28 6:08 ` Richard Cochran
2010-04-28 15:45 ` Randy Dunlap
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=4BDD5910.1040604@grandegger.com \
--to=wg@grandegger.com \
--cc=netdev@vger.kernel.org \
--cc=richardcochran@gmail.com \
/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.