svn commit: r365396 - head/sys/dev/iicbus/twsi

Andriy Gapon avg at FreeBSD.org
Mon Sep 7 06:29:41 UTC 2020


Author: avg
Date: Mon Sep  7 06:29:41 2020
New Revision: 365396
URL: https://svnweb.freebsd.org/changeset/base/365396

Log:
  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

Modified:
  head/sys/dev/iicbus/twsi/twsi.c

Modified: head/sys/dev/iicbus/twsi/twsi.c
==============================================================================
--- head/sys/dev/iicbus/twsi/twsi.c	Mon Sep  7 06:27:18 2020	(r365395)
+++ head/sys/dev/iicbus/twsi/twsi.c	Mon Sep  7 06:29:41 2020	(r365396)
@@ -510,7 +510,7 @@ twsi_transfer(device_t dev, struct iic_msg *msgs, uint
 		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");
 


More information about the svn-src-head mailing list