[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <4B840094.10003@oracle.com>
Date: Tue, 23 Feb 2010 08:21:40 -0800
From: Randy Dunlap <randy.dunlap@...cle.com>
To: Rodolfo Giometti <giometti@...ux.it>
CC: linux-kernel@...r.kernel.org,
Andrew Morton <akpm@...ux-foundation.org>,
David Woodhouse <dwmw2@...radead.org>,
Dave Jones <davej@...hat.com>, Sam Ravnborg <sam@...nborg.org>,
Greg KH <greg@...ah.com>, Kay Sievers <kay.sievers@...y.org>,
Alan Cox <alan@...rguk.ukuu.org.uk>,
"H. Peter Anvin" <hpa@...or.com>, Ingo Molnar <mingo@...e.hu>,
Michael Kerrisk <mtk.manpages@...il.com>,
Christoph Hellwig <hch@...radead.org>,
Alexander Gordeev <lasaine@....cs.msu.su>
Subject: Re: [PATCH 1/6] pps: LinuxPPS clients support.
On 02/23/10 04:40, Rodolfo Giometti wrote:
> Each PPS source can be registered/deregistered into the system by
> using special modules called "clients". They simply define the PPS
> sources' attributes and implement the time signal registartion
> mechanism.
>
> This patch adds a special directory for such clients and adds a dummy
> client that can be useful to test system integrity on real systems.
>
> Signed-off-by: Rodolfo Giometti <giometti@...ux.it>
> ---
> drivers/pps/Kconfig | 2 +
> drivers/pps/Makefile | 1 +
> drivers/pps/clients/Kconfig | 18 ++++++
> drivers/pps/clients/Makefile | 9 +++
> drivers/pps/clients/ktimer.c | 123 ++++++++++++++++++++++++++++++++++++++++++
> 5 files changed, 153 insertions(+), 0 deletions(-)
> create mode 100644 drivers/pps/clients/Kconfig
> create mode 100644 drivers/pps/clients/Makefile
> create mode 100644 drivers/pps/clients/ktimer.c
> diff --git a/drivers/pps/clients/Kconfig b/drivers/pps/clients/Kconfig
> new file mode 100644
> index 0000000..60b83be
> --- /dev/null
> +++ b/drivers/pps/clients/Kconfig
> @@ -0,0 +1,18 @@
> +#
> +# PPS clients configuration
> +#
> +
> +if PPS
> +
> +comment "PPS clients support"
> +
> +config PPS_CLIENT_KTIMER
> + tristate "Kernel timer client (Testing client, use for debug)"
> + help
> + If you say yes here you get support for a PPS debugging client
> + which uses a kernel timer to generate the PPS signal.
> +
> + This driver can also be built as a module. If so, the module
> + will be called ktimer.ko.
will be called ktimer.
Only a handful of other drivers/kconfigs have that incorrect.
> +
> +endif
> diff --git a/drivers/pps/clients/ktimer.c b/drivers/pps/clients/ktimer.c
> new file mode 100644
> index 0000000..6de5dfc
> --- /dev/null
> +++ b/drivers/pps/clients/ktimer.c
> @@ -0,0 +1,123 @@
> +/*
> + * ktimer.c -- kernel timer test client
> +/*
> + * Global variables
> + */
> +
> +static int source;
> +static struct timer_list ktimer;
> +
> +/*
> + * The kernel timer
> + */
> +
> +static void pps_ktimer_event(unsigned long ptr)
> +{
> + struct timespec __ts;
> + struct pps_ktime ts;
> +
> + /* First of all we get the time stamp... */
> + getnstimeofday(&__ts);
> +
> + pr_info("PPS event at %lu\n", jiffies);
> +
> + /* ... and translate it to PPS time data struct */
> + ts.sec = __ts.tv_sec;
> + ts.nsec = __ts.tv_nsec;
> +
> + pps_event(source, &ts, PPS_CAPTUREASSERT, NULL);
> +
> + mod_timer(&ktimer, jiffies + HZ);
> +}
> +
> +/*
> + * The echo function
> + */
> +
> +static void pps_ktimer_echo(int source, int event, void *data)
> +{
> + pr_info("echo %s %s for source %d\n",
> + event & PPS_CAPTUREASSERT ? "assert" : "",
> + event & PPS_CAPTURECLEAR ? "clear" : "",
> + source);
> +}
> +
> +/*
> + * The PPS info struct
> + */
> +
> +static struct pps_source_info pps_ktimer_info = {
> + .name = "ktimer",
> + .path = "",
> + .mode = PPS_CAPTUREASSERT | PPS_OFFSETASSERT | \
> + PPS_ECHOASSERT | \
> + PPS_CANWAIT | PPS_TSFMT_TSPEC,
We don't usually use \ continuation characters when they are not needed.
> + .echo = pps_ktimer_echo,
> + .owner = THIS_MODULE,
> +};
--
~Randy
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists