Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1480788 > unrolled thread

[PATCH 00/26] constify local structures

Started byJulia Lawall <Julia.Lawall@lip6.fr>
First post2016-09-11 15:30 +0200
Last post2016-09-11 21:20 +0200
Articles 20 on this page of 49 — 12 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 00/26] constify local structures Julia Lawall <Julia.Lawall@lip6.fr> - 2016-09-11 15:30 +0200
    [PATCH 02/26] lib: constify local structures Julia Lawall <Julia.Lawall@lip6.fr> - 2016-09-11 15:30 +0200
    [PATCH 13/26] [media]: constify local structures Julia Lawall <Julia.Lawall@lip6.fr> - 2016-09-11 15:30 +0200
    [PATCH 01/26] ALSA: pci: constify local structures Julia Lawall <Julia.Lawall@lip6.fr> - 2016-09-11 15:30 +0200
      Re: [PATCH 01/26] ALSA: pci: constify local structures Takashi Iwai <tiwai@suse.de> - 2016-09-12 08:20 +0200
    [PATCH 24/26] ACPI / APD: constify local structures Julia Lawall <Julia.Lawall@lip6.fr> - 2016-09-11 15:30 +0200
      Re: [PATCH 24/26] ACPI / APD: constify local structures "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2016-09-14 02:50 +0200
    [PATCH 25/26] pch_gbe: constify local structures Julia Lawall <Julia.Lawall@lip6.fr> - 2016-09-11 15:30 +0200
      Re: [PATCH 25/26] pch_gbe: constify local structures David Miller <davem@davemloft.net> - 2016-09-12 04:50 +0200
        Re: [PATCH 25/26] pch_gbe: constify local structures Julia Lawall <julia.lawall@lip6.fr> - 2016-09-12 11:10 +0200
          Re: [PATCH 25/26] pch_gbe: constify local structures David Miller <davem@davemloft.net> - 2016-09-12 18:40 +0200
      Re: [PATCH 25/26] pch_gbe: constify local structures Julia Lawall <julia.lawall@lip6.fr> - 2016-09-12 14:30 +0200
    [PATCH 22/26] esas2r: constify local structures Julia Lawall <Julia.Lawall@lip6.fr> - 2016-09-11 15:30 +0200
    [PATCH 21/26] rtlwifi: rtl818x: constify local structures Julia Lawall <Julia.Lawall@lip6.fr> - 2016-09-11 15:30 +0200
    [PATCH 15/26] platform/chrome: constify local structures Julia Lawall <Julia.Lawall@lip6.fr> - 2016-09-11 15:40 +0200
    [PATCH 07/26] net/mlx4_core: constify local structures Julia Lawall <Julia.Lawall@lip6.fr> - 2016-09-11 15:40 +0200
      Re: [PATCH 07/26] net/mlx4_core: constify local structures Leon Romanovsky <leon@kernel.org> - 2016-09-12 07:10 +0200
    [PATCH 05/26] ARCNET: constify local structures Julia Lawall <Julia.Lawall@lip6.fr> - 2016-09-11 15:40 +0200
      Re: [PATCH 05/26] ARCNET: constify local structures Julia Lawall <julia.lawall@lip6.fr> - 2016-09-12 14:40 +0200
    [PATCH 04/26] matroxfb: constify local structures Julia Lawall <Julia.Lawall@lip6.fr> - 2016-09-11 15:40 +0200
    [PATCH 18/26] intel_scu_ipc: constify local structures Julia Lawall <Julia.Lawall@lip6.fr> - 2016-09-11 15:40 +0200
      Re: [PATCH 18/26] intel_scu_ipc: constify local structures Julia Lawall <julia.lawall@lip6.fr> - 2016-09-12 14:40 +0200
    [PATCH 03/26] staging: rtl8192e: constify local structures Julia Lawall <Julia.Lawall@lip6.fr> - 2016-09-11 15:40 +0200
    [PATCH 11/26] can: constify local structures Julia Lawall <Julia.Lawall@lip6.fr> - 2016-09-11 15:40 +0200
      Re: [PATCH 11/26] can: constify local structures Julia Lawall <julia.lawall@lip6.fr> - 2016-09-12 14:40 +0200
    [PATCH 08/26] iwlegacy: constify local structures Julia Lawall <Julia.Lawall@lip6.fr> - 2016-09-11 15:40 +0200
      Re: [PATCH 08/26] iwlegacy: constify local structures Stanislaw Gruszka <sgruszka@redhat.com> - 2016-09-12 13:30 +0200
    [PATCH 17/26] intel_telemetry_debugfs: constify local structures Julia Lawall <Julia.Lawall@lip6.fr> - 2016-09-11 15:40 +0200
    [PATCH 19/26] intel_pstate: constify local structures Julia Lawall <Julia.Lawall@lip6.fr> - 2016-09-11 15:40 +0200
      Re: [PATCH 19/26] intel_pstate: constify local structures Viresh Kumar <viresh.kumar@linaro.org> - 2016-09-12 08:50 +0200
        Re: [PATCH 19/26] intel_pstate: constify local structures "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2016-09-14 03:00 +0200
    [PATCH 10/26] tpm: constify local structures Julia Lawall <Julia.Lawall@lip6.fr> - 2016-09-11 15:40 +0200
      Re: [PATCH 10/26] tpm: constify local structures Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2016-09-11 19:20 +0200
        Re: [PATCH 10/26] tpm: constify local structures Julia Lawall <julia.lawall@lip6.fr> - 2016-09-12 10:50 +0200
      Re: [PATCH 10/26] tpm: constify local structures Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2016-09-12 21:30 +0200
    [PATCH 09/26] i40iw: constify local structures Julia Lawall <Julia.Lawall@lip6.fr> - 2016-09-11 15:40 +0200
    [PATCH 16/26] ezusb: constify local structures Julia Lawall <Julia.Lawall@lip6.fr> - 2016-09-11 15:40 +0200
    Re: [PATCH 00/26] constify local structures Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2016-09-11 19:30 +0200
      Re: [PATCH 00/26] constify local structures Julia Lawall <julia.lawall@lip6.fr> - 2016-09-12 11:00 +0200
        Re: [PATCH 00/26] constify local structures Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2016-09-12 15:20 +0200
          Re: [PATCH 00/26] constify local structures Julia Lawall <julia.lawall@lip6.fr> - 2016-09-12 15:30 +0200
          Re: [PATCH 00/26] constify local structures Felipe Balbi <felipe.balbi@linux.intel.com> - 2016-09-12 15:50 +0200
            Re: [PATCH 00/26] constify local structures Geert Uytterhoeven <geert@linux-m68k.org> - 2016-09-12 16:00 +0200
            Re: [PATCH 00/26] constify local structures Julia Lawall <julia.lawall@lip6.fr> - 2016-09-12 16:00 +0200
              Re: [PATCH 00/26] constify local structures Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2016-09-12 21:00 +0200
            Re: [PATCH 00/26] constify local structures Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2016-09-12 22:20 +0200
              Re: [PATCH 00/26] constify local structures Julia Lawall <julia.lawall@lip6.fr> - 2016-09-12 23:20 +0200
    Re: [PATCH 00/26] constify local structures Joe Perches <joe@perches.com> - 2016-09-11 20:00 +0200
      Re: [PATCH 00/26] constify local structures Julia Lawall <julia.lawall@lip6.fr> - 2016-09-11 21:20 +0200

Page 1 of 3  [1] 2 3  Next page →


#1480788 — [PATCH 00/26] constify local structures

FromJulia Lawall <Julia.Lawall@lip6.fr>
Date2016-09-11 15:30 +0200
Subject[PATCH 00/26] constify local structures
Message-ID<sgcZz-6F5-5@gated-at.bofh.it>
Constify local structures.

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

// <smpl>
// The first rule ignores some cases that posed problems
@r disable optional_qualifier@
identifier s != {peri_clk_data,threshold_attr,tracer_flags,tracer};
identifier i != {s5k5baf_cis_rect,smtcfb_fix};
position p;
@@
static struct s i@p = { ... };

@lstruct@
identifier r.s;
@@
struct s { ... };

@used depends on lstruct@
identifier r.i;
@@
i

@bad1@
expression e;
identifier r.i;
assignment operator a;
@@
 (<+...i...+>) a e

@bad2@
identifier r.i;
@@
 &(<+...i...+>)

@bad3@
identifier r.i;
declarer d;
@@
 d(...,<+...i...+>,...);

@bad4@
identifier r.i;
type T;
T[] e;
identifier f;
position p;
@@

f@p(...,
(
  (<+...i...+>)
&
  e
)
,...)

@bad4a@
identifier r.i;
type T;
T *e;
identifier f;
position p;
@@

f@p(...,
(
  (<+...i...+>)
&
  e
)
,...)

@ok5@
expression *e;
identifier r.i;
position p;
@@
e =@p i

@bad5@
expression *e;
identifier r.i;
position p != ok5.p;
@@
e =@p (<+...i...+>)

@rr depends on used && !bad1 && !bad2 && !bad3 && !bad4 && !bad4a && !bad5@
identifier s,r.i;
position r.p;
@@

static
+const
 struct s i@p = { ... };

@depends on used && !bad1 && !bad2 && !bad3 && !bad4 && !bad4a && !bad5
 disable optional_qualifier@
identifier rr.s,r.i;
@@

static
+const
 struct s i;
// </smpl>

---

 drivers/acpi/acpi_apd.c                              |    8 +++---
 drivers/char/tpm/tpm-interface.c                     |   10 ++++----
 drivers/char/tpm/tpm-sysfs.c                         |    2 -
 drivers/cpufreq/intel_pstate.c                       |    8 +++---
 drivers/infiniband/hw/i40iw/i40iw_uk.c               |    6 ++---
 drivers/media/i2c/tvp514x.c                          |    2 -
 drivers/media/pci/ddbridge/ddbridge-core.c           |   18 +++++++--------
 drivers/media/pci/ngene/ngene-cards.c                |   14 ++++++------
 drivers/media/pci/smipcie/smipcie-main.c             |    8 +++---
 drivers/misc/sgi-xp/xpc_uv.c                         |    2 -
 drivers/net/arcnet/com20020-pci.c                    |   10 ++++----
 drivers/net/can/c_can/c_can_pci.c                    |    4 +--
 drivers/net/can/sja1000/plx_pci.c                    |   20 ++++++++---------
 drivers/net/ethernet/mellanox/mlx4/main.c            |    4 +--
 drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c |    2 -
 drivers/net/ethernet/renesas/sh_eth.c                |   14 ++++++------
 drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c     |    2 -
 drivers/net/wireless/ath/dfs_pattern_detector.c      |    2 -
 drivers/net/wireless/intel/iwlegacy/3945.c           |    4 +--
 drivers/net/wireless/realtek/rtlwifi/rtl8188ee/sw.c  |    2 -
 drivers/net/wireless/realtek/rtlwifi/rtl8192ce/sw.c  |    2 -
 drivers/net/wireless/realtek/rtlwifi/rtl8192de/sw.c  |    2 -
 drivers/net/wireless/realtek/rtlwifi/rtl8192ee/sw.c  |    2 -
 drivers/net/wireless/realtek/rtlwifi/rtl8192se/sw.c  |    2 -
 drivers/net/wireless/realtek/rtlwifi/rtl8723ae/sw.c  |    2 -
 drivers/net/wireless/realtek/rtlwifi/rtl8723be/sw.c  |    2 -
 drivers/net/wireless/realtek/rtlwifi/rtl8821ae/sw.c  |    2 -
 drivers/platform/chrome/chromeos_laptop.c            |   22 +++++++++----------
 drivers/platform/x86/intel_scu_ipc.c                 |    6 ++---
 drivers/platform/x86/intel_telemetry_debugfs.c       |    2 -
 drivers/scsi/esas2r/esas2r_flash.c                   |    2 -
 drivers/scsi/hptiop.c                                |    6 ++---
 drivers/spi/spi-dw-pci.c                             |    4 +--
 drivers/staging/rtl8192e/rtl8192e/rtl_core.c         |    2 -
 drivers/usb/misc/ezusb.c                             |    2 -
 drivers/video/fbdev/matrox/matroxfb_g450.c           |    2 -
 lib/crc64_ecma.c                                     |    2 -
 sound/pci/ctxfi/ctatc.c                              |    2 -
 sound/pci/hda/patch_ca0132.c                         |   10 ++++----
 sound/pci/riptide/riptide.c                          |    2 -
 40 files changed, 110 insertions(+), 110 deletions(-)

[toc] | [next] | [standalone]


#1480789 — [PATCH 02/26] lib: constify local structures

FromJulia Lawall <Julia.Lawall@lip6.fr>
Date2016-09-11 15:30 +0200
Subject[PATCH 02/26] lib: constify local structures
Message-ID<sgcZA-6F5-43@gated-at.bofh.it>
In reply to#1480788
For structure types defined in the same file or local header files, find
top-level static structure declarations that have the following
properties:
1. Never reassigned.
2. Address never taken
3. Not passed to a top-level macro call
4. No pointer or array-typed field passed to a function or stored in a
variable.
Declare structures having all of these properties as const.

Done using Coccinelle.
Based on a suggestion by Joe Perches <joe@perches.com>.

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

---
The semantic patch seems too long for a commit log, but is in the cover
letter.

 lib/crc64_ecma.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/crc64_ecma.c b/lib/crc64_ecma.c
index 41629ea..d013bf3 100644
--- a/lib/crc64_ecma.c
+++ b/lib/crc64_ecma.c
@@ -44,7 +44,7 @@ struct crc64_table {
 };
 
 
-static struct crc64_table CRC64_ECMA_182 = {
+static const struct crc64_table CRC64_ECMA_182 = {
 	CRC64_DEFAULT_INITVAL,
 	{
 		0x0000000000000000ULL,

[toc] | [prev] | [next] | [standalone]


#1480790 — [PATCH 13/26] [media]: constify local structures

FromJulia Lawall <Julia.Lawall@lip6.fr>
Date2016-09-11 15:30 +0200
Subject[PATCH 13/26] [media]: constify local structures
Message-ID<sgcZA-6F5-41@gated-at.bofh.it>
In reply to#1480788
For structure types defined in the same file or local header files, find
top-level static structure declarations that have the following
properties:
1. Never reassigned.
2. Address never taken
3. Not passed to a top-level macro call
4. No pointer or array-typed field passed to a function or stored in a
variable.
Declare structures having all of these properties as const.

Done using Coccinelle.
Based on a suggestion by Joe Perches <joe@perches.com>.

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

---
The semantic patch seems too long for a commit log, but is in the cover
letter.

 drivers/media/i2c/tvp514x.c                |    2 +-
 drivers/media/pci/ddbridge/ddbridge-core.c |   18 +++++++++---------
 drivers/media/pci/ngene/ngene-cards.c      |   14 +++++++-------
 drivers/media/pci/smipcie/smipcie-main.c   |    8 ++++----
 4 files changed, 21 insertions(+), 21 deletions(-)

diff --git a/drivers/media/i2c/tvp514x.c b/drivers/media/i2c/tvp514x.c
index 7cdd948..43a9252 100644
--- a/drivers/media/i2c/tvp514x.c
+++ b/drivers/media/i2c/tvp514x.c
@@ -977,7 +977,7 @@ static const struct v4l2_subdev_ops tvp514x_ops = {
 	.pad = &tvp514x_pad_ops,
 };
 
-static struct tvp514x_decoder tvp514x_dev = {
+static const struct tvp514x_decoder tvp514x_dev = {
 	.streaming = 0,
 	.fmt_list = tvp514x_fmt_list,
 	.num_fmts = ARRAY_SIZE(tvp514x_fmt_list),
diff --git a/drivers/media/pci/ddbridge/ddbridge-core.c b/drivers/media/pci/ddbridge/ddbridge-core.c
index 47def73..18e3a4d 100644
--- a/drivers/media/pci/ddbridge/ddbridge-core.c
+++ b/drivers/media/pci/ddbridge/ddbridge-core.c
@@ -1643,53 +1643,53 @@ fail:
 /******************************************************************************/
 /******************************************************************************/
 
-static struct ddb_info ddb_none = {
+static const struct ddb_info ddb_none = {
 	.type     = DDB_NONE,
 	.name     = "Digital Devices PCIe bridge",
 };
 
-static struct ddb_info ddb_octopus = {
+static const struct ddb_info ddb_octopus = {
 	.type     = DDB_OCTOPUS,
 	.name     = "Digital Devices Octopus DVB adapter",
 	.port_num = 4,
 };
 
-static struct ddb_info ddb_octopus_le = {
+static const struct ddb_info ddb_octopus_le = {
 	.type     = DDB_OCTOPUS,
 	.name     = "Digital Devices Octopus LE DVB adapter",
 	.port_num = 2,
 };
 
-static struct ddb_info ddb_octopus_mini = {
+static const struct ddb_info ddb_octopus_mini = {
 	.type     = DDB_OCTOPUS,
 	.name     = "Digital Devices Octopus Mini",
 	.port_num = 4,
 };
 
-static struct ddb_info ddb_v6 = {
+static const struct ddb_info ddb_v6 = {
 	.type     = DDB_OCTOPUS,
 	.name     = "Digital Devices Cine S2 V6 DVB adapter",
 	.port_num = 3,
 };
-static struct ddb_info ddb_v6_5 = {
+static const struct ddb_info ddb_v6_5 = {
 	.type     = DDB_OCTOPUS,
 	.name     = "Digital Devices Cine S2 V6.5 DVB adapter",
 	.port_num = 4,
 };
 
-static struct ddb_info ddb_dvbct = {
+static const struct ddb_info ddb_dvbct = {
 	.type     = DDB_OCTOPUS,
 	.name     = "Digital Devices DVBCT V6.1 DVB adapter",
 	.port_num = 3,
 };
 
-static struct ddb_info ddb_satixS2v3 = {
+static const struct ddb_info ddb_satixS2v3 = {
 	.type     = DDB_OCTOPUS,
 	.name     = "Mystique SaTiX-S2 V3 DVB adapter",
 	.port_num = 3,
 };
 
-static struct ddb_info ddb_octopusv3 = {
+static const struct ddb_info ddb_octopusv3 = {
 	.type     = DDB_OCTOPUS,
 	.name     = "Digital Devices Octopus V3 DVB adapter",
 	.port_num = 4,
diff --git a/drivers/media/pci/ngene/ngene-cards.c b/drivers/media/pci/ngene/ngene-cards.c
index 4e783a6..423e8c8 100644
--- a/drivers/media/pci/ngene/ngene-cards.c
+++ b/drivers/media/pci/ngene/ngene-cards.c
@@ -613,7 +613,7 @@ static struct stv6110x_config tuner_cineS2_1 = {
 	.clk_div = 1,
 };
 
-static struct ngene_info ngene_info_cineS2 = {
+static const struct ngene_info ngene_info_cineS2 = {
 	.type		= NGENE_SIDEWINDER,
 	.name		= "Linux4Media cineS2 DVB-S2 Twin Tuner",
 	.io_type	= {NGENE_IO_TSIN, NGENE_IO_TSIN},
@@ -627,7 +627,7 @@ static struct ngene_info ngene_info_cineS2 = {
 	.msi_supported	= true,
 };
 
-static struct ngene_info ngene_info_satixS2 = {
+static const struct ngene_info ngene_info_satixS2 = {
 	.type		= NGENE_SIDEWINDER,
 	.name		= "Mystique SaTiX-S2 Dual",
 	.io_type	= {NGENE_IO_TSIN, NGENE_IO_TSIN},
@@ -641,7 +641,7 @@ static struct ngene_info ngene_info_satixS2 = {
 	.msi_supported	= true,
 };
 
-static struct ngene_info ngene_info_satixS2v2 = {
+static const struct ngene_info ngene_info_satixS2v2 = {
 	.type		= NGENE_SIDEWINDER,
 	.name		= "Mystique SaTiX-S2 Dual (v2)",
 	.io_type	= {NGENE_IO_TSIN, NGENE_IO_TSIN, NGENE_IO_TSIN, NGENE_IO_TSIN,
@@ -656,7 +656,7 @@ static struct ngene_info ngene_info_satixS2v2 = {
 	.msi_supported	= true,
 };
 
-static struct ngene_info ngene_info_cineS2v5 = {
+static const struct ngene_info ngene_info_cineS2v5 = {
 	.type		= NGENE_SIDEWINDER,
 	.name		= "Linux4Media cineS2 DVB-S2 Twin Tuner (v5)",
 	.io_type	= {NGENE_IO_TSIN, NGENE_IO_TSIN, NGENE_IO_TSIN, NGENE_IO_TSIN,
@@ -672,7 +672,7 @@ static struct ngene_info ngene_info_cineS2v5 = {
 };
 
 
-static struct ngene_info ngene_info_duoFlex = {
+static const struct ngene_info ngene_info_duoFlex = {
 	.type           = NGENE_SIDEWINDER,
 	.name           = "Digital Devices DuoFlex PCIe or miniPCIe",
 	.io_type        = {NGENE_IO_TSIN, NGENE_IO_TSIN, NGENE_IO_TSIN, NGENE_IO_TSIN,
@@ -687,7 +687,7 @@ static struct ngene_info ngene_info_duoFlex = {
 	.msi_supported	= true,
 };
 
-static struct ngene_info ngene_info_m780 = {
+static const struct ngene_info ngene_info_m780 = {
 	.type           = NGENE_APP,
 	.name           = "Aver M780 ATSC/QAM-B",
 
@@ -727,7 +727,7 @@ static struct drxd_config fe_terratec_dvbt_1 = {
 	.osc_deviation  = osc_deviation,
 };
 
-static struct ngene_info ngene_info_terratec = {
+static const struct ngene_info ngene_info_terratec = {
 	.type           = NGENE_TERRATEC,
 	.name           = "Terratec Integra/Cinergy2400i Dual DVB-T",
 	.io_type        = {NGENE_IO_TSIN, NGENE_IO_TSIN},
diff --git a/drivers/media/pci/smipcie/smipcie-main.c b/drivers/media/pci/smipcie/smipcie-main.c
index 83981d61..6dbe3b4 100644
--- a/drivers/media/pci/smipcie/smipcie-main.c
+++ b/drivers/media/pci/smipcie/smipcie-main.c
@@ -1060,7 +1060,7 @@ static void smi_remove(struct pci_dev *pdev)
 }
 
 /* DVBSky cards */
-static struct smi_cfg_info dvbsky_s950_cfg = {
+static const struct smi_cfg_info dvbsky_s950_cfg = {
 	.type = SMI_DVBSKY_S950,
 	.name = "DVBSky S950 V3",
 	.ts_0 = SMI_TS_NULL,
@@ -1070,7 +1070,7 @@ static struct smi_cfg_info dvbsky_s950_cfg = {
 	.rc_map = RC_MAP_DVBSKY,
 };
 
-static struct smi_cfg_info dvbsky_s952_cfg = {
+static const struct smi_cfg_info dvbsky_s952_cfg = {
 	.type = SMI_DVBSKY_S952,
 	.name = "DVBSky S952 V3",
 	.ts_0 = SMI_TS_DMA_BOTH,
@@ -1080,7 +1080,7 @@ static struct smi_cfg_info dvbsky_s952_cfg = {
 	.rc_map = RC_MAP_DVBSKY,
 };
 
-static struct smi_cfg_info dvbsky_t9580_cfg = {
+static const struct smi_cfg_info dvbsky_t9580_cfg = {
 	.type = SMI_DVBSKY_T9580,
 	.name = "DVBSky T9580 V3",
 	.ts_0 = SMI_TS_DMA_BOTH,
@@ -1090,7 +1090,7 @@ static struct smi_cfg_info dvbsky_t9580_cfg = {
 	.rc_map = RC_MAP_DVBSKY,
 };
 
-static struct smi_cfg_info technotrend_s2_4200_cfg = {
+static const struct smi_cfg_info technotrend_s2_4200_cfg = {
 	.type = SMI_TECHNOTREND_S2_4200,
 	.name = "TechnoTrend TT-budget S2-4200 Twin",
 	.ts_0 = SMI_TS_DMA_BOTH,

[toc] | [prev] | [next] | [standalone]


#1480791 — [PATCH 01/26] ALSA: pci: constify local structures

FromJulia Lawall <Julia.Lawall@lip6.fr>
Date2016-09-11 15:30 +0200
Subject[PATCH 01/26] ALSA: pci: constify local structures
Message-ID<sgcZA-6F5-45@gated-at.bofh.it>
In reply to#1480788
For structure types defined in the same file or local header files, find
top-level static structure declarations that have the following
properties:
1. Never reassigned.
2. Address never taken
3. Not passed to a top-level macro call
4. No pointer or array-typed field passed to a function or stored in a
variable.
Declare structures having all of these properties as const.

Done using Coccinelle.
Based on a suggestion by Joe Perches <joe@perches.com>.

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

---
The semantic patch seems too long for a commit log, but is in the cover
letter.

 sound/pci/ctxfi/ctatc.c      |    2 +-
 sound/pci/hda/patch_ca0132.c |   10 +++++-----
 sound/pci/riptide/riptide.c  |    2 +-
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/sound/pci/ctxfi/ctatc.c b/sound/pci/ctxfi/ctatc.c
index 977a598..908658a 100644
--- a/sound/pci/ctxfi/ctatc.c
+++ b/sound/pci/ctxfi/ctatc.c
@@ -1623,7 +1623,7 @@ static int atc_resume(struct ct_atc *atc)
 }
 #endif
 
-static struct ct_atc atc_preset = {
+static const struct ct_atc atc_preset = {
 	.map_audio_buffer = ct_map_audio_buffer,
 	.unmap_audio_buffer = ct_unmap_audio_buffer,
 	.pcm_playback_prepare = atc_pcm_playback_prepare,
diff --git a/sound/pci/hda/patch_ca0132.c b/sound/pci/hda/patch_ca0132.c
index 9ceb2bc..ad06866 100644
--- a/sound/pci/hda/patch_ca0132.c
+++ b/sound/pci/hda/patch_ca0132.c
@@ -4018,7 +4018,7 @@ static int ca0132_build_controls(struct hda_codec *codec)
 /*
  * PCM
  */
-static struct hda_pcm_stream ca0132_pcm_analog_playback = {
+static const struct hda_pcm_stream ca0132_pcm_analog_playback = {
 	.substreams = 1,
 	.channels_min = 2,
 	.channels_max = 6,
@@ -4029,7 +4029,7 @@ static struct hda_pcm_stream ca0132_pcm_analog_playback = {
 	},
 };
 
-static struct hda_pcm_stream ca0132_pcm_analog_capture = {
+static const struct hda_pcm_stream ca0132_pcm_analog_capture = {
 	.substreams = 1,
 	.channels_min = 2,
 	.channels_max = 2,
@@ -4040,7 +4040,7 @@ static struct hda_pcm_stream ca0132_pcm_analog_capture = {
 	},
 };
 
-static struct hda_pcm_stream ca0132_pcm_digital_playback = {
+static const struct hda_pcm_stream ca0132_pcm_digital_playback = {
 	.substreams = 1,
 	.channels_min = 2,
 	.channels_max = 2,
@@ -4052,7 +4052,7 @@ static struct hda_pcm_stream ca0132_pcm_digital_playback = {
 	},
 };
 
-static struct hda_pcm_stream ca0132_pcm_digital_capture = {
+static const struct hda_pcm_stream ca0132_pcm_digital_capture = {
 	.substreams = 1,
 	.channels_min = 2,
 	.channels_max = 2,
@@ -4614,7 +4614,7 @@ static void ca0132_free(struct hda_codec *codec)
 	kfree(codec->spec);
 }
 
-static struct hda_codec_ops ca0132_patch_ops = {
+static const struct hda_codec_ops ca0132_patch_ops = {
 	.build_controls = ca0132_build_controls,
 	.build_pcms = ca0132_build_pcms,
 	.init = ca0132_init,
diff --git a/sound/pci/riptide/riptide.c b/sound/pci/riptide/riptide.c
index ae41fcb..ada5f01 100644
--- a/sound/pci/riptide/riptide.c
+++ b/sound/pci/riptide/riptide.c
@@ -644,7 +644,7 @@ static struct lbuspath lbus_play_paths[] = {
 	 .mono = lbus_play_mono3,
 	 },
 };
-static struct lbuspath lbus_rec_path = {
+static const struct lbuspath lbus_rec_path = {
 	.noconv = lbus_rec_noconv1,
 	.stereo = lbus_rec_stereo1,
 	.mono = lbus_rec_mono1,

[toc] | [prev] | [next] | [standalone]


#1480939 — Re: [PATCH 01/26] ALSA: pci: constify local structures

FromTakashi Iwai <tiwai@suse.de>
Date2016-09-12 08:20 +0200
SubjectRe: [PATCH 01/26] ALSA: pci: constify local structures
Message-ID<sgsKZ-81z-1@gated-at.bofh.it>
In reply to#1480791
On Sun, 11 Sep 2016 15:05:43 +0200,
Julia Lawall wrote:
> 
> For structure types defined in the same file or local header files, find
> top-level static structure declarations that have the following
> properties:
> 1. Never reassigned.
> 2. Address never taken
> 3. Not passed to a top-level macro call
> 4. No pointer or array-typed field passed to a function or stored in a
> variable.
> Declare structures having all of these properties as const.
> 
> Done using Coccinelle.
> Based on a suggestion by Joe Perches <joe@perches.com>.
> 
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

Thanks, applied now.


Takashi

> ---
> The semantic patch seems too long for a commit log, but is in the cover
> letter.
> 
>  sound/pci/ctxfi/ctatc.c      |    2 +-
>  sound/pci/hda/patch_ca0132.c |   10 +++++-----
>  sound/pci/riptide/riptide.c  |    2 +-
>  3 files changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/sound/pci/ctxfi/ctatc.c b/sound/pci/ctxfi/ctatc.c
> index 977a598..908658a 100644
> --- a/sound/pci/ctxfi/ctatc.c
> +++ b/sound/pci/ctxfi/ctatc.c
> @@ -1623,7 +1623,7 @@ static int atc_resume(struct ct_atc *atc)
>  }
>  #endif
>  
> -static struct ct_atc atc_preset = {
> +static const struct ct_atc atc_preset = {
>  	.map_audio_buffer = ct_map_audio_buffer,
>  	.unmap_audio_buffer = ct_unmap_audio_buffer,
>  	.pcm_playback_prepare = atc_pcm_playback_prepare,
> diff --git a/sound/pci/hda/patch_ca0132.c b/sound/pci/hda/patch_ca0132.c
> index 9ceb2bc..ad06866 100644
> --- a/sound/pci/hda/patch_ca0132.c
> +++ b/sound/pci/hda/patch_ca0132.c
> @@ -4018,7 +4018,7 @@ static int ca0132_build_controls(struct hda_codec *codec)
>  /*
>   * PCM
>   */
> -static struct hda_pcm_stream ca0132_pcm_analog_playback = {
> +static const struct hda_pcm_stream ca0132_pcm_analog_playback = {
>  	.substreams = 1,
>  	.channels_min = 2,
>  	.channels_max = 6,
> @@ -4029,7 +4029,7 @@ static struct hda_pcm_stream ca0132_pcm_analog_playback = {
>  	},
>  };
>  
> -static struct hda_pcm_stream ca0132_pcm_analog_capture = {
> +static const struct hda_pcm_stream ca0132_pcm_analog_capture = {
>  	.substreams = 1,
>  	.channels_min = 2,
>  	.channels_max = 2,
> @@ -4040,7 +4040,7 @@ static struct hda_pcm_stream ca0132_pcm_analog_capture = {
>  	},
>  };
>  
> -static struct hda_pcm_stream ca0132_pcm_digital_playback = {
> +static const struct hda_pcm_stream ca0132_pcm_digital_playback = {
>  	.substreams = 1,
>  	.channels_min = 2,
>  	.channels_max = 2,
> @@ -4052,7 +4052,7 @@ static struct hda_pcm_stream ca0132_pcm_digital_playback = {
>  	},
>  };
>  
> -static struct hda_pcm_stream ca0132_pcm_digital_capture = {
> +static const struct hda_pcm_stream ca0132_pcm_digital_capture = {
>  	.substreams = 1,
>  	.channels_min = 2,
>  	.channels_max = 2,
> @@ -4614,7 +4614,7 @@ static void ca0132_free(struct hda_codec *codec)
>  	kfree(codec->spec);
>  }
>  
> -static struct hda_codec_ops ca0132_patch_ops = {
> +static const struct hda_codec_ops ca0132_patch_ops = {
>  	.build_controls = ca0132_build_controls,
>  	.build_pcms = ca0132_build_pcms,
>  	.init = ca0132_init,
> diff --git a/sound/pci/riptide/riptide.c b/sound/pci/riptide/riptide.c
> index ae41fcb..ada5f01 100644
> --- a/sound/pci/riptide/riptide.c
> +++ b/sound/pci/riptide/riptide.c
> @@ -644,7 +644,7 @@ static struct lbuspath lbus_play_paths[] = {
>  	 .mono = lbus_play_mono3,
>  	 },
>  };
> -static struct lbuspath lbus_rec_path = {
> +static const struct lbuspath lbus_rec_path = {
>  	.noconv = lbus_rec_noconv1,
>  	.stereo = lbus_rec_stereo1,
>  	.mono = lbus_rec_mono1,
> 
> 

[toc] | [prev] | [next] | [standalone]


#1480792 — [PATCH 24/26] ACPI / APD: constify local structures

FromJulia Lawall <Julia.Lawall@lip6.fr>
Date2016-09-11 15:30 +0200
Subject[PATCH 24/26] ACPI / APD: constify local structures
Message-ID<sgcZA-6F5-55@gated-at.bofh.it>
In reply to#1480788
For structure types defined in the same file or local header files, find
top-level static structure declarations that have the following
properties:
1. Never reassigned.
2. Address never taken
3. Not passed to a top-level macro call
4. No pointer or array-typed field passed to a function or stored in a
variable.
Declare structures having all of these properties as const.

Done using Coccinelle.
Based on a suggestion by Joe Perches <joe@perches.com>.

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

---
The semantic patch seems too long for a commit log, but is in the cover
letter.

 drivers/acpi/acpi_apd.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/acpi/acpi_apd.c b/drivers/acpi/acpi_apd.c
index 1f30fff..d58fbf7 100644
--- a/drivers/acpi/acpi_apd.c
+++ b/drivers/acpi/acpi_apd.c
@@ -72,7 +72,7 @@ static int acpi_apd_setup(struct apd_private_data *pdata)
 }
 
 #ifdef CONFIG_X86_AMD_PLATFORM_DEVICE
-static struct apd_device_desc cz_i2c_desc = {
+static const struct apd_device_desc cz_i2c_desc = {
 	.setup = acpi_apd_setup,
 	.fixed_clk_rate = 133000000,
 };
@@ -84,7 +84,7 @@ static struct property_entry uart_properties[] = {
 	{ },
 };
 
-static struct apd_device_desc cz_uart_desc = {
+static const struct apd_device_desc cz_uart_desc = {
 	.setup = acpi_apd_setup,
 	.fixed_clk_rate = 48000000,
 	.properties = uart_properties,
@@ -92,12 +92,12 @@ static struct apd_device_desc cz_uart_desc = {
 #endif
 
 #ifdef CONFIG_ARM64
-static struct apd_device_desc xgene_i2c_desc = {
+static const struct apd_device_desc xgene_i2c_desc = {
 	.setup = acpi_apd_setup,
 	.fixed_clk_rate = 100000000,
 };
 
-static struct apd_device_desc vulcan_spi_desc = {
+static const struct apd_device_desc vulcan_spi_desc = {
 	.setup = acpi_apd_setup,
 	.fixed_clk_rate = 133000000,
 };

[toc] | [prev] | [next] | [standalone]


#1482853 — Re: [PATCH 24/26] ACPI / APD: constify local structures

From"Rafael J. Wysocki" <rjw@rjwysocki.net>
Date2016-09-14 02:50 +0200
SubjectRe: [PATCH 24/26] ACPI / APD: constify local structures
Message-ID<sh6yJ-13E-9@gated-at.bofh.it>
In reply to#1480792
On Sunday, September 11, 2016 03:06:06 PM Julia Lawall wrote:
> For structure types defined in the same file or local header files, find
> top-level static structure declarations that have the following
> properties:
> 1. Never reassigned.
> 2. Address never taken
> 3. Not passed to a top-level macro call
> 4. No pointer or array-typed field passed to a function or stored in a
> variable.
> Declare structures having all of these properties as const.
> 
> Done using Coccinelle.
> Based on a suggestion by Joe Perches <joe@perches.com>.
> 
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

Applied.

Thanks,
Rafael

[toc] | [prev] | [next] | [standalone]


#1480793 — [PATCH 25/26] pch_gbe: constify local structures

FromJulia Lawall <Julia.Lawall@lip6.fr>
Date2016-09-11 15:30 +0200
Subject[PATCH 25/26] pch_gbe: constify local structures
Message-ID<sgcZA-6F5-57@gated-at.bofh.it>
In reply to#1480788
For structure types defined in the same file or local header files, find
top-level static structure declarations that have the following
properties:
1. Never reassigned.
2. Address never taken
3. Not passed to a top-level macro call
4. No pointer or array-typed field passed to a function or stored in a
variable.
Declare structures having all of these properties as const.

Done using Coccinelle.
Based on a suggestion by Joe Perches <joe@perches.com>.

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

---
The semantic patch seems too long for a commit log, but is in the cover
letter.

 drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c b/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c
index 3cd87a4..6f33258 100644
--- a/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c
+++ b/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c
@@ -2729,7 +2729,7 @@ static int pch_gbe_minnow_platform_init(struct pci_dev *pdev)
 	return ret;
 }
 
-static struct pch_gbe_privdata pch_gbe_minnow_privdata = {
+static const struct pch_gbe_privdata pch_gbe_minnow_privdata = {
 	.phy_tx_clk_delay = true,
 	.phy_disable_hibernate = true,
 	.platform_init = pch_gbe_minnow_platform_init,

[toc] | [prev] | [next] | [standalone]


#1480902 — Re: [PATCH 25/26] pch_gbe: constify local structures

FromDavid Miller <davem@davemloft.net>
Date2016-09-12 04:50 +0200
SubjectRe: [PATCH 25/26] pch_gbe: constify local structures
Message-ID<sgptM-5TD-11@gated-at.bofh.it>
In reply to#1480793
Julia, I went over the networking driver patches in this series and
I have to say that I'd rather see these changes be more durable
and self-checking.

By this I mean that I want you to also make the driver private pointer
that holds these structures be const too.

Then if there are really any assignments to the objects being marked
const, it will show immediately.

Thank you.

[toc] | [prev] | [next] | [standalone]


#1481062 — Re: [PATCH 25/26] pch_gbe: constify local structures

FromJulia Lawall <julia.lawall@lip6.fr>
Date2016-09-12 11:10 +0200
SubjectRe: [PATCH 25/26] pch_gbe: constify local structures
Message-ID<sgvpw-1eW-23@gated-at.bofh.it>
In reply to#1480902

On Sun, 11 Sep 2016, David Miller wrote:

>
> Julia, I went over the networking driver patches in this series and
> I have to say that I'd rather see these changes be more durable
> and self-checking.
>
> By this I mean that I want you to also make the driver private pointer
> that holds these structures be const too.

Sorry, I'm not sure what you are asking for.  In these cases, we often end
up with something like:

static const struct foo = { ... };

and then later

xxx.ops = foo;

So foo is protected, but its lifetime of interest is quite short.  But we
can't set the ops field of the type of xxx to be const either, because it
is obviously not - the code above modifies it.  Everything would be fine
if ops were of pointer type but not structure type, but that is not the
case in this patch series, because the semantic patch disallows &foo.
There is the __ro_after_init annotation that might help in some cases, but
I have often seen these assignments in probe functions that are not
__init.  Kees Cook mentioned some code that could be inserted before and
after an assignment to make a field temporarily writeable, but I haven't
looked into that possibility yet.

Have I misunderstood something?

thanks,
julia

> Then if there are really any assignments to the objects being marked
> const, it will show immediately.
>
> Thank you.
> --
> To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>

[toc] | [prev] | [next] | [standalone]


#1481533 — Re: [PATCH 25/26] pch_gbe: constify local structures

FromDavid Miller <davem@davemloft.net>
Date2016-09-12 18:40 +0200
SubjectRe: [PATCH 25/26] pch_gbe: constify local structures
Message-ID<sgCr0-5K3-9@gated-at.bofh.it>
In reply to#1481062
From: Julia Lawall <julia.lawall@lip6.fr>
Date: Mon, 12 Sep 2016 11:07:15 +0200 (CEST)

> So foo is protected, but its lifetime of interest is quite short.  But we
> can't set the ops field of the type of xxx to be const either, because it
> is obviously not - the code above modifies it.

You can definitely make it a pointer to a const thing.

Just like "netdev_ops" in struct net_device is const.

[toc] | [prev] | [next] | [standalone]


#1481210 — Re: [PATCH 25/26] pch_gbe: constify local structures

FromJulia Lawall <julia.lawall@lip6.fr>
Date2016-09-12 14:30 +0200
SubjectRe: [PATCH 25/26] pch_gbe: constify local structures
Message-ID<sgyx4-3fQ-23@gated-at.bofh.it>
In reply to#1480793

On Sun, 11 Sep 2016, Julia Lawall wrote:

> For structure types defined in the same file or local header files, find
> top-level static structure declarations that have the following
> properties:
> 1. Never reassigned.
> 2. Address never taken
> 3. Not passed to a top-level macro call
> 4. No pointer or array-typed field passed to a function or stored in a
> variable.
> Declare structures having all of these properties as const.

Actually, this patch should be dropped.  Coccinelle did not recognize
kernel_ulong_t as a type, so it interpreted

(kernel_ulong_t)&pch_gbe_minnow_privdata

as a bit and operation.

julia

> Done using Coccinelle.
> Based on a suggestion by Joe Perches <joe@perches.com>.
>
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
>
> ---
> The semantic patch seems too long for a commit log, but is in the cover
> letter.
>
>  drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c b/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c
> index 3cd87a4..6f33258 100644
> --- a/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c
> +++ b/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c
> @@ -2729,7 +2729,7 @@ static int pch_gbe_minnow_platform_init(struct pci_dev *pdev)
>  	return ret;
>  }
>
> -static struct pch_gbe_privdata pch_gbe_minnow_privdata = {
> +static const struct pch_gbe_privdata pch_gbe_minnow_privdata = {
>  	.phy_tx_clk_delay = true,
>  	.phy_disable_hibernate = true,
>  	.platform_init = pch_gbe_minnow_platform_init,
>
> --
> To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>

[toc] | [prev] | [next] | [standalone]


#1480794 — [PATCH 22/26] esas2r: constify local structures

FromJulia Lawall <Julia.Lawall@lip6.fr>
Date2016-09-11 15:30 +0200
Subject[PATCH 22/26] esas2r: constify local structures
Message-ID<sgcZA-6F5-47@gated-at.bofh.it>
In reply to#1480788
For structure types defined in the same file or local header files, find
top-level static structure declarations that have the following
properties:
1. Never reassigned.
2. Address never taken
3. Not passed to a top-level macro call
4. No pointer or array-typed field passed to a function or stored in a
variable.
Declare structures having all of these properties as const.

Done using Coccinelle.
Based on a suggestion by Joe Perches <joe@perches.com>.

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

---
The semantic patch seems too long for a commit log, but is in the cover
letter.

 drivers/scsi/esas2r/esas2r_flash.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/esas2r/esas2r_flash.c b/drivers/scsi/esas2r/esas2r_flash.c
index 7bd376d..f8414b5 100644
--- a/drivers/scsi/esas2r/esas2r_flash.c
+++ b/drivers/scsi/esas2r/esas2r_flash.c
@@ -54,7 +54,7 @@
 
 #define ESAS2R_FS_DRVR_VER 2
 
-static struct esas2r_sas_nvram default_sas_nvram = {
+static const struct esas2r_sas_nvram default_sas_nvram = {
 	{ 'E',	'S',  'A',  'S'			     }, /* signature          */
 	SASNVR_VERSION,                                 /* version            */
 	0,                                              /* checksum           */

[toc] | [prev] | [next] | [standalone]


#1480796 — [PATCH 21/26] rtlwifi: rtl818x: constify local structures

FromJulia Lawall <Julia.Lawall@lip6.fr>
Date2016-09-11 15:30 +0200
Subject[PATCH 21/26] rtlwifi: rtl818x: constify local structures
Message-ID<sgcZA-6F5-53@gated-at.bofh.it>
In reply to#1480788
For structure types defined in the same file or local header files, find
top-level static structure declarations that have the following
properties:
1. Never reassigned.
2. Address never taken
3. Not passed to a top-level macro call
4. No pointer or array-typed field passed to a function or stored in a
variable.
Declare structures having all of these properties as const.

Done using Coccinelle.
Based on a suggestion by Joe Perches <joe@perches.com>.

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

---
The semantic patch seems too long for a commit log, but is in the cover
letter.

 drivers/net/wireless/realtek/rtlwifi/rtl8188ee/sw.c |    2 +-
 drivers/net/wireless/realtek/rtlwifi/rtl8192ce/sw.c |    2 +-
 drivers/net/wireless/realtek/rtlwifi/rtl8192de/sw.c |    2 +-
 drivers/net/wireless/realtek/rtlwifi/rtl8192ee/sw.c |    2 +-
 drivers/net/wireless/realtek/rtlwifi/rtl8192se/sw.c |    2 +-
 drivers/net/wireless/realtek/rtlwifi/rtl8723ae/sw.c |    2 +-
 drivers/net/wireless/realtek/rtlwifi/rtl8723be/sw.c |    2 +-
 drivers/net/wireless/realtek/rtlwifi/rtl8821ae/sw.c |    2 +-
 8 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/sw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/sw.c
index 47e32cb..e7b11b4 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/sw.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/sw.c
@@ -280,7 +280,7 @@ static struct rtl_mod_params rtl88ee_mod_params = {
 	.debug = DBG_EMERG,
 };
 
-static struct rtl_hal_cfg rtl88ee_hal_cfg = {
+static const struct rtl_hal_cfg rtl88ee_hal_cfg = {
 	.bar_id = 2,
 	.write_readback = true,
 	.name = "rtl88e_pci",
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/sw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/sw.c
index 4780bdc..87aa209 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/sw.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/sw.c
@@ -258,7 +258,7 @@ static struct rtl_mod_params rtl92ce_mod_params = {
 	.debug = DBG_EMERG,
 };
 
-static struct rtl_hal_cfg rtl92ce_hal_cfg = {
+static const struct rtl_hal_cfg rtl92ce_hal_cfg = {
 	.bar_id = 2,
 	.write_readback = true,
 	.name = "rtl92c_pci",
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/sw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/sw.c
index c6e09a1..0538a4d 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/sw.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/sw.c
@@ -262,7 +262,7 @@ static struct rtl_mod_params rtl92de_mod_params = {
 	.debug = DBG_EMERG,
 };
 
-static struct rtl_hal_cfg rtl92de_hal_cfg = {
+static const struct rtl_hal_cfg rtl92de_hal_cfg = {
 	.bar_id = 2,
 	.write_readback = true,
 	.name = "rtl8192de",
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/sw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/sw.c
index c31c6bf..ac299cb 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/sw.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/sw.c
@@ -262,7 +262,7 @@ static struct rtl_mod_params rtl92ee_mod_params = {
 	.debug = DBG_EMERG,
 };
 
-static struct rtl_hal_cfg rtl92ee_hal_cfg = {
+static const struct rtl_hal_cfg rtl92ee_hal_cfg = {
 	.bar_id = 2,
 	.write_readback = true,
 	.name = "rtl92ee_pci",
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192se/sw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192se/sw.c
index 31baca41..5e8e02d 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192se/sw.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192se/sw.c
@@ -306,7 +306,7 @@ static struct rtl_mod_params rtl92se_mod_params = {
 
 /* Because memory R/W bursting will cause system hang/crash
  * for 92se, so we don't read back after every write action */
-static struct rtl_hal_cfg rtl92se_hal_cfg = {
+static const struct rtl_hal_cfg rtl92se_hal_cfg = {
 	.bar_id = 1,
 	.write_readback = false,
 	.name = "rtl92s_pci",
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/sw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/sw.c
index ff49a8c..89c828a 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/sw.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/sw.c
@@ -276,7 +276,7 @@ static struct rtl_mod_params rtl8723e_mod_params = {
 	.disable_watchdog = false,
 };
 
-static struct rtl_hal_cfg rtl8723e_hal_cfg = {
+static const struct rtl_hal_cfg rtl8723e_hal_cfg = {
 	.bar_id = 2,
 	.write_readback = true,
 	.name = "rtl8723e_pci",
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/sw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/sw.c
index 2101793..20b53f0 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/sw.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/sw.c
@@ -276,7 +276,7 @@ static struct rtl_mod_params rtl8723be_mod_params = {
 	.ant_sel = 0,
 };
 
-static struct rtl_hal_cfg rtl8723be_hal_cfg = {
+static const struct rtl_hal_cfg rtl8723be_hal_cfg = {
 	.bar_id = 2,
 	.write_readback = true,
 	.name = "rtl8723be_pci",
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/sw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/sw.c
index 4159f9b..22f687b1 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/sw.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/sw.c
@@ -316,7 +316,7 @@ static struct rtl_mod_params rtl8821ae_mod_params = {
 	.disable_watchdog = 0,
 };
 
-static struct rtl_hal_cfg rtl8821ae_hal_cfg = {
+static const struct rtl_hal_cfg rtl8821ae_hal_cfg = {
 	.bar_id = 2,
 	.write_readback = true,
 	.name = "rtl8821ae_pci",

[toc] | [prev] | [next] | [standalone]


#1480797 — [PATCH 15/26] platform/chrome: constify local structures

FromJulia Lawall <Julia.Lawall@lip6.fr>
Date2016-09-11 15:40 +0200
Subject[PATCH 15/26] platform/chrome: constify local structures
Message-ID<sgd9f-6Ig-1@gated-at.bofh.it>
In reply to#1480788
For structure types defined in the same file or local header files, find
top-level static structure declarations that have the following
properties:
1. Never reassigned.
2. Address never taken
3. Not passed to a top-level macro call
4. No pointer or array-typed field passed to a function or stored in a
variable.
Declare structures having all of these properties as const.

Done using Coccinelle.
Based on a suggestion by Joe Perches <joe@perches.com>.

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

---
The semantic patch seems too long for a commit log, but is in the cover
letter.

 drivers/platform/chrome/chromeos_laptop.c |   22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/platform/chrome/chromeos_laptop.c b/drivers/platform/chrome/chromeos_laptop.c
index e8a44a9..01a53e7 100644
--- a/drivers/platform/chrome/chromeos_laptop.c
+++ b/drivers/platform/chrome/chromeos_laptop.c
@@ -423,7 +423,7 @@ static int chromeos_laptop_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static struct chromeos_laptop samsung_series_5_550 = {
+static const struct chromeos_laptop samsung_series_5_550 = {
 	.i2c_peripherals = {
 		/* Touchpad. */
 		{ .add = setup_cyapa_tp, I2C_ADAPTER_SMBUS },
@@ -432,14 +432,14 @@ static struct chromeos_laptop samsung_series_5_550 = {
 	},
 };
 
-static struct chromeos_laptop samsung_series_5 = {
+static const struct chromeos_laptop samsung_series_5 = {
 	.i2c_peripherals = {
 		/* Light Sensor. */
 		{ .add = setup_tsl2583_als, I2C_ADAPTER_SMBUS },
 	},
 };
 
-static struct chromeos_laptop chromebook_pixel = {
+static const struct chromeos_laptop chromebook_pixel = {
 	.i2c_peripherals = {
 		/* Touch Screen. */
 		{ .add = setup_atmel_1664s_ts, I2C_ADAPTER_PANEL },
@@ -450,14 +450,14 @@ static struct chromeos_laptop chromebook_pixel = {
 	},
 };
 
-static struct chromeos_laptop hp_chromebook_14 = {
+static const struct chromeos_laptop hp_chromebook_14 = {
 	.i2c_peripherals = {
 		/* Touchpad. */
 		{ .add = setup_cyapa_tp, I2C_ADAPTER_DESIGNWARE_0 },
 	},
 };
 
-static struct chromeos_laptop dell_chromebook_11 = {
+static const struct chromeos_laptop dell_chromebook_11 = {
 	.i2c_peripherals = {
 		/* Touchpad. */
 		{ .add = setup_cyapa_tp, I2C_ADAPTER_DESIGNWARE_0 },
@@ -466,28 +466,28 @@ static struct chromeos_laptop dell_chromebook_11 = {
 	},
 };
 
-static struct chromeos_laptop toshiba_cb35 = {
+static const struct chromeos_laptop toshiba_cb35 = {
 	.i2c_peripherals = {
 		/* Touchpad. */
 		{ .add = setup_cyapa_tp, I2C_ADAPTER_DESIGNWARE_0 },
 	},
 };
 
-static struct chromeos_laptop acer_c7_chromebook = {
+static const struct chromeos_laptop acer_c7_chromebook = {
 	.i2c_peripherals = {
 		/* Touchpad. */
 		{ .add = setup_cyapa_tp, I2C_ADAPTER_SMBUS },
 	},
 };
 
-static struct chromeos_laptop acer_ac700 = {
+static const struct chromeos_laptop acer_ac700 = {
 	.i2c_peripherals = {
 		/* Light Sensor. */
 		{ .add = setup_tsl2563_als, I2C_ADAPTER_SMBUS },
 	},
 };
 
-static struct chromeos_laptop acer_c720 = {
+static const struct chromeos_laptop acer_c720 = {
 	.i2c_peripherals = {
 		/* Touchscreen. */
 		{ .add = setup_atmel_1664s_ts, I2C_ADAPTER_DESIGNWARE_1 },
@@ -500,14 +500,14 @@ static struct chromeos_laptop acer_c720 = {
 	},
 };
 
-static struct chromeos_laptop hp_pavilion_14_chromebook = {
+static const struct chromeos_laptop hp_pavilion_14_chromebook = {
 	.i2c_peripherals = {
 		/* Touchpad. */
 		{ .add = setup_cyapa_tp, I2C_ADAPTER_SMBUS },
 	},
 };
 
-static struct chromeos_laptop cr48 = {
+static const struct chromeos_laptop cr48 = {
 	.i2c_peripherals = {
 		/* Light Sensor. */
 		{ .add = setup_tsl2563_als, I2C_ADAPTER_SMBUS },

[toc] | [prev] | [next] | [standalone]


#1480798 — [PATCH 07/26] net/mlx4_core: constify local structures

FromJulia Lawall <Julia.Lawall@lip6.fr>
Date2016-09-11 15:40 +0200
Subject[PATCH 07/26] net/mlx4_core: constify local structures
Message-ID<sgd9g-6Ig-3@gated-at.bofh.it>
In reply to#1480788
For structure types defined in the same file or local header files, find
top-level static structure declarations that have the following
properties:
1. Never reassigned.
2. Address never taken
3. Not passed to a top-level macro call
4. No pointer or array-typed field passed to a function or stored in a
variable.
Declare structures having all of these properties as const.

Done using Coccinelle.
Based on a suggestion by Joe Perches <joe@perches.com>.

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

---
The semantic patch seems too long for a commit log, but is in the cover
letter.

 drivers/net/ethernet/mellanox/mlx4/main.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c
index 75dd2e3..9a3c359 100644
--- a/drivers/net/ethernet/mellanox/mlx4/main.c
+++ b/drivers/net/ethernet/mellanox/mlx4/main.c
@@ -120,7 +120,7 @@ static char mlx4_version[] =
 	DRV_NAME ": Mellanox ConnectX core driver v"
 	DRV_VERSION " (" DRV_RELDATE ")\n";
 
-static struct mlx4_profile default_profile = {
+static const struct mlx4_profile default_profile = {
 	.num_qp		= 1 << 18,
 	.num_srq	= 1 << 16,
 	.rdmarc_per_qp	= 1 << 4,
@@ -130,7 +130,7 @@ static struct mlx4_profile default_profile = {
 	.num_mtt	= 1 << 20, /* It is really num mtt segements */
 };
 
-static struct mlx4_profile low_mem_profile = {
+static const struct mlx4_profile low_mem_profile = {
 	.num_qp		= 1 << 17,
 	.num_srq	= 1 << 6,
 	.rdmarc_per_qp	= 1 << 4,

[toc] | [prev] | [next] | [standalone]


#1480924 — Re: [PATCH 07/26] net/mlx4_core: constify local structures

FromLeon Romanovsky <leon@kernel.org>
Date2016-09-12 07:10 +0200
SubjectRe: [PATCH 07/26] net/mlx4_core: constify local structures
Message-ID<sgrFf-7pF-1@gated-at.bofh.it>
In reply to#1480798

[Multipart message — attachments visible in raw view] — view raw

On Sun, Sep 11, 2016 at 03:05:49PM +0200, Julia Lawall wrote:
> For structure types defined in the same file or local header files, find
> top-level static structure declarations that have the following
> properties:
> 1. Never reassigned.
> 2. Address never taken
> 3. Not passed to a top-level macro call
> 4. No pointer or array-typed field passed to a function or stored in a
> variable.
> Declare structures having all of these properties as const.
>
> Done using Coccinelle.
> Based on a suggestion by Joe Perches <joe@perches.com>.
>
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

Thanks,
Reviewed-by: Leon Romanovsky <leonro@mellanox.com>

[toc] | [prev] | [next] | [standalone]


#1480799 — [PATCH 05/26] ARCNET: constify local structures

FromJulia Lawall <Julia.Lawall@lip6.fr>
Date2016-09-11 15:40 +0200
Subject[PATCH 05/26] ARCNET: constify local structures
Message-ID<sgd9g-6Ig-7@gated-at.bofh.it>
In reply to#1480788
For structure types defined in the same file or local header files, find
top-level static structure declarations that have the following
properties:
1. Never reassigned.
2. Address never taken
3. Not passed to a top-level macro call
4. No pointer or array-typed field passed to a function or stored in a
variable.
Declare structures having all of these properties as const.

Done using Coccinelle.
Based on a suggestion by Joe Perches <joe@perches.com>.

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

---
The semantic patch seems too long for a commit log, but is in the cover
letter.

 drivers/net/arcnet/com20020-pci.c |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/net/arcnet/com20020-pci.c b/drivers/net/arcnet/com20020-pci.c
index 239de38..32b8406 100644
--- a/drivers/net/arcnet/com20020-pci.c
+++ b/drivers/net/arcnet/com20020-pci.c
@@ -264,7 +264,7 @@ static void com20020pci_remove(struct pci_dev *pdev)
 	}
 }
 
-static struct com20020_pci_card_info card_info_10mbit = {
+static const struct com20020_pci_card_info card_info_10mbit = {
 	.name = "ARC-PCI",
 	.devcount = 1,
 	.chan_map_tbl = {
@@ -277,7 +277,7 @@ static struct com20020_pci_card_info card_info_10mbit = {
 	.flags = ARC_CAN_10MBIT,
 };
 
-static struct com20020_pci_card_info card_info_5mbit = {
+static const struct com20020_pci_card_info card_info_5mbit = {
 	.name = "ARC-PCI",
 	.devcount = 1,
 	.chan_map_tbl = {
@@ -290,7 +290,7 @@ static struct com20020_pci_card_info card_info_5mbit = {
 	.flags = ARC_IS_5MBIT,
 };
 
-static struct com20020_pci_card_info card_info_sohard = {
+static const struct com20020_pci_card_info card_info_sohard = {
 	.name = "PLX-PCI",
 	.devcount = 1,
 	/* SOHARD needs PCI base addr 4 */
@@ -304,7 +304,7 @@ static struct com20020_pci_card_info card_info_sohard = {
 	.flags = ARC_CAN_10MBIT,
 };
 
-static struct com20020_pci_card_info card_info_eae_arc1 = {
+static const struct com20020_pci_card_info card_info_eae_arc1 = {
 	.name = "EAE PLX-PCI ARC1",
 	.devcount = 1,
 	.chan_map_tbl = {
@@ -329,7 +329,7 @@ static struct com20020_pci_card_info card_info_eae_arc1 = {
 	.flags = ARC_CAN_10MBIT,
 };
 
-static struct com20020_pci_card_info card_info_eae_ma1 = {
+static const struct com20020_pci_card_info card_info_eae_ma1 = {
 	.name = "EAE PLX-PCI MA1",
 	.devcount = 2,
 	.chan_map_tbl = {

[toc] | [prev] | [next] | [standalone]


#1481219 — Re: [PATCH 05/26] ARCNET: constify local structures

FromJulia Lawall <julia.lawall@lip6.fr>
Date2016-09-12 14:40 +0200
SubjectRe: [PATCH 05/26] ARCNET: constify local structures
Message-ID<sgyGL-3jx-51@gated-at.bofh.it>
In reply to#1480799

On Sun, 11 Sep 2016, Julia Lawall wrote:

> For structure types defined in the same file or local header files, find
> top-level static structure declarations that have the following
> properties:
> 1. Never reassigned.
> 2. Address never taken
> 3. Not passed to a top-level macro call
> 4. No pointer or array-typed field passed to a function or stored in a
> variable.
> Declare structures having all of these properties as const.

Actually, this patch should be dropped.  Coccinelle did not recognize
kernel_ulong_t as a type, so it interpreted things like

(kernel_ulong_t)&card_info_10mbit

as a bit and operation.

julia


>
> Done using Coccinelle.
> Based on a suggestion by Joe Perches <joe@perches.com>.
>
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
>
> ---
> The semantic patch seems too long for a commit log, but is in the cover
> letter.
>
>  drivers/net/arcnet/com20020-pci.c |   10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/net/arcnet/com20020-pci.c b/drivers/net/arcnet/com20020-pci.c
> index 239de38..32b8406 100644
> --- a/drivers/net/arcnet/com20020-pci.c
> +++ b/drivers/net/arcnet/com20020-pci.c
> @@ -264,7 +264,7 @@ static void com20020pci_remove(struct pci_dev *pdev)
>  	}
>  }
>
> -static struct com20020_pci_card_info card_info_10mbit = {
> +static const struct com20020_pci_card_info card_info_10mbit = {
>  	.name = "ARC-PCI",
>  	.devcount = 1,
>  	.chan_map_tbl = {
> @@ -277,7 +277,7 @@ static struct com20020_pci_card_info card_info_10mbit = {
>  	.flags = ARC_CAN_10MBIT,
>  };
>
> -static struct com20020_pci_card_info card_info_5mbit = {
> +static const struct com20020_pci_card_info card_info_5mbit = {
>  	.name = "ARC-PCI",
>  	.devcount = 1,
>  	.chan_map_tbl = {
> @@ -290,7 +290,7 @@ static struct com20020_pci_card_info card_info_5mbit = {
>  	.flags = ARC_IS_5MBIT,
>  };
>
> -static struct com20020_pci_card_info card_info_sohard = {
> +static const struct com20020_pci_card_info card_info_sohard = {
>  	.name = "PLX-PCI",
>  	.devcount = 1,
>  	/* SOHARD needs PCI base addr 4 */
> @@ -304,7 +304,7 @@ static struct com20020_pci_card_info card_info_sohard = {
>  	.flags = ARC_CAN_10MBIT,
>  };
>
> -static struct com20020_pci_card_info card_info_eae_arc1 = {
> +static const struct com20020_pci_card_info card_info_eae_arc1 = {
>  	.name = "EAE PLX-PCI ARC1",
>  	.devcount = 1,
>  	.chan_map_tbl = {
> @@ -329,7 +329,7 @@ static struct com20020_pci_card_info card_info_eae_arc1 = {
>  	.flags = ARC_CAN_10MBIT,
>  };
>
> -static struct com20020_pci_card_info card_info_eae_ma1 = {
> +static const struct com20020_pci_card_info card_info_eae_ma1 = {
>  	.name = "EAE PLX-PCI MA1",
>  	.devcount = 2,
>  	.chan_map_tbl = {
>
> --
> To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>

[toc] | [prev] | [next] | [standalone]


#1480800 — [PATCH 04/26] matroxfb: constify local structures

FromJulia Lawall <Julia.Lawall@lip6.fr>
Date2016-09-11 15:40 +0200
Subject[PATCH 04/26] matroxfb: constify local structures
Message-ID<sgd9g-6Ig-5@gated-at.bofh.it>
In reply to#1480788
For structure types defined in the same file or local header files, find
top-level static structure declarations that have the following
properties:
1. Never reassigned.
2. Address never taken
3. Not passed to a top-level macro call
4. No pointer or array-typed field passed to a function or stored in a
variable.
Declare structures having all of these properties as const.

Done using Coccinelle.
Based on a suggestion by Joe Perches <joe@perches.com>.

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

---
The semantic patch seems too long for a commit log, but is in the cover
letter.

 drivers/video/fbdev/matrox/matroxfb_g450.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/video/fbdev/matrox/matroxfb_g450.c b/drivers/video/fbdev/matrox/matroxfb_g450.c
index cff0546..f108ae6 100644
--- a/drivers/video/fbdev/matrox/matroxfb_g450.c
+++ b/drivers/video/fbdev/matrox/matroxfb_g450.c
@@ -433,7 +433,7 @@ static void cve2_init_TVdata(int norm, struct mavenregs* data, const struct outp
 		0x00,	/* 3E written multiple times */
 		0x00,	/* 3F not written */
 	} };
-	static struct mavenregs ntscregs = { {
+	static const struct mavenregs ntscregs = { {
 		0x21, 0xF0, 0x7C, 0x1F,	/* 00: chroma subcarrier */
 		0x00,
 		0x00,	/* test */

[toc] | [prev] | [next] | [standalone]


Page 1 of 3  [1] 2 3  Next page →

Back to top | Article view | linux.kernel


csiph-web