From owner-svn-src-head@freebsd.org Sun May 22 03:55:58 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DAB67B410B1; Sun, 22 May 2016 03:55:58 +0000 (UTC) (envelope-from loos@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 9DEA91DDE; Sun, 22 May 2016 03:55:58 +0000 (UTC) (envelope-from loos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4M3tvss014895; Sun, 22 May 2016 03:55:57 GMT (envelope-from loos@FreeBSD.org) Received: (from loos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4M3tvsM014893; Sun, 22 May 2016 03:55:57 GMT (envelope-from loos@FreeBSD.org) Message-Id: <201605220355.u4M3tvsM014893@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: loos set sender to loos@FreeBSD.org using -f From: Luiz Otavio O Souza Date: Sun, 22 May 2016 03:55:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300392 - head/sys/dev/gpio 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.22 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: Sun, 22 May 2016 03:55:59 -0000 Author: loos Date: Sun May 22 03:55:57 2016 New Revision: 300392 URL: https://svnweb.freebsd.org/changeset/base/300392 Log: Get rid of two consumers of gpiobus acquire/release. The GPIO hardware should not be owned by a single device, this defeats any chance of use of the GPIO controller as an interrupt source. ow(4) is now the only consumer of this 'feature' before we can remove it for good. Discussed with: ian, bsdimp Modified: head/sys/dev/gpio/gpioiic.c head/sys/dev/gpio/gpioled.c Modified: head/sys/dev/gpio/gpioiic.c ============================================================================== --- head/sys/dev/gpio/gpioiic.c Sun May 22 03:34:18 2016 (r300391) +++ head/sys/dev/gpio/gpioiic.c Sun May 22 03:55:57 2016 (r300392) @@ -70,7 +70,6 @@ static int gpioiic_attach(device_t); /* iicbb interface */ static void gpioiic_reset_bus(device_t); -static int gpioiic_callback(device_t, int, caddr_t); static void gpioiic_setsda(device_t, int); static void gpioiic_setscl(device_t, int); static int gpioiic_getsda(device_t); @@ -161,30 +160,6 @@ gpioiic_reset_bus(device_t dev) GPIO_PIN_INPUT); } -static int -gpioiic_callback(device_t dev, int index, caddr_t data) -{ - struct gpioiic_softc *sc = device_get_softc(dev); - int error, how; - - how = GPIOBUS_DONTWAIT; - if (data != NULL && *(int*)data == IIC_WAIT) - how = GPIOBUS_WAIT; - error = 0; - switch (index) { - case IIC_REQUEST_BUS: - error = GPIOBUS_ACQUIRE_BUS(sc->sc_busdev, sc->sc_dev, how); - break; - case IIC_RELEASE_BUS: - GPIOBUS_RELEASE_BUS(sc->sc_busdev, sc->sc_dev); - break; - default: - error = EINVAL; - } - - return (error); -} - static void gpioiic_setsda(device_t dev, int val) { @@ -271,7 +246,6 @@ static device_method_t gpioiic_methods[] DEVMETHOD(device_detach, bus_generic_detach), /* iicbb interface */ - DEVMETHOD(iicbb_callback, gpioiic_callback), DEVMETHOD(iicbb_setsda, gpioiic_setsda), DEVMETHOD(iicbb_setscl, gpioiic_setscl), DEVMETHOD(iicbb_getsda, gpioiic_getsda), Modified: head/sys/dev/gpio/gpioled.c ============================================================================== --- head/sys/dev/gpio/gpioled.c Sun May 22 03:34:18 2016 (r300391) +++ head/sys/dev/gpio/gpioled.c Sun May 22 03:55:57 2016 (r300392) @@ -76,23 +76,15 @@ static int gpioled_detach(device_t); static void gpioled_control(void *priv, int onoff) { - int error; struct gpioled_softc *sc; sc = (struct gpioled_softc *)priv; GPIOLED_LOCK(sc); - error = GPIOBUS_ACQUIRE_BUS(sc->sc_busdev, sc->sc_dev, - GPIOBUS_DONTWAIT); - if (error != 0) { - GPIOLED_UNLOCK(sc); - return; - } - error = GPIOBUS_PIN_SETFLAGS(sc->sc_busdev, sc->sc_dev, - GPIOLED_PIN, GPIO_PIN_OUTPUT); - if (error == 0) + if (GPIOBUS_PIN_SETFLAGS(sc->sc_busdev, sc->sc_dev, GPIOLED_PIN, + GPIO_PIN_OUTPUT) == 0) { GPIOBUS_PIN_SET(sc->sc_busdev, sc->sc_dev, GPIOLED_PIN, onoff ? GPIO_PIN_HIGH : GPIO_PIN_LOW); - GPIOBUS_RELEASE_BUS(sc->sc_busdev, sc->sc_dev); + } GPIOLED_UNLOCK(sc); }