diff options
-rw-r--r-- | drivers/pps/kapi.c | 4 | ||||
-rw-r--r-- | drivers/pps/pps.c | 10 | ||||
-rw-r--r-- | include/linux/pps_kernel.h | 2 |
3 files changed, 10 insertions, 6 deletions
diff --git a/drivers/pps/kapi.c b/drivers/pps/kapi.c index 55f39618261b..3f89f5eba81c 100644 --- a/drivers/pps/kapi.c +++ b/drivers/pps/kapi.c | |||
@@ -326,8 +326,8 @@ void pps_event(int source, struct pps_ktime *ts, int event, void *data) | |||
326 | 326 | ||
327 | /* Wake up if captured something */ | 327 | /* Wake up if captured something */ |
328 | if (captured) { | 328 | if (captured) { |
329 | pps->go = ~0; | 329 | pps->last_ev++; |
330 | wake_up_interruptible(&pps->queue); | 330 | wake_up_interruptible_all(&pps->queue); |
331 | 331 | ||
332 | kill_fasync(&pps->async_queue, SIGIO, POLL_IN); | 332 | kill_fasync(&pps->async_queue, SIGIO, POLL_IN); |
333 | } | 333 | } |
diff --git a/drivers/pps/pps.c b/drivers/pps/pps.c index c76afb980a98..dc7e66cb2762 100644 --- a/drivers/pps/pps.c +++ b/drivers/pps/pps.c | |||
@@ -136,6 +136,7 @@ static long pps_cdev_ioctl(struct file *file, | |||
136 | 136 | ||
137 | case PPS_FETCH: { | 137 | case PPS_FETCH: { |
138 | struct pps_fdata fdata; | 138 | struct pps_fdata fdata; |
139 | unsigned int ev; | ||
139 | 140 | ||
140 | pr_debug("PPS_FETCH: source %d\n", pps->id); | 141 | pr_debug("PPS_FETCH: source %d\n", pps->id); |
141 | 142 | ||
@@ -143,11 +144,12 @@ static long pps_cdev_ioctl(struct file *file, | |||
143 | if (err) | 144 | if (err) |
144 | return -EFAULT; | 145 | return -EFAULT; |
145 | 146 | ||
146 | pps->go = 0; | 147 | ev = pps->last_ev; |
147 | 148 | ||
148 | /* Manage the timeout */ | 149 | /* Manage the timeout */ |
149 | if (fdata.timeout.flags & PPS_TIME_INVALID) | 150 | if (fdata.timeout.flags & PPS_TIME_INVALID) |
150 | err = wait_event_interruptible(pps->queue, pps->go); | 151 | err = wait_event_interruptible(pps->queue, |
152 | ev != pps->last_ev); | ||
151 | else { | 153 | else { |
152 | unsigned long ticks; | 154 | unsigned long ticks; |
153 | 155 | ||
@@ -159,7 +161,9 @@ static long pps_cdev_ioctl(struct file *file, | |||
159 | 161 | ||
160 | if (ticks != 0) { | 162 | if (ticks != 0) { |
161 | err = wait_event_interruptible_timeout( | 163 | err = wait_event_interruptible_timeout( |
162 | pps->queue, pps->go, ticks); | 164 | pps->queue, |
165 | ev != pps->last_ev, | ||
166 | ticks); | ||
163 | if (err == 0) | 167 | if (err == 0) |
164 | return -ETIMEDOUT; | 168 | return -ETIMEDOUT; |
165 | } | 169 | } |
diff --git a/include/linux/pps_kernel.h b/include/linux/pps_kernel.h index 23f63c3263bb..65194fe498bb 100644 --- a/include/linux/pps_kernel.h +++ b/include/linux/pps_kernel.h | |||
@@ -55,7 +55,7 @@ struct pps_device { | |||
55 | struct pps_ktime clear_tu; | 55 | struct pps_ktime clear_tu; |
56 | int current_mode; /* PPS mode at event time */ | 56 | int current_mode; /* PPS mode at event time */ |
57 | 57 | ||
58 | int go; /* PPS event is arrived? */ | 58 | unsigned int last_ev; /* last PPS event id */ |
59 | wait_queue_head_t queue; /* PPS event queue */ | 59 | wait_queue_head_t queue; /* PPS event queue */ |
60 | 60 | ||
61 | unsigned int id; /* PPS source unique ID */ | 61 | unsigned int id; /* PPS source unique ID */ |