Re: [PATCH 1/3] serial: mctrl_gpio: restrict MCTRL initialization

From
Andy Shevchenko <hidden>
Date
2017-07-27 14:01:32
Also in
linux-omap, linux-serial
On Thu, 2017-07-27 at 15:17 +0200, yegorslists-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org wrote:
From: Yegor Yefremov <redacted>

GPIOs specified for serial port can be used either as GPIO driven
MCTRL
or as a wakeup-source. Use the latter property to abort the MCTRL
initialization.
Please, elaborate on a choice of error code for this (-ENOSYS).
Cc: Andy Shevchenko <redacted>
Suggested-by: I suppose.

I dunno about documentation part for this property, I leave it for DT
people to decide. Below part looks good to me.
quoted hunk
Signed-off-by: Yegor Yefremov <redacted>
---
 drivers/tty/serial/serial_mctrl_gpio.c | 4 ++++
 1 file changed, 4 insertions(+)
diff --git a/drivers/tty/serial/serial_mctrl_gpio.c
b/drivers/tty/serial/serial_mctrl_gpio.c
index d2da6aa..dce661c 100644
--- a/drivers/tty/serial/serial_mctrl_gpio.c
+++ b/drivers/tty/serial/serial_mctrl_gpio.c
@@ -19,6 +19,7 @@
 #include <linux/irq.h>
 #include <linux/gpio/consumer.h>
 #include <linux/termios.h>
+#include <linux/property.h>
 #include <linux/serial_core.h>
 #include <linux/module.h>
 
@@ -118,6 +119,9 @@ struct mctrl_gpios *mctrl_gpio_init_noauto(struct
device *dev, unsigned int idx)
 	struct mctrl_gpios *gpios;
 	enum mctrl_gpio_idx i;
 
+	if (device_property_present(dev, "wakeup-source"))
+		return ERR_PTR(-ENOSYS);
+
 	gpios = devm_kzalloc(dev, sizeof(*gpios), GFP_KERNEL);
 	if (!gpios)
 		return ERR_PTR(-ENOMEM);
-- 
Andy Shevchenko [off-list ref]
Intel Finland Oy
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Thread (1 message) 1 message, 1 author, last reply 2017-07-27
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help