Date: Tue, 13 Dec 2016 03:36:41 +0000 (UTC) From: Luiz Otavio O Souza <loos@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310000 - head/sys/dev/gpio Message-ID: <201612130336.uBD3afXR092603@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: loos Date: Tue Dec 13 03:36:41 2016 New Revision: 310000 URL: https://svnweb.freebsd.org/changeset/base/310000 Log: Remove a too strict test and instead, just filter the passed flags with the supported capabilities. Spotted by: yamori813@yahoo.co.jp (Hiroki Mori) MFC after: 2 weeks Modified: head/sys/dev/gpio/gpiobus.c Modified: head/sys/dev/gpio/gpiobus.c ============================================================================== --- head/sys/dev/gpio/gpiobus.c Tue Dec 13 03:26:12 2016 (r309999) +++ head/sys/dev/gpio/gpiobus.c Tue Dec 13 03:36:41 2016 (r310000) @@ -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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201612130336.uBD3afXR092603>