Re: [PATCH 1/1] LinuxPPS: Pulse per Second support for Linux

From: H. Peter Anvin
Date: Mon Feb 19 2007 - 21:56:57 EST


Rodolfo Giometti wrote:

Please read the following consideratios before sending to /dev/null!
:)

RFC considerations
------------------

While implementing a PPS API as RFC 2783 defines and using an embedded
CPU GPIO-Pin as physical link to the signal, I encountered a deeper
problem:

At startup it needs a file descriptor as argument for the function
time_pps_create().

This implies that the source has a /dev/... entry. This assumption is
ok for the serial and parallel port, where you can do something
usefull beside(!) the gathering of timestamps as it is the central
task for a PPS-API. But this assumption does not work for a single
purpose GPIO line. In this case even basic file-related functionality
(like read() and write()) makes no sense at all and should not be a
precondition for the use of a PPS-API.


It's not a precondition for a file descriptor, either. There are plenty of ioctl-only device drivers in existence.

Furthermore, a file descriptor doesn't imply a device entry. Consider pipe(2), for example.

As far as the kernel is concerned, a file handle is a nice, uniform system for providing communication between the kernel and user space. It doesn't matter if one can read() or write() on it; it's perfectly normal to support only a subset of the normal operations.

-hpa
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/