Thread (19 messages) 19 messages, 4 authors, 2014-10-24

[PATCH 2/4] serial: mxs-auart: use mctrl_gpio helpers for handling modem signals

From: Russell King - ARM Linux <hidden>
Date: 2014-09-27 10:07:38
Also in: linux-devicetree, linux-serial

On Sat, Sep 27, 2014 at 11:46:35AM +0200, Janusz Uzycki wrote:
quoted hunk ↗ jump to hunk
@@ -635,7 +645,12 @@ static void mxs_auart_settermios(struct uart_port *u,
 		ctrl |= AUART_LINECTRL_STP2;
 
 	/* figure out the hardware flow control settings */
-	if (cflag & CRTSCTS) {
+	/* FIXME: Likely DMA could be enabled not only for HW flow control */
+	if (cflag & CRTSCTS &&
+			(IS_ERR_OR_NULL(mctrl_gpio_to_gpiod(s->gpios,
+					 UART_GPIO_RTS)) ||
+			 IS_ERR_OR_NULL(mctrl_gpio_to_gpiod(s->gpios,
+					 UART_GPIO_CTS)))) {
There has to be a better way to do this.
+static int mxs_auart_init_gpios(struct mxs_auart_port *s, struct device *dev)
+{
+	s->gpios = mctrl_gpio_init(dev, 0);
+	if (IS_ERR_OR_NULL(s->gpios))
+		return -1;
+	return 0;
I personally hate the practise of returning -1 - it ends up getting returned
to userspace as an error code, and it means EPERM.  If you want to indicate
success/failure, use the bool return type, and return true/false.
quoted hunk ↗ jump to hunk
@@ -1074,6 +1100,11 @@ static int mxs_auart_probe(struct platform_device *pdev)
 
 	platform_set_drvdata(pdev, s);
 
+	ret = mxs_auart_init_gpios(s, &pdev->dev);
+	if (ret < 0)
+		dev_err(&pdev->dev, "%s",
+			"Failed to initialize GPIOs. The serial port may not work as expected");
Does the "%s" do anything for this message?  More importantly though, it's
lacking a newline.

-- 
FTTC broadband for 0.8mile line: currently at 9.5Mbps down 400kbps up
according to speedtest.net.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help