[PATCH] PPS: pps_event() prototype changed.
Rodolfo Giometti
giometti at linux.it
Mon May 5 17:52:13 CEST 2008
The function pps_event() doesn't record anymore the PPS timestamp by
itself rather then getting it as an argument.
Signed-off-by: Rodolfo Giometti <giometti at linux.it>
---
drivers/pps/clients/ktimer.c | 12 +++++++++++-
drivers/pps/kapi.c | 22 +++++++---------------
include/linux/parport.h | 12 +++++++++++-
include/linux/pps.h | 2 +-
include/linux/serial_core.h | 25 ++++++++++++++++---------
5 files changed, 46 insertions(+), 27 deletions(-)
diff --git a/drivers/pps/clients/ktimer.c b/drivers/pps/clients/ktimer.c
index 5845188..259baa7 100644
--- a/drivers/pps/clients/ktimer.c
+++ b/drivers/pps/clients/ktimer.c
@@ -41,9 +41,19 @@ static struct timer_list ktimer;
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);
- pps_event(source, PPS_CAPTUREASSERT, NULL);
+ /* ... 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);
}
diff --git a/drivers/pps/kapi.c b/drivers/pps/kapi.c
index 6c72e2e..749ead7 100644
--- a/drivers/pps/kapi.c
+++ b/drivers/pps/kapi.c
@@ -248,6 +248,7 @@ EXPORT_SYMBOL(pps_unregister_source);
/* pps_event - register a PPS event into the system
*
* source: the PPS source ID
+ * ts: the event timestamp
* event: the event type
* data: userdef pointer
*
@@ -259,20 +260,11 @@ EXPORT_SYMBOL(pps_unregister_source);
* pps->info.echo(source, event, data);
*/
-void pps_event(int source, int event, void *data)
+void pps_event(int source, struct pps_ktime *ts, int event, void *data)
{
struct pps_device *pps;
- struct timespec __ts;
- struct pps_ktime ts;
unsigned long flags;
- /* First of all we get the time stamp... */
- getnstimeofday(&__ts);
-
- /* ... and translate it to PPS time data struct */
- ts.sec = __ts.tv_sec;
- ts.nsec = __ts.tv_nsec;
-
if ((event & (PPS_CAPTUREASSERT | PPS_CAPTURECLEAR)) == 0) {
printk(KERN_ERR "pps: unknown event (%x) for source %d\n",
event, source);
@@ -284,7 +276,7 @@ void pps_event(int source, int event, void *data)
return;
pr_debug("PPS event on source %d at %llu.%06u\n",
- pps->id, (unsigned long long) ts.sec, ts.nsec);
+ pps->id, (unsigned long long) ts->sec, ts->nsec);
spin_lock_irqsave(&pps->lock, flags);
@@ -297,10 +289,10 @@ void pps_event(int source, int event, void *data)
if (event & PPS_CAPTUREASSERT) {
/* We have to add an offset? */
if (pps->params.mode & PPS_OFFSETASSERT)
- pps_add_offset(&ts, &pps->params.assert_off_tu);
+ pps_add_offset(ts, &pps->params.assert_off_tu);
/* Save the time stamp */
- pps->assert_tu = ts;
+ pps->assert_tu = *ts;
pps->assert_sequence++;
pr_debug("capture assert seq #%u for source %d\n",
pps->assert_sequence, source);
@@ -308,10 +300,10 @@ void pps_event(int source, int event, void *data)
if (event & PPS_CAPTURECLEAR) {
/* We have to add an offset? */
if (pps->params.mode & PPS_OFFSETCLEAR)
- pps_add_offset(&ts, &pps->params.clear_off_tu);
+ pps_add_offset(ts, &pps->params.clear_off_tu);
/* Save the time stamp */
- pps->clear_tu = ts;
+ pps->clear_tu = *ts;
pps->clear_sequence++;
pr_debug("capture clear seq #%u for source %d\n",
pps->clear_sequence, source);
diff --git a/include/linux/parport.h b/include/linux/parport.h
index 501a9dc..b2c6be9 100644
--- a/include/linux/parport.h
+++ b/include/linux/parport.h
@@ -523,7 +523,17 @@ extern int parport_daisy_select (struct parport *port, int daisy, int mode);
static inline void parport_generic_irq(struct parport *port)
{
#ifdef CONFIG_PPS_CLIENT_LP
- pps_event(port->pps_source, PPS_CAPTUREASSERT, port);
+ struct timespec __ts;
+ struct pps_ktime ts;
+
+ /* First of all we get the time stamp... */
+ getnstimeofday(&__ts);
+
+ /* ... and translate it to PPS time data struct */
+ ts.sec = __ts.tv_sec;
+ ts.nsec = __ts.tv_nsec;
+
+ pps_event(port->pps_source, &ts, PPS_CAPTUREASSERT, port);
dev_dbg(port->dev, "PPS assert at %lu on source #%d\n",
jiffies, port->pps_source);
#endif
diff --git a/include/linux/pps.h b/include/linux/pps.h
index 83a23d2..51ac98d 100644
--- a/include/linux/pps.h
+++ b/include/linux/pps.h
@@ -195,7 +195,7 @@ extern int pps_register_source(struct pps_source_info *info,
extern void pps_unregister_source(int source);
extern int pps_register_cdev(struct pps_device *pps);
extern void pps_unregister_cdev(struct pps_device *pps);
-extern void pps_event(int source, int event, void *data);
+extern void pps_event(int source, struct pps_ktime *ts, int event, void *data);
#endif /* __KERNEL__ */
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index c8e4d92..c28799f 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -490,16 +490,23 @@ uart_handle_dcd_change(struct uart_port *port, unsigned int status)
struct uart_info *info = port->info;
#ifdef CONFIG_PPS_CLIENT_UART
+ struct timespec __ts;
+ struct pps_ktime ts;
+
+ /* First of all we get the time stamp... */
+ getnstimeofday(&__ts);
+
+ /* ... and translate it to PPS time data struct */
+ ts.sec = __ts.tv_sec;
+ ts.nsec = __ts.tv_nsec;
+
if (port->flags & UPF_HARDPPS_CD) {
- if (status) {
- pps_event(port->pps_source, PPS_CAPTUREASSERT, port);
- dev_dbg(port->dev, "PPS assert at %lu on source #%d\n",
- jiffies, port->pps_source);
- } else {
- pps_event(port->pps_source, PPS_CAPTURECLEAR, port);
- dev_dbg(port->dev, "PPS clear at %lu on source #%d\n",
- jiffies, port->pps_source);
- }
+ pps_event(port->pps_source,
+ &ts,
+ status ? PPS_CAPTUREASSERT : PPS_CAPTURECLEAR,
+ port);
+ dev_dbg(port->dev, "PPS %s at %lu on source #%d\n",
+ status ? "assert" : "clear", jiffies, port->pps_source);
}
#endif
--
1.5.4.3
--PmA2V3Z32TCmWXqI
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="0002-PPS-low-level-IRQ-timestamps-recording.patch"
More information about the LinuxPPS
mailing list