Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1291705 > unrolled thread

[PATCH] tty: serial: constify uartlite_reg_ops structs

Started byAya Mahfouz <mahfouz.saif.elyazal@gmail.com>
First post2015-12-15 00:50 +0100
Last post2015-12-15 16:00 +0100
Articles 2 — 1 participant

Back to article view | Back to linux.kernel


Contents

  [PATCH] tty: serial: constify uartlite_reg_ops structs Aya Mahfouz <mahfouz.saif.elyazal@gmail.com> - 2015-12-15 00:50 +0100
    Re: [PATCH] tty: serial: constify uartlite_reg_ops structs Aya Mahfouz <mahfouz.saif.elyazal@gmail.com> - 2015-12-15 16:00 +0100

#1291705 — [PATCH] tty: serial: constify uartlite_reg_ops structs

FromAya Mahfouz <mahfouz.saif.elyazal@gmail.com>
Date2015-12-15 00:50 +0100
Subject[PATCH] tty: serial: constify uartlite_reg_ops structs
Message-ID<qFL2q-4xi-23@gated-at.bofh.it>
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 <Julia.Lawall@lip6.fr>
Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
---
 drivers/tty/serial/uartlite.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/tty/serial/uartlite.c b/drivers/tty/serial/uartlite.c
index b1c6bd3..733cf58 100644
--- a/drivers/tty/serial/uartlite.c
+++ b/drivers/tty/serial/uartlite.c
@@ -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);
 }
-- 
2.4.3


-- 
Kind Regards,
Aya Saif El-yazal Mahfouz
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1292233

FromAya Mahfouz <mahfouz.saif.elyazal@gmail.com>
Date2015-12-15 16:00 +0100
Message-ID<qFZf4-5rq-5@gated-at.bofh.it>
In reply to#1291705
On Tue, Dec 15, 2015 at 01:42:05AM +0200, Aya Mahfouz wrote:
> 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 <Julia.Lawall@lip6.fr>
> Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
> ---
>  drivers/tty/serial/uartlite.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/tty/serial/uartlite.c b/drivers/tty/serial/uartlite.c
> index b1c6bd3..733cf58 100644
> --- a/drivers/tty/serial/uartlite.c
> +++ b/drivers/tty/serial/uartlite.c
> @@ -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);
>  }
> -- 
> 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.
-- 
Kind Regards,
Aya Saif El-yazal Mahfouz
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web