stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Patch "gpiolib: don't allow OPEN_DRAIN & OPEN_SOURCE flags simultaneously" has been added to the 4.15-stable tree
@ 2018-03-16 14:15 gregkh
  0 siblings, 0 replies; only message in thread
From: gregkh @ 2018-03-16 14:15 UTC (permalink / raw)
  To: brgl, alexander.levin, gregkh, linus.walleij; +Cc: stable, stable-commits


This is a note to let you know that I've just added the patch titled

    gpiolib: don't allow OPEN_DRAIN & OPEN_SOURCE flags simultaneously

to the 4.15-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     gpiolib-don-t-allow-open_drain-open_source-flags-simultaneously.patch
and it can be found in the queue-4.15 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.


>From foo@baz Fri Mar 16 15:11:07 CET 2018
From: Bartosz Golaszewski <brgl@bgdev.pl>
Date: Wed, 15 Nov 2017 16:47:43 +0100
Subject: gpiolib: don't allow OPEN_DRAIN & OPEN_SOURCE flags simultaneously

From: Bartosz Golaszewski <brgl@bgdev.pl>


[ Upstream commit 588fc3bceaf81bbd62e18af6f7bd475e01c2b7e8 ]

Do not allow OPEN_SOURCE & OPEN_DRAIN flags in a single request. If
the hardware actually supports enabling both at the same time the
electrical result would be disastrous.

Suggested-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/gpio/gpiolib.c |    9 +++++++++
 1 file changed, 9 insertions(+)

--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -460,6 +460,15 @@ static int linehandle_create(struct gpio
 	if (lflags & ~GPIOHANDLE_REQUEST_VALID_FLAGS)
 		return -EINVAL;
 
+	/*
+	 * Do not allow OPEN_SOURCE & OPEN_DRAIN flags in a single request. If
+	 * the hardware actually supports enabling both at the same time the
+	 * electrical result would be disastrous.
+	 */
+	if ((lflags & GPIOHANDLE_REQUEST_OPEN_DRAIN) &&
+	    (lflags & GPIOHANDLE_REQUEST_OPEN_SOURCE))
+		return -EINVAL;
+
 	/* OPEN_DRAIN and OPEN_SOURCE flags only make sense for output mode. */
 	if (!(lflags & GPIOHANDLE_REQUEST_OUTPUT) &&
 	    ((lflags & GPIOHANDLE_REQUEST_OPEN_DRAIN) ||


Patches currently in stable-queue which might be from brgl@bgdev.pl are

queue-4.15/gpiolib-don-t-allow-open_drain-open_source-flags-simultaneously.patch

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2018-03-16 14:16 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-16 14:15 Patch "gpiolib: don't allow OPEN_DRAIN & OPEN_SOURCE flags simultaneously" has been added to the 4.15-stable tree gregkh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).