* [PATCH] serial: imx: Drop a few unneeded casts
@ 2023-03-02 11:54 ` Uwe Kleine-König
0 siblings, 0 replies; 6+ messages in thread
From: Uwe Kleine-König @ 2023-03-02 11:54 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 | 17 ++++++-----------
1 file changed, 6 insertions(+), 11 deletions(-)
diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
index 523f296d5747..84bc0e768726 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;
}
/*
@@ -1818,10 +1816,8 @@ static const char *imx_uart_type(struct uart_port *port)
*/
static void imx_uart_config_port(struct uart_port *port, int flags)
{
- struct imx_port *sport = (struct imx_port *)port;
-
if (flags & UART_CONFIG_TYPE)
- sport->port.type = PORT_IMX;
+ port->type = PORT_IMX;
}
/*
@@ -1832,20 +1828,19 @@ static void imx_uart_config_port(struct uart_port *port, int flags)
static int
imx_uart_verify_port(struct uart_port *port, struct serial_struct *ser)
{
- struct imx_port *sport = (struct imx_port *)port;
int ret = 0;
if (ser->type != PORT_UNKNOWN && ser->type != PORT_IMX)
ret = -EINVAL;
- if (sport->port.irq != ser->irq)
+ if (port->irq != ser->irq)
ret = -EINVAL;
if (ser->io_type != UPIO_MEM)
ret = -EINVAL;
- if (sport->port.uartclk / 16 != ser->baud_base)
+ if (port->uartclk / 16 != ser->baud_base)
ret = -EINVAL;
- if (sport->port.mapbase != (unsigned long)ser->iomem_base)
+ if (port->mapbase != (unsigned long)ser->iomem_base)
ret = -EINVAL;
- if (sport->port.iobase != ser->port)
+ if (port->iobase != ser->port)
ret = -EINVAL;
if (ser->hub6 != 0)
ret = -EINVAL;
--
2.39.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH] serial: imx: Drop a few unneeded casts
@ 2023-03-02 11:54 ` Uwe Kleine-König
0 siblings, 0 replies; 6+ messages in thread
From: Uwe Kleine-König @ 2023-03-02 11:54 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 | 17 ++++++-----------
1 file changed, 6 insertions(+), 11 deletions(-)
diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
index 523f296d5747..84bc0e768726 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;
}
/*
@@ -1818,10 +1816,8 @@ static const char *imx_uart_type(struct uart_port *port)
*/
static void imx_uart_config_port(struct uart_port *port, int flags)
{
- struct imx_port *sport = (struct imx_port *)port;
-
if (flags & UART_CONFIG_TYPE)
- sport->port.type = PORT_IMX;
+ port->type = PORT_IMX;
}
/*
@@ -1832,20 +1828,19 @@ static void imx_uart_config_port(struct uart_port *port, int flags)
static int
imx_uart_verify_port(struct uart_port *port, struct serial_struct *ser)
{
- struct imx_port *sport = (struct imx_port *)port;
int ret = 0;
if (ser->type != PORT_UNKNOWN && ser->type != PORT_IMX)
ret = -EINVAL;
- if (sport->port.irq != ser->irq)
+ if (port->irq != ser->irq)
ret = -EINVAL;
if (ser->io_type != UPIO_MEM)
ret = -EINVAL;
- if (sport->port.uartclk / 16 != ser->baud_base)
+ if (port->uartclk / 16 != ser->baud_base)
ret = -EINVAL;
- if (sport->port.mapbase != (unsigned long)ser->iomem_base)
+ if (port->mapbase != (unsigned long)ser->iomem_base)
ret = -EINVAL;
- if (sport->port.iobase != ser->port)
+ if (port->iobase != ser->port)
ret = -EINVAL;
if (ser->hub6 != 0)
ret = -EINVAL;
--
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] 6+ messages in thread
* Re: [PATCH] serial: imx: Drop a few unneeded casts
2023-03-02 11:54 ` Uwe Kleine-König
@ 2023-03-02 15:35 ` Ilpo Järvinen
-1 siblings, 0 replies; 6+ messages in thread
From: Ilpo Järvinen @ 2023-03-02 15:35 UTC (permalink / raw)
To: Uwe Kleine-König
Cc: Greg Kroah-Hartman, Jiri Slaby, Shawn Guo,
Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
linux-serial, linux-arm-kernel
[-- Attachment #1: Type: text/plain, Size: 2348 bytes --]
On Thu, 2 Mar 2023, 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.
I don't know what this sentence is supposed to mean (did you forgot to
add a negation into it)?
The code changes :-) are okay though:
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
--
i.
>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---
> drivers/tty/serial/imx.c | 17 ++++++-----------
> 1 file changed, 6 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
> index 523f296d5747..84bc0e768726 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;
> }
>
> /*
> @@ -1818,10 +1816,8 @@ static const char *imx_uart_type(struct uart_port *port)
> */
> static void imx_uart_config_port(struct uart_port *port, int flags)
> {
> - struct imx_port *sport = (struct imx_port *)port;
> -
> if (flags & UART_CONFIG_TYPE)
> - sport->port.type = PORT_IMX;
> + port->type = PORT_IMX;
> }
>
> /*
> @@ -1832,20 +1828,19 @@ static void imx_uart_config_port(struct uart_port *port, int flags)
> static int
> imx_uart_verify_port(struct uart_port *port, struct serial_struct *ser)
> {
> - struct imx_port *sport = (struct imx_port *)port;
> int ret = 0;
>
> if (ser->type != PORT_UNKNOWN && ser->type != PORT_IMX)
> ret = -EINVAL;
> - if (sport->port.irq != ser->irq)
> + if (port->irq != ser->irq)
> ret = -EINVAL;
> if (ser->io_type != UPIO_MEM)
> ret = -EINVAL;
> - if (sport->port.uartclk / 16 != ser->baud_base)
> + if (port->uartclk / 16 != ser->baud_base)
> ret = -EINVAL;
> - if (sport->port.mapbase != (unsigned long)ser->iomem_base)
> + if (port->mapbase != (unsigned long)ser->iomem_base)
> ret = -EINVAL;
> - if (sport->port.iobase != ser->port)
> + if (port->iobase != ser->port)
> ret = -EINVAL;
> if (ser->hub6 != 0)
> ret = -EINVAL;
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] serial: imx: Drop a few unneeded casts
@ 2023-03-02 15:35 ` Ilpo Järvinen
0 siblings, 0 replies; 6+ messages in thread
From: Ilpo Järvinen @ 2023-03-02 15:35 UTC (permalink / raw)
To: Uwe Kleine-König
Cc: Greg Kroah-Hartman, Jiri Slaby, Shawn Guo,
Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
linux-serial, linux-arm-kernel
[-- Attachment #1: Type: text/plain, Size: 2348 bytes --]
On Thu, 2 Mar 2023, 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.
I don't know what this sentence is supposed to mean (did you forgot to
add a negation into it)?
The code changes :-) are okay though:
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
--
i.
>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---
> drivers/tty/serial/imx.c | 17 ++++++-----------
> 1 file changed, 6 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
> index 523f296d5747..84bc0e768726 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;
> }
>
> /*
> @@ -1818,10 +1816,8 @@ static const char *imx_uart_type(struct uart_port *port)
> */
> static void imx_uart_config_port(struct uart_port *port, int flags)
> {
> - struct imx_port *sport = (struct imx_port *)port;
> -
> if (flags & UART_CONFIG_TYPE)
> - sport->port.type = PORT_IMX;
> + port->type = PORT_IMX;
> }
>
> /*
> @@ -1832,20 +1828,19 @@ static void imx_uart_config_port(struct uart_port *port, int flags)
> static int
> imx_uart_verify_port(struct uart_port *port, struct serial_struct *ser)
> {
> - struct imx_port *sport = (struct imx_port *)port;
> int ret = 0;
>
> if (ser->type != PORT_UNKNOWN && ser->type != PORT_IMX)
> ret = -EINVAL;
> - if (sport->port.irq != ser->irq)
> + if (port->irq != ser->irq)
> ret = -EINVAL;
> if (ser->io_type != UPIO_MEM)
> ret = -EINVAL;
> - if (sport->port.uartclk / 16 != ser->baud_base)
> + if (port->uartclk / 16 != ser->baud_base)
> ret = -EINVAL;
> - if (sport->port.mapbase != (unsigned long)ser->iomem_base)
> + if (port->mapbase != (unsigned long)ser->iomem_base)
> ret = -EINVAL;
> - if (sport->port.iobase != ser->port)
> + if (port->iobase != ser->port)
> ret = -EINVAL;
> if (ser->hub6 != 0)
> ret = -EINVAL;
>
[-- 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] 6+ messages in thread
* Re: [PATCH] serial: imx: Drop a few unneeded casts
2023-03-02 15:35 ` Ilpo Järvinen
@ 2023-03-02 16:06 ` Uwe Kleine-König
-1 siblings, 0 replies; 6+ messages in thread
From: Uwe Kleine-König @ 2023-03-02 16:06 UTC (permalink / raw)
To: Ilpo Järvinen
Cc: linux-serial, Jiri Slaby, Greg Kroah-Hartman, NXP Linux Team,
Pengutronix Kernel Team, Shawn Guo, Fabio Estevam,
linux-arm-kernel
[-- Attachment #1: Type: text/plain, Size: 923 bytes --]
Hello Ilpo,
On Thu, Mar 02, 2023 at 05:35:17PM +0200, Ilpo Järvinen wrote:
> On Thu, 2 Mar 2023, 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.
>
> I don't know what this sentence is supposed to mean (did you forgot to
> add a negation into it)?
>
> The code changes :-) are okay though:
Yes, I intended to write:
This introduces no changes to the generated binary.
> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Thanks.
Greg isn't in patch collecting mood currently anyhow, so I will wait a
bit before sending out a fixed patch.
Best regards
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] 6+ messages in thread
* Re: [PATCH] serial: imx: Drop a few unneeded casts
@ 2023-03-02 16:06 ` Uwe Kleine-König
0 siblings, 0 replies; 6+ messages in thread
From: Uwe Kleine-König @ 2023-03-02 16:06 UTC (permalink / raw)
To: Ilpo Järvinen
Cc: linux-serial, Jiri Slaby, Greg Kroah-Hartman, NXP Linux Team,
Pengutronix Kernel Team, Shawn Guo, Fabio Estevam,
linux-arm-kernel
[-- Attachment #1.1: Type: text/plain, Size: 923 bytes --]
Hello Ilpo,
On Thu, Mar 02, 2023 at 05:35:17PM +0200, Ilpo Järvinen wrote:
> On Thu, 2 Mar 2023, 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.
>
> I don't know what this sentence is supposed to mean (did you forgot to
> add a negation into it)?
>
> The code changes :-) are okay though:
Yes, I intended to write:
This introduces no changes to the generated binary.
> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Thanks.
Greg isn't in patch collecting mood currently anyhow, so I will wait a
bit before sending out a fixed patch.
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] 6+ messages in thread
end of thread, other threads:[~2023-03-02 16:46 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-02 11:54 [PATCH] serial: imx: Drop a few unneeded casts Uwe Kleine-König
2023-03-02 11:54 ` Uwe Kleine-König
2023-03-02 15:35 ` Ilpo Järvinen
2023-03-02 15:35 ` Ilpo Järvinen
2023-03-02 16:06 ` Uwe Kleine-König
2023-03-02 16:06 ` Uwe Kleine-König
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.