tty: serial: constify uartlite_reg_ops structs
Subsystems (2)
PATCH 1/1 tty: serial: constify uartlite_reg_ops structs
Constifies uartlite_reg_ops structures in tty's
serial port driver since they are not modified
after their initialization.
Detected and found using Coccinelle.
Suggested-by Julia Lawall <[email protected]>
Signed-off-by Aya Mahfouz <[email protected]>
--- drivers/tty/serial/uartlite.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/tty/serial/uartlite.c +4 -4
@@ -72,7 +72,7 @@ static void uartlite_outbe32(u32 val, void __iomem *addr)iowrite32be (val, addr); } -static struct uartlite_reg_ops uartlite_be = { +static const struct uartlite_reg_ops uartlite_be = { .in = uartlite_inbe32, .out = uartlite_outbe32, };
@@ -87,21 +87,21 @@ static void uartlite_outle32(u32 val, void __iomem *addr)iowrite32 (val, addr); } -static struct uartlite_reg_ops uartlite_le = { +static const struct uartlite_reg_ops uartlite_le = { .in = uartlite_inle32, .out = uartlite_outle32, };static inline u32 uart_in32 (u32 offset,struct uart_port *port) { -struct uartlite_reg_ops *reg_ops = port->private_data; +const struct uartlite_reg_ops *reg_ops = port->private_data;return reg_ops->in (port->membase + offset); }static inline void uart_out32 (u32 val,u32 offset,struct uart_port *port) { -struct uartlite_reg_ops *reg_ops = port->private_data; +const struct uartlite_reg_ops *reg_ops = port->private_data; reg_ops->out (val, port->membase + offset); }
Signature · 6 lines
2.4.3 -- Kind Regards, Aya Saif El-yazal Mahfouz
Quoted 57 lines · Aya Mahfouz
Constifies
uartlite_reg_opsstructures in tty's
serial port driver since they are not modified
after their initialization.Detected and found using Coccinelle.
Suggested-by Julia Lawall <[email protected]>Signed-off-by Aya Mahfouz <[email protected]>--- drivers/tty/serial/uartlite.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)drivers/tty/serial/uartlite.c +4
-4@@ -72,7 +72,7 @@ static void uartlite_outbe32(u32 val, void __iomem *addr)iowrite32be (val, addr); } -static struct uartlite_reg_ops uartlite_be = { +static const struct uartlite_reg_ops uartlite_be = { .in = uartlite_inbe32, .out = uartlite_outbe32, };@@ -87,21 +87,21 @@ static void uartlite_outle32(u32 val, void __iomem *addr)iowrite32 (val, addr); } -static struct uartlite_reg_ops uartlite_le = { +static const struct uartlite_reg_ops uartlite_le = { .in = uartlite_inle32, .out = uartlite_outle32, };static inline u32 uart_in32 (u32 offset,struct uart_port *port) { -struct uartlite_reg_ops *reg_ops = port->private_data; +const struct uartlite_reg_ops *reg_ops = port->private_data;return reg_ops->in (port->membase + offset); }static inline void uart_out32 (u32 val,u32 offset,struct uart_port *port) { -struct uartlite_reg_ops *reg_ops = port->private_data; +const struct uartlite_reg_ops *reg_ops = port->private_data; reg_ops->out (val, port->membase + offset); }Signature · 6 lines
2.4.3 -- Kind Regards, Aya Saif El-yazal Mahfouz
Kindly drop this patch. I'm retracting it since
it will introduce two build warnings and fixing
it will not be a simple process.
Signature · 2 lines
Kind Regards, Aya Saif El-yazal Mahfouz