From owner-svn-src-stable-11@freebsd.org Sat Dec 31 02:02:44 2016 Return-Path: Delivered-To: svn-src-stable-11@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 2ECDEC97275; Sat, 31 Dec 2016 02:02:44 +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 F23F81EC8; Sat, 31 Dec 2016 02:02:43 +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 uBV22hCA020891; Sat, 31 Dec 2016 02:02:43 GMT (envelope-from loos@FreeBSD.org) Received: (from loos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBV22h4Q020890; Sat, 31 Dec 2016 02:02:43 GMT (envelope-from loos@FreeBSD.org) Message-Id: <201612310202.uBV22h4Q020890@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: loos set sender to loos@FreeBSD.org using -f From: Luiz Otavio O Souza Date: Sat, 31 Dec 2016 02:02:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310885 - stable/11/sys/dev/gpio X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Dec 2016 02:02:44 -0000 Author: loos Date: Sat Dec 31 02:02:42 2016 New Revision: 310885 URL: https://svnweb.freebsd.org/changeset/base/310885 Log: MFC r310000: Remove a too strict test and instead, just filter the passed flags with the supported capabilities. Spotted by: yamori813@yahoo.co.jp (Hiroki Mori) Modified: stable/11/sys/dev/gpio/gpiobus.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/gpio/gpiobus.c ============================================================================== --- stable/11/sys/dev/gpio/gpiobus.c Sat Dec 31 02:00:51 2016 (r310884) +++ stable/11/sys/dev/gpio/gpiobus.c Sat Dec 31 02:02:42 2016 (r310885) @@ -120,9 +120,9 @@ int gpio_check_flags(uint32_t caps, uint32_t flags) { - /* Check for unwanted flags. */ - if ((flags & caps) == 0 || (flags & caps) != flags) - return (EINVAL); + /* Filter unwanted flags. */ + flags &= caps; + /* Cannot mix input/output together. */ if (flags & GPIO_PIN_INPUT && flags & GPIO_PIN_OUTPUT) return (EINVAL);