pps: Add pps_lookup_dev() function
authorGeorge Spelvin <linux@horizon.com>
Sun, 10 Feb 2013 09:08:32 +0000 (04:08 -0500)
committerBen Hutchings <ben@decadent.org.uk>
Wed, 6 Mar 2013 03:23:57 +0000 (03:23 +0000)
commit7063a9950d1005f4e797bd047eae7fda181209fb
treefcddfef74341a4b9c40c9f90995b1b5292efb499
parent72df9eccdc41633b6eab5ef2489ff8acb8391c6c
pps: Add pps_lookup_dev() function

commit 513b032c98b4b9414aa4e9b4a315cb1bf0380101 upstream.

The PPS serial line discipline wants to attach a PPS device to a tty
without changing the tty code to add a struct pps_device * pointer.

Since the number of PPS devices in a typical system is generally very low
(n=1 is by far the most common), it's practical to search the entire list
of allocated pps devices.  (We capture the timestamp before the lookup,
so the timing isn't affected.)

It is a bit ugly that this function, which is part of the in-kernel
PPS API, has to be in pps.c as opposed to kapi,c, but that's not
something that affects users.

Signed-off-by: George Spelvin <linux@horizon.com>
Acked-by: Rodolfo Giometti <giometti@enneenne.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
drivers/pps/pps.c
include/linux/pps_kernel.h