linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/9] constify uart_ops structures
@ 2016-09-01 17:51 Julia Lawall
  2016-09-01 17:51 ` [PATCH 1/9] serial: st-asc: " Julia Lawall
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Julia Lawall @ 2016-09-01 17:51 UTC (permalink / raw)
  To: linux-arm-kernel

Constify uart_ops structures.

---

 drivers/tty/serial/altera_jtaguart.c |    2 +-
 drivers/tty/serial/altera_uart.c     |    2 +-
 drivers/tty/serial/arc_uart.c        |    2 +-
 drivers/tty/serial/atmel_serial.c    |    2 +-
 drivers/tty/serial/bcm63xx_uart.c    |    2 +-
 drivers/tty/serial/fsl_lpuart.c      |    4 ++--
 drivers/tty/serial/imx.c             |    2 +-
 drivers/tty/serial/jsm/jsm_tty.c     |    2 +-
 drivers/tty/serial/max3100.c         |    2 +-
 drivers/tty/serial/men_z135_uart.c   |    2 +-
 drivers/tty/serial/mxs-auart.c       |    2 +-
 drivers/tty/serial/pch_uart.c        |    2 +-
 drivers/tty/serial/sh-sci.c          |    2 +-
 drivers/tty/serial/st-asc.c          |    2 +-
 drivers/tty/serial/timbuart.c        |    2 +-
 drivers/tty/serial/uartlite.c        |    2 +-
 drivers/tty/serial/xilinx_uartps.c   |    2 +-
 17 files changed, 18 insertions(+), 18 deletions(-)

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/9] serial: st-asc: constify uart_ops structures
  2016-09-01 17:51 [PATCH 0/9] constify uart_ops structures Julia Lawall
@ 2016-09-01 17:51 ` Julia Lawall
  2016-09-01 19:55   ` [STLinux Kernel] " Peter Griffin
  2016-09-01 17:51 ` [PATCH 4/9] serial/bcm63xx_uart: " Julia Lawall
  2016-09-01 17:51 ` [PATCH 7/9] tty: xuartps: " Julia Lawall
  2 siblings, 1 reply; 5+ messages in thread
From: Julia Lawall @ 2016-09-01 17:51 UTC (permalink / raw)
  To: linux-arm-kernel

Check for uart_ops structures that are only stored in the ops field of a
uart_port structure.  This field is declared const, so uart_ops structures
that have this property can be declared as const also.

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@r disable optional_qualifier@
identifier i;
position p;
@@
static struct uart_ops i at p = { ... };

@ok@
identifier r.i;
struct uart_port e;
position p;
@@
e.ops = &i at p;

@bad@
position p != {r.p,ok.p};
identifier r.i;
struct uart_ops e;
@@
e at i@p

@depends on !bad disable optional_qualifier@
identifier r.i;
@@
static
+const
 struct uart_ops i = { ... };
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

---
 drivers/tty/serial/st-asc.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/tty/serial/st-asc.c b/drivers/tty/serial/st-asc.c
index 2d78cb3..379e5bd 100644
--- a/drivers/tty/serial/st-asc.c
+++ b/drivers/tty/serial/st-asc.c
@@ -639,7 +639,7 @@ static void asc_put_poll_char(struct uart_port *port, unsigned char c)
 
 /*---------------------------------------------------------------------*/
 
-static struct uart_ops asc_uart_ops = {
+static const struct uart_ops asc_uart_ops = {
 	.tx_empty	= asc_tx_empty,
 	.set_mctrl	= asc_set_mctrl,
 	.get_mctrl	= asc_get_mctrl,

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 4/9] serial/bcm63xx_uart: constify uart_ops structures
  2016-09-01 17:51 [PATCH 0/9] constify uart_ops structures Julia Lawall
  2016-09-01 17:51 ` [PATCH 1/9] serial: st-asc: " Julia Lawall
@ 2016-09-01 17:51 ` Julia Lawall
  2016-09-01 17:51 ` [PATCH 7/9] tty: xuartps: " Julia Lawall
  2 siblings, 0 replies; 5+ messages in thread
From: Julia Lawall @ 2016-09-01 17:51 UTC (permalink / raw)
  To: linux-arm-kernel

Check for uart_ops structures that are only stored in the ops field of a
uart_port structure.  This field is declared const, so uart_ops structures
that have this property can be declared as const also.

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@r disable optional_qualifier@
identifier i;
position p;
@@
static struct uart_ops i at p = { ... };

@ok@
identifier r.i;
struct uart_port e;
position p;
@@
e.ops = &i at p;

@bad@
position p != {r.p,ok.p};
identifier r.i;
struct uart_ops e;
@@
e at i@p

@depends on !bad disable optional_qualifier@
identifier r.i;
@@
static
+const
 struct uart_ops i = { ... };
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

---
 drivers/tty/serial/bcm63xx_uart.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/tty/serial/bcm63xx_uart.c b/drivers/tty/serial/bcm63xx_uart.c
index 5108fab..583c9a0 100644
--- a/drivers/tty/serial/bcm63xx_uart.c
+++ b/drivers/tty/serial/bcm63xx_uart.c
@@ -631,7 +631,7 @@ static int bcm_uart_verify_port(struct uart_port *port,
 }
 
 /* serial core callbacks */
-static struct uart_ops bcm_uart_ops = {
+static const struct uart_ops bcm_uart_ops = {
 	.tx_empty	= bcm_uart_tx_empty,
 	.get_mctrl	= bcm_uart_get_mctrl,
 	.set_mctrl	= bcm_uart_set_mctrl,

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 7/9] tty: xuartps: constify uart_ops structures
  2016-09-01 17:51 [PATCH 0/9] constify uart_ops structures Julia Lawall
  2016-09-01 17:51 ` [PATCH 1/9] serial: st-asc: " Julia Lawall
  2016-09-01 17:51 ` [PATCH 4/9] serial/bcm63xx_uart: " Julia Lawall
@ 2016-09-01 17:51 ` Julia Lawall
  2 siblings, 0 replies; 5+ messages in thread
From: Julia Lawall @ 2016-09-01 17:51 UTC (permalink / raw)
  To: linux-arm-kernel

Check for uart_ops structures that are only stored in the ops field of a
uart_port structure.  This field is declared const, so uart_ops structures
that have this property can be declared as const also.

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@r disable optional_qualifier@
identifier i;
position p;
@@
static struct uart_ops i at p = { ... };

@ok@
identifier r.i;
struct uart_port e;
position p;
@@
e.ops = &i at p;

@bad@
position p != {r.p,ok.p};
identifier r.i;
struct uart_ops e;
@@
e at i@p

@depends on !bad disable optional_qualifier@
identifier r.i;
@@
static
+const
 struct uart_ops i = { ... };
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

---
 drivers/tty/serial/xilinx_uartps.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/tty/serial/xilinx_uartps.c b/drivers/tty/serial/xilinx_uartps.c
index 9ca1a4d..11a2b36 100644
--- a/drivers/tty/serial/xilinx_uartps.c
+++ b/drivers/tty/serial/xilinx_uartps.c
@@ -993,7 +993,7 @@ static void cdns_uart_pm(struct uart_port *port, unsigned int state,
 	}
 }
 
-static struct uart_ops cdns_uart_ops = {
+static const struct uart_ops cdns_uart_ops = {
 	.set_mctrl	= cdns_uart_set_mctrl,
 	.get_mctrl	= cdns_uart_get_mctrl,
 	.start_tx	= cdns_uart_start_tx,

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [STLinux Kernel] [PATCH 1/9] serial: st-asc: constify uart_ops structures
  2016-09-01 17:51 ` [PATCH 1/9] serial: st-asc: " Julia Lawall
@ 2016-09-01 19:55   ` Peter Griffin
  0 siblings, 0 replies; 5+ messages in thread
From: Peter Griffin @ 2016-09-01 19:55 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, 01 Sep 2016, Julia Lawall wrote:

> Check for uart_ops structures that are only stored in the ops field of a
> uart_port structure.  This field is declared const, so uart_ops structures
> that have this property can be declared as const also.

Acked-by: Peter Griffin <peter.griffin@linaro.org>

regards,

Peter.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-09-01 19:55 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-01 17:51 [PATCH 0/9] constify uart_ops structures Julia Lawall
2016-09-01 17:51 ` [PATCH 1/9] serial: st-asc: " Julia Lawall
2016-09-01 19:55   ` [STLinux Kernel] " Peter Griffin
2016-09-01 17:51 ` [PATCH 4/9] serial/bcm63xx_uart: " Julia Lawall
2016-09-01 17:51 ` [PATCH 7/9] tty: xuartps: " Julia Lawall

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