linux-gpio.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 08/16] pinctrl: ssbi-mpp: " Julia Lawall
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ 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] 7+ messages in thread

* [PATCH 08/16] pinctrl: ssbi-mpp: 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-07 10:43   ` Linus Walleij
  2020-01-01  7:43 ` [PATCH 14/16] pinctrl: qcom: ssbi-gpio: " Julia Lawall
  2020-01-01  7:43 ` [PATCH 16/16] pinctrl: nuvoton: npcm7xx: " Julia Lawall
  2 siblings, 1 reply; 7+ messages in thread
From: Julia Lawall @ 2020-01-01  7:43 UTC (permalink / raw)
  To: Andy Gross
  Cc: kernel-janitors, Bjorn Andersson, Linus Walleij, linux-arm-msm,
	linux-gpio, linux-kernel

The pm8xxx_pinctrl_desc 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/pinctrl/qcom/pinctrl-ssbi-mpp.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pinctrl/qcom/pinctrl-ssbi-mpp.c b/drivers/pinctrl/qcom/pinctrl-ssbi-mpp.c
index 3d8b1d74fa2f..681d8dcf37e3 100644
--- a/drivers/pinctrl/qcom/pinctrl-ssbi-mpp.c
+++ b/drivers/pinctrl/qcom/pinctrl-ssbi-mpp.c
@@ -430,7 +430,7 @@ static const struct pinconf_ops pm8xxx_pinconf_ops = {
 	.pin_config_group_set = pm8xxx_pin_config_set,
 };
 
-static struct pinctrl_desc pm8xxx_pinctrl_desc = {
+static const struct pinctrl_desc pm8xxx_pinctrl_desc = {
 	.name = "pm8xxx_mpp",
 	.pctlops = &pm8xxx_pinctrl_ops,
 	.pmxops = &pm8xxx_pinmux_ops,


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

* [PATCH 14/16] pinctrl: qcom: ssbi-gpio: constify copied structure
  2020-01-01  7:43 [PATCH 00/16] constify copied structure Julia Lawall
  2020-01-01  7:43 ` [PATCH 08/16] pinctrl: ssbi-mpp: " Julia Lawall
@ 2020-01-01  7:43 ` Julia Lawall
  2020-01-07 10:44   ` Linus Walleij
  2020-01-01  7:43 ` [PATCH 16/16] pinctrl: nuvoton: npcm7xx: " Julia Lawall
  2 siblings, 1 reply; 7+ messages in thread
From: Julia Lawall @ 2020-01-01  7:43 UTC (permalink / raw)
  To: Bjorn Andersson
  Cc: kernel-janitors, Andy Gross, Linus Walleij, linux-arm-msm,
	linux-gpio, linux-kernel

The pm8xxx_pinctrl_desc 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/pinctrl/qcom/pinctrl-ssbi-gpio.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pinctrl/qcom/pinctrl-ssbi-gpio.c b/drivers/pinctrl/qcom/pinctrl-ssbi-gpio.c
index dca86886b1f9..c7912135bbfb 100644
--- a/drivers/pinctrl/qcom/pinctrl-ssbi-gpio.c
+++ b/drivers/pinctrl/qcom/pinctrl-ssbi-gpio.c
@@ -439,7 +439,7 @@ static const struct pinconf_ops pm8xxx_pinconf_ops = {
 	.pin_config_group_set = pm8xxx_pin_config_set,
 };
 
-static struct pinctrl_desc pm8xxx_pinctrl_desc = {
+static const struct pinctrl_desc pm8xxx_pinctrl_desc = {
 	.name = "pm8xxx_gpio",
 	.pctlops = &pm8xxx_pinctrl_ops,
 	.pmxops = &pm8xxx_pinmux_ops,


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

* [PATCH 16/16] pinctrl: nuvoton: npcm7xx: constify copied structure
  2020-01-01  7:43 [PATCH 00/16] constify copied structure Julia Lawall
  2020-01-01  7:43 ` [PATCH 08/16] pinctrl: ssbi-mpp: " Julia Lawall
  2020-01-01  7:43 ` [PATCH 14/16] pinctrl: qcom: ssbi-gpio: " Julia Lawall
@ 2020-01-01  7:43 ` Julia Lawall
  2020-01-07 10:45   ` Linus Walleij
  2 siblings, 1 reply; 7+ messages in thread
From: Julia Lawall @ 2020-01-01  7:43 UTC (permalink / raw)
  To: Linus Walleij; +Cc: kernel-janitors, linux-gpio, linux-kernel

The npcmgpio_irqchip 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/pinctrl/nuvoton/pinctrl-npcm7xx.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c b/drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c
index 22077cbe6880..a935065cdac4 100644
--- a/drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c
+++ b/drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c
@@ -331,7 +331,7 @@ static unsigned int npcmgpio_irq_startup(struct irq_data *d)
 	return 0;
 }
 
-static struct irq_chip npcmgpio_irqchip = {
+static const struct irq_chip npcmgpio_irqchip = {
 	.name = "NPCM7XX-GPIO-IRQ",
 	.irq_ack = npcmgpio_irq_ack,
 	.irq_unmask = npcmgpio_irq_unmask,


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

* Re: [PATCH 08/16] pinctrl: ssbi-mpp: constify copied structure
  2020-01-01  7:43 ` [PATCH 08/16] pinctrl: ssbi-mpp: " Julia Lawall
@ 2020-01-07 10:43   ` Linus Walleij
  0 siblings, 0 replies; 7+ messages in thread
From: Linus Walleij @ 2020-01-07 10:43 UTC (permalink / raw)
  To: Julia Lawall
  Cc: Andy Gross, kernel-janitors, Bjorn Andersson, MSM,
	open list:GPIO SUBSYSTEM, linux-kernel

On Wed, Jan 1, 2020 at 9:20 AM Julia Lawall <Julia.Lawall@inria.fr> wrote:

> The pm8xxx_pinctrl_desc 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>

That's a pretty cool semantic check finding things like this!

Patch applied.

Yours,
Linus Walleij

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

* Re: [PATCH 14/16] pinctrl: qcom: ssbi-gpio: constify copied structure
  2020-01-01  7:43 ` [PATCH 14/16] pinctrl: qcom: ssbi-gpio: " Julia Lawall
@ 2020-01-07 10:44   ` Linus Walleij
  0 siblings, 0 replies; 7+ messages in thread
From: Linus Walleij @ 2020-01-07 10:44 UTC (permalink / raw)
  To: Julia Lawall
  Cc: Bjorn Andersson, kernel-janitors, Andy Gross, MSM,
	open list:GPIO SUBSYSTEM, linux-kernel

On Wed, Jan 1, 2020 at 9:20 AM Julia Lawall <Julia.Lawall@inria.fr> wrote:

> The pm8xxx_pinctrl_desc 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>

Patch applied.

Yours,
Linus Walleij

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

* Re: [PATCH 16/16] pinctrl: nuvoton: npcm7xx: constify copied structure
  2020-01-01  7:43 ` [PATCH 16/16] pinctrl: nuvoton: npcm7xx: " Julia Lawall
@ 2020-01-07 10:45   ` Linus Walleij
  0 siblings, 0 replies; 7+ messages in thread
From: Linus Walleij @ 2020-01-07 10:45 UTC (permalink / raw)
  To: Julia Lawall; +Cc: kernel-janitors, open list:GPIO SUBSYSTEM, linux-kernel

On Wed, Jan 1, 2020 at 9:20 AM Julia Lawall <Julia.Lawall@inria.fr> wrote:

> The npcmgpio_irqchip 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>

Patch applied.

Yours,
Linus Walleij

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

end of thread, other threads:[~2020-01-07 10:45 UTC | newest]

Thread overview: 7+ 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 08/16] pinctrl: ssbi-mpp: " Julia Lawall
2020-01-07 10:43   ` Linus Walleij
2020-01-01  7:43 ` [PATCH 14/16] pinctrl: qcom: ssbi-gpio: " Julia Lawall
2020-01-07 10:44   ` Linus Walleij
2020-01-01  7:43 ` [PATCH 16/16] pinctrl: nuvoton: npcm7xx: " Julia Lawall
2020-01-07 10:45   ` Linus Walleij

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