From owner-svn-src-head@FreeBSD.ORG Tue Dec 23 19:31:57 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 98D26AD0; Tue, 23 Dec 2014 19:31:57 +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 8520A19F1; Tue, 23 Dec 2014 19:31:57 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sBNJVv8X001780; Tue, 23 Dec 2014 19:31:57 GMT (envelope-from loos@FreeBSD.org) Received: (from loos@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sBNJVv0j001773; Tue, 23 Dec 2014 19:31:57 GMT (envelope-from loos@FreeBSD.org) Message-Id: <201412231931.sBNJVv0j001773@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: loos set sender to loos@FreeBSD.org using -f From: Luiz Otavio O Souza Date: Tue, 23 Dec 2014 19:31:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r276151 - head/sys/arm/ti 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: Tue, 23 Dec 2014 19:31:57 -0000 Author: loos Date: Tue Dec 23 19:31:56 2014 New Revision: 276151 URL: https://svnweb.freebsd.org/changeset/base/276151 Log: Do not return the total number of available pins but the maximum pin number we can cope. Previously the returned value could prevent access to some of the pins. Modified: head/sys/arm/ti/ti_gpio.c Modified: head/sys/arm/ti/ti_gpio.c ============================================================================== --- head/sys/arm/ti/ti_gpio.c Tue Dec 23 18:48:45 2014 (r276150) +++ head/sys/arm/ti/ti_gpio.c Tue Dec 23 19:31:56 2014 (r276151) @@ -293,19 +293,8 @@ ti_gpio_intr_clr(struct ti_gpio_softc *s static int ti_gpio_pin_max(device_t dev, int *maxpin) { - struct ti_gpio_softc *sc = device_get_softc(dev); - unsigned int i; - unsigned int banks = 0; - - /* Calculate how many valid banks we have and then multiply that by 32 to - * give use the total number of pins. - */ - for (i = 0; i < ti_max_gpio_banks(); i++) { - if (sc->sc_mem_res[i] != NULL) - banks++; - } - *maxpin = (banks * PINS_PER_BANK) - 1; + *maxpin = ti_max_gpio_banks() * PINS_PER_BANK - 1; return (0); }