* [PATCH 00/16] constify copied structure
@ 2020-01-01 7:43 Julia Lawall
2020-01-01 7:43 ` [PATCH 09/16] powerpc/mpic: " Julia Lawall
0 siblings, 1 reply; 3+ messages in thread
From: Julia Lawall @ 2020-01-01 7:43 UTC (permalink / raw)
To: Jernej Skrabec
Cc: linux-fbdev, alsa-devel, Jonas Karlman, linux-arm-msm, linux-usb,
kernel-janitors, linux-kernel, dri-devel, linux-gpio,
Laurent Pinchart, netdev, linuxppc-dev, linux-nfs,
linux-arm-kernel, linux-media
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] 3+ messages in thread
* [PATCH 09/16] powerpc/mpic: 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-29 5:17 ` Michael Ellerman
0 siblings, 1 reply; 3+ messages in thread
From: Julia Lawall @ 2020-01-01 7:43 UTC (permalink / raw)
To: Benjamin Herrenschmidt
Cc: Paul Mackerras, kernel-janitors, linuxppc-dev, linux-kernel
The mpic_ipi_chip and mpic_irq_ht_chip structures are only copied
into other structures, so make them const.
The opportunity for this change was found using Coccinelle.
Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>
---
arch/powerpc/sysdev/mpic.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/powerpc/sysdev/mpic.c b/arch/powerpc/sysdev/mpic.c
index 934a77324f6b..a3a72b780e67 100644
--- a/arch/powerpc/sysdev/mpic.c
+++ b/arch/powerpc/sysdev/mpic.c
@@ -964,7 +964,7 @@ static struct irq_chip mpic_irq_chip = {
};
#ifdef CONFIG_SMP
-static struct irq_chip mpic_ipi_chip = {
+static const struct irq_chip mpic_ipi_chip = {
.irq_mask = mpic_mask_ipi,
.irq_unmask = mpic_unmask_ipi,
.irq_eoi = mpic_end_ipi,
@@ -978,7 +978,7 @@ static struct irq_chip mpic_tm_chip = {
};
#ifdef CONFIG_MPIC_U3_HT_IRQS
-static struct irq_chip mpic_irq_ht_chip = {
+static const struct irq_chip mpic_irq_ht_chip = {
.irq_startup = mpic_startup_ht_irq,
.irq_shutdown = mpic_shutdown_ht_irq,
.irq_mask = mpic_mask_irq,
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 09/16] powerpc/mpic: constify copied structure
2020-01-01 7:43 ` [PATCH 09/16] powerpc/mpic: " Julia Lawall
@ 2020-01-29 5:17 ` Michael Ellerman
0 siblings, 0 replies; 3+ messages in thread
From: Michael Ellerman @ 2020-01-29 5:17 UTC (permalink / raw)
To: Julia Lawall, Benjamin Herrenschmidt
Cc: kernel-janitors, Paul Mackerras, linuxppc-dev, linux-kernel
On Wed, 2020-01-01 at 07:43:27 UTC, Julia Lawall wrote:
> The mpic_ipi_chip and mpic_irq_ht_chip structures are only copied
> into other structures, so make them const.
>
> The opportunity for this change was found using Coccinelle.
>
> Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>
Applied to powerpc next, thanks.
https://git.kernel.org/powerpc/c/5084ff33cac0988c1b979814501dcc2e1ecbf9c0
cheers
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-01-29 5:54 UTC | newest]
Thread overview: 3+ 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 09/16] powerpc/mpic: " Julia Lawall
2020-01-29 5:17 ` Michael Ellerman
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).