LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH 1/2] serial: mctrl_gpio: Check if GPIO property exisits before requesting it
@ 2019-05-22 12:11 Stefan Roese
  2019-05-22 12:11 ` [PATCH 2/2] tty/serial/8250: use mctrl_gpio helpers Stefan Roese
  2019-05-24  7:56 ` [PATCH 1/2] serial: mctrl_gpio: Check if GPIO property exisits before requesting it Greg Kroah-Hartman
  0 siblings, 2 replies; 3+ messages in thread
From: Stefan Roese @ 2019-05-22 12:11 UTC (permalink / raw)
  To: linux-serial
  Cc: linux-kernel, Mika Westerberg, Andy Shevchenko, Yegor Yefremov,
	Greg Kroah-Hartman, Giulio Benetti

This patch adds a check for the GPIOs property existence, before the
GPIO is requested. This fixes an issue seen when the 8250 mctrl_gpio
support is added (2nd patch in this patch series) on x86 platforms using
ACPI. Please find a details problem description here:

https://lkml.org/lkml/2016/8/9/357

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Mika Westerberg <mika.westerberg@linux.intel.com>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Yegor Yefremov <yegorslists@googlemail.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Giulio Benetti <giulio.benetti@micronovasrl.com>
---
 drivers/tty/serial/serial_mctrl_gpio.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/tty/serial/serial_mctrl_gpio.c b/drivers/tty/serial/serial_mctrl_gpio.c
index 39ed56214cd3..cac50b20a119 100644
--- a/drivers/tty/serial/serial_mctrl_gpio.c
+++ b/drivers/tty/serial/serial_mctrl_gpio.c
@@ -116,6 +116,13 @@ struct mctrl_gpios *mctrl_gpio_init_noauto(struct device *dev, unsigned int idx)
 
 	for (i = 0; i < UART_GPIO_MAX; i++) {
 		enum gpiod_flags flags;
+		char *gpio_str;
+
+		/* Check if GPIO property exists and continue if not */
+		gpio_str = kasprintf(GFP_KERNEL, "%s-gpios",
+				     mctrl_gpios_desc[i].name);
+		if (!device_property_present(dev, gpio_str))
+			continue;
 
 		if (mctrl_gpios_desc[i].dir_out)
 			flags = GPIOD_OUT_LOW;
-- 
2.21.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-05-24  7:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-22 12:11 [PATCH 1/2] serial: mctrl_gpio: Check if GPIO property exisits before requesting it Stefan Roese
2019-05-22 12:11 ` [PATCH 2/2] tty/serial/8250: use mctrl_gpio helpers Stefan Roese
2019-05-24  7:56 ` [PATCH 1/2] serial: mctrl_gpio: Check if GPIO property exisits before requesting it Greg Kroah-Hartman

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).