From: Randy Dunlap on
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(a)linux.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(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/