* [PATCH] serial: imx: Simplify imx_uart_type
@ 2023-03-02 11:48 Uwe Kleine-König
2023-03-02 11:55 ` Uwe Kleine-König
0 siblings, 1 reply; 4+ messages in thread
From: Uwe Kleine-König @ 2023-03-02 11:48 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: Jiri Slaby, Shawn Guo, Pengutronix Kernel Team, Fabio Estevam,
NXP Linux Team, linux-serial, linux-arm-kernel
There is no point in casting a struct uart_port to a struct imx_port
just to access the first member of the latter (a struct uart_port).
This introduces code changes.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
drivers/tty/serial/imx.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
index 523f296d5747..8d5933e83248 100644
--- a/drivers/tty/serial/imx.c
+++ b/drivers/tty/serial/imx.c
@@ -1808,9 +1808,7 @@ imx_uart_set_termios(struct uart_port *port, struct ktermios *termios,
static const char *imx_uart_type(struct uart_port *port)
{
- struct imx_port *sport = (struct imx_port *)port;
-
- return sport->port.type == PORT_IMX ? "IMX" : NULL;
+ return port->type == PORT_IMX ? "IMX" : NULL;
}
/*
--
2.39.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] serial: imx: Simplify imx_uart_type
2023-03-02 11:48 [PATCH] serial: imx: Simplify imx_uart_type Uwe Kleine-König
@ 2023-03-02 11:55 ` Uwe Kleine-König
2023-03-02 12:20 ` Alexander Stein
0 siblings, 1 reply; 4+ messages in thread
From: Uwe Kleine-König @ 2023-03-02 11:55 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: linux-serial, Jiri Slaby, Fabio Estevam, NXP Linux Team,
Pengutronix Kernel Team, Shawn Guo, linux-arm-kernel
[-- Attachment #1.1: Type: text/plain, Size: 678 bytes --]
Hello,
On Thu, Mar 02, 2023 at 12:48:10PM +0100, Uwe Kleine-König wrote:
> There is no point in casting a struct uart_port to a struct imx_port
> just to access the first member of the latter (a struct uart_port).
>
> This introduces code changes.
Please disregard this patch. While the patch is fine as is, I just
noticed a few more functions in this driver that can be simplified
accordingly. I'm about to send out an improved version (with a different
subject, so not called v2).
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | https://www.pengutronix.de/ |
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
[-- Attachment #2: Type: text/plain, Size: 176 bytes --]
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] serial: imx: Simplify imx_uart_type
2023-03-02 11:55 ` Uwe Kleine-König
@ 2023-03-02 12:20 ` Alexander Stein
2023-03-02 13:19 ` Uwe Kleine-König
0 siblings, 1 reply; 4+ messages in thread
From: Alexander Stein @ 2023-03-02 12:20 UTC (permalink / raw)
To: Greg Kroah-Hartman, linux-arm-kernel
Cc: linux-serial, Jiri Slaby, Fabio Estevam, NXP Linux Team,
Pengutronix Kernel Team, Shawn Guo, linux-arm-kernel,
Uwe Kleine-König
Hi Uwe,
Am Donnerstag, 2. März 2023, 12:55:47 CET schrieb Uwe Kleine-König:
> * PGP Signed by an unknown key
>
> Hello,
>
> On Thu, Mar 02, 2023 at 12:48:10PM +0100, Uwe Kleine-König wrote:
> > There is no point in casting a struct uart_port to a struct imx_port
> > just to access the first member of the latter (a struct uart_port).
> >
> > This introduces code changes.
>
> Please disregard this patch. While the patch is fine as is, I just
> noticed a few more functions in this driver that can be simplified
> accordingly. I'm about to send out an improved version (with a different
> subject, so not called v2).
Shouldn't this cast on the other locations be converted into a to_imx_port()
function using container_of as well?
Best regards,
Alexander
> Best regards
> Uwe
--
TQ-Systems GmbH | Mühlstraße 2, Gut Delling | 82229 Seefeld, Germany
Amtsgericht München, HRB 105018
Geschäftsführer: Detlef Schneider, Rüdiger Stahl, Stefan Schneider
http://www.tq-group.com/
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] serial: imx: Simplify imx_uart_type
2023-03-02 12:20 ` Alexander Stein
@ 2023-03-02 13:19 ` Uwe Kleine-König
0 siblings, 0 replies; 4+ messages in thread
From: Uwe Kleine-König @ 2023-03-02 13:19 UTC (permalink / raw)
To: Alexander Stein
Cc: Greg Kroah-Hartman, linux-arm-kernel, linux-serial, Jiri Slaby,
Shawn Guo, NXP Linux Team, Pengutronix Kernel Team, Fabio Estevam
[-- Attachment #1.1: Type: text/plain, Size: 1195 bytes --]
Hello,
On Thu, Mar 02, 2023 at 01:20:25PM +0100, Alexander Stein wrote:
> Am Donnerstag, 2. März 2023, 12:55:47 CET schrieb Uwe Kleine-König:
> > * PGP Signed by an unknown key
> >
> > Hello,
> >
> > On Thu, Mar 02, 2023 at 12:48:10PM +0100, Uwe Kleine-König wrote:
> > > There is no point in casting a struct uart_port to a struct imx_port
> > > just to access the first member of the latter (a struct uart_port).
> > >
> > > This introduces code changes.
> >
> > Please disregard this patch. While the patch is fine as is, I just
> > noticed a few more functions in this driver that can be simplified
> > accordingly. I'm about to send out an improved version (with a different
> > subject, so not called v2).
>
> Shouldn't this cast on the other locations be converted into a to_imx_port()
> function using container_of as well?
Yeah, I wondered about that, too, but didn't tackle that (yet). I'll
keep that for another day (or someone else, don't hesitate if you're
motivated).
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | https://www.pengutronix.de/ |
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
[-- Attachment #2: Type: text/plain, Size: 176 bytes --]
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-03-02 13:20 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-02 11:48 [PATCH] serial: imx: Simplify imx_uart_type Uwe Kleine-König
2023-03-02 11:55 ` Uwe Kleine-König
2023-03-02 12:20 ` Alexander Stein
2023-03-02 13:19 ` 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;
as well as URLs for NNTP newsgroup(s).