* [PATCH] serial: imx: Move imx_uart_probe_dt() content into probe()
@ 2020-12-09 21:47 Fabio Estevam
2020-12-10 12:59 ` Uwe Kleine-König
0 siblings, 1 reply; 2+ messages in thread
From: Fabio Estevam @ 2020-12-09 21:47 UTC (permalink / raw)
To: gregkh; +Cc: u.kleine-koenig, linux-serial, Fabio Estevam
Now that the driver only probes via devicetree, we can move the
content of imx_uart_probe_dt() directly into imx_uart_probe() to
make the code simpler.
Suggested-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Fabio Estevam <festevam@gmail.com>
---
drivers/tty/serial/imx.c | 64 +++++++++++++++-------------------------
1 file changed, 24 insertions(+), 40 deletions(-)
diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
index 2452e57a5663..425624d794dd 100644
--- a/drivers/tty/serial/imx.c
+++ b/drivers/tty/serial/imx.c
@@ -2163,44 +2163,6 @@ static struct uart_driver imx_uart_uart_driver = {
.cons = IMX_CONSOLE,
};
-/*
- * This function returns 0 iff it could successfully get all information
- * from dt or a negative errno.
- */
-static int imx_uart_probe_dt(struct imx_port *sport,
- struct platform_device *pdev)
-{
- struct device_node *np = pdev->dev.of_node;
- int ret;
-
- sport->devdata = of_device_get_match_data(&pdev->dev);
-
- ret = of_alias_get_id(np, "serial");
- if (ret < 0) {
- dev_err(&pdev->dev, "failed to get alias id, errno %d\n", ret);
- return ret;
- }
- sport->port.line = ret;
-
- if (of_get_property(np, "uart-has-rtscts", NULL) ||
- of_get_property(np, "fsl,uart-has-rtscts", NULL) /* deprecated */)
- sport->have_rtscts = 1;
-
- if (of_get_property(np, "fsl,dte-mode", NULL))
- sport->dte_mode = 1;
-
- if (of_get_property(np, "rts-gpios", NULL))
- sport->have_rtsgpio = 1;
-
- if (of_get_property(np, "fsl,inverted-tx", NULL))
- sport->inverted_tx = 1;
-
- if (of_get_property(np, "fsl,inverted-rx", NULL))
- sport->inverted_rx = 1;
-
- return 0;
-}
-
static enum hrtimer_restart imx_trigger_start_tx(struct hrtimer *t)
{
struct imx_port *sport = container_of(t, struct imx_port, trigger_start_tx);
@@ -2229,6 +2191,7 @@ static enum hrtimer_restart imx_trigger_stop_tx(struct hrtimer *t)
static int imx_uart_probe(struct platform_device *pdev)
{
+ struct device_node *np = pdev->dev.of_node;
struct imx_port *sport;
void __iomem *base;
int ret = 0;
@@ -2240,9 +2203,30 @@ static int imx_uart_probe(struct platform_device *pdev)
if (!sport)
return -ENOMEM;
- ret = imx_uart_probe_dt(sport, pdev);
- if (ret < 0)
+ sport->devdata = of_device_get_match_data(&pdev->dev);
+
+ ret = of_alias_get_id(np, "serial");
+ if (ret < 0) {
+ dev_err(&pdev->dev, "failed to get alias id, errno %d\n", ret);
return ret;
+ }
+ sport->port.line = ret;
+
+ if (of_get_property(np, "uart-has-rtscts", NULL) ||
+ of_get_property(np, "fsl,uart-has-rtscts", NULL) /* deprecated */)
+ sport->have_rtscts = 1;
+
+ if (of_get_property(np, "fsl,dte-mode", NULL))
+ sport->dte_mode = 1;
+
+ if (of_get_property(np, "rts-gpios", NULL))
+ sport->have_rtsgpio = 1;
+
+ if (of_get_property(np, "fsl,inverted-tx", NULL))
+ sport->inverted_tx = 1;
+
+ if (of_get_property(np, "fsl,inverted-rx", NULL))
+ sport->inverted_rx = 1;
if (sport->port.line >= ARRAY_SIZE(imx_uart_ports)) {
dev_err(&pdev->dev, "serial%d out of range\n",
--
2.17.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] serial: imx: Move imx_uart_probe_dt() content into probe()
2020-12-09 21:47 [PATCH] serial: imx: Move imx_uart_probe_dt() content into probe() Fabio Estevam
@ 2020-12-10 12:59 ` Uwe Kleine-König
0 siblings, 0 replies; 2+ messages in thread
From: Uwe Kleine-König @ 2020-12-10 12:59 UTC (permalink / raw)
To: Fabio Estevam; +Cc: gregkh, linux-serial
[-- Attachment #1: Type: text/plain, Size: 622 bytes --]
On Wed, Dec 09, 2020 at 06:47:12PM -0300, Fabio Estevam wrote:
> Now that the driver only probes via devicetree, we can move the
> content of imx_uart_probe_dt() directly into imx_uart_probe() to
> make the code simpler.
>
> Suggested-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> Signed-off-by: Fabio Estevam <festevam@gmail.com>
Reviewed-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Thanks for picking up the suggestion,
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | https://www.pengutronix.de/ |
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-12-10 13:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-12-09 21:47 [PATCH] serial: imx: Move imx_uart_probe_dt() content into probe() Fabio Estevam
2020-12-10 12:59 ` Uwe Kleine-König
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox