linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] serial: 8250_mtk: make two read-only arrays static const
@ 2022-03-07 23:00 Colin Ian King
  2022-03-08  6:31 ` Jiri Slaby
  0 siblings, 1 reply; 2+ messages in thread
From: Colin Ian King @ 2022-03-07 23:00 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby, Matthias Brugger, linux-serial,
	linux-arm-kernel, linux-mediatek
  Cc: kernel-janitors, linux-kernel

Don't populate the read-only arrays fraction_L_mapping and
fraction_M_mapping on the stack but instead make them static
const. Also makes the object code a little smaller.

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
---
 drivers/tty/serial/8250/8250_mtk.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/tty/serial/8250/8250_mtk.c b/drivers/tty/serial/8250/8250_mtk.c
index fb65dc601b23..f4a0caa56f84 100644
--- a/drivers/tty/serial/8250/8250_mtk.c
+++ b/drivers/tty/serial/8250/8250_mtk.c
@@ -289,10 +289,10 @@ static void
 mtk8250_set_termios(struct uart_port *port, struct ktermios *termios,
 			struct ktermios *old)
 {
-	unsigned short fraction_L_mapping[] = {
+	static const unsigned short fraction_L_mapping[] = {
 		0, 1, 0x5, 0x15, 0x55, 0x57, 0x57, 0x77, 0x7F, 0xFF, 0xFF
 	};
-	unsigned short fraction_M_mapping[] = {
+	static const unsigned short fraction_M_mapping[] = {
 		0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 3
 	};
 	struct uart_8250_port *up = up_to_u8250p(port);
-- 
2.35.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] 2+ messages in thread

* Re: [PATCH] serial: 8250_mtk: make two read-only arrays static const
  2022-03-07 23:00 [PATCH] serial: 8250_mtk: make two read-only arrays static const Colin Ian King
@ 2022-03-08  6:31 ` Jiri Slaby
  0 siblings, 0 replies; 2+ messages in thread
From: Jiri Slaby @ 2022-03-08  6:31 UTC (permalink / raw)
  To: Colin Ian King, Greg Kroah-Hartman, Matthias Brugger,
	linux-serial, linux-arm-kernel, linux-mediatek
  Cc: kernel-janitors, linux-kernel

On 08. 03. 22, 0:00, Colin Ian King wrote:
> Don't populate the read-only arrays fraction_L_mapping and
> fraction_M_mapping on the stack but instead make them static
> const. Also makes the object code a little smaller.
> 
> Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
> ---
>   drivers/tty/serial/8250/8250_mtk.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/tty/serial/8250/8250_mtk.c b/drivers/tty/serial/8250/8250_mtk.c
> index fb65dc601b23..f4a0caa56f84 100644
> --- a/drivers/tty/serial/8250/8250_mtk.c
> +++ b/drivers/tty/serial/8250/8250_mtk.c
> @@ -289,10 +289,10 @@ static void
>   mtk8250_set_termios(struct uart_port *port, struct ktermios *termios,
>   			struct ktermios *old)
>   {
> -	unsigned short fraction_L_mapping[] = {
> +	static const unsigned short fraction_L_mapping[] = {
>   		0, 1, 0x5, 0x15, 0x55, 0x57, 0x57, 0x77, 0x7F, 0xFF, 0xFF
>   	};
> -	unsigned short fraction_M_mapping[] = {
> +	static const unsigned short fraction_M_mapping[] = {
>   		0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 3
>   	};

And perhaps make them both unsigned char?

thanks,
-- 
js
suse labs

_______________________________________________
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] 2+ messages in thread

end of thread, other threads:[~2022-03-08  6:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-03-07 23:00 [PATCH] serial: 8250_mtk: make two read-only arrays static const Colin Ian King
2022-03-08  6:31 ` Jiri Slaby

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).