]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
tty: serial: fsl_lpuart: Constify struct lpuart_soc_data
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Sat, 28 Jun 2025 06:35:06 +0000 (08:35 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 29 Jun 2025 12:24:34 +0000 (14:24 +0200)
'struct lpuart_soc_data' are not modified in this driver.

Constifying these structures moves some data to a read-only section, so
increases overall security.

This also makes the code more consistent.

On a x86_64, with allmodconfig, as an example:
Before:
======
   text    data     bss     dec     hex filename
 172668   23470     128  196266   2feaa drivers/tty/serial/fsl_lpuart.o

After:
=====
   text    data     bss     dec     hex filename
 172924   23214     128  196266   2feaa drivers/tty/serial/fsl_lpuart.o

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Reviewed-by: Sherry Sun <sherry.sun@nxp.com>
Link: https://lore.kernel.org/r/93dc860a06f92236db283c71be0640cc477b7291.1751092467.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/fsl_lpuart.c

index 2790b4078e7ed49399645ab2a2072b891d28c4b9..c9519e649e826819a3c05c637e8fa33b35f6d067 100644 (file)
@@ -318,27 +318,27 @@ static const struct lpuart_soc_data ls1028a_data = {
        .rx_watermark = 0,
 };
 
-static struct lpuart_soc_data imx7ulp_data = {
+static const struct lpuart_soc_data imx7ulp_data = {
        .devtype = IMX7ULP_LPUART,
        .iotype = UPIO_MEM32,
        .reg_off = IMX_REG_OFF,
        .rx_watermark = 1,
 };
 
-static struct lpuart_soc_data imx8ulp_data = {
+static const struct lpuart_soc_data imx8ulp_data = {
        .devtype = IMX8ULP_LPUART,
        .iotype = UPIO_MEM32,
        .reg_off = IMX_REG_OFF,
        .rx_watermark = 3,
 };
 
-static struct lpuart_soc_data imx8qxp_data = {
+static const struct lpuart_soc_data imx8qxp_data = {
        .devtype = IMX8QXP_LPUART,
        .iotype = UPIO_MEM32,
        .reg_off = IMX_REG_OFF,
        .rx_watermark = 7, /* A lower watermark is ideal for low baud rates. */
 };
-static struct lpuart_soc_data imxrt1050_data = {
+static const struct lpuart_soc_data imxrt1050_data = {
        .devtype = IMXRT1050_LPUART,
        .iotype = UPIO_MEM32,
        .reg_off = IMX_REG_OFF,