From e21a4ccfd1fd41dca59e89002f336adf554ad897 Mon Sep 17 00:00:00 2001 From: Andriy Gapon Date: Mon, 7 Sep 2020 06:29:41 +0000 Subject: [PATCH] twsi: use tsleep instead of pause for better responsiveness wakeup() does not have any effect on pause(), so if a transfer was not finished by the time of the first check, then the thread would sleep full 30 ms. To do: protect the transfer and interrupt code with the mutex, switch from tsleep from msleep Reviewed by: manu MFC after: 3 weeks Differential Revision: https://reviews.freebsd.org/D26309 --- sys/dev/iicbus/twsi/twsi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/iicbus/twsi/twsi.c b/sys/dev/iicbus/twsi/twsi.c index 417d03653c68..9d1a17f43103 100644 --- a/sys/dev/iicbus/twsi/twsi.c +++ b/sys/dev/iicbus/twsi/twsi.c @@ -510,7 +510,7 @@ twsi_transfer(device_t dev, struct iic_msg *msgs, uint32_t nmsgs) sc->control_val &= ~TWSI_CONTROL_ACK; TWSI_WRITE(sc, sc->reg_control, sc->control_val | TWSI_CONTROL_START); while (sc->error == 0 && sc->transfer != 0) { - pause_sbt("twsi", SBT_1MS * 30, SBT_1MS, 0); + tsleep_sbt(sc, 0, "twsi", SBT_1MS * 30, SBT_1MS, 0); } debugf(sc->dev, "pause finish\n");