Author: loos Date: Mon Oct 20 13:36:52 2014 New Revision: 273329 URL: https://svnweb.freebsd.org/changeset/base/273329
Log: Add another wakeup() after actually set the bus as free. This fix a race where the threads waiting for the bus would wake up early and still see bus as busy. While here, give a better description to wmesg for the two use cases we have (bus and io waiting). MFC after: 1 week Modified: head/sys/arm/broadcom/bcm2835/bcm2835_bsc.c Modified: head/sys/arm/broadcom/bcm2835/bcm2835_bsc.c ============================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2835_bsc.c Mon Oct 20 13:18:52 2014 (r273328) +++ head/sys/arm/broadcom/bcm2835/bcm2835_bsc.c Mon Oct 20 13:36:52 2014 (r273329) @@ -395,7 +395,7 @@ bcm_bsc_transfer(device_t dev, struct ii /* If the controller is busy wait until it is available. */ while (sc->sc_flags & BCM_I2C_BUSY) - mtx_sleep(dev, &sc->sc_mtx, 0, "bcm_bsc", 0); + mtx_sleep(dev, &sc->sc_mtx, 0, "bscbusw", 0); /* Now we have control over the BSC controller. */ sc->sc_flags = BCM_I2C_BUSY; @@ -439,7 +439,7 @@ bcm_bsc_transfer(device_t dev, struct ii BCM_BSC_CTRL_ST | read | intr); /* Wait for the transaction to complete. */ - err = mtx_sleep(dev, &sc->sc_mtx, 0, "bcm_bsc", hz); + err = mtx_sleep(dev, &sc->sc_mtx, 0, "bsciow", hz); /* Check if we have a timeout or an I2C error. */ if ((sc->sc_flags & BCM_I2C_ERROR) || err == EWOULDBLOCK) { @@ -452,6 +452,9 @@ bcm_bsc_transfer(device_t dev, struct ii /* Clean the controller flags. */ sc->sc_flags = 0; + /* Wake up the threads waiting for bus. */ + wakeup(dev); + BCM_BSC_UNLOCK(sc); return (err); _______________________________________________ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"