Skip to content

Commit 5849e2d

Browse files
linosanfilippo-kunbusl1k
authored andcommitted
pibridge-serdev: fix bad cycle times
Use wait_event_hrtimeout() instead of wait_event_timeout() to wait for more data. The latter uses jiffies to specify the timeout which requires a minimum of 2 jiffies (which equals 20 msecs) to avoid a timeout before the the IO timeout interval used by the pibridge module (10 msecs) have passed. With wait_event_hrtimeout() it is possible to specify the exact 10 msecs as a timeout so we do not have to wait up to 20 msecs in case that no more data arrives. Signed-off-by: Lino Sanfilippo <l.sanfilippo@kunbus.com>
1 parent ec5400f commit 5849e2d

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

drivers/tty/serdev/pibridge.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,9 @@ static int pibridge_discard_timeout(u16 len, u16 timeout)
8383
unsigned int discarded;
8484
int ret = 0;
8585

86-
wait_event_timeout(pi->read_queue,
87-
kfifo_len(&pi->read_fifo) >= len,
88-
msecs_to_jiffies(timeout) + 1);
86+
wait_event_hrtimeout(pi->read_queue,
87+
kfifo_len(&pi->read_fifo) >= len,
88+
ms_to_ktime(timeout));
8989

9090
mutex_lock(&pi->lock);
9191
discarded = kfifo_len(&pi->read_fifo);
@@ -184,8 +184,8 @@ int pibridge_recv_timeout(void *buf, u8 len, u16 timeout)
184184

185185
trace_pibridge_receive_begin(len);
186186

187-
wait_event_timeout(pi->read_queue, kfifo_len(&pi->read_fifo) >= len,
188-
msecs_to_jiffies(timeout) + 1);
187+
wait_event_hrtimeout(pi->read_queue, kfifo_len(&pi->read_fifo) >= len,
188+
ms_to_ktime(timeout));
189189

190190
mutex_lock(&pi->lock);
191191
received = kfifo_out(&pi->read_fifo, buf, len);

0 commit comments

Comments
 (0)