Skip to content

Commit 5e40169

Browse files
tititiou36gregkh
authored andcommitted
tty: serial: fsl_lpuart: Constify struct lpuart_soc_data
'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>
1 parent d2db0d7 commit 5e40169

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

drivers/tty/serial/fsl_lpuart.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -318,27 +318,27 @@ static const struct lpuart_soc_data ls1028a_data = {
318318
.rx_watermark = 0,
319319
};
320320

321-
static struct lpuart_soc_data imx7ulp_data = {
321+
static const struct lpuart_soc_data imx7ulp_data = {
322322
.devtype = IMX7ULP_LPUART,
323323
.iotype = UPIO_MEM32,
324324
.reg_off = IMX_REG_OFF,
325325
.rx_watermark = 1,
326326
};
327327

328-
static struct lpuart_soc_data imx8ulp_data = {
328+
static const struct lpuart_soc_data imx8ulp_data = {
329329
.devtype = IMX8ULP_LPUART,
330330
.iotype = UPIO_MEM32,
331331
.reg_off = IMX_REG_OFF,
332332
.rx_watermark = 3,
333333
};
334334

335-
static struct lpuart_soc_data imx8qxp_data = {
335+
static const struct lpuart_soc_data imx8qxp_data = {
336336
.devtype = IMX8QXP_LPUART,
337337
.iotype = UPIO_MEM32,
338338
.reg_off = IMX_REG_OFF,
339339
.rx_watermark = 7, /* A lower watermark is ideal for low baud rates. */
340340
};
341-
static struct lpuart_soc_data imxrt1050_data = {
341+
static const struct lpuart_soc_data imxrt1050_data = {
342342
.devtype = IMXRT1050_LPUART,
343343
.iotype = UPIO_MEM32,
344344
.reg_off = IMX_REG_OFF,

0 commit comments

Comments
 (0)