From: Fabio Estevam <festevam@gmail.com>
To: gregkh@linuxfoundation.org
Cc: u.kleine-koenig@pengutronix.de, linux-serial@vger.kernel.org,
Fabio Estevam <festevam@gmail.com>
Subject: [PATCH 1/2] serial: mxs-auart: Remove serial_mxs_probe_dt()
Date: Mon, 18 Jan 2021 12:21:53 -0300 [thread overview]
Message-ID: <20210118152154.1644569-1-festevam@gmail.com> (raw)
The mxs platform is devicetree-only, so there is no need to check
whether it was instantiated via devicetree.
Simplify the code my removing serial_mxs_probe_dt() and add its
content into the main probe function.
Signed-off-by: Fabio Estevam <festevam@gmail.com>
---
drivers/tty/serial/mxs-auart.c | 43 +++++++++-------------------------
1 file changed, 11 insertions(+), 32 deletions(-)
diff --git a/drivers/tty/serial/mxs-auart.c b/drivers/tty/serial/mxs-auart.c
index 8ecf622602cb..01fedb41cf93 100644
--- a/drivers/tty/serial/mxs-auart.c
+++ b/drivers/tty/serial/mxs-auart.c
@@ -1535,34 +1535,6 @@ static int mxs_get_clks(struct mxs_auart_port *s,
return err;
}
-/*
- * This function returns 1 if pdev isn't a device instatiated by dt, 0 if it
- * could successfully get all information from dt or a negative errno.
- */
-static int serial_mxs_probe_dt(struct mxs_auart_port *s,
- struct platform_device *pdev)
-{
- struct device_node *np = pdev->dev.of_node;
- int ret;
-
- if (!np)
- /* no device tree device */
- return 1;
-
- ret = of_alias_get_id(np, "serial");
- if (ret < 0) {
- dev_err(&pdev->dev, "failed to get alias id: %d\n", ret);
- return ret;
- }
- s->port.line = ret;
-
- if (of_get_property(np, "uart-has-rtscts", NULL) ||
- of_get_property(np, "fsl,uart-has-rtscts", NULL) /* deprecated */)
- set_bit(MXS_AUART_RTSCTS, &s->flags);
-
- return 0;
-}
-
static int mxs_auart_init_gpios(struct mxs_auart_port *s, struct device *dev)
{
enum mctrl_gpio_idx i;
@@ -1631,6 +1603,7 @@ static int mxs_auart_request_gpio_irq(struct mxs_auart_port *s)
static int mxs_auart_probe(struct platform_device *pdev)
{
+ struct device_node *np = pdev->dev.of_node;
struct mxs_auart_port *s;
u32 version;
int ret, irq;
@@ -1643,11 +1616,17 @@ static int mxs_auart_probe(struct platform_device *pdev)
s->port.dev = &pdev->dev;
s->dev = &pdev->dev;
- ret = serial_mxs_probe_dt(s, pdev);
- if (ret > 0)
- s->port.line = pdev->id < 0 ? 0 : pdev->id;
- else if (ret < 0)
+ ret = of_alias_get_id(np, "serial");
+ if (ret < 0) {
+ dev_err(&pdev->dev, "failed to get alias id: %d\n", ret);
return ret;
+ }
+ s->port.line = ret;
+
+ if (of_get_property(np, "uart-has-rtscts", NULL) ||
+ of_get_property(np, "fsl,uart-has-rtscts", NULL) /* deprecated */)
+ set_bit(MXS_AUART_RTSCTS, &s->flags);
+
if (s->port.line >= ARRAY_SIZE(auart_port)) {
dev_err(&pdev->dev, "serial%d out of range\n", s->port.line);
return -EINVAL;
--
2.17.1
next reply other threads:[~2021-01-18 15:25 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-18 15:21 Fabio Estevam [this message]
2021-01-18 15:21 ` [PATCH 2/2] serial: mxs-auart: Remove <asm/cacheflush.h> Fabio Estevam
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=20210118152154.1644569-1-festevam@gmail.com \
--to=festevam@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-serial@vger.kernel.org \
--cc=u.kleine-koenig@pengutronix.de \
/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 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).