From owner-svn-src-head@FreeBSD.ORG Mon Oct 20 13:36:53 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9568D60E; Mon, 20 Oct 2014 13:36:53 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 81F2E6BE; Mon, 20 Oct 2014 13:36:53 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9KDarfa063376; Mon, 20 Oct 2014 13:36:53 GMT (envelope-from loos@FreeBSD.org) Received: (from loos@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9KDarfB063375; Mon, 20 Oct 2014 13:36:53 GMT (envelope-from loos@FreeBSD.org) Message-Id: <201410201336.s9KDarfB063375@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: loos set sender to loos@FreeBSD.org using -f From: Luiz Otavio O Souza Date: Mon, 20 Oct 2014 13:36:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273329 - head/sys/arm/broadcom/bcm2835 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Oct 2014 13:36:53 -0000 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);