netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/16] constify copied structure
@ 2020-01-01  7:43 Julia Lawall
  2020-01-01  7:43 ` [PATCH 12/16] SUNRPC: " Julia Lawall
  2020-01-01  7:43 ` [PATCH 13/16] ptp: ptp_clockmatrix: " Julia Lawall
  0 siblings, 2 replies; 5+ messages in thread
From: Julia Lawall @ 2020-01-01  7:43 UTC (permalink / raw)
  To: Jernej Skrabec
  Cc: kernel-janitors, Jonas Karlman, Laurent Pinchart, linuxppc-dev,
	linux-fbdev, dri-devel, linux-media, linux-kernel, alsa-devel,
	linux-arm-kernel, linux-usb, linux-arm-msm, linux-gpio, linux-nfs,
	netdev

Make const static structures that are just copied into other structures.

The semantic patch that detects the opportunity for this change is as
follows: (http://coccinelle.lip6.fr/)

<smpl>
@r disable optional_qualifier@
identifier i,j;
position p;
@@
static struct i j@p = { ... };

@upd@
position p1;
identifier r.j;
expression e;
@@
e = j@p1

@ref@
position p2 != {r.p,upd.p1};
identifier r.j;
@@
j@p2

@script:ocaml depends on upd && !ref@
i << r.i;
j << r.j;
p << r.p;
@@
if j = (List.hd p).current_element
then Coccilib.print_main i p
</smpl>

---

 arch/powerpc/sysdev/mpic.c                          |    4 ++--
 drivers/gpu/drm/bridge/synopsys/dw-hdmi-ahb-audio.c |    2 +-
 drivers/media/i2c/mt9v111.c                         |    2 +-
 drivers/media/platform/davinci/isif.c               |    2 +-
 drivers/media/usb/cx231xx/cx231xx-dvb.c             |    2 +-
 drivers/media/usb/dvb-usb-v2/anysee.c               |    4 ++--
 drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c           |    2 +-
 drivers/pinctrl/qcom/pinctrl-ssbi-gpio.c            |    2 +-
 drivers/pinctrl/qcom/pinctrl-ssbi-mpp.c             |    2 +-
 drivers/ptp/ptp_clockmatrix.c                       |    2 +-
 drivers/usb/gadget/udc/atmel_usba_udc.c             |    2 +-
 drivers/video/fbdev/sa1100fb.c                      |    2 +-
 net/sunrpc/xdr.c                                    |    2 +-
 sound/isa/ad1816a/ad1816a_lib.c                     |    2 +-
 sound/pci/hda/hda_controller.c                      |    2 +-
 sound/soc/qcom/qdsp6/q6asm-dai.c                    |    2 +-
 16 files changed, 18 insertions(+), 18 deletions(-)

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

* [PATCH 12/16] SUNRPC: constify copied structure
  2020-01-01  7:43 [PATCH 00/16] constify copied structure Julia Lawall
@ 2020-01-01  7:43 ` Julia Lawall
  2020-01-01  7:43 ` [PATCH 13/16] ptp: ptp_clockmatrix: " Julia Lawall
  1 sibling, 0 replies; 5+ messages in thread
From: Julia Lawall @ 2020-01-01  7:43 UTC (permalink / raw)
  To: J. Bruce Fields
  Cc: kernel-janitors, Chuck Lever, Trond Myklebust, Anna Schumaker,
	David S. Miller, linux-nfs, netdev, linux-kernel

The empty_iov structure is only copied into another structure,
so make it const.

The opportunity for this change was found using Coccinelle.

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

---
 net/sunrpc/xdr.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/sunrpc/xdr.c b/net/sunrpc/xdr.c
index f3104be8ff5d..e5497dc2475b 100644
--- a/net/sunrpc/xdr.c
+++ b/net/sunrpc/xdr.c
@@ -1079,7 +1079,7 @@ void xdr_enter_page(struct xdr_stream *xdr, unsigned int len)
 }
 EXPORT_SYMBOL_GPL(xdr_enter_page);
 
-static struct kvec empty_iov = {.iov_base = NULL, .iov_len = 0};
+static const struct kvec empty_iov = {.iov_base = NULL, .iov_len = 0};
 
 void
 xdr_buf_from_iov(struct kvec *iov, struct xdr_buf *buf)


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

* [PATCH 13/16] ptp: ptp_clockmatrix: constify copied structure
  2020-01-01  7:43 [PATCH 00/16] constify copied structure Julia Lawall
  2020-01-01  7:43 ` [PATCH 12/16] SUNRPC: " Julia Lawall
@ 2020-01-01  7:43 ` Julia Lawall
  2020-01-01 15:43   ` Richard Cochran
  2020-01-03  0:31   ` David Miller
  1 sibling, 2 replies; 5+ messages in thread
From: Julia Lawall @ 2020-01-01  7:43 UTC (permalink / raw)
  To: Richard Cochran; +Cc: kernel-janitors, netdev, linux-kernel

The idtcm_caps structure is only copied into another structure,
so make it const.

The opportunity for this change was found using Coccinelle.

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

---
 drivers/ptp/ptp_clockmatrix.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/ptp/ptp_clockmatrix.c b/drivers/ptp/ptp_clockmatrix.c
index a5110b7b4ece..e85836715f0b 100644
--- a/drivers/ptp/ptp_clockmatrix.c
+++ b/drivers/ptp/ptp_clockmatrix.c
@@ -1102,7 +1102,7 @@ static void idtcm_display_version_info(struct idtcm *idtcm)
 		 product_id, hw_rev_id, bond_id, csr_id, irq_id);
 }
 
-static struct ptp_clock_info idtcm_caps = {
+static const struct ptp_clock_info idtcm_caps = {
 	.owner		= THIS_MODULE,
 	.max_adj	= 244000,
 	.n_per_out	= 1,


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

* Re: [PATCH 13/16] ptp: ptp_clockmatrix: constify copied structure
  2020-01-01  7:43 ` [PATCH 13/16] ptp: ptp_clockmatrix: " Julia Lawall
@ 2020-01-01 15:43   ` Richard Cochran
  2020-01-03  0:31   ` David Miller
  1 sibling, 0 replies; 5+ messages in thread
From: Richard Cochran @ 2020-01-01 15:43 UTC (permalink / raw)
  To: Julia Lawall; +Cc: kernel-janitors, netdev, linux-kernel

On Wed, Jan 01, 2020 at 08:43:31AM +0100, Julia Lawall wrote:
> The idtcm_caps structure is only copied into another structure,
> so make it const.
> 
> The opportunity for this change was found using Coccinelle.
> 
> Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>

Acked-by: Richard Cochran <richardcochran@gmail.com>

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

* Re: [PATCH 13/16] ptp: ptp_clockmatrix: constify copied structure
  2020-01-01  7:43 ` [PATCH 13/16] ptp: ptp_clockmatrix: " Julia Lawall
  2020-01-01 15:43   ` Richard Cochran
@ 2020-01-03  0:31   ` David Miller
  1 sibling, 0 replies; 5+ messages in thread
From: David Miller @ 2020-01-03  0:31 UTC (permalink / raw)
  To: Julia.Lawall; +Cc: richardcochran, kernel-janitors, netdev, linux-kernel

From: Julia Lawall <Julia.Lawall@inria.fr>
Date: Wed,  1 Jan 2020 08:43:31 +0100

> The idtcm_caps structure is only copied into another structure,
> so make it const.
> 
> The opportunity for this change was found using Coccinelle.
> 
> Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>

Applied to net-next.

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

end of thread, other threads:[~2020-01-03  0:31 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-01-01  7:43 [PATCH 00/16] constify copied structure Julia Lawall
2020-01-01  7:43 ` [PATCH 12/16] SUNRPC: " Julia Lawall
2020-01-01  7:43 ` [PATCH 13/16] ptp: ptp_clockmatrix: " Julia Lawall
2020-01-01 15:43   ` Richard Cochran
2020-01-03  0:31   ` David Miller

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