* [PATCH 00/16] constify copied structure
@ 2020-01-01 7:43 Julia Lawall
2020-01-01 7:43 ` [PATCH 03/16] [media] anysee: " Julia Lawall
` (3 more replies)
0 siblings, 4 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 03/16] [media] anysee: 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 05/16] media: isif: " Julia Lawall
` (2 subsequent siblings)
3 siblings, 0 replies; 7+ messages in thread
From: Julia Lawall @ 2020-01-01 7:43 UTC (permalink / raw)
To: Antti Palosaari
Cc: kernel-janitors, Mauro Carvalho Chehab, linux-media, linux-kernel
The anysee_tda18212_config and anysee_tda18212_config2 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>
---
drivers/media/usb/dvb-usb-v2/anysee.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/media/usb/dvb-usb-v2/anysee.c b/drivers/media/usb/dvb-usb-v2/anysee.c
index fb6d99dea31a..94b8d3e5d8f7 100644
--- a/drivers/media/usb/dvb-usb-v2/anysee.c
+++ b/drivers/media/usb/dvb-usb-v2/anysee.c
@@ -318,14 +318,14 @@ static struct tda10023_config anysee_tda10023_tda18212_config = {
.deltaf = 0xba02,
};
-static struct tda18212_config anysee_tda18212_config = {
+static const struct tda18212_config anysee_tda18212_config = {
.if_dvbt_6 = 4150,
.if_dvbt_7 = 4150,
.if_dvbt_8 = 4150,
.if_dvbc = 5000,
};
-static struct tda18212_config anysee_tda18212_config2 = {
+static const struct tda18212_config anysee_tda18212_config2 = {
.if_dvbt_6 = 3550,
.if_dvbt_7 = 3700,
.if_dvbt_8 = 4150,
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 05/16] media: isif: constify copied structure
2020-01-01 7:43 [PATCH 00/16] constify copied structure Julia Lawall
2020-01-01 7:43 ` [PATCH 03/16] [media] anysee: " Julia Lawall
@ 2020-01-01 7:43 ` Julia Lawall
2020-01-09 7:13 ` Lad, Prabhakar
2020-01-01 7:43 ` [PATCH 06/16] media: mt9v111: " Julia Lawall
2020-01-01 7:43 ` [PATCH 11/16] media: cx231xx: " Julia Lawall
3 siblings, 1 reply; 7+ messages in thread
From: Julia Lawall @ 2020-01-01 7:43 UTC (permalink / raw)
To: Lad Prabhakar
Cc: kernel-janitors, Mauro Carvalho Chehab, linux-media, linux-kernel
The isif_config_defaults 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/media/platform/davinci/isif.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/media/platform/davinci/isif.c b/drivers/media/platform/davinci/isif.c
index b49378b18e5d..c98edb67cfb2 100644
--- a/drivers/media/platform/davinci/isif.c
+++ b/drivers/media/platform/davinci/isif.c
@@ -29,7 +29,7 @@
#include "ccdc_hw_device.h"
/* Defaults for module configuration parameters */
-static struct isif_config_params_raw isif_config_defaults = {
+static const struct isif_config_params_raw isif_config_defaults = {
.linearize = {
.en = 0,
.corr_shft = ISIF_NO_SHIFT,
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 06/16] media: mt9v111: constify copied structure
2020-01-01 7:43 [PATCH 00/16] constify copied structure Julia Lawall
2020-01-01 7:43 ` [PATCH 03/16] [media] anysee: " Julia Lawall
2020-01-01 7:43 ` [PATCH 05/16] media: isif: " Julia Lawall
@ 2020-01-01 7:43 ` Julia Lawall
2020-01-02 8:11 ` Jacopo Mondi
2020-01-01 7:43 ` [PATCH 11/16] media: cx231xx: " Julia Lawall
3 siblings, 1 reply; 7+ messages in thread
From: Julia Lawall @ 2020-01-01 7:43 UTC (permalink / raw)
To: Jacopo Mondi
Cc: kernel-janitors, Mauro Carvalho Chehab, linux-media, linux-kernel
The mt9v111_def_fmt 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/media/i2c/mt9v111.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/media/i2c/mt9v111.c b/drivers/media/i2c/mt9v111.c
index bb41bea950ac..61ae6a0d5679 100644
--- a/drivers/media/i2c/mt9v111.c
+++ b/drivers/media/i2c/mt9v111.c
@@ -103,7 +103,7 @@
#define MT9V111_MAX_CLKIN 27000000
/* The default sensor configuration at startup time. */
-static struct v4l2_mbus_framefmt mt9v111_def_fmt = {
+static const struct v4l2_mbus_framefmt mt9v111_def_fmt = {
.width = 640,
.height = 480,
.code = MEDIA_BUS_FMT_UYVY8_2X8,
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 11/16] media: cx231xx: constify copied structure
2020-01-01 7:43 [PATCH 00/16] constify copied structure Julia Lawall
` (2 preceding siblings ...)
2020-01-01 7:43 ` [PATCH 06/16] media: mt9v111: " Julia Lawall
@ 2020-01-01 7:43 ` Julia Lawall
3 siblings, 0 replies; 7+ messages in thread
From: Julia Lawall @ 2020-01-01 7:43 UTC (permalink / raw)
To: Mauro Carvalho Chehab; +Cc: kernel-janitors, linux-media, linux-kernel
The hauppauge_955q_lgdt3306a_config 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/media/usb/cx231xx/cx231xx-dvb.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/media/usb/cx231xx/cx231xx-dvb.c b/drivers/media/usb/cx231xx/cx231xx-dvb.c
index e205f7f0a56a..0037b4b1381e 100644
--- a/drivers/media/usb/cx231xx/cx231xx-dvb.c
+++ b/drivers/media/usb/cx231xx/cx231xx-dvb.c
@@ -147,7 +147,7 @@ static struct tda18271_config pv_tda18271_config = {
.small_i2c = TDA18271_03_BYTE_CHUNK_INIT,
};
-static struct lgdt3306a_config hauppauge_955q_lgdt3306a_config = {
+static const struct lgdt3306a_config hauppauge_955q_lgdt3306a_config = {
.qam_if_khz = 4000,
.vsb_if_khz = 3250,
.spectral_inversion = 1,
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 06/16] media: mt9v111: constify copied structure
2020-01-01 7:43 ` [PATCH 06/16] media: mt9v111: " Julia Lawall
@ 2020-01-02 8:11 ` Jacopo Mondi
0 siblings, 0 replies; 7+ messages in thread
From: Jacopo Mondi @ 2020-01-02 8:11 UTC (permalink / raw)
To: Julia Lawall
Cc: kernel-janitors, Mauro Carvalho Chehab, linux-media, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 982 bytes --]
Hi Julia,
thanks for the patch
On Wed, Jan 01, 2020 at 08:43:24AM +0100, Julia Lawall wrote:
> The mt9v111_def_fmt 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: Jacopo Mondi <jacopo+renesas@jmondi.org>
Thanks
j
>
> ---
> drivers/media/i2c/mt9v111.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/media/i2c/mt9v111.c b/drivers/media/i2c/mt9v111.c
> index bb41bea950ac..61ae6a0d5679 100644
> --- a/drivers/media/i2c/mt9v111.c
> +++ b/drivers/media/i2c/mt9v111.c
> @@ -103,7 +103,7 @@
> #define MT9V111_MAX_CLKIN 27000000
>
> /* The default sensor configuration at startup time. */
> -static struct v4l2_mbus_framefmt mt9v111_def_fmt = {
> +static const struct v4l2_mbus_framefmt mt9v111_def_fmt = {
> .width = 640,
> .height = 480,
> .code = MEDIA_BUS_FMT_UYVY8_2X8,
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 05/16] media: isif: constify copied structure
2020-01-01 7:43 ` [PATCH 05/16] media: isif: " Julia Lawall
@ 2020-01-09 7:13 ` Lad, Prabhakar
0 siblings, 0 replies; 7+ messages in thread
From: Lad, Prabhakar @ 2020-01-09 7:13 UTC (permalink / raw)
To: Julia Lawall; +Cc: kernel-janitors, Mauro Carvalho Chehab, linux-media, LKML
On Wed, Jan 1, 2020 at 8:20 AM Julia Lawall <Julia.Lawall@inria.fr> wrote:
>
> The isif_config_defaults 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: Lad Prabhakar <prabhakar.csengg@gmail.com>
Cheers,
--Prabhakar Lad
> ---
> drivers/media/platform/davinci/isif.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/media/platform/davinci/isif.c b/drivers/media/platform/davinci/isif.c
> index b49378b18e5d..c98edb67cfb2 100644
> --- a/drivers/media/platform/davinci/isif.c
> +++ b/drivers/media/platform/davinci/isif.c
> @@ -29,7 +29,7 @@
> #include "ccdc_hw_device.h"
>
> /* Defaults for module configuration parameters */
> -static struct isif_config_params_raw isif_config_defaults = {
> +static const struct isif_config_params_raw isif_config_defaults = {
> .linearize = {
> .en = 0,
> .corr_shft = ISIF_NO_SHIFT,
>
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2020-01-09 7:13 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 03/16] [media] anysee: " Julia Lawall
2020-01-01 7:43 ` [PATCH 05/16] media: isif: " Julia Lawall
2020-01-09 7:13 ` Lad, Prabhakar
2020-01-01 7:43 ` [PATCH 06/16] media: mt9v111: " Julia Lawall
2020-01-02 8:11 ` Jacopo Mondi
2020-01-01 7:43 ` [PATCH 11/16] media: cx231xx: " 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).