LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Greg KH <greg@kroah.com>
To: Rodolfo Giometti <giometti@linux.it>
Cc: linux-kernel@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>,
	David Woodhouse <dwmw2@infradead.org>,
	Dave Jones <davej@redhat.com>
Subject: Re: [PATCH 1/8] LinuxPPS core support.
Date: Fri, 8 Feb 2008 22:45:31 -0800	[thread overview]
Message-ID: <20080209064531.GA29926@kroah.com> (raw)
In-Reply-To: <120249364418-git-send-email-giometti@linux.it>

On Fri, Feb 08, 2008 at 07:00:37PM +0100, Rodolfo Giometti wrote:
> This patch adds the kernel side of the PPS support currently named
> "LinuxPPS".
> 
> PPS means "pulse per second" and a PPS source is just a device which
> provides a high precision signal each second so that an application
> can use it to adjust system clock time.
> 
> Common use is the combination of the NTPD as userland program with a
> GPS receiver as PPS source to obtain a wallclock-time with
> sub-millisecond synchronisation to UTC.
> 
> To obtain this goal the userland programs shoud use the PPS API
> specification (RFC 2783 - Pulse-Per-Second API for UNIX-like Operating
> Systems, Version 1.0) which in part is implemented by this patch. It
> provides a set of chars devices, one per PPS source, which can be used
> to get the time signal. The RFC's functions can be implemented by
> accessing to these char devices.
> 
> Signed-off-by: Rodolfo Giometti <giometti@linux.it>
> ---
>  MAINTAINERS          |    7 +
>  drivers/Kconfig      |    2 +
>  drivers/Makefile     |    1 +
>  drivers/pps/Kconfig  |   32 +++++
>  drivers/pps/Makefile |   10 ++
>  drivers/pps/kapi.c   |  272 +++++++++++++++++++++++++++++++++++++++
>  drivers/pps/pps.c    |  342 ++++++++++++++++++++++++++++++++++++++++++++++++++
>  drivers/pps/sysfs.c  |  142 +++++++++++++++++++++

As you are adding sysfs files, please also describe them in
Documentation/ABI/ in this same series of patches.

> +void pps_sysfs_remove_source_entry(struct pps_device *pps)
> +{
> +	/* Delete info files */
> +	if (pps->info.mode & PPS_CAPTUREASSERT)
> +		device_remove_file(pps->dev, &dev_attr_assert);
> +
> +	if (pps->info.mode & PPS_CAPTURECLEAR)
> +		device_remove_file(pps->dev, &dev_attr_clear);
> +
> +	device_remove_file(pps->dev, &dev_attr_mode);
> +	device_remove_file(pps->dev, &dev_attr_echo);
> +	device_remove_file(pps->dev, &dev_attr_name);
> +	device_remove_file(pps->dev, &dev_attr_path);
> +}
> +
> +int pps_sysfs_create_source_entry(struct pps_device *pps)
> +{
> +	int ret;
> +
> +	/* Create file "assert" and "clear" according to source capability */
> +	if (pps->info.mode & PPS_CAPTUREASSERT) {
> +		ret = device_create_file(pps->dev, &dev_attr_assert);
> +		if (ret)
> +			dev_err(pps->dev, "unable to create \"assert\" "
> +					"sysfs entry");
> +	}
> +
> +	if (pps->info.mode & PPS_CAPTURECLEAR) {
> +		ret = device_create_file(pps->dev, &dev_attr_clear);
> +		if (ret)
> +			dev_err(pps->dev, "unable to create \"clear\" "
> +					"sysfs entry");
> +	}
> +
> +	ret = device_create_file(pps->dev, &dev_attr_mode);
> +	if (ret)
> +		dev_err(pps->dev, "unable to create \"mode\" sysfs entry");
> +	ret = device_create_file(pps->dev, &dev_attr_echo);
> +	if (ret)
> +		dev_err(pps->dev, "unable to create \"echo\" sysfs entry");
> +	ret = device_create_file(pps->dev, &dev_attr_name);
> +	if (ret)
> +		dev_err(pps->dev, "unable to create \"name\" sysfs entry");
> +	ret = device_create_file(pps->dev, &dev_attr_path);
> +	if (ret)
> +		dev_err(pps->dev, "unable to create \"path\" sysfs entry");

Why not use a default attribute group?

That way the files are created before the uevent is issued, and the
amount of code you have to write is much smaller.

thanks,

greg k-h

  parent reply	other threads:[~2008-02-09  6:41 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-08 18:00 LinuxPPS: the PPS Linux implementation Rodolfo Giometti
2008-02-08 18:00 ` [PATCH 1/8] LinuxPPS core support Rodolfo Giometti
2008-02-08 18:00   ` [PATCH 2/8] PPS: basic documentation file Rodolfo Giometti
2008-02-08 18:00     ` [PATCH 3/8] PPS: userland header file for PPS API Rodolfo Giometti
2008-02-08 18:00       ` [PATCH 4/8] PPS: documentation programs and examples Rodolfo Giometti
2008-02-08 18:00         ` [PATCH 5/8] PPS: LinuxPPS clients support Rodolfo Giometti
2008-02-08 18:00           ` [PATCH 6/8] PPS: serial " Rodolfo Giometti
2008-02-08 18:00             ` [PATCH 7/8] PPS: example program to enable PPS support on serial ports Rodolfo Giometti
2008-02-08 18:00               ` [PATCH 8/8] PPS: parallel port clients support Rodolfo Giometti
2008-02-08 19:11   ` [PATCH 1/8] LinuxPPS core support Sam Ravnborg
2008-02-09  6:45   ` Greg KH [this message]
2008-02-11  9:53     ` Rodolfo Giometti
2008-02-11 15:25       ` Greg KH
2008-02-11 18:31         ` Rodolfo Giometti
2008-02-11 18:42           ` Rodolfo Giometti

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=20080209064531.GA29926@kroah.com \
    --to=greg@kroah.com \
    --cc=akpm@linux-foundation.org \
    --cc=davej@redhat.com \
    --cc=dwmw2@infradead.org \
    --cc=giometti@linux.it \
    --cc=linux-kernel@vger.kernel.org \
    --subject='Re: [PATCH 1/8] LinuxPPS core support.' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).