aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/pps/clients/pps-ktimer.c12
-rw-r--r--drivers/pps/clients/pps_parport.c9
-rw-r--r--drivers/pps/kapi.c20
3 files changed, 13 insertions, 28 deletions
diff --git a/drivers/pps/clients/pps-ktimer.c b/drivers/pps/clients/pps-ktimer.c
index 82583b0ff82d..436b4e4e71a1 100644
--- a/drivers/pps/clients/pps-ktimer.c
+++ b/drivers/pps/clients/pps-ktimer.c
@@ -52,17 +52,6 @@ static void pps_ktimer_event(unsigned long ptr)
52} 52}
53 53
54/* 54/*
55 * The echo function
56 */
57
58static void pps_ktimer_echo(struct pps_device *pps, int event, void *data)
59{
60 dev_info(pps->dev, "echo %s %s\n",
61 event & PPS_CAPTUREASSERT ? "assert" : "",
62 event & PPS_CAPTURECLEAR ? "clear" : "");
63}
64
65/*
66 * The PPS info struct 55 * The PPS info struct
67 */ 56 */
68 57
@@ -72,7 +61,6 @@ static struct pps_source_info pps_ktimer_info = {
72 .mode = PPS_CAPTUREASSERT | PPS_OFFSETASSERT | 61 .mode = PPS_CAPTUREASSERT | PPS_OFFSETASSERT |
73 PPS_ECHOASSERT | 62 PPS_ECHOASSERT |
74 PPS_CANWAIT | PPS_TSFMT_TSPEC, 63 PPS_CANWAIT | PPS_TSFMT_TSPEC,
75 .echo = pps_ktimer_echo,
76 .owner = THIS_MODULE, 64 .owner = THIS_MODULE,
77}; 65};
78 66
diff --git a/drivers/pps/clients/pps_parport.c b/drivers/pps/clients/pps_parport.c
index c571d6dd8f61..e1b4705ae3ec 100644
--- a/drivers/pps/clients/pps_parport.c
+++ b/drivers/pps/clients/pps_parport.c
@@ -133,14 +133,6 @@ out_both:
133 return; 133 return;
134} 134}
135 135
136/* the PPS echo function */
137static void pps_echo(struct pps_device *pps, int event, void *data)
138{
139 dev_info(pps->dev, "echo %s %s\n",
140 event & PPS_CAPTUREASSERT ? "assert" : "",
141 event & PPS_CAPTURECLEAR ? "clear" : "");
142}
143
144static void parport_attach(struct parport *port) 136static void parport_attach(struct parport *port)
145{ 137{
146 struct pps_client_pp *device; 138 struct pps_client_pp *device;
@@ -151,7 +143,6 @@ static void parport_attach(struct parport *port)
151 PPS_OFFSETASSERT | PPS_OFFSETCLEAR | \ 143 PPS_OFFSETASSERT | PPS_OFFSETCLEAR | \
152 PPS_ECHOASSERT | PPS_ECHOCLEAR | \ 144 PPS_ECHOASSERT | PPS_ECHOCLEAR | \
153 PPS_CANWAIT | PPS_TSFMT_TSPEC, 145 PPS_CANWAIT | PPS_TSFMT_TSPEC,
154 .echo = pps_echo,
155 .owner = THIS_MODULE, 146 .owner = THIS_MODULE,
156 .dev = NULL 147 .dev = NULL
157 }; 148 };
diff --git a/drivers/pps/kapi.c b/drivers/pps/kapi.c
index a4e8eb9fece6..f197e8ea185c 100644
--- a/drivers/pps/kapi.c
+++ b/drivers/pps/kapi.c
@@ -52,6 +52,14 @@ static void pps_add_offset(struct pps_ktime *ts, struct pps_ktime *offset)
52 ts->sec += offset->sec; 52 ts->sec += offset->sec;
53} 53}
54 54
55static void pps_echo_client_default(struct pps_device *pps, int event,
56 void *data)
57{
58 dev_info(pps->dev, "echo %s %s\n",
59 event & PPS_CAPTUREASSERT ? "assert" : "",
60 event & PPS_CAPTURECLEAR ? "clear" : "");
61}
62
55/* 63/*
56 * Exported functions 64 * Exported functions
57 */ 65 */
@@ -80,13 +88,6 @@ struct pps_device *pps_register_source(struct pps_source_info *info,
80 err = -EINVAL; 88 err = -EINVAL;
81 goto pps_register_source_exit; 89 goto pps_register_source_exit;
82 } 90 }
83 if ((info->mode & (PPS_ECHOASSERT | PPS_ECHOCLEAR)) != 0 &&
84 info->echo == NULL) {
85 pr_err("%s: echo function is not defined\n",
86 info->name);
87 err = -EINVAL;
88 goto pps_register_source_exit;
89 }
90 if ((info->mode & (PPS_TSFMT_TSPEC | PPS_TSFMT_NTPFP)) == 0) { 91 if ((info->mode & (PPS_TSFMT_TSPEC | PPS_TSFMT_NTPFP)) == 0) {
91 pr_err("%s: unspecified time format\n", 92 pr_err("%s: unspecified time format\n",
92 info->name); 93 info->name);
@@ -108,6 +109,11 @@ struct pps_device *pps_register_source(struct pps_source_info *info,
108 pps->params.mode = default_params; 109 pps->params.mode = default_params;
109 pps->info = *info; 110 pps->info = *info;
110 111
112 /* check for default echo function */
113 if ((pps->info.mode & (PPS_ECHOASSERT | PPS_ECHOCLEAR)) &&
114 pps->info.echo == NULL)
115 pps->info.echo = pps_echo_client_default;
116
111 init_waitqueue_head(&pps->queue); 117 init_waitqueue_head(&pps->queue);
112 spin_lock_init(&pps->lock); 118 spin_lock_init(&pps->lock);
113 119