From: Russell King - ARM Linux <linux@arm.linux.org.uk>
To: Janusz Uzycki <j.uzycki@elproma.com.pl>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
devicetree@vger.kernel.org,
Richard Genoud <richard.genoud@gmail.com>,
Jiri Slaby <jslaby@suse.cz>,
linux-serial@vger.kernel.org, Fabio Estevam <festevam@gmail.com>,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 2/4] serial: mxs-auart: use mctrl_gpio helpers for handling modem signals
Date: Sat, 27 Sep 2014 11:07:38 +0100 [thread overview]
Message-ID: <20140927100737.GC5182@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <1411811197-12638-3-git-send-email-j.uzycki@elproma.com.pl>
On Sat, Sep 27, 2014 at 11:46:35AM +0200, Janusz Uzycki wrote:
> @@ -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.
> @@ -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.
WARNING: multiple messages have this Message-ID (diff)
From: linux@arm.linux.org.uk (Russell King - ARM Linux)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/4] serial: mxs-auart: use mctrl_gpio helpers for handling modem signals
Date: Sat, 27 Sep 2014 11:07:38 +0100 [thread overview]
Message-ID: <20140927100737.GC5182@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <1411811197-12638-3-git-send-email-j.uzycki@elproma.com.pl>
On Sat, Sep 27, 2014 at 11:46:35AM +0200, Janusz Uzycki wrote:
> @@ -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.
> @@ -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.
next prev parent reply other threads:[~2014-09-27 10:07 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-27 9:46 [PATCH v3] serial: mxs-auart: gpios as modem signals (dirty) Janusz Uzycki
2014-09-27 9:46 ` Janusz Uzycki
2014-09-27 9:46 ` [PATCH 1/4] serial: mxs-auart: ctrl removed from mxs_auart_port Janusz Uzycki
2014-09-27 9:46 ` Janusz Uzycki
2014-09-27 10:03 ` Russell King - ARM Linux
2014-09-27 10:03 ` Russell King - ARM Linux
2014-09-27 11:44 ` [PATCH] serial: mxs-auart: clean get_mctrl and set_mctrl Janusz Uzycki
2014-09-27 11:44 ` Janusz Uzycki
2014-09-27 9:46 ` [PATCH 2/4] serial: mxs-auart: use mctrl_gpio helpers for handling modem signals Janusz Uzycki
2014-09-27 9:46 ` Janusz Uzycki
2014-09-27 10:07 ` Russell King - ARM Linux [this message]
2014-09-27 10:07 ` Russell King - ARM Linux
2014-09-27 20:32 ` serial: mxs-auart: gpios as modem signals (dirty) Janusz Uzycki
2014-09-27 20:32 ` Janusz Uzycki
2014-09-27 20:32 ` [PATCH 1/2] serial: mxs-auart: use mctrl_gpio helpers for handling modem signals Janusz Uzycki
2014-09-27 20:32 ` Janusz Uzycki
2014-09-27 20:32 ` [PATCH 2/2] serial: mxs-auart: add interrupts for modem control lines Janusz Uzycki
2014-09-27 20:32 ` Janusz Uzycki
2014-09-27 10:33 ` [PATCH 2/4] serial: mxs-auart: use mctrl_gpio helpers for handling modem signals Janusz Użycki
2014-09-27 10:33 ` Janusz Użycki
2014-09-27 10:54 ` Russell King - ARM Linux
2014-09-27 10:54 ` Russell King - ARM Linux
2014-09-27 11:15 ` Janusz Użycki
2014-09-27 11:15 ` Janusz Użycki
2014-09-27 12:18 ` Russell King - ARM Linux
2014-09-27 12:18 ` Russell King - ARM Linux
2014-09-27 9:46 ` [PATCH 3/4] serial: mxs-auart: add interrupts for modem control lines Janusz Uzycki
2014-09-27 9:46 ` Janusz Uzycki
2014-10-24 15:32 ` Richard Genoud
2014-10-24 15:32 ` Richard Genoud
2014-10-24 15:36 ` Janusz Użycki
2014-10-24 15:36 ` Janusz Użycki
2014-09-27 9:46 ` [PATCH 4/4] serial: mxs-auart: enable PPS support Janusz Uzycki
2014-09-27 9:46 ` Janusz Uzycki
2014-09-27 12:47 ` Sergei Shtylyov
2014-09-27 12:47 ` Sergei Shtylyov
2014-09-27 13:36 ` [PATCH] " Janusz Uzycki
2014-09-27 13:36 ` Janusz Uzycki
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140927100737.GC5182@n2100.arm.linux.org.uk \
--to=linux@arm.linux.org.uk \
--cc=devicetree@vger.kernel.org \
--cc=festevam@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=j.uzycki@elproma.com.pl \
--cc=jslaby@suse.cz \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-serial@vger.kernel.org \
--cc=richard.genoud@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.