From owner-svn-src-head@freebsd.org Tue Apr 19 15:18:33 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 F1423B1384E; Tue, 19 Apr 2016 15:18:32 +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 BEF6D1141; Tue, 19 Apr 2016 15:18:32 +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 u3JFIVAd042222; Tue, 19 Apr 2016 15:18:31 GMT (envelope-from loos@FreeBSD.org) Received: (from loos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u3JFIVFA042221; Tue, 19 Apr 2016 15:18:31 GMT (envelope-from loos@FreeBSD.org) Message-Id: <201604191518.u3JFIVFA042221@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: loos set sender to loos@FreeBSD.org using -f From: Luiz Otavio O Souza Date: Tue, 19 Apr 2016 15:18:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r298272 - head/lib/libgpio 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.21 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, 19 Apr 2016 15:18:33 -0000 Author: loos Date: Tue Apr 19 15:18:31 2016 New Revision: 298272 URL: https://svnweb.freebsd.org/changeset/base/298272 Log: Use GPIOTOGGLE to toggle the pin state instead of read, modify and write. Modified: head/lib/libgpio/gpio.c Modified: head/lib/libgpio/gpio.c ============================================================================== --- head/lib/libgpio/gpio.c Tue Apr 19 15:08:35 2016 (r298271) +++ head/lib/libgpio/gpio.c Tue Apr 19 15:18:31 2016 (r298272) @@ -181,14 +181,14 @@ gpio_pin_set(gpio_handle_t handle, gpio_ int gpio_pin_toggle(gpio_handle_t handle, gpio_pin_t pin) { - gpio_value_t value; + struct gpio_req gpreq; - value = gpio_pin_get(handle, pin); - if (value == GPIO_VALUE_INVALID) + bzero(&gpreq, sizeof(gpreq)); + gpreq.gp_pin = pin; + if (ioctl(handle, GPIOTOGGLE, &gpreq) < 0) return (-1); - value = !value; - return (gpio_pin_set(handle, pin, value)); + return (0); } int