Re: [PATCH] ALSA: sound/isa: constify snd_kcontrol_new structures

2017-05-17 Thread Bhumika Goyal
On Wed, May 17, 2017 at 5:50 PM, Takashi Iwai <ti...@suse.de> wrote:
> On Wed, 17 May 2017 13:38:56 +0200,
> Bhumika Goyal wrote:
>>
>> Declare snd_kcontrol_new structures as const as they are only passed an
>> argument to the function snd_ctl_new1. This argument is of type const,
>> so snd_kcontrol_new structures having this property can be made const.
>> Done using Coccinelle:
>>
>> @r disable optional_qualifier@
>> identifier x;
>> position p;
>> @@
>> static struct snd_kcontrol_new x@p={...};
>>
>> @ok@
>> identifier r.x;
>> position p;
>> @@
>> snd_ctl_new1(@p,...)
>>
>> @bad@
>> position p != {r.p,ok.p};
>> identifier r.x;
>> @@
>> x@p
>>
>> @depends on !bad disable optional_qualifier@
>> identifier r.x;
>> @@
>> +const
>> struct snd_kcontrol_new x;
>>
>> Signed-off-by: Bhumika Goyal <bhumi...@gmail.com>
>
> As I already asked, could you send as a patchset if you have multiple
> similar patches?
>

Sure. Will combine the already sent ones and some new ones into a
patchset and send again.

Thanks,
Bhumika

>
> thanks,
>
> Takashi


[PATCH 0/2] drivers: net: add const to mii_phy_ops structures

2017-06-08 Thread Bhumika Goyal
The object references of mii_phy_ops structures are only stored
in the ops field of a mii_phy_def structure. This ops field is of type
const. So, mii_phy_ops structures having similar properties can be
declared as const.

Bhumika Goyal (2):
  drivers/net/sungem: add const to mii_phy_ops structures
  drivers: net: emac: add const to mii_phy_ops structures

 drivers/net/ethernet/ibm/emac/phy.c | 12 ++--
 drivers/net/sungem_phy.c| 26 +-
 2 files changed, 19 insertions(+), 19 deletions(-)

-- 
2.7.4



[PATCH 1/2] drivers/net/sungem: add const to mii_phy_ops structures

2017-06-08 Thread Bhumika Goyal
The object references of mii_phy_ops structures are only stored
in the ops field of a mii_phy_def structure. This ops field is of type
const. So, mii_phy_ops structures having similar properties can be
declared as const.

Signed-off-by: Bhumika Goyal <bhumi...@gmail.com>
---
 drivers/net/sungem_phy.c | 26 +-
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/drivers/net/sungem_phy.c b/drivers/net/sungem_phy.c
index 92578d72..63a8ff8 100644
--- a/drivers/net/sungem_phy.c
+++ b/drivers/net/sungem_phy.c
@@ -886,7 +886,7 @@ static int marvell_read_link(struct mii_phy *phy)
 SUPPORTED_1000baseT_Half | SUPPORTED_1000baseT_Full)
 
 /* Broadcom BCM 5201 */
-static struct mii_phy_ops bcm5201_phy_ops = {
+static const struct mii_phy_ops bcm5201_phy_ops = {
.init   = bcm5201_init,
.suspend= bcm5201_suspend,
.setup_aneg = genmii_setup_aneg,
@@ -905,7 +905,7 @@ static struct mii_phy_def bcm5201_phy_def = {
 };
 
 /* Broadcom BCM 5221 */
-static struct mii_phy_ops bcm5221_phy_ops = {
+static const struct mii_phy_ops bcm5221_phy_ops = {
.suspend= bcm5221_suspend,
.init   = bcm5221_init,
.setup_aneg = genmii_setup_aneg,
@@ -924,7 +924,7 @@ static struct mii_phy_def bcm5221_phy_def = {
 };
 
 /* Broadcom BCM 5241 */
-static struct mii_phy_ops bcm5241_phy_ops = {
+static const struct mii_phy_ops bcm5241_phy_ops = {
.suspend= bcm5241_suspend,
.init   = bcm5241_init,
.setup_aneg = genmii_setup_aneg,
@@ -942,7 +942,7 @@ static struct mii_phy_def bcm5241_phy_def = {
 };
 
 /* Broadcom BCM 5400 */
-static struct mii_phy_ops bcm5400_phy_ops = {
+static const struct mii_phy_ops bcm5400_phy_ops = {
.init   = bcm5400_init,
.suspend= bcm5400_suspend,
.setup_aneg = bcm54xx_setup_aneg,
@@ -961,7 +961,7 @@ static struct mii_phy_def bcm5400_phy_def = {
 };
 
 /* Broadcom BCM 5401 */
-static struct mii_phy_ops bcm5401_phy_ops = {
+static const struct mii_phy_ops bcm5401_phy_ops = {
.init   = bcm5401_init,
.suspend= bcm5401_suspend,
.setup_aneg = bcm54xx_setup_aneg,
@@ -980,7 +980,7 @@ static struct mii_phy_def bcm5401_phy_def = {
 };
 
 /* Broadcom BCM 5411 */
-static struct mii_phy_ops bcm5411_phy_ops = {
+static const struct mii_phy_ops bcm5411_phy_ops = {
.init   = bcm5411_init,
.suspend= generic_suspend,
.setup_aneg = bcm54xx_setup_aneg,
@@ -999,7 +999,7 @@ static struct mii_phy_def bcm5411_phy_def = {
 };
 
 /* Broadcom BCM 5421 */
-static struct mii_phy_ops bcm5421_phy_ops = {
+static const struct mii_phy_ops bcm5421_phy_ops = {
.init   = bcm5421_init,
.suspend= generic_suspend,
.setup_aneg = bcm54xx_setup_aneg,
@@ -1019,7 +1019,7 @@ static struct mii_phy_def bcm5421_phy_def = {
 };
 
 /* Broadcom BCM 5421 built-in K2 */
-static struct mii_phy_ops bcm5421k2_phy_ops = {
+static const struct mii_phy_ops bcm5421k2_phy_ops = {
.init   = bcm5421_init,
.suspend= generic_suspend,
.setup_aneg = bcm54xx_setup_aneg,
@@ -1037,7 +1037,7 @@ static struct mii_phy_def bcm5421k2_phy_def = {
.ops= _phy_ops
 };
 
-static struct mii_phy_ops bcm5461_phy_ops = {
+static const struct mii_phy_ops bcm5461_phy_ops = {
.init   = bcm5421_init,
.suspend= generic_suspend,
.setup_aneg = bcm54xx_setup_aneg,
@@ -1057,7 +1057,7 @@ static struct mii_phy_def bcm5461_phy_def = {
 };
 
 /* Broadcom BCM 5462 built-in Vesta */
-static struct mii_phy_ops bcm5462V_phy_ops = {
+static const struct mii_phy_ops bcm5462V_phy_ops = {
.init   = bcm5421_init,
.suspend= generic_suspend,
.setup_aneg = bcm54xx_setup_aneg,
@@ -1076,7 +1076,7 @@ static struct mii_phy_def bcm5462V_phy_def = {
 };
 
 /* Marvell 88E1101 amd 88E */
-static struct mii_phy_ops marvell88e1101_phy_ops = {
+static const struct mii_phy_ops marvell88e1101_phy_ops = {
.suspend= generic_suspend,
.setup_aneg = marvell_setup_aneg,
.setup_forced   = marvell_setup_forced,
@@ -1084,7 +1084,7 @@ static struct mii_phy_ops marvell88e1101_phy_ops = {
.read_link  = marvell_read_link
 };
 
-static struct mii_phy_ops marvell88e_phy_ops = {
+static const struct mii_phy_ops marvell88e_phy_ops = {
.init   = marvell88e_init,
.suspend= generic_suspend,
.setup_aneg = marvell_setup_aneg,
@@ -1122,7 +1122,7 @@ static struct mii_phy_def marvell88e_phy_def = {
 };
 
 /* Generic implementation for most 10/100 PHYs */
-static struct mii_phy_ops generic_phy_ops = {
+static const struct mii_phy_ops generic_phy_ops = {
.setup_aneg = genmii_setup_aneg,
.setup_forced   = genmii_setup_forced,
.pol

[PATCH 2/2] drivers: net: emac: add const to mii_phy_ops structures

2017-06-08 Thread Bhumika Goyal
The object references of mii_phy_ops structures are only stored
in the ops field of a mii_phy_def structure. This ops field is of type
const. So, mii_phy_ops structures having similar properties can be
declared as const.

Signed-off-by: Bhumika Goyal <bhumi...@gmail.com>
---
 drivers/net/ethernet/ibm/emac/phy.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ethernet/ibm/emac/phy.c 
b/drivers/net/ethernet/ibm/emac/phy.c
index 5b88cc6..35865d0 100644
--- a/drivers/net/ethernet/ibm/emac/phy.c
+++ b/drivers/net/ethernet/ibm/emac/phy.c
@@ -276,7 +276,7 @@ static int genmii_read_link(struct mii_phy *phy)
 }
 
 /* Generic implementation for most 10/100/1000 PHYs */
-static struct mii_phy_ops generic_phy_ops = {
+static const struct mii_phy_ops generic_phy_ops = {
.setup_aneg = genmii_setup_aneg,
.setup_forced   = genmii_setup_forced,
.poll_link  = genmii_poll_link,
@@ -340,7 +340,7 @@ static int cis8201_init(struct mii_phy *phy)
return 0;
 }
 
-static struct mii_phy_ops cis8201_phy_ops = {
+static const struct mii_phy_ops cis8201_phy_ops = {
.init   = cis8201_init,
.setup_aneg = genmii_setup_aneg,
.setup_forced   = genmii_setup_forced,
@@ -420,7 +420,7 @@ static int et1011c_init(struct mii_phy *phy)
return 0;
 }
 
-static struct mii_phy_ops et1011c_phy_ops = {
+static const struct mii_phy_ops et1011c_phy_ops = {
.init   = et1011c_init,
.setup_aneg = genmii_setup_aneg,
.setup_forced   = genmii_setup_forced,
@@ -439,7 +439,7 @@ static struct mii_phy_def et1011c_phy_def = {
 
 
 
-static struct mii_phy_ops m88e_phy_ops = {
+static const struct mii_phy_ops m88e_phy_ops = {
.init   = m88e_init,
.setup_aneg = genmii_setup_aneg,
.setup_forced   = genmii_setup_forced,
@@ -455,7 +455,7 @@ static struct mii_phy_def m88e_phy_def = {
.ops= _phy_ops,
 };
 
-static struct mii_phy_ops m88e1112_phy_ops = {
+static const struct mii_phy_ops m88e1112_phy_ops = {
.init   = m88e1112_init,
.setup_aneg = genmii_setup_aneg,
.setup_forced   = genmii_setup_forced,
@@ -480,7 +480,7 @@ static int ar8035_init(struct mii_phy *phy)
return 0;
 }
 
-static struct mii_phy_ops ar8035_phy_ops = {
+static const struct mii_phy_ops ar8035_phy_ops = {
.init   = ar8035_init,
.setup_aneg = genmii_setup_aneg,
.setup_forced   = genmii_setup_forced,
-- 
2.7.4



[PATCH v2] platform/x86: ideapad-laptop: constify rfkill_ops structure

2017-06-09 Thread Bhumika Goyal
Add const to rfkill_ops structure as it is only passed as an argument
to the functions rfkill_alloc. This argument is of type const, 
so annotate the structure with const.

Signed-off-by: Bhumika Goyal <bhumi...@gmail.com>
---
Changes since v1:
* Split the changes to one patch per vendor.

 drivers/platform/x86/ideapad-laptop.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/platform/x86/ideapad-laptop.c 
b/drivers/platform/x86/ideapad-laptop.c
index 24ca9fb..3beec1e 100644
--- a/drivers/platform/x86/ideapad-laptop.c
+++ b/drivers/platform/x86/ideapad-laptop.c
@@ -478,7 +478,7 @@ static int ideapad_rfk_set(void *data, bool blocked)
return write_ec_cmd(priv->priv->adev->handle, opcode, !blocked);
 }
 
-static struct rfkill_ops ideapad_rfk_ops = {
+static const struct rfkill_ops ideapad_rfk_ops = {
.set_block = ideapad_rfk_set,
 };
 
-- 
2.7.4



[PATCH v2] platform/x86: samsung-laptop: constify rfkill_ops structures

2017-06-09 Thread Bhumika Goyal
Add const to rfkill_ops structures that are only passed as an argument
to the functions rfkill_alloc or samsung_new_rfkill. These arguments are
of type const, so such structures can be annotated with const.

Signed-off-by: Bhumika Goyal <bhumi...@gmail.com>
---
Changes since v1:
* Split the changes to one patch per vendor.

 drivers/platform/x86/samsung-laptop.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/platform/x86/samsung-laptop.c 
b/drivers/platform/x86/samsung-laptop.c
index 8c146e2..e1e8897 100644
--- a/drivers/platform/x86/samsung-laptop.c
+++ b/drivers/platform/x86/samsung-laptop.c
@@ -591,7 +591,7 @@ static int seclinux_rfkill_set(void *data, bool blocked)
 !blocked);
 }
 
-static struct rfkill_ops seclinux_rfkill_ops = {
+static const struct rfkill_ops seclinux_rfkill_ops = {
.set_block = seclinux_rfkill_set,
 };
 
@@ -651,7 +651,7 @@ static void swsmi_rfkill_query(struct rfkill *rfkill, void 
*priv)
rfkill_set_sw_state(rfkill, !ret);
 }
 
-static struct rfkill_ops swsmi_rfkill_ops = {
+static const struct rfkill_ops swsmi_rfkill_ops = {
.set_block = swsmi_rfkill_set,
.query = swsmi_rfkill_query,
 };
-- 
2.7.4



[PATCH v2] dell-rbtn: constify rfkill_ops structures

2017-06-08 Thread Bhumika Goyal
Add const to rfkill_ops structures that are only passed as an argument
to the functions rfkill_alloc or samsung_new_rfkill. These arguments are
of type const, so such structures can be annotated with const.

Signed-off-by: Bhumika Goyal <bhumi...@gmail.com>
---
Changes since v1:
* Split the changes to one patch per vendor.

 drivers/platform/x86/dell-rbtn.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/platform/x86/dell-rbtn.c b/drivers/platform/x86/dell-rbtn.c
index dcd9f40..6b5bbaf 100644
--- a/drivers/platform/x86/dell-rbtn.c
+++ b/drivers/platform/x86/dell-rbtn.c
@@ -110,7 +110,7 @@ static int rbtn_rfkill_set_block(void *data, bool blocked)
return -EINVAL;
 }
 
-static struct rfkill_ops rbtn_ops = {
+static const struct rfkill_ops rbtn_ops = {
.query = rbtn_rfkill_query,
.set_block = rbtn_rfkill_set_block,
 };
-- 
2.7.4



[PATCH 0/2] platform/x86: add const to thermal_cooling_device_ops structures

2017-06-21 Thread Bhumika Goyal
Declare thermal_cooling_device_ops structures as const.

Bhumika Goyal (2):
  acerhdf: add const to thermal_cooling_device_ops structure
  intel_menlow: add const to thermal_cooling_device_ops structure

 drivers/platform/x86/acerhdf.c  | 2 +-
 drivers/platform/x86/intel_menlow.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

-- 
2.7.4



[PATCH 2/2] intel_menlow: add const to thermal_cooling_device_ops structure

2017-06-21 Thread Bhumika Goyal
Declare thermal_cooling_device_ops structure as const as it is only passed
as an argument to the function thermal_cooling_device_register and this
argument is of type const. So, declare the structure as const.

Signed-off-by: Bhumika Goyal <bhumi...@gmail.com>
---
 drivers/platform/x86/intel_menlow.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/platform/x86/intel_menlow.c 
b/drivers/platform/x86/intel_menlow.c
index cbe0102..ef9b0af 100644
--- a/drivers/platform/x86/intel_menlow.c
+++ b/drivers/platform/x86/intel_menlow.c
@@ -142,7 +142,7 @@ static int memory_set_cur_bandwidth(struct 
thermal_cooling_device *cdev,
return 0;
 }
 
-static struct thermal_cooling_device_ops memory_cooling_ops = {
+static const struct thermal_cooling_device_ops memory_cooling_ops = {
.get_max_state = memory_get_max_bandwidth,
.get_cur_state = memory_get_cur_bandwidth,
.set_cur_state = memory_set_cur_bandwidth,
-- 
2.7.4



[PATCH 1/2] acerhdf: add const to thermal_cooling_device_ops structure

2017-06-21 Thread Bhumika Goyal
Declare thermal_cooling_device_ops structure as const as it is only passed
as an argument to the function thermal_cooling_device_register and this
argument is of type const. So, declare the structure as const.

Signed-off-by: Bhumika Goyal <bhumi...@gmail.com>
---
 drivers/platform/x86/acerhdf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/platform/x86/acerhdf.c b/drivers/platform/x86/acerhdf.c
index 2acdb0d..ea22591 100644
--- a/drivers/platform/x86/acerhdf.c
+++ b/drivers/platform/x86/acerhdf.c
@@ -557,7 +557,7 @@ static int acerhdf_set_cur_state(struct 
thermal_cooling_device *cdev,
 }
 
 /* bind fan callbacks to fan device */
-static struct thermal_cooling_device_ops acerhdf_cooling_ops = {
+static const struct thermal_cooling_device_ops acerhdf_cooling_ops = {
.get_max_state = acerhdf_get_max_state,
.get_cur_state = acerhdf_get_cur_state,
.set_cur_state = acerhdf_set_cur_state,
-- 
2.7.4



[PATCH v2 0/2] drm: constify drm_encoder_helper_funcs structures

2017-06-21 Thread Bhumika Goyal
Add const to drm_encoder_helper_funcs structures.

Changes in v2 -
* Let the line exceed over 80 characters while adding const
in analogix_dp-rockchip.c file.

Bhumika Goyal (2):
  drm/rockchip: add const to drm_encoder_helper_funcs structures
  drm/sun4i: add const to drm_encoder_helper_funcs structures

 drivers/gpu/drm/rockchip/analogix_dp-rockchip.c | 2 +-
 drivers/gpu/drm/rockchip/inno_hdmi.c| 2 +-
 drivers/gpu/drm/sun4i/sun4i_rgb.c   | 2 +-
 drivers/gpu/drm/sun4i/sun4i_tv.c| 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

-- 
2.7.4



[PATCH v2 2/2] drm/sun4i: add const to drm_encoder_helper_funcs structures

2017-06-21 Thread Bhumika Goyal
Add const to drm_encoder_helper_funcs structures as they are only passed
as an argument to the function drm_encoder_helper_add and this argument
is of type const. So, add const to these structures.

Signed-off-by: Bhumika Goyal <bhumi...@gmail.com>
---
Changes in v2 -
* No change

 drivers/gpu/drm/sun4i/sun4i_rgb.c | 2 +-
 drivers/gpu/drm/sun4i/sun4i_tv.c  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/sun4i/sun4i_rgb.c 
b/drivers/gpu/drm/sun4i/sun4i_rgb.c
index 422b191..67847d2 100644
--- a/drivers/gpu/drm/sun4i/sun4i_rgb.c
+++ b/drivers/gpu/drm/sun4i/sun4i_rgb.c
@@ -181,7 +181,7 @@ static void sun4i_rgb_encoder_mode_set(struct drm_encoder 
*encoder,
clk_set_phase(tcon->dclk, 120);
 }
 
-static struct drm_encoder_helper_funcs sun4i_rgb_enc_helper_funcs = {
+static const struct drm_encoder_helper_funcs sun4i_rgb_enc_helper_funcs = {
.atomic_check   = sun4i_rgb_atomic_check,
.mode_set   = sun4i_rgb_encoder_mode_set,
.disable= sun4i_rgb_encoder_disable,
diff --git a/drivers/gpu/drm/sun4i/sun4i_tv.c b/drivers/gpu/drm/sun4i/sun4i_tv.c
index 338b9e5..b20f97a 100644
--- a/drivers/gpu/drm/sun4i/sun4i_tv.c
+++ b/drivers/gpu/drm/sun4i/sun4i_tv.c
@@ -488,7 +488,7 @@ static void sun4i_tv_mode_set(struct drm_encoder *encoder,
regmap_write(tv->regs, SUN4I_TVE_SLAVE_REG, 0);
 }
 
-static struct drm_encoder_helper_funcs sun4i_tv_helper_funcs = {
+static const struct drm_encoder_helper_funcs sun4i_tv_helper_funcs = {
.atomic_check   = sun4i_tv_atomic_check,
.disable= sun4i_tv_disable,
.enable = sun4i_tv_enable,
-- 
2.7.4



[PATCH v2 1/2] drm/rockchip: add const to drm_encoder_helper_funcs structures

2017-06-21 Thread Bhumika Goyal
Add const to drm_encoder_helper_funcs structures as they are only passed
as an argument to the function drm_encoder_helper_add and this argument
is of type const. So, add const to these structures.

Signed-off-by: Bhumika Goyal <bhumi...@gmail.com>
---
Changes in v2 -
* Let the line exceed over 80 characters while adding const.

 drivers/gpu/drm/rockchip/analogix_dp-rockchip.c | 2 +-
 drivers/gpu/drm/rockchip/inno_hdmi.c| 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c 
b/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c
index 9606121..b64cadc 100644
--- a/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c
+++ b/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c
@@ -252,7 +252,7 @@ rockchip_dp_drm_encoder_atomic_check(struct drm_encoder 
*encoder,
return 0;
 }
 
-static struct drm_encoder_helper_funcs rockchip_dp_encoder_helper_funcs = {
+static const struct drm_encoder_helper_funcs rockchip_dp_encoder_helper_funcs 
= {
.mode_fixup = rockchip_dp_drm_encoder_mode_fixup,
.mode_set = rockchip_dp_drm_encoder_mode_set,
.enable = rockchip_dp_drm_encoder_enable,
diff --git a/drivers/gpu/drm/rockchip/inno_hdmi.c 
b/drivers/gpu/drm/rockchip/inno_hdmi.c
index 7d9b75e..4ab9fad 100644
--- a/drivers/gpu/drm/rockchip/inno_hdmi.c
+++ b/drivers/gpu/drm/rockchip/inno_hdmi.c
@@ -530,7 +530,7 @@ inno_hdmi_encoder_atomic_check(struct drm_encoder *encoder,
return 0;
 }
 
-static struct drm_encoder_helper_funcs inno_hdmi_encoder_helper_funcs = {
+static const struct drm_encoder_helper_funcs inno_hdmi_encoder_helper_funcs = {
.enable = inno_hdmi_encoder_enable,
.disable= inno_hdmi_encoder_disable,
.mode_fixup = inno_hdmi_encoder_mode_fixup,
-- 
2.7.4



[PATCH] thermal/intel_powerclamp: add const to thermal_cooling_device_ops structure

2017-06-21 Thread Bhumika Goyal
Declare thermal_cooling_device_ops structure as const as it is only passed
as an argument to the function thermal_cooling_device_register and this
argument is of type const. So, declare the structure as const.

Signed-off-by: Bhumika Goyal <bhumi...@gmail.com>
---
 drivers/thermal/intel_powerclamp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/thermal/intel_powerclamp.c 
b/drivers/thermal/intel_powerclamp.c
index d718cd1..e4c68b7 100644
--- a/drivers/thermal/intel_powerclamp.c
+++ b/drivers/thermal/intel_powerclamp.c
@@ -659,7 +659,7 @@ static int powerclamp_set_cur_state(struct 
thermal_cooling_device *cdev,
 }
 
 /* bind to generic thermal layer as cooling device*/
-static struct thermal_cooling_device_ops powerclamp_cooling_ops = {
+static const struct thermal_cooling_device_ops powerclamp_cooling_ops = {
.get_max_state = powerclamp_get_max_state,
.get_cur_state = powerclamp_get_cur_state,
.set_cur_state = powerclamp_set_cur_state,
-- 
2.7.4



Re: [PATCH 1/2] drm/rockchip: add const to drm_encoder_helper_funcs structures

2017-06-21 Thread Bhumika Goyal
On Wed, Jun 21, 2017 at 6:18 AM, Mark yao <mark@rock-chips.com> wrote:
> On 2017年06月20日 21:07, Bhumika Goyal wrote:
>>
>> Add const to drm_encoder_helper_funcs structures as they are only passed
>> as an argument to the function drm_encoder_helper_add and this argument
>> is of type const. So, add const to these structures. Also, fix line over
>> 80 characters warning while adding const.
>>
>> Signed-off-by: Bhumika Goyal <bhumi...@gmail.com>
>> ---
>>   drivers/gpu/drm/rockchip/analogix_dp-rockchip.c | 3 ++-
>>   drivers/gpu/drm/rockchip/inno_hdmi.c| 2 +-
>>   2 files changed, 3 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c
>> b/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c
>> index 9606121..96c6c10 100644
>> --- a/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c
>> +++ b/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c
>> @@ -252,7 +252,8 @@ rockchip_dp_drm_encoder_atomic_check(struct
>> drm_encoder *encoder,
>> return 0;
>>   }
>>   -static struct drm_encoder_helper_funcs rockchip_dp_encoder_helper_funcs
>> = {
>> +static
>> +const struct drm_encoder_helper_funcs rockchip_dp_encoder_helper_funcs =
>> {
>
>
> I don't think split static and const into two line is a good idea, it's
> ugly. I'm ok over 80 characters with good-looking.
> Or split like following:
> static const struct drm_encoder_helper_funcs
> rockchip_dp_encoder_helper_funcs = {
>

Okay, so I will let the line exceed over 80 characters and send a v2.

Thanks,
Bhumika

>> .mode_fixup = rockchip_dp_drm_encoder_mode_fixup,
>> .mode_set = rockchip_dp_drm_encoder_mode_set,
>> .enable = rockchip_dp_drm_encoder_enable,
>> diff --git a/drivers/gpu/drm/rockchip/inno_hdmi.c
>> b/drivers/gpu/drm/rockchip/inno_hdmi.c
>> index 7d9b75e..4ab9fad 100644
>> --- a/drivers/gpu/drm/rockchip/inno_hdmi.c
>> +++ b/drivers/gpu/drm/rockchip/inno_hdmi.c
>> @@ -530,7 +530,7 @@ inno_hdmi_encoder_atomic_check(struct drm_encoder
>> *encoder,
>> return 0;
>>   }
>>   -static struct drm_encoder_helper_funcs inno_hdmi_encoder_helper_funcs =
>> {
>> +static const struct drm_encoder_helper_funcs
>> inno_hdmi_encoder_helper_funcs = {
>> .enable = inno_hdmi_encoder_enable,
>> .disable= inno_hdmi_encoder_disable,
>> .mode_fixup = inno_hdmi_encoder_mode_fixup,
>
>
> Thanks
>
> --
> Mark Yao
>
>


[PATCH] iwlwifi: mvm: add const to thermal_cooling_device_ops structure

2017-06-21 Thread Bhumika Goyal
Declare thermal_cooling_device_ops structure as const as it is only passed
as an argument to the function thermal_cooling_device_register and this
argument is of type const. So, declare the structure as const.

Signed-off-by: Bhumika Goyal <bhumi...@gmail.com>
---
 drivers/net/wireless/intel/iwlwifi/mvm/tt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/tt.c 
b/drivers/net/wireless/intel/iwlwifi/mvm/tt.c
index 453a785..0b5a177 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/tt.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/tt.c
@@ -813,7 +813,7 @@ static int iwl_mvm_tcool_set_cur_state(struct 
thermal_cooling_device *cdev,
return ret;
 }
 
-static struct thermal_cooling_device_ops tcooling_ops = {
+static const struct thermal_cooling_device_ops tcooling_ops = {
.get_max_state = iwl_mvm_tcool_get_max_state,
.get_cur_state = iwl_mvm_tcool_get_cur_state,
.set_cur_state = iwl_mvm_tcool_set_cur_state,
-- 
2.7.4



[PATCH] drm/etnaviv: add const to thermal_cooling_device_ops structure

2017-06-21 Thread Bhumika Goyal
Declare thermal_cooling_device_ops structure as const as it is only passed
as an argument to the function thermal_of_cooling_device_register and this
argument is of type const. So, declare the structure as const.

Signed-off-by: Bhumika Goyal <bhumi...@gmail.com>
---
 drivers/gpu/drm/etnaviv/etnaviv_gpu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c 
b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
index ada45fd..cfa9cfc 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
@@ -1608,7 +1608,7 @@ etnaviv_gpu_cooling_set_cur_state(struct 
thermal_cooling_device *cdev,
return 0;
 }
 
-static struct thermal_cooling_device_ops cooling_ops = {
+static const struct thermal_cooling_device_ops cooling_ops = {
.get_max_state = etnaviv_gpu_cooling_get_max_state,
.get_cur_state = etnaviv_gpu_cooling_get_cur_state,
.set_cur_state = etnaviv_gpu_cooling_set_cur_state,
-- 
2.7.4



[PATCH] ath10k: add const to thermal_cooling_device_ops structure

2017-06-21 Thread Bhumika Goyal
Declare thermal_cooling_device_ops structure as const as it is only passed
as an argument to the function thermal_cooling_device_register and this
argument is of type const. So, declare the structure as const.

Signed-off-by: Bhumika Goyal <bhumi...@gmail.com>
---
 drivers/net/wireless/ath/ath10k/thermal.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath10k/thermal.c 
b/drivers/net/wireless/ath/ath10k/thermal.c
index 87948af..ef717b6 100644
--- a/drivers/net/wireless/ath/ath10k/thermal.c
+++ b/drivers/net/wireless/ath/ath10k/thermal.c
@@ -63,7 +63,7 @@ ath10k_thermal_set_cur_throttle_state(struct 
thermal_cooling_device *cdev,
return 0;
 }
 
-static struct thermal_cooling_device_ops ath10k_thermal_ops = {
+static const struct thermal_cooling_device_ops ath10k_thermal_ops = {
.get_max_state = ath10k_thermal_get_max_throttle_state,
.get_cur_state = ath10k_thermal_get_cur_throttle_state,
.set_cur_state = ath10k_thermal_set_cur_throttle_state,
-- 
2.7.4



[PATCH 0/2] drm: constify drm_encoder_helper_funcs structures

2017-06-20 Thread Bhumika Goyal
Add const to drm_encoder_helper_funcs structures.

Bhumika Goyal (2):
  drm/rockchip: add const to drm_encoder_helper_funcs structures
  drm/sun4i: add const to drm_encoder_helper_funcs structures

 drivers/gpu/drm/rockchip/analogix_dp-rockchip.c | 3 ++-
 drivers/gpu/drm/rockchip/inno_hdmi.c| 2 +-
 drivers/gpu/drm/sun4i/sun4i_rgb.c   | 2 +-
 drivers/gpu/drm/sun4i/sun4i_tv.c| 2 +-
 4 files changed, 5 insertions(+), 4 deletions(-)

-- 
2.7.4



[PATCH 2/2] drm/sun4i: add const to drm_encoder_helper_funcs structures

2017-06-20 Thread Bhumika Goyal
Add const to drm_encoder_helper_funcs structures as they are only passed
as an argument to the function drm_encoder_helper_add and this argument
is of type const. So, add const to these structures.

Signed-off-by: Bhumika Goyal <bhumi...@gmail.com>
---
 drivers/gpu/drm/sun4i/sun4i_rgb.c | 2 +-
 drivers/gpu/drm/sun4i/sun4i_tv.c  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/sun4i/sun4i_rgb.c 
b/drivers/gpu/drm/sun4i/sun4i_rgb.c
index 422b191..67847d2 100644
--- a/drivers/gpu/drm/sun4i/sun4i_rgb.c
+++ b/drivers/gpu/drm/sun4i/sun4i_rgb.c
@@ -181,7 +181,7 @@ static void sun4i_rgb_encoder_mode_set(struct drm_encoder 
*encoder,
clk_set_phase(tcon->dclk, 120);
 }
 
-static struct drm_encoder_helper_funcs sun4i_rgb_enc_helper_funcs = {
+static const struct drm_encoder_helper_funcs sun4i_rgb_enc_helper_funcs = {
.atomic_check   = sun4i_rgb_atomic_check,
.mode_set   = sun4i_rgb_encoder_mode_set,
.disable= sun4i_rgb_encoder_disable,
diff --git a/drivers/gpu/drm/sun4i/sun4i_tv.c b/drivers/gpu/drm/sun4i/sun4i_tv.c
index 338b9e5..b20f97a 100644
--- a/drivers/gpu/drm/sun4i/sun4i_tv.c
+++ b/drivers/gpu/drm/sun4i/sun4i_tv.c
@@ -488,7 +488,7 @@ static void sun4i_tv_mode_set(struct drm_encoder *encoder,
regmap_write(tv->regs, SUN4I_TVE_SLAVE_REG, 0);
 }
 
-static struct drm_encoder_helper_funcs sun4i_tv_helper_funcs = {
+static const struct drm_encoder_helper_funcs sun4i_tv_helper_funcs = {
.atomic_check   = sun4i_tv_atomic_check,
.disable= sun4i_tv_disable,
.enable = sun4i_tv_enable,
-- 
2.7.4



[PATCH 1/2] drm/rockchip: add const to drm_encoder_helper_funcs structures

2017-06-20 Thread Bhumika Goyal
Add const to drm_encoder_helper_funcs structures as they are only passed
as an argument to the function drm_encoder_helper_add and this argument
is of type const. So, add const to these structures. Also, fix line over
80 characters warning while adding const.

Signed-off-by: Bhumika Goyal <bhumi...@gmail.com>
---
 drivers/gpu/drm/rockchip/analogix_dp-rockchip.c | 3 ++-
 drivers/gpu/drm/rockchip/inno_hdmi.c| 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c 
b/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c
index 9606121..96c6c10 100644
--- a/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c
+++ b/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c
@@ -252,7 +252,8 @@ rockchip_dp_drm_encoder_atomic_check(struct drm_encoder 
*encoder,
return 0;
 }
 
-static struct drm_encoder_helper_funcs rockchip_dp_encoder_helper_funcs = {
+static
+const struct drm_encoder_helper_funcs rockchip_dp_encoder_helper_funcs = {
.mode_fixup = rockchip_dp_drm_encoder_mode_fixup,
.mode_set = rockchip_dp_drm_encoder_mode_set,
.enable = rockchip_dp_drm_encoder_enable,
diff --git a/drivers/gpu/drm/rockchip/inno_hdmi.c 
b/drivers/gpu/drm/rockchip/inno_hdmi.c
index 7d9b75e..4ab9fad 100644
--- a/drivers/gpu/drm/rockchip/inno_hdmi.c
+++ b/drivers/gpu/drm/rockchip/inno_hdmi.c
@@ -530,7 +530,7 @@ inno_hdmi_encoder_atomic_check(struct drm_encoder *encoder,
return 0;
 }
 
-static struct drm_encoder_helper_funcs inno_hdmi_encoder_helper_funcs = {
+static const struct drm_encoder_helper_funcs inno_hdmi_encoder_helper_funcs = {
.enable = inno_hdmi_encoder_enable,
.disable= inno_hdmi_encoder_disable,
.mode_fixup = inno_hdmi_encoder_mode_fixup,
-- 
2.7.4



[PATCH 0/2] ALSA: add const to snd_ratnum structures

2017-06-19 Thread Bhumika Goyal
Declare snd_ratnum structures as const as their reference is only
stored in the rate field of a snd_pcm_hw_constraint_ratnums structure.
This field is of type const, so snd_ratnum structures can be made const.

Bhumika Goyal (2):
  ALSA: sound/isa: constify snd_ratnum structures
  ALSA: sound/pci: add const to snd_ratnum structures

 sound/isa/gus/gus_pcm.c | 2 +-
 sound/isa/sb/sb8_main.c | 2 +-
 sound/pci/bt87x.c   | 2 +-
 sound/pci/ens1370.c | 4 ++--
 4 files changed, 5 insertions(+), 5 deletions(-)

-- 
2.7.4



[PATCH 1/2] ALSA: sound/isa: constify snd_ratnum structures

2017-06-19 Thread Bhumika Goyal
Declare snd_ratnum structures as const as their reference is only
stored in the rate field of a snd_pcm_hw_constraint_ratnums structure.
This field is of type const, so snd_ratnum structures can be made const.

Signed-off-by: Bhumika Goyal <bhumi...@gmail.com>
---
 sound/isa/gus/gus_pcm.c | 2 +-
 sound/isa/sb/sb8_main.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/isa/gus/gus_pcm.c b/sound/isa/gus/gus_pcm.c
index 33c1891..95df8ca 100644
--- a/sound/isa/gus/gus_pcm.c
+++ b/sound/isa/gus/gus_pcm.c
@@ -547,7 +547,7 @@ static snd_pcm_uframes_t 
snd_gf1_pcm_playback_pointer(struct snd_pcm_substream *
return pos;
 }
 
-static struct snd_ratnum clock = {
+static const struct snd_ratnum clock = {
.num = 9878400/16,
.den_min = 2,
.den_max = 257,
diff --git a/sound/isa/sb/sb8_main.c b/sound/isa/sb/sb8_main.c
index 9043397..2491655 100644
--- a/sound/isa/sb/sb8_main.c
+++ b/sound/isa/sb/sb8_main.c
@@ -46,7 +46,7 @@ MODULE_LICENSE("GPL");
 #define SB8_DEN(v) ((SB8_CLOCK + (v) / 2) / (v))
 #define SB8_RATE(v)(SB8_CLOCK / SB8_DEN(v))
 
-static struct snd_ratnum clock = {
+static const struct snd_ratnum clock = {
.num = SB8_CLOCK,
.den_min = 1,
.den_max = 256,
-- 
2.7.4



[PATCH 2/2] ALSA: sound/pci: add const to snd_ratnum structures

2017-06-19 Thread Bhumika Goyal
Declare snd_ratnum structures as const as their reference is only
stored in the rate field of a snd_pcm_hw_constraint_ratnums structure.
This field is of type const, so snd_ratnum structures can be made const.

Signed-off-by: Bhumika Goyal <bhumi...@gmail.com>
---
 sound/pci/bt87x.c   | 2 +-
 sound/pci/ens1370.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/sound/pci/bt87x.c b/sound/pci/bt87x.c
index 099efb0..cbff975 100644
--- a/sound/pci/bt87x.c
+++ b/sound/pci/bt87x.c
@@ -401,7 +401,7 @@ static int snd_bt87x_set_digital_hw(struct snd_bt87x *chip, 
struct snd_pcm_runti
 
 static int snd_bt87x_set_analog_hw(struct snd_bt87x *chip, struct 
snd_pcm_runtime *runtime)
 {
-   static struct snd_ratnum analog_clock = {
+   static const struct snd_ratnum analog_clock = {
.num = ANALOG_CLOCK,
.den_min = CLOCK_DIV_MIN,
.den_max = CLOCK_DIV_MAX,
diff --git a/sound/pci/ens1370.c b/sound/pci/ens1370.c
index 09a63ef..f023076 100644
--- a/sound/pci/ens1370.c
+++ b/sound/pci/ens1370.c
@@ -474,7 +474,7 @@ static struct snd_pcm_hw_constraint_list 
snd_es1370_hw_constraints_rates = {
.list = snd_es1370_fixed_rates,
.mask = 0,
 };
-static struct snd_ratnum es1370_clock = {
+static const struct snd_ratnum es1370_clock = {
.num = ES_1370_SRCLOCK,
.den_min = 29, 
.den_max = 353,
@@ -495,7 +495,7 @@ static struct snd_pcm_hw_constraint_ratdens 
snd_es1371_hw_constraints_dac_clock
.nrats = 1,
.rats = _dac_clock,
 };
-static struct snd_ratnum es1371_adc_clock = {
+static const struct snd_ratnum es1371_adc_clock = {
.num = 48000 << 15,
.den_min = 32768, 
.den_max = 393216,
-- 
2.7.4



[PATCH] cw1200: add const to hwbus_ops structures

2017-06-23 Thread Bhumika Goyal
Declare hwbus_ops structures as const as they are only passed as an
argument to the function cw1200_core_probe. This argument is of type
const. So, make these structures const.

Signed-off-by: Bhumika Goyal <bhumi...@gmail.com>
---
 drivers/net/wireless/st/cw1200/cw1200_sdio.c | 2 +-
 drivers/net/wireless/st/cw1200/cw1200_spi.c  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/st/cw1200/cw1200_sdio.c 
b/drivers/net/wireless/st/cw1200/cw1200_sdio.c
index 709f56e..1037ec6 100644
--- a/drivers/net/wireless/st/cw1200/cw1200_sdio.c
+++ b/drivers/net/wireless/st/cw1200/cw1200_sdio.c
@@ -266,7 +266,7 @@ static int cw1200_sdio_pm(struct hwbus_priv *self, bool 
suspend)
return ret;
 }
 
-static struct hwbus_ops cw1200_sdio_hwbus_ops = {
+static const struct hwbus_ops cw1200_sdio_hwbus_ops = {
.hwbus_memcpy_fromio= cw1200_sdio_memcpy_fromio,
.hwbus_memcpy_toio  = cw1200_sdio_memcpy_toio,
.lock   = cw1200_sdio_lock,
diff --git a/drivers/net/wireless/st/cw1200/cw1200_spi.c 
b/drivers/net/wireless/st/cw1200/cw1200_spi.c
index 63f95e9..412fb6e4 100644
--- a/drivers/net/wireless/st/cw1200/cw1200_spi.c
+++ b/drivers/net/wireless/st/cw1200/cw1200_spi.c
@@ -352,7 +352,7 @@ static int cw1200_spi_pm(struct hwbus_priv *self, bool 
suspend)
return irq_set_irq_wake(self->func->irq, suspend);
 }
 
-static struct hwbus_ops cw1200_spi_hwbus_ops = {
+static const struct hwbus_ops cw1200_spi_hwbus_ops = {
.hwbus_memcpy_fromio= cw1200_spi_memcpy_fromio,
.hwbus_memcpy_toio  = cw1200_spi_memcpy_toio,
.lock   = cw1200_spi_lock,
-- 
2.7.4



Re: [PATCH] ALSA: sound/isa: constify snd_kcontrol_new structures

2017-05-21 Thread Bhumika Goyal
On Sun, May 21, 2017 at 12:39 PM, Takashi Iwai <ti...@suse.de> wrote:
> On Wed, 17 May 2017 14:33:45 +0200,
> Bhumika Goyal wrote:
>>
>> On Wed, May 17, 2017 at 5:50 PM, Takashi Iwai <ti...@suse.de> wrote:
>> > On Wed, 17 May 2017 13:38:56 +0200,
>> > Bhumika Goyal wrote:
>> >>
>> >> Declare snd_kcontrol_new structures as const as they are only passed an
>> >> argument to the function snd_ctl_new1. This argument is of type const,
>> >> so snd_kcontrol_new structures having this property can be made const.
>> >> Done using Coccinelle:
>> >>
>> >> @r disable optional_qualifier@
>> >> identifier x;
>> >> position p;
>> >> @@
>> >> static struct snd_kcontrol_new x@p={...};
>> >>
>> >> @ok@
>> >> identifier r.x;
>> >> position p;
>> >> @@
>> >> snd_ctl_new1(@p,...)
>> >>
>> >> @bad@
>> >> position p != {r.p,ok.p};
>> >> identifier r.x;
>> >> @@
>> >> x@p
>> >>
>> >> @depends on !bad disable optional_qualifier@
>> >> identifier r.x;
>> >> @@
>> >> +const
>> >> struct snd_kcontrol_new x;
>> >>
>> >> Signed-off-by: Bhumika Goyal <bhumi...@gmail.com>
>> >
>> > As I already asked, could you send as a patchset if you have multiple
>> > similar patches?
>> >
>>
>> Sure. Will combine the already sent ones and some new ones into a
>> patchset and send again.
>
> Well, since there haven't been new submissions and the patches are
> trivial, I applied the existing four patches.  If you have newer ones,
> please submit as a patchset.
>
>

Hey,

Thanks for applying the patches.
I have a doubt that since some of my coming patches are for the sound
subsystem containing similar changes and you will be applying those,
so can I combine and put all the changes in a single patch or sending
a patchset would be a correct way.

Thanks,
Bhumika

> thanks,
>
> Takashi


Re: [PATCH] ALSA: sound/isa: constify snd_kcontrol_new structures

2017-05-22 Thread Bhumika Goyal
On Mon, May 22, 2017 at 11:59 AM, Takashi Iwai <ti...@suse.de> wrote:
> On Mon, 22 May 2017 08:20:45 +0200,
> Julia Lawall wrote:
>>
>>
>>
>> On Mon, 22 May 2017, Bhumika Goyal wrote:
>>
>> > On Sun, May 21, 2017 at 12:39 PM, Takashi Iwai <ti...@suse.de> wrote:
>> > > On Wed, 17 May 2017 14:33:45 +0200,
>> > > Bhumika Goyal wrote:
>> > >>
>> > >> On Wed, May 17, 2017 at 5:50 PM, Takashi Iwai <ti...@suse.de> wrote:
>> > >> > On Wed, 17 May 2017 13:38:56 +0200,
>> > >> > Bhumika Goyal wrote:
>> > >> >>
>> > >> >> Declare snd_kcontrol_new structures as const as they are only passed 
>> > >> >> an
>> > >> >> argument to the function snd_ctl_new1. This argument is of type 
>> > >> >> const,
>> > >> >> so snd_kcontrol_new structures having this property can be made 
>> > >> >> const.
>> > >> >> Done using Coccinelle:
>> > >> >>
>> > >> >> @r disable optional_qualifier@
>> > >> >> identifier x;
>> > >> >> position p;
>> > >> >> @@
>> > >> >> static struct snd_kcontrol_new x@p={...};
>> > >> >>
>> > >> >> @ok@
>> > >> >> identifier r.x;
>> > >> >> position p;
>> > >> >> @@
>> > >> >> snd_ctl_new1(@p,...)
>> > >> >>
>> > >> >> @bad@
>> > >> >> position p != {r.p,ok.p};
>> > >> >> identifier r.x;
>> > >> >> @@
>> > >> >> x@p
>> > >> >>
>> > >> >> @depends on !bad disable optional_qualifier@
>> > >> >> identifier r.x;
>> > >> >> @@
>> > >> >> +const
>> > >> >> struct snd_kcontrol_new x;
>> > >> >>
>> > >> >> Signed-off-by: Bhumika Goyal <bhumi...@gmail.com>
>> > >> >
>> > >> > As I already asked, could you send as a patchset if you have multiple
>> > >> > similar patches?
>> > >> >
>> > >>
>> > >> Sure. Will combine the already sent ones and some new ones into a
>> > >> patchset and send again.
>> > >
>> > > Well, since there haven't been new submissions and the patches are
>> > > trivial, I applied the existing four patches.  If you have newer ones,
>> > > please submit as a patchset.
>> > >
>> > >
>> >
>> > Hey,
>> >
>> > Thanks for applying the patches.
>> > I have a doubt that since some of my coming patches are for the sound
>> > subsystem containing similar changes and you will be applying those,
>> > so can I combine and put all the changes in a single patch or sending
>> > a patchset would be a correct way.
>>
>> I think he means that when you have more sound patches, just do them all
>> at once.
>
> Yes, that's my point.
>
> You've sent each patch individually, and this made me difficult to
> pick up, as I had to wonder "is this really all?" (then 10 minutes
> later another patch arrived :)
>
> At best, submit all the relevant patches via git-send-email with the
> proper cover letter in a single thread.
>

Thanks Julia and Takashi for clearing my doubt. I will keep this point
in mind for my future patches :)

Thanks,
Bhumika
>
> thanks,
>
> Takashi


[PATCH] ALSA: declare snd_kcontrol_new structures as const

2017-05-27 Thread Bhumika Goyal
Declare snd_kcontrol_new structures as const as they are only passed an
argument to the function snd_ctl_new1. This argument is of type const,
so snd_kcontrol_new structures having this property can be made const.
Done using Coccinelle:

@r disable optional_qualifier@
identifier x;
position p;
@@
static struct snd_kcontrol_new x@p={...};

@ok@
identifier r.x;
position p;
@@
snd_ctl_new1(@p,...)

@bad@
position p != {r.p,ok.p};
identifier r.x;
@@
x@p

@depends on !bad disable optional_qualifier@
identifier r.x;
@@
+const
struct snd_kcontrol_new x;

Cross compiled these files:
sound/aoa/codecs/tas.c - powerpc
sound/mips/{hal2.c/sgio2audio.c} - mips
sound/ppc/{awacs.c/beep.c/tumbler.c} - powerpc
sound/soc/sh/siu_dai.c - sh
Could not find an architecture to compile sound/sh/aica.c.

Signed-off-by: Bhumika Goyal <bhumi...@gmail.com>
---
 sound/aoa/codecs/tas.c  | 14 +++---
 sound/aoa/fabrics/layout.c  |  8 
 sound/core/ctljack.c|  2 +-
 sound/drivers/vx/vx_mixer.c | 24 
 sound/firewire/bebob/bebob_maudio.c |  8 
 sound/mips/hal2.c   |  4 ++--
 sound/mips/sgio2audio.c | 14 +++---
 sound/pcmcia/vx/vxp_mixer.c |  4 ++--
 sound/ppc/awacs.c   |  4 ++--
 sound/ppc/beep.c|  2 +-
 sound/ppc/tumbler.c |  8 
 sound/sh/aica.c |  4 ++--
 sound/soc/sh/siu_dai.c  |  4 ++--
 sound/usb/mixer_quirks.c|  2 +-
 14 files changed, 51 insertions(+), 51 deletions(-)

diff --git a/sound/aoa/codecs/tas.c b/sound/aoa/codecs/tas.c
index 78ed1ff..733b636 100644
--- a/sound/aoa/codecs/tas.c
+++ b/sound/aoa/codecs/tas.c
@@ -271,7 +271,7 @@ static int tas_snd_vol_put(struct snd_kcontrol *kcontrol,
return 1;
 }
 
-static struct snd_kcontrol_new volume_control = {
+static const struct snd_kcontrol_new volume_control = {
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.name = "Master Playback Volume",
.access = SNDRV_CTL_ELEM_ACCESS_READWRITE,
@@ -314,7 +314,7 @@ static int tas_snd_mute_put(struct snd_kcontrol *kcontrol,
return 1;
 }
 
-static struct snd_kcontrol_new mute_control = {
+static const struct snd_kcontrol_new mute_control = {
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.name = "Master Playback Switch",
.access = SNDRV_CTL_ELEM_ACCESS_READWRITE,
@@ -426,7 +426,7 @@ static int tas_snd_drc_range_put(struct snd_kcontrol 
*kcontrol,
return 1;
 }
 
-static struct snd_kcontrol_new drc_range_control = {
+static const struct snd_kcontrol_new drc_range_control = {
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.name = "DRC Range",
.access = SNDRV_CTL_ELEM_ACCESS_READWRITE,
@@ -466,7 +466,7 @@ static int tas_snd_drc_switch_put(struct snd_kcontrol 
*kcontrol,
return 1;
 }
 
-static struct snd_kcontrol_new drc_switch_control = {
+static const struct snd_kcontrol_new drc_switch_control = {
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.name = "DRC Range Switch",
.access = SNDRV_CTL_ELEM_ACCESS_READWRITE,
@@ -524,7 +524,7 @@ static int tas_snd_capture_source_put(struct snd_kcontrol 
*kcontrol,
return 1;
 }
 
-static struct snd_kcontrol_new capture_source_control = {
+static const struct snd_kcontrol_new capture_source_control = {
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
/* If we name this 'Input Source', it properly shows up in
 * alsamixer as a selection, * but it's shown under the
@@ -586,7 +586,7 @@ static int tas_snd_treble_put(struct snd_kcontrol *kcontrol,
return 1;
 }
 
-static struct snd_kcontrol_new treble_control = {
+static const struct snd_kcontrol_new treble_control = {
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.name = "Treble",
.access = SNDRV_CTL_ELEM_ACCESS_READWRITE,
@@ -637,7 +637,7 @@ static int tas_snd_bass_put(struct snd_kcontrol *kcontrol,
return 1;
 }
 
-static struct snd_kcontrol_new bass_control = {
+static const struct snd_kcontrol_new bass_control = {
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.name = "Bass",
.access = SNDRV_CTL_ELEM_ACCESS_READWRITE,
diff --git a/sound/aoa/fabrics/layout.c b/sound/aoa/fabrics/layout.c
index a0c4a5d..1eddf8f 100644
--- a/sound/aoa/fabrics/layout.c
+++ b/sound/aoa/fabrics/layout.c
@@ -707,7 +707,7 @@ static int detect_choice_put(struct snd_kcontrol *kcontrol,
return 1;
 }
 
-static struct snd_kcontrol_new headphone_detect_choice = {
+static const struct snd_kcontrol_new headphone_detect_choice = {
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.name = "Headphone Detect Autoswitch",
.info = control_info,
@@ -717,7 +717,7 @@ static struct snd_kcontrol_new headphone_detect_choice = {
.private_value = 0,
 };
 
-static struct snd_kcontrol_new lineout_detect_choice = {
+s

Re: [PATCH] ALSA: declare snd_kcontrol_new structures as const

2017-05-30 Thread Bhumika Goyal
On Tue, May 30, 2017 at 2:24 PM, Takashi Iwai <ti...@suse.de> wrote:
> On Sat, 27 May 2017 16:46:15 +0200,
> Bhumika Goyal wrote:
>>
>> Declare snd_kcontrol_new structures as const as they are only passed an
>> argument to the function snd_ctl_new1. This argument is of type const,
>> so snd_kcontrol_new structures having this property can be made const.
>> Done using Coccinelle:
>>
>> @r disable optional_qualifier@
>> identifier x;
>> position p;
>> @@
>> static struct snd_kcontrol_new x@p={...};
>>
>> @ok@
>> identifier r.x;
>> position p;
>> @@
>> snd_ctl_new1(@p,...)
>>
>> @bad@
>> position p != {r.p,ok.p};
>> identifier r.x;
>> @@
>> x@p
>>
>> @depends on !bad disable optional_qualifier@
>> identifier r.x;
>> @@
>> +const
>> struct snd_kcontrol_new x;
>>
>> Cross compiled these files:
>> sound/aoa/codecs/tas.c - powerpc
>> sound/mips/{hal2.c/sgio2audio.c} - mips
>> sound/ppc/{awacs.c/beep.c/tumbler.c} - powerpc
>> sound/soc/sh/siu_dai.c - sh
>> Could not find an architecture to compile sound/sh/aica.c.
>>
>> Signed-off-by: Bhumika Goyal <bhumi...@gmail.com>
>
> Applied now, as it looks safe enough.  But I prefer splitting to
> individual patches, so please try to do that at the next time.
>
>

Okay :)

Thanks,
Bhumika

> thanks,
>
> Takashi


Re: [PATCH] ALSA: declare snd_kcontrol_new structures as const

2017-05-30 Thread Bhumika Goyal
On Tue, May 30, 2017 at 2:26 PM, Julia Lawall <julia.law...@lip6.fr> wrote:
>
>
> On Tue, 30 May 2017, Takashi Iwai wrote:
>
>> On Sat, 27 May 2017 16:46:15 +0200,
>> Bhumika Goyal wrote:
>> >
>> > Declare snd_kcontrol_new structures as const as they are only passed an
>> > argument to the function snd_ctl_new1. This argument is of type const,
>> > so snd_kcontrol_new structures having this property can be made const.
>> > Done using Coccinelle:
>> >
>> > @r disable optional_qualifier@
>> > identifier x;
>> > position p;
>> > @@
>> > static struct snd_kcontrol_new x@p={...};
>> >
>> > @ok@
>> > identifier r.x;
>> > position p;
>> > @@
>> > snd_ctl_new1(@p,...)
>> >
>> > @bad@
>> > position p != {r.p,ok.p};
>> > identifier r.x;
>> > @@
>> > x@p
>> >
>> > @depends on !bad disable optional_qualifier@
>> > identifier r.x;
>> > @@
>> > +const
>> > struct snd_kcontrol_new x;
>> >
>> > Cross compiled these files:
>> > sound/aoa/codecs/tas.c - powerpc
>> > sound/mips/{hal2.c/sgio2audio.c} - mips
>> > sound/ppc/{awacs.c/beep.c/tumbler.c} - powerpc
>> > sound/soc/sh/siu_dai.c - sh
>> > Could not find an architecture to compile sound/sh/aica.c.
>> >
>> > Signed-off-by: Bhumika Goyal <bhumi...@gmail.com>
>>
>> Applied now, as it looks safe enough.  But I prefer splitting to
>> individual patches, so please try to do that at the next time.
>
> Individual patches in a series?
>

Yes, I think so. Takashi told to send a patchset for similar changes.

Thanks,
Bhumika

> julia


[PATCH] platform/x86: constify rfkill_ops structures

2017-06-08 Thread Bhumika Goyal
Add const to rfkill_ops structures that are only passed as an argument
to the functions rfkill_alloc or samsung_new_rfkill. These arguments are
of type const, so such structures can be annotated with const.

Signed-off-by: Bhumika Goyal <bhumi...@gmail.com>
---
 drivers/platform/x86/dell-rbtn.c  | 2 +-
 drivers/platform/x86/ideapad-laptop.c | 2 +-
 drivers/platform/x86/samsung-laptop.c | 4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/platform/x86/dell-rbtn.c b/drivers/platform/x86/dell-rbtn.c
index dcd9f40..6b5bbaf 100644
--- a/drivers/platform/x86/dell-rbtn.c
+++ b/drivers/platform/x86/dell-rbtn.c
@@ -110,7 +110,7 @@ static int rbtn_rfkill_set_block(void *data, bool blocked)
return -EINVAL;
 }
 
-static struct rfkill_ops rbtn_ops = {
+static const struct rfkill_ops rbtn_ops = {
.query = rbtn_rfkill_query,
.set_block = rbtn_rfkill_set_block,
 };
diff --git a/drivers/platform/x86/ideapad-laptop.c 
b/drivers/platform/x86/ideapad-laptop.c
index 24ca9fb..3beec1e 100644
--- a/drivers/platform/x86/ideapad-laptop.c
+++ b/drivers/platform/x86/ideapad-laptop.c
@@ -478,7 +478,7 @@ static int ideapad_rfk_set(void *data, bool blocked)
return write_ec_cmd(priv->priv->adev->handle, opcode, !blocked);
 }
 
-static struct rfkill_ops ideapad_rfk_ops = {
+static const struct rfkill_ops ideapad_rfk_ops = {
.set_block = ideapad_rfk_set,
 };
 
diff --git a/drivers/platform/x86/samsung-laptop.c 
b/drivers/platform/x86/samsung-laptop.c
index 8c146e2..e1e8897 100644
--- a/drivers/platform/x86/samsung-laptop.c
+++ b/drivers/platform/x86/samsung-laptop.c
@@ -591,7 +591,7 @@ static int seclinux_rfkill_set(void *data, bool blocked)
 !blocked);
 }
 
-static struct rfkill_ops seclinux_rfkill_ops = {
+static const struct rfkill_ops seclinux_rfkill_ops = {
.set_block = seclinux_rfkill_set,
 };
 
@@ -651,7 +651,7 @@ static void swsmi_rfkill_query(struct rfkill *rfkill, void 
*priv)
rfkill_set_sw_state(rfkill, !ret);
 }
 
-static struct rfkill_ops swsmi_rfkill_ops = {
+static const struct rfkill_ops swsmi_rfkill_ops = {
.set_block = swsmi_rfkill_set,
.query = swsmi_rfkill_query,
 };
-- 
2.7.4



Re: [PATCH] platform/x86: constify rfkill_ops structures

2017-06-08 Thread Bhumika Goyal
On Thu, Jun 8, 2017 at 6:08 PM, Andy Shevchenko
<andy.shevche...@gmail.com> wrote:
> On Thu, Jun 8, 2017 at 2:17 PM, Bhumika Goyal <bhumi...@gmail.com> wrote:
>> Add const to rfkill_ops structures that are only passed as an argument
>> to the functions rfkill_alloc or samsung_new_rfkill. These arguments are
>> of type const, so such structures can be annotated with const.
>
> Change is fine by me, but please split to one patch per vendor.
>

Okay.

Thanks,
Bhumika

>>
>> Signed-off-by: Bhumika Goyal <bhumi...@gmail.com>
>> ---
>>  drivers/platform/x86/dell-rbtn.c  | 2 +-
>>  drivers/platform/x86/ideapad-laptop.c | 2 +-
>>  drivers/platform/x86/samsung-laptop.c | 4 ++--
>>  3 files changed, 4 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/platform/x86/dell-rbtn.c 
>> b/drivers/platform/x86/dell-rbtn.c
>> index dcd9f40..6b5bbaf 100644
>> --- a/drivers/platform/x86/dell-rbtn.c
>> +++ b/drivers/platform/x86/dell-rbtn.c
>> @@ -110,7 +110,7 @@ static int rbtn_rfkill_set_block(void *data, bool 
>> blocked)
>> return -EINVAL;
>>  }
>>
>> -static struct rfkill_ops rbtn_ops = {
>> +static const struct rfkill_ops rbtn_ops = {
>> .query = rbtn_rfkill_query,
>> .set_block = rbtn_rfkill_set_block,
>>  };
>> diff --git a/drivers/platform/x86/ideapad-laptop.c 
>> b/drivers/platform/x86/ideapad-laptop.c
>> index 24ca9fb..3beec1e 100644
>> --- a/drivers/platform/x86/ideapad-laptop.c
>> +++ b/drivers/platform/x86/ideapad-laptop.c
>> @@ -478,7 +478,7 @@ static int ideapad_rfk_set(void *data, bool blocked)
>> return write_ec_cmd(priv->priv->adev->handle, opcode, !blocked);
>>  }
>>
>> -static struct rfkill_ops ideapad_rfk_ops = {
>> +static const struct rfkill_ops ideapad_rfk_ops = {
>> .set_block = ideapad_rfk_set,
>>  };
>>
>> diff --git a/drivers/platform/x86/samsung-laptop.c 
>> b/drivers/platform/x86/samsung-laptop.c
>> index 8c146e2..e1e8897 100644
>> --- a/drivers/platform/x86/samsung-laptop.c
>> +++ b/drivers/platform/x86/samsung-laptop.c
>> @@ -591,7 +591,7 @@ static int seclinux_rfkill_set(void *data, bool blocked)
>>  !blocked);
>>  }
>>
>> -static struct rfkill_ops seclinux_rfkill_ops = {
>> +static const struct rfkill_ops seclinux_rfkill_ops = {
>> .set_block = seclinux_rfkill_set,
>>  };
>>
>> @@ -651,7 +651,7 @@ static void swsmi_rfkill_query(struct rfkill *rfkill, 
>> void *priv)
>> rfkill_set_sw_state(rfkill, !ret);
>>  }
>>
>> -static struct rfkill_ops swsmi_rfkill_ops = {
>> +static const struct rfkill_ops swsmi_rfkill_ops = {
>> .set_block = swsmi_rfkill_set,
>> .query = swsmi_rfkill_query,
>>  };
>> --
>> 2.7.4
>>
>
>
>
> --
> With Best Regards,
> Andy Shevchenko


[PATCH] ata: declare ata_port_info structures as const

2017-06-09 Thread Bhumika Goyal
ata_port_info structures are either copied to other objects or their
references are stored in objects of type const. So, ata_port_info
structures having similar usage pattern can be made const.

Signed-off-by: Bhumika Goyal <bhumi...@gmail.com>
---
 drivers/ata/pata_rdc.c  | 2 +-
 drivers/ata/pata_sch.c  | 2 +-
 drivers/ata/sata_inic162x.c | 2 +-
 drivers/ata/sata_via.c  | 6 +++---
 4 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/ata/pata_rdc.c b/drivers/ata/pata_rdc.c
index 9ce5952..959bb54 100644
--- a/drivers/ata/pata_rdc.c
+++ b/drivers/ata/pata_rdc.c
@@ -292,7 +292,7 @@ static struct ata_port_operations rdc_pata_ops = {
.prereset   = rdc_pata_prereset,
 };
 
-static struct ata_port_info rdc_port_info = {
+static const struct ata_port_info rdc_port_info = {
 
.flags  = ATA_FLAG_SLAVE_POSS,
.pio_mask   = ATA_PIO4,
diff --git a/drivers/ata/pata_sch.c b/drivers/ata/pata_sch.c
index b920c34..1b80a66 100644
--- a/drivers/ata/pata_sch.c
+++ b/drivers/ata/pata_sch.c
@@ -81,7 +81,7 @@ static struct ata_port_operations sch_pata_ops = {
.set_dmamode= sch_set_dmamode,
 };
 
-static struct ata_port_info sch_port_info = {
+static const struct ata_port_info sch_port_info = {
.flags  = ATA_FLAG_SLAVE_POSS,
.pio_mask   = ATA_PIO4,
.mwdma_mask = ATA_MWDMA2,
diff --git a/drivers/ata/sata_inic162x.c b/drivers/ata/sata_inic162x.c
index e81a821..9b6d793 100644
--- a/drivers/ata/sata_inic162x.c
+++ b/drivers/ata/sata_inic162x.c
@@ -737,7 +737,7 @@ static struct ata_port_operations inic_port_ops = {
.port_start = inic_port_start,
 };
 
-static struct ata_port_info inic_port_info = {
+static const struct ata_port_info inic_port_info = {
.flags  = ATA_FLAG_SATA | ATA_FLAG_PIO_DMA,
.pio_mask   = ATA_PIO4,
.mwdma_mask = ATA_MWDMA2,
diff --git a/drivers/ata/sata_via.c b/drivers/ata/sata_via.c
index f3f538e..31a2768 100644
--- a/drivers/ata/sata_via.c
+++ b/drivers/ata/sata_via.c
@@ -166,7 +166,7 @@ static const struct ata_port_info vt6420_port_info = {
.port_ops   = _sata_ops,
 };
 
-static struct ata_port_info vt6421_sport_info = {
+static const struct ata_port_info vt6421_sport_info = {
.flags  = ATA_FLAG_SATA,
.pio_mask   = ATA_PIO4,
.mwdma_mask = ATA_MWDMA2,
@@ -174,7 +174,7 @@ static struct ata_port_info vt6421_sport_info = {
.port_ops   = _sata_ops,
 };
 
-static struct ata_port_info vt6421_pport_info = {
+static const struct ata_port_info vt6421_pport_info = {
.flags  = ATA_FLAG_SLAVE_POSS,
.pio_mask   = ATA_PIO4,
/* No MWDMA */
@@ -182,7 +182,7 @@ static struct ata_port_info vt6421_pport_info = {
.port_ops   = _pata_ops,
 };
 
-static struct ata_port_info vt8251_port_info = {
+static const struct ata_port_info vt8251_port_info = {
.flags  = ATA_FLAG_SATA | ATA_FLAG_SLAVE_POSS,
.pio_mask   = ATA_PIO4,
.mwdma_mask = ATA_MWDMA2,
-- 
2.7.4



[PATCH] ALSA: oxygen: Xonar DG(X): make model_xonar_dg const

2017-09-14 Thread Bhumika Goyal
Make this const as it not modified anywhere. It is only used during a
copy operation. Also, add const to the declaration in header.

Signed-off-by: Bhumika Goyal <bhumi...@gmail.com>
---
 sound/pci/oxygen/xonar_dg.h   | 2 +-
 sound/pci/oxygen/xonar_dg_mixer.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/pci/oxygen/xonar_dg.h b/sound/pci/oxygen/xonar_dg.h
index d461df3..5a07cda 100644
--- a/sound/pci/oxygen/xonar_dg.h
+++ b/sound/pci/oxygen/xonar_dg.h
@@ -51,6 +51,6 @@ void dump_cs4245_registers(struct oxygen *chip,
 void dg_resume(struct oxygen *chip);
 void dg_cleanup(struct oxygen *chip);
 
-extern struct oxygen_model model_xonar_dg;
+extern const struct oxygen_model model_xonar_dg;
 
 #endif
diff --git a/sound/pci/oxygen/xonar_dg_mixer.c 
b/sound/pci/oxygen/xonar_dg_mixer.c
index b885dac..d22fbe8 100644
--- a/sound/pci/oxygen/xonar_dg_mixer.c
+++ b/sound/pci/oxygen/xonar_dg_mixer.c
@@ -449,7 +449,7 @@ static int dg_mixer_init(struct oxygen *chip)
return 0;
 }
 
-struct oxygen_model model_xonar_dg = {
+const struct oxygen_model model_xonar_dg = {
.longname = "C-Media Oxygen HD Audio",
.chip = "CMI8786",
.init = dg_init,
-- 
1.9.1



[PATCH] video: fbdev: make fb_var_screeninfo static, const and __initconst

2017-09-14 Thread Bhumika Goyal
Make these structures static as they are not referenced in any other
file. Make them const as they are used only during a copy operation.
Replace __initdata with __initconst in file igafb.c to avoid section
conflict error.

Signed-off-by: Bhumika Goyal <bhumi...@gmail.com>
---
The changes are not compile tested as I could not find the right 
architecture to cross compile the files.

 drivers/video/fbdev/dnfb.c  | 2 +-
 drivers/video/fbdev/igafb.c | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/video/fbdev/dnfb.c b/drivers/video/fbdev/dnfb.c
index 7b1492d..0941500 100644
--- a/drivers/video/fbdev/dnfb.c
+++ b/drivers/video/fbdev/dnfb.c
@@ -115,7 +115,7 @@
.fb_imageblit   = cfb_imageblit,
 };
 
-struct fb_var_screeninfo dnfb_var = {
+static const struct fb_var_screeninfo dnfb_var = {
.xres   = 1280,
.yres   = 1024,
.xres_virtual   = 2048,
diff --git a/drivers/video/fbdev/igafb.c b/drivers/video/fbdev/igafb.c
index 486f188..607b6c0 100644
--- a/drivers/video/fbdev/igafb.c
+++ b/drivers/video/fbdev/igafb.c
@@ -97,7 +97,7 @@ struct fb_var_screeninfo default_var = {
 };
 
 #ifdef CONFIG_SPARC
-struct fb_var_screeninfo default_var_1024x768 __initdata = {
+static const struct fb_var_screeninfo default_var_1024x768 __initconst = {
/* 1024x768, 75 Hz, Non-Interlaced (78.75 MHz dotclock) */
.xres   = 1024,
.yres   = 768,
@@ -120,7 +120,7 @@ struct fb_var_screeninfo default_var_1024x768 __initdata = {
.vmode  = FB_SYNC_HOR_HIGH_ACT|FB_SYNC_VERT_HIGH_ACT, 
FB_VMODE_NONINTERLACED
 };
 
-struct fb_var_screeninfo default_var_1152x900 __initdata = {
+static const struct fb_var_screeninfo default_var_1152x900 __initconst = {
/* 1152x900, 76 Hz, Non-Interlaced (110.0 MHz dotclock) */
.xres   = 1152,
.yres   = 900,
@@ -143,7 +143,7 @@ struct fb_var_screeninfo default_var_1152x900 __initdata = {
.vmode  = FB_SYNC_HOR_HIGH_ACT|FB_SYNC_VERT_HIGH_ACT, 
FB_VMODE_NONINTERLACED
 };
 
-struct fb_var_screeninfo default_var_1280x1024 __initdata = {
+static const struct fb_var_screeninfo default_var_1280x1024 __initconst = {
/* 1280x1024, 75 Hz, Non-Interlaced (135.00 MHz dotclock) */
.xres   = 1280,
.yres   = 1024,
-- 
1.9.1



[PATCH] ASoC: Intel: atom: make sst_platform_compr_ops const

2017-09-13 Thread Bhumika Goyal
Make this const as it not modified in the file referencing it.
It only stored in the const field 'compr_ops' of a snd_soc_platform_driver
structure. Also, add const to the declaration in the header file.

Signed-off-by: Bhumika Goyal <bhumi...@gmail.com>
---
 sound/soc/intel/atom/sst-mfld-platform-compress.c | 2 +-
 sound/soc/intel/atom/sst-mfld-platform.h  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/intel/atom/sst-mfld-platform-compress.c 
b/sound/soc/intel/atom/sst-mfld-platform-compress.c
index 1bead81..1dbcab5 100644
--- a/sound/soc/intel/atom/sst-mfld-platform-compress.c
+++ b/sound/soc/intel/atom/sst-mfld-platform-compress.c
@@ -259,7 +259,7 @@ static int sst_platform_compr_set_metadata(struct 
snd_compr_stream *cstream,
return stream->compr_ops->set_metadata(sst->dev, stream->id, metadata);
 }
 
-struct snd_compr_ops sst_platform_compr_ops = {
+const struct snd_compr_ops sst_platform_compr_ops = {
 
.open = sst_platform_compr_open,
.free = sst_platform_compr_free,
diff --git a/sound/soc/intel/atom/sst-mfld-platform.h 
b/sound/soc/intel/atom/sst-mfld-platform.h
index cb32cc7..31a58c2 100644
--- a/sound/soc/intel/atom/sst-mfld-platform.h
+++ b/sound/soc/intel/atom/sst-mfld-platform.h
@@ -25,7 +25,7 @@
 #include "sst-atom-controls.h"
 
 extern struct sst_device *sst;
-extern struct snd_compr_ops sst_platform_compr_ops;
+extern const struct snd_compr_ops sst_platform_compr_ops;
 
 #define SST_MONO   1
 #define SST_STEREO 2
-- 
1.9.1



[PATCH] [media] saa7146: make saa7146_use_ops const

2017-09-13 Thread Bhumika Goyal
Make these const as they are not modified in the file referencing them.
They are only used when their function pointer fields invokes a
function and therefore none of the structure fields are getting modified.
Also, add a const to the declaration in the header.

Signed-off-by: Bhumika Goyal <bhumi...@gmail.com>
---
 drivers/media/common/saa7146/saa7146_vbi.c   | 2 +-
 drivers/media/common/saa7146/saa7146_video.c | 2 +-
 include/media/drv-intf/saa7146_vv.h  | 4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/media/common/saa7146/saa7146_vbi.c 
b/drivers/media/common/saa7146/saa7146_vbi.c
index d79e4d7..69525ca 100644
--- a/drivers/media/common/saa7146/saa7146_vbi.c
+++ b/drivers/media/common/saa7146/saa7146_vbi.c
@@ -488,7 +488,7 @@ static ssize_t vbi_read(struct file *file, char __user 
*data, size_t count, loff
return ret;
 }
 
-struct saa7146_use_ops saa7146_vbi_uops = {
+const struct saa7146_use_ops saa7146_vbi_uops = {
.init   = vbi_init,
.open   = vbi_open,
.release= vbi_close,
diff --git a/drivers/media/common/saa7146/saa7146_video.c 
b/drivers/media/common/saa7146/saa7146_video.c
index 37b4654..51eeed8 100644
--- a/drivers/media/common/saa7146/saa7146_video.c
+++ b/drivers/media/common/saa7146/saa7146_video.c
@@ -1303,7 +1303,7 @@ static ssize_t video_read(struct file *file, char __user 
*data, size_t count, lo
return ret;
 }
 
-struct saa7146_use_ops saa7146_video_uops = {
+const struct saa7146_use_ops saa7146_video_uops = {
.init = video_init,
.open = video_open,
.release = video_close,
diff --git a/include/media/drv-intf/saa7146_vv.h 
b/include/media/drv-intf/saa7146_vv.h
index 0da6ccc..736f4f2 100644
--- a/include/media/drv-intf/saa7146_vv.h
+++ b/include/media/drv-intf/saa7146_vv.h
@@ -202,14 +202,14 @@ void saa7146_dma_free(struct saa7146_dev* dev,struct 
videobuf_queue *q,
 /* from saa7146_video.c */
 extern const struct v4l2_ioctl_ops saa7146_video_ioctl_ops;
 extern const struct v4l2_ioctl_ops saa7146_vbi_ioctl_ops;
-extern struct saa7146_use_ops saa7146_video_uops;
+extern const struct saa7146_use_ops saa7146_video_uops;
 int saa7146_start_preview(struct saa7146_fh *fh);
 int saa7146_stop_preview(struct saa7146_fh *fh);
 long saa7146_video_do_ioctl(struct file *file, unsigned int cmd, void *arg);
 int saa7146_s_ctrl(struct v4l2_ctrl *ctrl);
 
 /* from saa7146_vbi.c */
-extern struct saa7146_use_ops saa7146_vbi_uops;
+extern const struct saa7146_use_ops saa7146_vbi_uops;
 
 /* resource management functions */
 int saa7146_res_get(struct saa7146_fh *fh, unsigned int bit);
-- 
1.9.1



[PATCH] ath10k: make ath10k_hw_ce_regs const

2017-09-13 Thread Bhumika Goyal
Make them const as they are not modified in the file referencing
them. They are only stored in the const field 'hw_ce_reg' of an ath10k
structure. Also, make the declarations in the header const.

Signed-off-by: Bhumika Goyal <bhumi...@gmail.com>
---
 drivers/net/wireless/ath/ath10k/hw.c | 4 ++--
 drivers/net/wireless/ath/ath10k/hw.h | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/hw.c 
b/drivers/net/wireless/ath/ath10k/hw.c
index a860691..07df7c6 100644
--- a/drivers/net/wireless/ath/ath10k/hw.c
+++ b/drivers/net/wireless/ath/ath10k/hw.c
@@ -310,7 +310,7 @@
.wm_high= _dst_wm_high,
 };
 
-struct ath10k_hw_ce_regs wcn3990_ce_regs = {
+const struct ath10k_hw_ce_regs wcn3990_ce_regs = {
.sr_base_addr   = 0x,
.sr_size_addr   = 0x0008,
.dr_base_addr   = 0x000c,
@@ -457,7 +457,7 @@ struct ath10k_hw_ce_regs wcn3990_ce_regs = {
.wm_high= _dst_wm_high,
 };
 
-struct ath10k_hw_ce_regs qcax_ce_regs = {
+const struct ath10k_hw_ce_regs qcax_ce_regs = {
.sr_base_addr   = 0x,
.sr_size_addr   = 0x0004,
.dr_base_addr   = 0x0008,
diff --git a/drivers/net/wireless/ath/ath10k/hw.h 
b/drivers/net/wireless/ath/ath10k/hw.h
index 0c089f6..f80840f 100644
--- a/drivers/net/wireless/ath/ath10k/hw.h
+++ b/drivers/net/wireless/ath/ath10k/hw.h
@@ -369,8 +369,8 @@ struct ath10k_hw_values {
 extern const struct ath10k_hw_values qca9888_values;
 extern const struct ath10k_hw_values qca4019_values;
 extern const struct ath10k_hw_values wcn3990_values;
-extern struct ath10k_hw_ce_regs wcn3990_ce_regs;
-extern struct ath10k_hw_ce_regs qcax_ce_regs;
+extern const struct ath10k_hw_ce_regs wcn3990_ce_regs;
+extern const struct ath10k_hw_ce_regs qcax_ce_regs;
 
 void ath10k_hw_fill_survey_time(struct ath10k *ar, struct survey_info *survey,
u32 cc, u32 rcc, u32 cc_prev, u32 rcc_prev);
-- 
1.9.1



[PATCH] ARM: OMAP2+: make omap_dma_dev_info __initdata

2017-09-18 Thread Bhumika Goyal
Make this __initdata as it is only modified only during the initialisation
phase in the function omap2_system_dma_init_dev and after this it is not
referenced anywhere in the kernel.

Signed-off-by: Bhumika Goyal <bhumi...@gmail.com>
---
 arch/arm/mach-omap2/dma.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/mach-omap2/dma.c b/arch/arm/mach-omap2/dma.c
index 694ce09..a005e2a 100644
--- a/arch/arm/mach-omap2/dma.c
+++ b/arch/arm/mach-omap2/dma.c
@@ -223,7 +223,7 @@ static unsigned configure_dma_errata(void)
.dma_read   = dma_read,
 };
 
-static struct platform_device_info omap_dma_dev_info = {
+static struct platform_device_info omap_dma_dev_info __initdata = {
.name = "omap-dma-engine",
.id = -1,
.dma_mask = DMA_BIT_MASK(32),
-- 
1.9.1



[PATCH] x86/pci/intel_mid_pci: make intel_mid_pci_ops const and __initconst

2017-09-18 Thread Bhumika Goyal
Make this const as it is only used during a copy operation. This usage
is inside init function and the structure is not referenced after
initialisation, so make it __initconst too.

Signed-off-by: Bhumika Goyal <bhumi...@gmail.com>
---
 arch/x86/pci/intel_mid_pci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/pci/intel_mid_pci.c b/arch/x86/pci/intel_mid_pci.c
index b901ece..63fbe8f 100644
--- a/arch/x86/pci/intel_mid_pci.c
+++ b/arch/x86/pci/intel_mid_pci.c
@@ -279,7 +279,7 @@ static void intel_mid_pci_irq_disable(struct pci_dev *dev)
}
 }
 
-static struct pci_ops intel_mid_pci_ops = {
+static const struct pci_ops intel_mid_pci_ops __initconst = {
.read = pci_read,
.write = pci_write,
 };
-- 
1.9.1



[PATCH] parport: make parport_ip32_ops const and __initconst

2017-09-18 Thread Bhumika Goyal
Make this const as it is only used during a copy operation. This usage
is inside init function and the structure is not referenced after
initialisation, so make it __initconst too.

Signed-off-by: Bhumika Goyal <bhumi...@gmail.com>
---
 drivers/parport/parport_ip32.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/parport/parport_ip32.c b/drivers/parport/parport_ip32.c
index 0186db7..6287307 100644
--- a/drivers/parport/parport_ip32.c
+++ b/drivers/parport/parport_ip32.c
@@ -1769,7 +1769,7 @@ static size_t parport_ip32_ecp_write_data(struct parport 
*p,
 
 /*--- Default parport operations ---*/
 
-static __initdata struct parport_operations parport_ip32_ops = {
+static const struct parport_operations parport_ip32_ops __initconst = {
.write_data = parport_ip32_write_data,
.read_data  = parport_ip32_read_data,
 
-- 
1.9.1



[PATCH] x86/numachip: make numachip2_clockevent const and __initconst

2017-09-18 Thread Bhumika Goyal
Make this const as it is only used during a copy operation. This usage
is during the init phase, so annotate the structure with __initconst
too.
Done using Coccinelle.

Signed-off-by: Bhumika Goyal <bhumi...@gmail.com>
---
 drivers/clocksource/numachip.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clocksource/numachip.c b/drivers/clocksource/numachip.c
index 6a20dc8..9a7d7f0 100644
--- a/drivers/clocksource/numachip.c
+++ b/drivers/clocksource/numachip.c
@@ -43,7 +43,7 @@ static int numachip2_set_next_event(unsigned long delta, 
struct clock_event_devi
return 0;
 }
 
-static struct clock_event_device numachip2_clockevent = {
+static const struct clock_event_device numachip2_clockevent __initconst = {
.name= "numachip2",
.rating  = 400,
.set_next_event  = numachip2_set_next_event,
-- 
1.9.1



[PATCH] powerpc: make irq_chip const, __initdata and __initconst

2017-09-18 Thread Bhumika Goyal
Make ehv_pic_irq_chip, mpic_ipi_chip and mpic_tm_chip const as they are
used only as a copy operation. This usage is during init, so make them
__initconst too.
Make mpic_ipi_chip __initdata as it is only modified during the init
phase and there is no reference of it anywhere after init.

Signed-off-by: Bhumika Goyal <bhumi...@gmail.com>
---
 arch/powerpc/sysdev/ehv_pic.c | 2 +-
 arch/powerpc/sysdev/mpic.c| 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/powerpc/sysdev/ehv_pic.c b/arch/powerpc/sysdev/ehv_pic.c
index 48866e6..12a54f3 100644
--- a/arch/powerpc/sysdev/ehv_pic.c
+++ b/arch/powerpc/sysdev/ehv_pic.c
@@ -141,7 +141,7 @@ int ehv_pic_set_irq_type(struct irq_data *d, unsigned int 
flow_type)
return IRQ_SET_MASK_OK_NOCOPY;
 }
 
-static struct irq_chip ehv_pic_irq_chip = {
+static const struct irq_chip ehv_pic_irq_chip __initconst = {
.irq_mask   = ehv_pic_mask_irq,
.irq_unmask = ehv_pic_unmask_irq,
.irq_eoi= ehv_pic_end_irq,
diff --git a/arch/powerpc/sysdev/mpic.c b/arch/powerpc/sysdev/mpic.c
index ead3e25..6a435c0 100644
--- a/arch/powerpc/sysdev/mpic.c
+++ b/arch/powerpc/sysdev/mpic.c
@@ -964,21 +964,21 @@ static void mpic_set_destination(unsigned int virq, 
unsigned int cpuid)
 };
 
 #ifdef CONFIG_SMP
-static struct irq_chip mpic_ipi_chip = {
+static const struct irq_chip mpic_ipi_chip __initconst = {
.irq_mask   = mpic_mask_ipi,
.irq_unmask = mpic_unmask_ipi,
.irq_eoi= mpic_end_ipi,
 };
 #endif /* CONFIG_SMP */
 
-static struct irq_chip mpic_tm_chip = {
+static struct irq_chip mpic_tm_chip __initdata = {
.irq_mask   = mpic_mask_tm,
.irq_unmask = mpic_unmask_tm,
.irq_eoi= mpic_end_irq,
 };
 
 #ifdef CONFIG_MPIC_U3_HT_IRQS
-static struct irq_chip mpic_irq_ht_chip = {
+static const struct irq_chip mpic_irq_ht_chip __initconst = {
.irq_startup= mpic_startup_ht_irq,
.irq_shutdown   = mpic_shutdown_ht_irq,
.irq_mask   = mpic_mask_irq,
-- 
1.9.1



[PATCH] qe/ic: make qe_ic_irq_chip const and __initconst

2017-09-18 Thread Bhumika Goyal
Make this const as it is used only as a copy operation. This usage is
inside an __init function, so make it __initconst too.

Done using Coccinelle.

Signed-off-by: Bhumika Goyal <bhumi...@gmail.com>
---
Cross-compiled for powerpc.

 drivers/soc/fsl/qe/qe_ic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/soc/fsl/qe/qe_ic.c b/drivers/soc/fsl/qe/qe_ic.c
index ec2ca86..781e0ce 100644
--- a/drivers/soc/fsl/qe/qe_ic.c
+++ b/drivers/soc/fsl/qe/qe_ic.c
@@ -238,7 +238,7 @@ static void qe_ic_mask_irq(struct irq_data *d)
raw_spin_unlock_irqrestore(_ic_lock, flags);
 }
 
-static struct irq_chip qe_ic_irq_chip = {
+static const struct irq_chip qe_ic_irq_chip __initconst = {
.name = "QEIC",
.irq_unmask = qe_ic_unmask_irq,
.irq_mask = qe_ic_mask_irq,
-- 
1.9.1



[PATCH v2] MN10300: make resource __initdata

2017-09-19 Thread Bhumika Goyal
Make code_resource and data_resource __initdata as these are only
modified during the init phase and after that the structures and their
fields are not referenced anywhere.

Signed-off-by: Bhumika Goyal <bhumi...@gmail.com>
---
Changes in v2:
* Replace __initconst with __initdata in the subject line.

 arch/mn10300/kernel/setup.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/mn10300/kernel/setup.c b/arch/mn10300/kernel/setup.c
index 1b3d80d..5c21ef9 100644
--- a/arch/mn10300/kernel/setup.c
+++ b/arch/mn10300/kernel/setup.c
@@ -41,13 +41,13 @@
 
 char __initdata redboot_platform_name[COMMAND_LINE_SIZE];
 
-static struct resource code_resource = {
+static struct resource code_resource __initdata = {
.start  = 0x10,
.end= 0,
.name   = "Kernel code",
 };
 
-static struct resource data_resource = {
+static struct resource data_resource __initdata = {
.start  = 0,
.end= 0,
.name   = "Kernel data",
-- 
1.9.1



[PATCH] m32r: make resource __initdata

2017-09-19 Thread Bhumika Goyal
Make code_resource and data_resource __initdata as these are only
modified during the init phase and after that the structures and their
fields are not referenced anywhere.
Done using Coccinelle.

Signed-off-by: Bhumika Goyal <bhumi...@gmail.com>
---
 arch/m32r/kernel/setup.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/m32r/kernel/setup.c b/arch/m32r/kernel/setup.c
index 1a9e977..7f98a1a 100644
--- a/arch/m32r/kernel/setup.c
+++ b/arch/m32r/kernel/setup.c
@@ -66,14 +66,14 @@ struct screen_info screen_info = {
 
 static char __initdata command_line[COMMAND_LINE_SIZE];
 
-static struct resource data_resource = {
+static struct resource data_resource __initdata = {
.name   = "Kernel data",
.start  = 0,
.end= 0,
.flags  = IORESOURCE_BUSY | IORESOURCE_SYSTEM_RAM
 };
 
-static struct resource code_resource = {
+static struct resource code_resource __initdata = {
.name   = "Kernel code",
.start  = 0,
.end= 0,
-- 
1.9.1



[PATCH] hexagon/time: make rtos_timer_device __initdata

2017-09-19 Thread Bhumika Goyal
Make this __initdata as it is only modified during the init phase and
after that the structure and its fields are not referenced anywhere.

Signed-off-by: Bhumika Goyal <bhumi...@gmail.com>
---
Hexagon architecture was not found while cross-compiling, so the
file is not compile-tested. 

 arch/hexagon/kernel/time.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/hexagon/kernel/time.c b/arch/hexagon/kernel/time.c
index 29b1f57..5b5a366 100644
--- a/arch/hexagon/kernel/time.c
+++ b/arch/hexagon/kernel/time.c
@@ -54,7 +54,7 @@
},
 };
 
-static struct platform_device rtos_timer_device = {
+static struct platform_device rtos_timer_device __initdata = {
.name   = "rtos_timer",
.id = -1,
.num_resources  = ARRAY_SIZE(rtos_timer_resources),
-- 
1.9.1



[PATCH] MN10300: make resource __initconst

2017-09-19 Thread Bhumika Goyal
Make code_resource and data_resource __initdata as these are only
modified during the init phase and after that the structures and their
fields are not referenced anywhere.
Done using Coccinelle.

Signed-off-by: Bhumika Goyal <bhumi...@gmail.com>
---
 arch/mn10300/kernel/setup.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/mn10300/kernel/setup.c b/arch/mn10300/kernel/setup.c
index 1b3d80d..5c21ef9 100644
--- a/arch/mn10300/kernel/setup.c
+++ b/arch/mn10300/kernel/setup.c
@@ -41,13 +41,13 @@
 
 char __initdata redboot_platform_name[COMMAND_LINE_SIZE];
 
-static struct resource code_resource = {
+static struct resource code_resource __initdata = {
.start  = 0x10,
.end= 0,
.name   = "Kernel code",
 };
 
-static struct resource data_resource = {
+static struct resource data_resource __initdata = {
.start  = 0,
.end= 0,
.name   = "Kernel data",
-- 
1.9.1



[PATCH] x86/events/amd/iommu: make iommu_pmu const and __initconst

2017-09-19 Thread Bhumika Goyal
Make this const as it is only used during a copy operation. Also, make
it __initconst as it is only used during the init phase and after this
it is not referenced anywhere.

Signed-off-by: Bhumika Goyal <bhumi...@gmail.com>
---
 arch/x86/events/amd/iommu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/events/amd/iommu.c b/arch/x86/events/amd/iommu.c
index 3641e24..38b5d41 100644
--- a/arch/x86/events/amd/iommu.c
+++ b/arch/x86/events/amd/iommu.c
@@ -405,7 +405,7 @@ static __init int _init_events_attrs(void)
NULL,
 };
 
-static struct pmu iommu_pmu = {
+static const struct pmu iommu_pmu __initconst = {
.event_init = perf_iommu_event_init,
.add= perf_iommu_add,
.del= perf_iommu_del,
-- 
1.9.1



[PATCH] ALSA: hrtimer: make hrtimer_hw const and __initconst

2017-09-19 Thread Bhumika Goyal
Make this const as it is only used during a copy operation. Also, make
it __initconst as it is only used during the init phase and after this
it is not referenced anywhere.

Signed-off-by: Bhumika Goyal <bhumi...@gmail.com>
---
 sound/core/hrtimer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/core/hrtimer.c b/sound/core/hrtimer.c
index 1ac0c42..5603e49 100644
--- a/sound/core/hrtimer.c
+++ b/sound/core/hrtimer.c
@@ -127,7 +127,7 @@ static int snd_hrtimer_stop(struct snd_timer *t)
return 0;
 }
 
-static struct snd_timer_hardware hrtimer_hw = {
+static const struct snd_timer_hardware hrtimer_hw __initconst = {
.flags =SNDRV_TIMER_HW_AUTO | SNDRV_TIMER_HW_TASKLET,
.open = snd_hrtimer_open,
.close =snd_hrtimer_close,
-- 
1.9.1



[PATCH] apparmor: make allperms structure const

2017-09-19 Thread Bhumika Goyal
Make this structure const as it is only used as a copy operations in the
files referencing it. Add const to the declaration in the header too.

Structure found using a Coccinelle script and changes done by hand.

Signed-off-by: Bhumika Goyal <bhumi...@gmail.com>
---
 security/apparmor/include/perms.h | 2 +-
 security/apparmor/lib.c   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/security/apparmor/include/perms.h 
b/security/apparmor/include/perms.h
index af04d5a..95ac9b6 100644
--- a/security/apparmor/include/perms.h
+++ b/security/apparmor/include/perms.h
@@ -90,7 +90,7 @@ struct aa_perms {
 
 #define ALL_PERMS_MASK 0x
 extern struct aa_perms nullperms;
-extern struct aa_perms allperms;
+extern const struct aa_perms allperms;
 
 
 #define xcheck(FN1, FN2)   \
diff --git a/security/apparmor/lib.c b/security/apparmor/lib.c
index 8818621..5b2c245 100644
--- a/security/apparmor/lib.c
+++ b/security/apparmor/lib.c
@@ -25,7 +25,7 @@
 #include "include/policy.h"
 
 struct aa_perms nullperms;
-struct aa_perms allperms = { .allow = ALL_PERMS_MASK,
+const struct aa_perms allperms = { .allow = ALL_PERMS_MASK,
 .quiet = ALL_PERMS_MASK,
 .hide = ALL_PERMS_MASK };
 
-- 
1.9.1



[PATCH] tty: serial: make sport_uart_ops static and const

2017-09-13 Thread Bhumika Goyal
Make this const as it is only stored in the const field 'ops' of an
uart_port structure. It is not referenced in any other file and therefore
make it static too.

Done using Coccinelle.

Signed-off-by: Bhumika Goyal <bhumi...@gmail.com>
---
Compile-tested for blackfin.

 drivers/tty/serial/bfin_sport_uart.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/tty/serial/bfin_sport_uart.c 
b/drivers/tty/serial/bfin_sport_uart.c
index 6b03fb1..6525378 100644
--- a/drivers/tty/serial/bfin_sport_uart.c
+++ b/drivers/tty/serial/bfin_sport_uart.c
@@ -584,7 +584,7 @@ static void sport_set_termios(struct uart_port *port,
spin_unlock_irqrestore(>port.lock, flags);
 }
 
-struct uart_ops sport_uart_ops = {
+static const struct uart_ops sport_uart_ops = {
.tx_empty   = sport_tx_empty,
.set_mctrl  = sport_set_mctrl,
.get_mctrl  = sport_get_mctrl,
-- 
1.9.1



[PATCH] clk: tegra30: make tegra_clk_pll_params __ro_after_init

2017-10-02 Thread Bhumika Goyal
These structures are only passed to the functions tegra_clk_register_pll,
tegra_clk_register_pll{e/u} or tegra_periph_clk_init during the init
phase. These functions modify the structures only during the init phase
and after that the structures are never modified. Therefore, make them
__ro_after_init.

Signed-off-by: Bhumika Goyal <bhumi...@gmail.com>
---
 drivers/clk/tegra/clk-tegra30.c | 16 
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/clk/tegra/clk-tegra30.c b/drivers/clk/tegra/clk-tegra30.c
index a2d163f..1ce7d76 100644
--- a/drivers/clk/tegra/clk-tegra30.c
+++ b/drivers/clk/tegra/clk-tegra30.c
@@ -359,7 +359,7 @@
 };
 
 /* PLL parameters */
-static struct tegra_clk_pll_params pll_c_params = {
+static struct tegra_clk_pll_params pll_c_params __ro_after_init = {
.input_min = 200,
.input_max = 3100,
.cf_min = 100,
@@ -388,7 +388,7 @@
.override_divp_shift = 15,
 };
 
-static struct tegra_clk_pll_params pll_m_params = {
+static struct tegra_clk_pll_params pll_m_params __ro_after_init = {
.input_min = 200,
.input_max = 3100,
.cf_min = 100,
@@ -409,7 +409,7 @@
 TEGRA_PLL_HAS_LOCK_ENABLE | TEGRA_PLL_FIXED,
 };
 
-static struct tegra_clk_pll_params pll_p_params = {
+static struct tegra_clk_pll_params pll_p_params __ro_after_init = {
.input_min = 200,
.input_max = 3100,
.cf_min = 100,
@@ -444,7 +444,7 @@
 TEGRA_PLL_HAS_LOCK_ENABLE,
 };
 
-static struct tegra_clk_pll_params pll_d_params = {
+static struct tegra_clk_pll_params pll_d_params __ro_after_init = {
.input_min = 200,
.input_max = 4000,
.cf_min = 100,
@@ -461,7 +461,7 @@
 TEGRA_PLL_USE_LOCK | TEGRA_PLL_HAS_LOCK_ENABLE,
 };
 
-static struct tegra_clk_pll_params pll_d2_params = {
+static struct tegra_clk_pll_params pll_d2_params __ro_after_init = {
.input_min = 200,
.input_max = 4000,
.cf_min = 100,
@@ -478,7 +478,7 @@
 TEGRA_PLL_USE_LOCK | TEGRA_PLL_HAS_LOCK_ENABLE,
 };
 
-static struct tegra_clk_pll_params pll_u_params = {
+static struct tegra_clk_pll_params pll_u_params __ro_after_init = {
.input_min = 200,
.input_max = 4000,
.cf_min = 100,
@@ -496,7 +496,7 @@
 TEGRA_PLL_HAS_LOCK_ENABLE,
 };
 
-static struct tegra_clk_pll_params pll_x_params = {
+static struct tegra_clk_pll_params pll_x_params __ro_after_init = {
.input_min = 200,
.input_max = 3100,
.cf_min = 100,
@@ -513,7 +513,7 @@
 TEGRA_PLL_USE_LOCK | TEGRA_PLL_HAS_LOCK_ENABLE,
 };
 
-static struct tegra_clk_pll_params pll_e_params = {
+static struct tegra_clk_pll_params pll_e_params __ro_after_init = {
.input_min = 1200,
.input_max = 21600,
.cf_min = 1200,
-- 
1.9.1



[PATCH 1/2] ARM: davinci: make the function argument as const

2017-10-16 Thread Bhumika Goyal
Make the function argument of the function davinci_common_init
as const as it's memory contents are only copied during a
memcpy call. So, the fields of the structure to which the argument
soc_info points to never gets modified and therefore the argument can
be made const.
Add const to the prototype too.

Signed-off-by: Bhumika Goyal <bhumi...@gmail.com>
---
 arch/arm/mach-davinci/common.c  | 2 +-
 arch/arm/mach-davinci/include/mach/common.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-davinci/common.c b/arch/arm/mach-davinci/common.c
index 9f9fbfa..bcb6a7b 100644
--- a/arch/arm/mach-davinci/common.c
+++ b/arch/arm/mach-davinci/common.c
@@ -77,7 +77,7 @@ static int __init davinci_init_id(struct davinci_soc_info 
*soc_info)
return -EINVAL;
 }
 
-void __init davinci_common_init(struct davinci_soc_info *soc_info)
+void __init davinci_common_init(const struct davinci_soc_info *soc_info)
 {
int ret;
 
diff --git a/arch/arm/mach-davinci/include/mach/common.h 
b/arch/arm/mach-davinci/include/mach/common.h
index 037aa66..433a008 100644
--- a/arch/arm/mach-davinci/include/mach/common.h
+++ b/arch/arm/mach-davinci/include/mach/common.h
@@ -79,7 +79,7 @@ struct davinci_soc_info {
 
 extern struct davinci_soc_info davinci_soc_info;
 
-extern void davinci_common_init(struct davinci_soc_info *soc_info);
+extern void davinci_common_init(const struct davinci_soc_info *soc_info);
 extern void davinci_init_ide(void);
 void davinci_restart(enum reboot_mode mode, const char *cmd);
 void davinci_init_late(void);
-- 
1.9.1



[PATCH 2/2] ARM: davinci: make davinci_soc_info structures const

2017-10-16 Thread Bhumika Goyal
This is a followup patch for [PATCH 1/2].

Make the structures const as they are either passed to the function
davinci_common_init having the argument as const or their field cpu_clks
of type struct clk_lookup * is passed to the function davinci_clk_init.
So, the fields are never modified and the structures can be const. 

Done using Coccinelle.

Signed-off-by: Bhumika Goyal <bhumi...@gmail.com>
---
 arch/arm/mach-davinci/da830.c  | 2 +-
 arch/arm/mach-davinci/da850.c  | 2 +-
 arch/arm/mach-davinci/dm355.c  | 2 +-
 arch/arm/mach-davinci/dm365.c  | 2 +-
 arch/arm/mach-davinci/dm644x.c | 2 +-
 arch/arm/mach-davinci/dm646x.c | 2 +-
 6 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/arch/arm/mach-davinci/da830.c b/arch/arm/mach-davinci/da830.c
index bd88470..ed0b700 100644
--- a/arch/arm/mach-davinci/da830.c
+++ b/arch/arm/mach-davinci/da830.c
@@ -1194,7 +1194,7 @@ int __init da830_register_gpio(void)
.clocksource_id = T0_BOT,
 };
 
-static struct davinci_soc_info davinci_soc_info_da830 = {
+static const struct davinci_soc_info davinci_soc_info_da830 = {
.io_desc= da830_io_desc,
.io_desc_num= ARRAY_SIZE(da830_io_desc),
.jtag_id_reg= DA8XX_SYSCFG0_BASE + DA8XX_JTAG_ID_REG,
diff --git a/arch/arm/mach-davinci/da850.c b/arch/arm/mach-davinci/da850.c
index 07d6f0e..04a58a3 100644
--- a/arch/arm/mach-davinci/da850.c
+++ b/arch/arm/mach-davinci/da850.c
@@ -1347,7 +1347,7 @@ int __init da850_register_gpio(void)
return da8xx_register_gpio(_gpio_platform_data);
 }
 
-static struct davinci_soc_info davinci_soc_info_da850 = {
+static const struct davinci_soc_info davinci_soc_info_da850 = {
.io_desc= da850_io_desc,
.io_desc_num= ARRAY_SIZE(da850_io_desc),
.jtag_id_reg= DA8XX_SYSCFG0_BASE + DA8XX_JTAG_ID_REG,
diff --git a/arch/arm/mach-davinci/dm355.c b/arch/arm/mach-davinci/dm355.c
index bd50367..938747f 100644
--- a/arch/arm/mach-davinci/dm355.c
+++ b/arch/arm/mach-davinci/dm355.c
@@ -1006,7 +1006,7 @@ struct platform_device dm355_serial_device[] = {
}
 };
 
-static struct davinci_soc_info davinci_soc_info_dm355 = {
+static const struct davinci_soc_info davinci_soc_info_dm355 = {
.io_desc= dm355_io_desc,
.io_desc_num= ARRAY_SIZE(dm355_io_desc),
.jtag_id_reg= 0x01c40028,
diff --git a/arch/arm/mach-davinci/dm365.c b/arch/arm/mach-davinci/dm365.c
index 8be04ec..bcf1494 100644
--- a/arch/arm/mach-davinci/dm365.c
+++ b/arch/arm/mach-davinci/dm365.c
@@ -1108,7 +1108,7 @@ struct platform_device dm365_serial_device[] = {
}
 };
 
-static struct davinci_soc_info davinci_soc_info_dm365 = {
+static const struct davinci_soc_info davinci_soc_info_dm365 = {
.io_desc= dm365_io_desc,
.io_desc_num= ARRAY_SIZE(dm365_io_desc),
.jtag_id_reg= 0x01c40028,
diff --git a/arch/arm/mach-davinci/dm644x.c b/arch/arm/mach-davinci/dm644x.c
index b437c37..6b41e1c 100644
--- a/arch/arm/mach-davinci/dm644x.c
+++ b/arch/arm/mach-davinci/dm644x.c
@@ -899,7 +899,7 @@ struct platform_device dm644x_serial_device[] = {
}
 };
 
-static struct davinci_soc_info davinci_soc_info_dm644x = {
+static const struct davinci_soc_info davinci_soc_info_dm644x = {
.io_desc= dm644x_io_desc,
.io_desc_num= ARRAY_SIZE(dm644x_io_desc),
.jtag_id_reg= 0x01c40028,
diff --git a/arch/arm/mach-davinci/dm646x.c b/arch/arm/mach-davinci/dm646x.c
index da21353..b72e04a 100644
--- a/arch/arm/mach-davinci/dm646x.c
+++ b/arch/arm/mach-davinci/dm646x.c
@@ -882,7 +882,7 @@ struct platform_device dm646x_serial_device[] = {
}
 };
 
-static struct davinci_soc_info davinci_soc_info_dm646x = {
+static const struct davinci_soc_info davinci_soc_info_dm646x = {
.io_desc= dm646x_io_desc,
.io_desc_num= ARRAY_SIZE(dm646x_io_desc),
.jtag_id_reg= 0x01c40028,
-- 
1.9.1



[PATCH 0/2] ARM: davinci: make function argument and structure const

2017-10-16 Thread Bhumika Goyal
Make the function argument of davinci_common_init const. 
After doing this change make the structures davinci_soc_info const.

Bhumika Goyal (2):
  ARM: davinci: make the function argument as const
  ARM: davinci: make davinci_soc_info structures const

 arch/arm/mach-davinci/common.c  | 2 +-
 arch/arm/mach-davinci/da830.c   | 2 +-
 arch/arm/mach-davinci/da850.c   | 2 +-
 arch/arm/mach-davinci/dm355.c   | 2 +-
 arch/arm/mach-davinci/dm365.c   | 2 +-
 arch/arm/mach-davinci/dm644x.c  | 2 +-
 arch/arm/mach-davinci/dm646x.c  | 2 +-
 arch/arm/mach-davinci/include/mach/common.h | 2 +-
 8 files changed, 8 insertions(+), 8 deletions(-)

-- 
1.9.1



Re: [PATCH] stm class: make config_item_type const

2017-10-16 Thread Bhumika Goyal
On Mon, Oct 16, 2017 at 1:55 PM, Alexander Shishkin
<alexander.shish...@linux.intel.com> wrote:
> Bhumika Goyal <bhumi...@gmail.com> writes:
>
>> On Thu, Oct 12, 2017 at 2:12 PM, Bhumika Goyal <bhumi...@gmail.com> wrote:
>>> This is a followup patch for:
>>> https://patchwork.kernel.org/patch/649/ and
>>> https://lkml.org/lkml/2017/10/11/375
>>>
>>> Make config_item_type structures const as they are either passed to a
>>> function having the argument as const or used inside a if statement or
>>> stored in the const "ci_type" field of a config_item structure.
>>>
>>> Done using Coccinelle.
>>>
>>
>> Tthis patch is dependent on the patches in the links
>> https://lkml.org/lkml/2017/10/11/375 and
>> https://patchwork.kernel.org/patch/649/. Therefore, this patch
>> won't be correct unless the patches in these links gets applied.
>
> So why not send it as a series then?
>

I will re-send all the changes in a series.

Thanks,
Bhumika

> Regards,
> --
> Alex


Re: [PATCH] configfs: make config_item_type const

2017-10-16 Thread Bhumika Goyal
On Mon, Oct 16, 2017 at 2:43 PM, Christoph Hellwig <h...@lst.de> wrote:
> On Thu, Oct 12, 2017 at 05:02:43PM +0200, Bhumika Goyal wrote:
>> Actually, this patch is dependent on the patches in the links
>> https://lkml.org/lkml/2017/10/11/375 and
>> https://patchwork.kernel.org/patch/649/. Therefore, this patch
>> won't be correct unless the patches in these links gets applied.
>
> Please send all the configfs-related constification patches to me and
> linux-fsdevel in a single series, and I will apply them to the configfs
> tree after some time to give the various maintainers a chance to review
> them.


Thanks! I will re-send them in a series.

Thanks,
Bhumika


[PATCH v2 11/15] stm class: make config_item_type const

2017-10-16 Thread Bhumika Goyal
Make config_item_type structures const as they are either passed to a
function having the argument as const or used inside a if statement or
stored in the const "ci_type" field of a config_item structure.

Done using Coccinelle.

Signed-off-by: Bhumika Goyal <bhumi...@gmail.com>
---
* Changes in v2- Combine all the followup patches and the constification
patches into a series.

 drivers/hwtracing/stm/policy.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/hwtracing/stm/policy.c b/drivers/hwtracing/stm/policy.c
index 6c0ae29..33e9a1b 100644
--- a/drivers/hwtracing/stm/policy.c
+++ b/drivers/hwtracing/stm/policy.c
@@ -187,8 +187,8 @@ static void stp_policy_node_release(struct config_item 
*item)
NULL,
 };
 
-static struct config_item_type stp_policy_type;
-static struct config_item_type stp_policy_node_type;
+static const struct config_item_type stp_policy_type;
+static const struct config_item_type stp_policy_node_type;
 
 static struct config_group *
 stp_policy_node_make(struct config_group *group, const char *name)
@@ -236,7 +236,7 @@ static void stp_policy_node_release(struct config_item 
*item)
.drop_item  = stp_policy_node_drop,
 };
 
-static struct config_item_type stp_policy_node_type = {
+static const struct config_item_type stp_policy_node_type = {
.ct_item_ops= _policy_node_item_ops,
.ct_group_ops   = _policy_node_group_ops,
.ct_attrs   = stp_policy_node_attrs,
@@ -311,7 +311,7 @@ static void stp_policy_release(struct config_item *item)
.make_group = stp_policy_node_make,
 };
 
-static struct config_item_type stp_policy_type = {
+static const struct config_item_type stp_policy_type = {
.ct_item_ops= _policy_item_ops,
.ct_group_ops   = _policy_group_ops,
.ct_attrs   = stp_policy_attrs,
@@ -380,7 +380,7 @@ static void stp_policy_release(struct config_item *item)
.make_group = stp_policies_make,
 };
 
-static struct config_item_type stp_policies_type = {
+static const struct config_item_type stp_policies_type = {
.ct_group_ops   = _policies_group_ops,
.ct_owner   = THIS_MODULE,
 };
-- 
1.9.1



[PATCH v2 12/15] RDMA/cma: make config_item_type const

2017-10-16 Thread Bhumika Goyal
Make these structures const as they are either passed to the functions
having the argument as const or stored as a reference in the "ci_type"
const field of a config_item structure.

Signed-off-by: Bhumika Goyal <bhumi...@gmail.com>
---
* Changes in v2- Combine all the followup patches and the constification
patches into a series.

 drivers/infiniband/core/cma_configfs.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/infiniband/core/cma_configfs.c 
b/drivers/infiniband/core/cma_configfs.c
index 54076a3..31dfee0 100644
--- a/drivers/infiniband/core/cma_configfs.c
+++ b/drivers/infiniband/core/cma_configfs.c
@@ -186,7 +186,7 @@ static ssize_t default_roce_tos_store(struct config_item 
*item,
NULL,
 };
 
-static struct config_item_type cma_port_group_type = {
+static const struct config_item_type cma_port_group_type = {
.ct_attrs   = cma_configfs_attributes,
.ct_owner   = THIS_MODULE
 };
@@ -263,7 +263,7 @@ static void release_cma_ports_group(struct config_item  
*item)
.release = release_cma_ports_group
 };
 
-static struct config_item_type cma_ports_group_type = {
+static const struct config_item_type cma_ports_group_type = {
.ct_item_ops= _ports_item_ops,
.ct_owner   = THIS_MODULE
 };
@@ -272,7 +272,7 @@ static void release_cma_ports_group(struct config_item  
*item)
.release = release_cma_dev
 };
 
-static struct config_item_type cma_device_group_type = {
+static const struct config_item_type cma_device_group_type = {
.ct_item_ops= _device_item_ops,
.ct_owner   = THIS_MODULE
 };
@@ -323,7 +323,7 @@ static struct config_group *make_cma_dev(struct 
config_group *group,
.make_group = make_cma_dev,
 };
 
-static struct config_item_type cma_subsys_type = {
+static const struct config_item_type cma_subsys_type = {
.ct_group_ops   = _subsys_group_ops,
.ct_owner   = THIS_MODULE,
 };
-- 
1.9.1



[PATCH v2 06/15] PCI: endpoint: make config_item_type const

2017-10-16 Thread Bhumika Goyal
Make config_item_type structures const as they are either passed to a
function having the argument as const or stored in the const "ci_type"
field of a config_item structure.

Done using Coccinelle.

Signed-off-by: Bhumika Goyal <bhumi...@gmail.com>
---
* Changes in v2- Combine all the followup patches and the constification
patches into a series.

 drivers/pci/endpoint/pci-ep-cfs.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/pci/endpoint/pci-ep-cfs.c 
b/drivers/pci/endpoint/pci-ep-cfs.c
index 424fdd6..4f74386 100644
--- a/drivers/pci/endpoint/pci-ep-cfs.c
+++ b/drivers/pci/endpoint/pci-ep-cfs.c
@@ -150,7 +150,7 @@ static void pci_epc_epf_unlink(struct config_item *epc_item,
.drop_link  = pci_epc_epf_unlink,
 };
 
-static struct config_item_type pci_epc_type = {
+static const struct config_item_type pci_epc_type = {
.ct_item_ops= _epc_item_ops,
.ct_attrs   = pci_epc_attrs,
.ct_owner   = THIS_MODULE,
@@ -361,7 +361,7 @@ static void pci_epf_release(struct config_item *item)
.release= pci_epf_release,
 };
 
-static struct config_item_type pci_epf_type = {
+static const struct config_item_type pci_epf_type = {
.ct_item_ops= _epf_ops,
.ct_attrs   = pci_epf_attrs,
.ct_owner   = THIS_MODULE,
@@ -400,7 +400,7 @@ static void pci_epf_drop(struct config_group *group, struct 
config_item *item)
.drop_item  = _epf_drop,
 };
 
-static struct config_item_type pci_epf_group_type = {
+static const struct config_item_type pci_epf_group_type = {
.ct_group_ops   = _epf_group_ops,
.ct_owner   = THIS_MODULE,
 };
@@ -428,15 +428,15 @@ void pci_ep_cfs_remove_epf_group(struct config_group 
*group)
 }
 EXPORT_SYMBOL(pci_ep_cfs_remove_epf_group);
 
-static struct config_item_type pci_functions_type = {
+static const struct config_item_type pci_functions_type = {
.ct_owner   = THIS_MODULE,
 };
 
-static struct config_item_type pci_controllers_type = {
+static const struct config_item_type pci_controllers_type = {
.ct_owner   = THIS_MODULE,
 };
 
-static struct config_item_type pci_ep_type = {
+static const struct config_item_type pci_ep_type = {
.ct_owner   = THIS_MODULE,
 };
 
-- 
1.9.1



[PATCH v2 07/15] usb: gadget: configfs: make config_item_type const

2017-10-16 Thread Bhumika Goyal
Make config_item_type structures const as they are either passed to a
function having the argument as const or stored in the const "ci_type"
field of a config_item structure.

Done using Coccinelle.

Signed-off-by: Bhumika Goyal <bhumi...@gmail.com>
---
* Changes in v2- Combine all the followup patches and the constification
patches into a series.

 drivers/usb/gadget/configfs.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/usb/gadget/configfs.c b/drivers/usb/gadget/configfs.c
index aeb9f3c..9d18b99 100644
--- a/drivers/usb/gadget/configfs.c
+++ b/drivers/usb/gadget/configfs.c
@@ -505,13 +505,13 @@ static ssize_t 
gadget_config_desc_bmAttributes_store(struct config_item *item,
NULL,
 };
 
-static struct config_item_type gadget_config_type = {
+static const struct config_item_type gadget_config_type = {
.ct_item_ops= _config_item_ops,
.ct_attrs   = gadget_config_attrs,
.ct_owner   = THIS_MODULE,
 };
 
-static struct config_item_type gadget_root_type = {
+static const struct config_item_type gadget_root_type = {
.ct_item_ops= _root_item_ops,
.ct_attrs   = gadget_root_attrs,
.ct_owner   = THIS_MODULE,
@@ -593,7 +593,7 @@ static void function_drop(
.drop_item  = _drop,
 };
 
-static struct config_item_type functions_type = {
+static const struct config_item_type functions_type = {
.ct_group_ops   = _ops,
.ct_owner   = THIS_MODULE,
 };
@@ -694,7 +694,7 @@ static void config_desc_drop(
.drop_item  = _desc_drop,
 };
 
-static struct config_item_type config_desc_type = {
+static const struct config_item_type config_desc_type = {
.ct_group_ops   = _desc_ops,
.ct_owner   = THIS_MODULE,
 };
@@ -1476,7 +1476,7 @@ static void gadgets_drop(struct config_group *group, 
struct config_item *item)
.drop_item  = _drop,
 };
 
-static struct config_item_type gadgets_type = {
+static const struct config_item_type gadgets_type = {
.ct_group_ops   = _ops,
.ct_owner   = THIS_MODULE,
 };
-- 
1.9.1



[PATCH v2 05/15] ocfs2/cluster: make config_item_type const

2017-10-16 Thread Bhumika Goyal
Make these structures const as they are either passed to the functions
having the argument as const or stored as a reference in the "ci_type"
const field of a config_item structure.

Done using Coccinelle.

Signed-off-by: Bhumika Goyal <bhumi...@gmail.com>
---
* Changes in v2- Combine all the followup patches and the constification
patches into a series.

 fs/ocfs2/cluster/heartbeat.c   | 4 ++--
 fs/ocfs2/cluster/nodemanager.c | 8 
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/fs/ocfs2/cluster/heartbeat.c b/fs/ocfs2/cluster/heartbeat.c
index d020604..ea8c551 100644
--- a/fs/ocfs2/cluster/heartbeat.c
+++ b/fs/ocfs2/cluster/heartbeat.c
@@ -2025,7 +2025,7 @@ static ssize_t o2hb_region_pid_show(struct config_item 
*item, char *page)
.release= o2hb_region_release,
 };
 
-static struct config_item_type o2hb_region_type = {
+static const struct config_item_type o2hb_region_type = {
.ct_item_ops= _region_item_ops,
.ct_attrs   = o2hb_region_attrs,
.ct_owner   = THIS_MODULE,
@@ -2310,7 +2310,7 @@ static ssize_t o2hb_heartbeat_group_mode_store(struct 
config_item *item,
.drop_item  = o2hb_heartbeat_group_drop_item,
 };
 
-static struct config_item_type o2hb_heartbeat_group_type = {
+static const struct config_item_type o2hb_heartbeat_group_type = {
.ct_group_ops   = _heartbeat_group_group_ops,
.ct_attrs   = o2hb_heartbeat_group_attrs,
.ct_owner   = THIS_MODULE,
diff --git a/fs/ocfs2/cluster/nodemanager.c b/fs/ocfs2/cluster/nodemanager.c
index b17d180..a51200e 100644
--- a/fs/ocfs2/cluster/nodemanager.c
+++ b/fs/ocfs2/cluster/nodemanager.c
@@ -378,7 +378,7 @@ static ssize_t o2nm_node_local_store(struct config_item 
*item, const char *page,
.release= o2nm_node_release,
 };
 
-static struct config_item_type o2nm_node_type = {
+static const struct config_item_type o2nm_node_type = {
.ct_item_ops= _node_item_ops,
.ct_attrs   = o2nm_node_attrs,
.ct_owner   = THIS_MODULE,
@@ -619,7 +619,7 @@ static void o2nm_node_group_drop_item(struct config_group 
*group,
.drop_item  = o2nm_node_group_drop_item,
 };
 
-static struct config_item_type o2nm_node_group_type = {
+static const struct config_item_type o2nm_node_group_type = {
.ct_group_ops   = _node_group_group_ops,
.ct_owner   = THIS_MODULE,
 };
@@ -637,7 +637,7 @@ static void o2nm_cluster_release(struct config_item *item)
.release= o2nm_cluster_release,
 };
 
-static struct config_item_type o2nm_cluster_type = {
+static const struct config_item_type o2nm_cluster_type = {
.ct_item_ops= _cluster_item_ops,
.ct_attrs   = o2nm_cluster_attrs,
.ct_owner   = THIS_MODULE,
@@ -722,7 +722,7 @@ static void o2nm_cluster_group_drop_item(struct 
config_group *group, struct conf
.drop_item  = o2nm_cluster_group_drop_item,
 };
 
-static struct config_item_type o2nm_cluster_group_type = {
+static const struct config_item_type o2nm_cluster_group_type = {
.ct_group_ops   = _cluster_group_group_ops,
.ct_owner   = THIS_MODULE,
 };
-- 
1.9.1



[PATCH v2 02/15] usb: gadget: make config_item_type structures const

2017-10-16 Thread Bhumika Goyal
Make these structures const as they are only passed to the const
argument of the functions config_{group/item}_init_type_name.

Signed-off-by: Bhumika Goyal <bhumi...@gmail.com>
---
* Changes in v2- Combine all the followup patches and the constification
patches into a series.

 drivers/usb/gadget/function/f_acm.c  |  2 +-
 drivers/usb/gadget/function/f_ecm.c  |  2 +-
 drivers/usb/gadget/function/f_eem.c  |  2 +-
 drivers/usb/gadget/function/f_fs.c   |  2 +-
 drivers/usb/gadget/function/f_hid.c  |  2 +-
 drivers/usb/gadget/function/f_loopback.c |  2 +-
 drivers/usb/gadget/function/f_mass_storage.c |  4 +--
 drivers/usb/gadget/function/f_midi.c |  2 +-
 drivers/usb/gadget/function/f_ncm.c  |  2 +-
 drivers/usb/gadget/function/f_obex.c |  2 +-
 drivers/usb/gadget/function/f_phonet.c   |  2 +-
 drivers/usb/gadget/function/f_printer.c  |  2 +-
 drivers/usb/gadget/function/f_rndis.c|  2 +-
 drivers/usb/gadget/function/f_serial.c   |  2 +-
 drivers/usb/gadget/function/f_sourcesink.c   |  2 +-
 drivers/usb/gadget/function/f_subset.c   |  2 +-
 drivers/usb/gadget/function/f_tcm.c  |  2 +-
 drivers/usb/gadget/function/f_uac1.c |  2 +-
 drivers/usb/gadget/function/f_uac1_legacy.c  |  2 +-
 drivers/usb/gadget/function/f_uac2.c |  2 +-
 drivers/usb/gadget/function/uvc_configfs.c   | 50 ++--
 21 files changed, 46 insertions(+), 46 deletions(-)

diff --git a/drivers/usb/gadget/function/f_acm.c 
b/drivers/usb/gadget/function/f_acm.c
index 5e3828d..8680af4 100644
--- a/drivers/usb/gadget/function/f_acm.c
+++ b/drivers/usb/gadget/function/f_acm.c
@@ -786,7 +786,7 @@ static ssize_t f_acm_port_num_show(struct config_item 
*item, char *page)
NULL,
 };
 
-static struct config_item_type acm_func_type = {
+static const struct config_item_type acm_func_type = {
.ct_item_ops= _item_ops,
.ct_attrs   = acm_attrs,
.ct_owner   = THIS_MODULE,
diff --git a/drivers/usb/gadget/function/f_ecm.c 
b/drivers/usb/gadget/function/f_ecm.c
index 4c488d1..9657e19 100644
--- a/drivers/usb/gadget/function/f_ecm.c
+++ b/drivers/usb/gadget/function/f_ecm.c
@@ -845,7 +845,7 @@ static inline struct f_ecm_opts *to_f_ecm_opts(struct 
config_item *item)
NULL,
 };
 
-static struct config_item_type ecm_func_type = {
+static const struct config_item_type ecm_func_type = {
.ct_item_ops= _item_ops,
.ct_attrs   = ecm_attrs,
.ct_owner   = THIS_MODULE,
diff --git a/drivers/usb/gadget/function/f_eem.c 
b/drivers/usb/gadget/function/f_eem.c
index 007ec6e..5e5d164 100644
--- a/drivers/usb/gadget/function/f_eem.c
+++ b/drivers/usb/gadget/function/f_eem.c
@@ -556,7 +556,7 @@ static inline struct f_eem_opts *to_f_eem_opts(struct 
config_item *item)
NULL,
 };
 
-static struct config_item_type eem_func_type = {
+static const struct config_item_type eem_func_type = {
.ct_item_ops= _item_ops,
.ct_attrs   = eem_attrs,
.ct_owner   = THIS_MODULE,
diff --git a/drivers/usb/gadget/function/f_fs.c 
b/drivers/usb/gadget/function/f_fs.c
index 8b34258..5362fc4 100644
--- a/drivers/usb/gadget/function/f_fs.c
+++ b/drivers/usb/gadget/function/f_fs.c
@@ -3385,7 +3385,7 @@ static void ffs_attr_release(struct config_item *item)
.release= ffs_attr_release,
 };
 
-static struct config_item_type ffs_func_type = {
+static const struct config_item_type ffs_func_type = {
.ct_item_ops= _item_ops,
.ct_owner   = THIS_MODULE,
 };
diff --git a/drivers/usb/gadget/function/f_hid.c 
b/drivers/usb/gadget/function/f_hid.c
index d8e359e..6993cb8 100644
--- a/drivers/usb/gadget/function/f_hid.c
+++ b/drivers/usb/gadget/function/f_hid.c
@@ -992,7 +992,7 @@ static ssize_t f_hid_opts_dev_show(struct config_item 
*item, char *page)
NULL,
 };
 
-static struct config_item_type hid_func_type = {
+static const struct config_item_type hid_func_type = {
.ct_item_ops= _item_ops,
.ct_attrs   = hid_attrs,
.ct_owner   = THIS_MODULE,
diff --git a/drivers/usb/gadget/function/f_loopback.c 
b/drivers/usb/gadget/function/f_loopback.c
index e700938..9311f8c 100644
--- a/drivers/usb/gadget/function/f_loopback.c
+++ b/drivers/usb/gadget/function/f_loopback.c
@@ -556,7 +556,7 @@ static ssize_t f_lb_opts_bulk_buflen_store(struct 
config_item *item,
NULL,
 };
 
-static struct config_item_type lb_func_type = {
+static const struct config_item_type lb_func_type = {
.ct_item_ops= _item_ops,
.ct_attrs   = lb_attrs,
.ct_owner   = THIS_MODULE,
diff --git a/drivers/usb/gadget/function/f_mass_storage.c 
b/drivers/usb/gadget/function/f_mass_storage.c
index 5153e29..a538be3 100644
--- a/drivers/usb/gadget/function/f_mass_storage.c
+++ b/drivers/usb/gadget/function/f_mass_storage.c
@@ -3140,7 +3140,7 @@ static s

[PATCH v2 00/15] make structure field, function arguments and structures const

2017-10-16 Thread Bhumika Goyal
Make the ci_type field and some function arguments as const. After this
change, make config_item_type structures as const.

* Changes in v2- Combine all the followup patches and the constification
patches into a series.

Bhumika Goyal (15):
  configfs: make ci_type field, some pointers and function arguments
const
  usb: gadget: make config_item_type structures const
  target: make config_item_type const
  iio: make function argument and some structures const
  ocfs2/cluster: make config_item_type const
  PCI: endpoint: make config_item_type const
  usb: gadget: configfs: make config_item_type const
  nvmet: make config_item_type const
  ACPI: configfs: make config_item_type const
  nullb: make config_item_type const
  stm class: make config_item_type const
  RDMA/cma: make config_item_type const
  netconsole: make config_item_type const
  dlm: make config_item_type const
  configfs: make config_item_type const

 drivers/acpi/acpi_configfs.c |  6 ++--
 drivers/block/null_blk.c |  4 +--
 drivers/hwtracing/stm/policy.c   | 10 +++---
 drivers/iio/dummy/iio_simple_dummy.c |  2 +-
 drivers/iio/industrialio-configfs.c  |  2 +-
 drivers/iio/industrialio-sw-device.c |  6 ++--
 drivers/iio/industrialio-sw-trigger.c|  6 ++--
 drivers/iio/trigger/iio-trig-hrtimer.c   |  2 +-
 drivers/iio/trigger/iio-trig-loop.c  |  2 +-
 drivers/infiniband/core/cma_configfs.c   |  8 ++---
 drivers/net/netconsole.c |  4 +--
 drivers/nvme/target/configfs.c   | 30 -
 drivers/pci/endpoint/pci-ep-cfs.c| 12 +++
 drivers/target/iscsi/iscsi_target_stat.c | 12 +++
 drivers/target/target_core_configfs.c| 14 
 drivers/target/target_core_stat.c| 16 -
 drivers/usb/gadget/configfs.c| 10 +++---
 drivers/usb/gadget/function/f_acm.c  |  2 +-
 drivers/usb/gadget/function/f_ecm.c  |  2 +-
 drivers/usb/gadget/function/f_eem.c  |  2 +-
 drivers/usb/gadget/function/f_fs.c   |  2 +-
 drivers/usb/gadget/function/f_hid.c  |  2 +-
 drivers/usb/gadget/function/f_loopback.c |  2 +-
 drivers/usb/gadget/function/f_mass_storage.c |  4 +--
 drivers/usb/gadget/function/f_midi.c |  2 +-
 drivers/usb/gadget/function/f_ncm.c  |  2 +-
 drivers/usb/gadget/function/f_obex.c |  2 +-
 drivers/usb/gadget/function/f_phonet.c   |  2 +-
 drivers/usb/gadget/function/f_printer.c  |  2 +-
 drivers/usb/gadget/function/f_rndis.c|  2 +-
 drivers/usb/gadget/function/f_serial.c   |  2 +-
 drivers/usb/gadget/function/f_sourcesink.c   |  2 +-
 drivers/usb/gadget/function/f_subset.c   |  2 +-
 drivers/usb/gadget/function/f_tcm.c  |  2 +-
 drivers/usb/gadget/function/f_uac1.c |  2 +-
 drivers/usb/gadget/function/f_uac1_legacy.c  |  2 +-
 drivers/usb/gadget/function/f_uac2.c |  2 +-
 drivers/usb/gadget/function/uvc_configfs.c   | 50 ++--
 fs/configfs/dir.c| 10 +++---
 fs/configfs/item.c   |  6 ++--
 fs/configfs/symlink.c|  4 +--
 fs/dlm/config.c  | 16 -
 fs/ocfs2/cluster/heartbeat.c |  4 +--
 fs/ocfs2/cluster/nodemanager.c   |  8 ++---
 include/linux/configfs.h |  8 ++---
 include/linux/iio/sw_device.h|  2 +-
 include/linux/iio/sw_trigger.h   |  2 +-
 include/target/iscsi/iscsi_target_stat.h | 12 +++
 samples/configfs/configfs_sample.c   |  8 ++---
 49 files changed, 159 insertions(+), 159 deletions(-)

-- 
1.9.1



[PATCH v2 15/15] configfs: make config_item_type const

2017-10-16 Thread Bhumika Goyal
Make config_item_type structures const as they are either passed to a
function having the argument as const or stored in the const "ci_type"
field of a config_item structure.

Done using Coccinelle.

Signed-off-by: Bhumika Goyal <bhumi...@gmail.com>
---
* Changes in v2- Combine all the followup patches and the constification
patches into a series.

 samples/configfs/configfs_sample.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/samples/configfs/configfs_sample.c 
b/samples/configfs/configfs_sample.c
index 1ea3311..004a4e2 100644
--- a/samples/configfs/configfs_sample.c
+++ b/samples/configfs/configfs_sample.c
@@ -115,7 +115,7 @@ static ssize_t childless_description_show(struct 
config_item *item, char *page)
NULL,
 };
 
-static struct config_item_type childless_type = {
+static const struct config_item_type childless_type = {
.ct_attrs   = childless_attrs,
.ct_owner   = THIS_MODULE,
 };
@@ -193,7 +193,7 @@ static void simple_child_release(struct config_item *item)
.release= simple_child_release,
 };
 
-static struct config_item_type simple_child_type = {
+static const struct config_item_type simple_child_type = {
.ct_item_ops= _child_item_ops,
.ct_attrs   = simple_child_attrs,
.ct_owner   = THIS_MODULE,
@@ -261,7 +261,7 @@ static void simple_children_release(struct config_item 
*item)
.make_item  = simple_children_make_item,
 };
 
-static struct config_item_type simple_children_type = {
+static const struct config_item_type simple_children_type = {
.ct_item_ops= _children_item_ops,
.ct_group_ops   = _children_group_ops,
.ct_attrs   = simple_children_attrs,
@@ -331,7 +331,7 @@ static ssize_t group_children_description_show(struct 
config_item *item,
.make_group = group_children_make_group,
 };
 
-static struct config_item_type group_children_type = {
+static const struct config_item_type group_children_type = {
.ct_group_ops   = _children_group_ops,
.ct_attrs   = group_children_attrs,
.ct_owner   = THIS_MODULE,
-- 
1.9.1



[PATCH v2 14/15] dlm: make config_item_type const

2017-10-16 Thread Bhumika Goyal
Make config_item_type structures const as they are either passed to a
function having the argument as const or stored in the const "ci_type"
field of a config_item structure.

Done using Coccinelle.

Signed-off-by: Bhumika Goyal <bhumi...@gmail.com>
---
* Changes in v2- Combine all the followup patches and the constification
patches into a series.

 fs/dlm/config.c | 16 
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/fs/dlm/config.c b/fs/dlm/config.c
index 7211e82..1270551 100644
--- a/fs/dlm/config.c
+++ b/fs/dlm/config.c
@@ -282,44 +282,44 @@ struct dlm_node {
.release = release_node,
 };
 
-static struct config_item_type clusters_type = {
+static const struct config_item_type clusters_type = {
.ct_group_ops = _ops,
.ct_owner = THIS_MODULE,
 };
 
-static struct config_item_type cluster_type = {
+static const struct config_item_type cluster_type = {
.ct_item_ops = _ops,
.ct_attrs = cluster_attrs,
.ct_owner = THIS_MODULE,
 };
 
-static struct config_item_type spaces_type = {
+static const struct config_item_type spaces_type = {
.ct_group_ops = _ops,
.ct_owner = THIS_MODULE,
 };
 
-static struct config_item_type space_type = {
+static const struct config_item_type space_type = {
.ct_item_ops = _ops,
.ct_owner = THIS_MODULE,
 };
 
-static struct config_item_type comms_type = {
+static const struct config_item_type comms_type = {
.ct_group_ops = _ops,
.ct_owner = THIS_MODULE,
 };
 
-static struct config_item_type comm_type = {
+static const struct config_item_type comm_type = {
.ct_item_ops = _ops,
.ct_attrs = comm_attrs,
.ct_owner = THIS_MODULE,
 };
 
-static struct config_item_type nodes_type = {
+static const struct config_item_type nodes_type = {
.ct_group_ops = _ops,
.ct_owner = THIS_MODULE,
 };
 
-static struct config_item_type node_type = {
+static const struct config_item_type node_type = {
.ct_item_ops = _ops,
.ct_attrs = node_attrs,
.ct_owner = THIS_MODULE,
-- 
1.9.1



[PATCH v2 13/15] netconsole: make config_item_type const

2017-10-16 Thread Bhumika Goyal
Make these structures const as they are either passed to the functions
having the argument as const or stored as a reference in the "ci_type"
const field of a config_item structure.

Done using Coccienlle.

Signed-off-by: Bhumika Goyal <bhumi...@gmail.com>
---
* Changes in v2- Combine all the followup patches and the constification
patches into a series.

 drivers/net/netconsole.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c
index 0e27920..be9aa36 100644
--- a/drivers/net/netconsole.c
+++ b/drivers/net/netconsole.c
@@ -616,7 +616,7 @@ static void netconsole_target_release(struct config_item 
*item)
.release= netconsole_target_release,
 };
 
-static struct config_item_type netconsole_target_type = {
+static const struct config_item_type netconsole_target_type = {
.ct_attrs   = netconsole_target_attrs,
.ct_item_ops= _target_item_ops,
.ct_owner   = THIS_MODULE,
@@ -682,7 +682,7 @@ static void drop_netconsole_target(struct config_group 
*group,
.drop_item  = drop_netconsole_target,
 };
 
-static struct config_item_type netconsole_subsys_type = {
+static const struct config_item_type netconsole_subsys_type = {
.ct_group_ops   = _subsys_group_ops,
.ct_owner   = THIS_MODULE,
 };
-- 
1.9.1



[PATCH v2 10/15] nullb: make config_item_type const

2017-10-16 Thread Bhumika Goyal
Make these structures const as they are either passed to the functions
having the argument as const or stored as a reference in the "ci_type"
const field of a config_item structure.

Done using Coccienlle.

Signed-off-by: Bhumika Goyal <bhumi...@gmail.com>
---
* Changes in v2- Combine all the followup patches and the constification
patches into a series.

 drivers/block/null_blk.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/block/null_blk.c b/drivers/block/null_blk.c
index bf2c8ca..46b6008 100644
--- a/drivers/block/null_blk.c
+++ b/drivers/block/null_blk.c
@@ -480,7 +480,7 @@ static void nullb_device_release(struct config_item *item)
.release= nullb_device_release,
 };
 
-static struct config_item_type nullb_device_type = {
+static const struct config_item_type nullb_device_type = {
.ct_item_ops= _device_ops,
.ct_attrs   = nullb_device_attrs,
.ct_owner   = THIS_MODULE,
@@ -532,7 +532,7 @@ static ssize_t memb_group_features_show(struct config_item 
*item, char *page)
.drop_item  = nullb_group_drop_item,
 };
 
-static struct config_item_type nullb_group_type = {
+static const struct config_item_type nullb_group_type = {
.ct_group_ops   = _group_ops,
.ct_attrs   = nullb_group_attrs,
.ct_owner   = THIS_MODULE,
-- 
1.9.1



[PATCH v2 09/15] ACPI: configfs: make config_item_type const

2017-10-16 Thread Bhumika Goyal
Make these structures const as they are either passed to the functions
having the argument as const or stored as a reference in the "ci_type"
const field of a config_item structure.

Done using Coccienlle.

Signed-off-by: Bhumika Goyal <bhumi...@gmail.com>
---
* Changes in v2- Combine all the followup patches and the constification
patches into a series.

 drivers/acpi/acpi_configfs.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/acpi/acpi_configfs.c b/drivers/acpi/acpi_configfs.c
index 853bc7f..b588503 100644
--- a/drivers/acpi/acpi_configfs.c
+++ b/drivers/acpi/acpi_configfs.c
@@ -204,7 +204,7 @@ struct configfs_attribute *acpi_table_attrs[] = {
NULL,
 };
 
-static struct config_item_type acpi_table_type = {
+static const struct config_item_type acpi_table_type = {
.ct_owner = THIS_MODULE,
.ct_bin_attrs = acpi_table_bin_attrs,
.ct_attrs = acpi_table_attrs,
@@ -237,12 +237,12 @@ struct configfs_group_operations acpi_table_group_ops = {
.drop_item = acpi_table_drop_item,
 };
 
-static struct config_item_type acpi_tables_type = {
+static const struct config_item_type acpi_tables_type = {
.ct_owner = THIS_MODULE,
.ct_group_ops = _table_group_ops,
 };
 
-static struct config_item_type acpi_root_group_type = {
+static const struct config_item_type acpi_root_group_type = {
.ct_owner = THIS_MODULE,
 };
 
-- 
1.9.1



[PATCH v2 03/15] target: make config_item_type const

2017-10-16 Thread Bhumika Goyal
Make these structures const as they are either passed to the functions
having the argument as const or stored as a reference in the "ci_type"
const field of a config_item structure.

Done using Coccinelle.

Signed-off-by: Bhumika Goyal <bhumi...@gmail.com>
---
* Changes in v2- Combine all the followup patches and the constification
patches into a series.

 drivers/target/iscsi/iscsi_target_stat.c | 12 ++--
 drivers/target/target_core_configfs.c| 14 +++---
 drivers/target/target_core_stat.c| 16 
 include/target/iscsi/iscsi_target_stat.h | 12 ++--
 4 files changed, 27 insertions(+), 27 deletions(-)

diff --git a/drivers/target/iscsi/iscsi_target_stat.c 
b/drivers/target/iscsi/iscsi_target_stat.c
index 411cb26..df0a398 100644
--- a/drivers/target/iscsi/iscsi_target_stat.c
+++ b/drivers/target/iscsi/iscsi_target_stat.c
@@ -187,7 +187,7 @@ static ssize_t iscsi_stat_instance_version_show(struct 
config_item *item,
NULL,
 };
 
-struct config_item_type iscsi_stat_instance_cit = {
+const struct config_item_type iscsi_stat_instance_cit = {
.ct_attrs   = iscsi_stat_instance_attrs,
.ct_owner   = THIS_MODULE,
 };
@@ -249,7 +249,7 @@ static ssize_t 
iscsi_stat_sess_err_format_errors_show(struct config_item *item,
NULL,
 };
 
-struct config_item_type iscsi_stat_sess_err_cit = {
+const struct config_item_type iscsi_stat_sess_err_cit = {
.ct_attrs   = iscsi_stat_sess_err_attrs,
.ct_owner   = THIS_MODULE,
 };
@@ -390,7 +390,7 @@ static ssize_t 
iscsi_stat_tgt_attr_fail_intr_addr_show(struct config_item *item,
NULL,
 };
 
-struct config_item_type iscsi_stat_tgt_attr_cit = {
+const struct config_item_type iscsi_stat_tgt_attr_cit = {
.ct_attrs   = iscsi_stat_tgt_attr_attrs,
.ct_owner   = THIS_MODULE,
 };
@@ -522,7 +522,7 @@ static ssize_t iscsi_stat_login_negotiate_fails_show(struct 
config_item *item,
NULL,
 };
 
-struct config_item_type iscsi_stat_login_cit = {
+const struct config_item_type iscsi_stat_login_cit = {
.ct_attrs   = iscsi_stat_login_stats_attrs,
.ct_owner   = THIS_MODULE,
 };
@@ -579,7 +579,7 @@ static ssize_t 
iscsi_stat_logout_abnormal_logouts_show(struct config_item *item,
NULL,
 };
 
-struct config_item_type iscsi_stat_logout_cit = {
+const struct config_item_type iscsi_stat_logout_cit = {
.ct_attrs   = iscsi_stat_logout_stats_attrs,
.ct_owner   = THIS_MODULE,
 };
@@ -801,7 +801,7 @@ static ssize_t iscsi_stat_sess_conn_timeout_errors_show(
NULL,
 };
 
-struct config_item_type iscsi_stat_sess_cit = {
+const struct config_item_type iscsi_stat_sess_cit = {
.ct_attrs   = iscsi_stat_sess_stats_attrs,
.ct_owner   = THIS_MODULE,
 };
diff --git a/drivers/target/target_core_configfs.c 
b/drivers/target/target_core_configfs.c
index 7e87d95..bd87cc2 100644
--- a/drivers/target/target_core_configfs.c
+++ b/drivers/target/target_core_configfs.c
@@ -307,7 +307,7 @@ static void target_core_deregister_fabric(
 /*
  * Provides Fabrics Groups and Item Attributes for /sys/kernel/config/target/
  */
-static struct config_item_type target_core_fabrics_item = {
+static const struct config_item_type target_core_fabrics_item = {
.ct_group_ops   = _core_fabric_group_ops,
.ct_attrs   = target_core_fabric_item_attrs,
.ct_owner   = THIS_MODULE,
@@ -2376,7 +2376,7 @@ static void target_core_alua_lu_gp_release(struct 
config_item *item)
.release= target_core_alua_lu_gp_release,
 };
 
-static struct config_item_type target_core_alua_lu_gp_cit = {
+static const struct config_item_type target_core_alua_lu_gp_cit = {
.ct_item_ops= _core_alua_lu_gp_ops,
.ct_attrs   = target_core_alua_lu_gp_attrs,
.ct_owner   = THIS_MODULE,
@@ -2434,7 +2434,7 @@ static void target_core_alua_drop_lu_gp(
.drop_item  = _core_alua_drop_lu_gp,
 };
 
-static struct config_item_type target_core_alua_lu_gps_cit = {
+static const struct config_item_type target_core_alua_lu_gps_cit = {
.ct_item_ops= NULL,
.ct_group_ops   = _core_alua_lu_gps_group_ops,
.ct_owner   = THIS_MODULE,
@@ -2813,7 +2813,7 @@ static void target_core_alua_tg_pt_gp_release(struct 
config_item *item)
.release= target_core_alua_tg_pt_gp_release,
 };
 
-static struct config_item_type target_core_alua_tg_pt_gp_cit = {
+static const struct config_item_type target_core_alua_tg_pt_gp_cit = {
.ct_item_ops= _core_alua_tg_pt_gp_ops,
.ct_attrs   = target_core_alua_tg_pt_gp_attrs,
.ct_owner   = THIS_MODULE,
@@ -2884,7 +2884,7 @@ static void target_core_alua_drop_tg_pt_gp(
  * core/alua

[PATCH v2 04/15] iio: make function argument and some structures const

2017-10-16 Thread Bhumika Goyal
Make the argument of the functions iio_sw{d/t}_group_init_type_name const
as they are only passed to the function config_group_init_type_name having
the argument as const.

Make the config_item_type structures const as they are either passed to
the functions having the argument as const or they are
stored in the const "ci_type" field of a config_item structure.

Signed-off-by: Bhumika Goyal <bhumi...@gmail.com>
---
* Changes in v2- Combine all the followup patches and the constification
patches into a series.

 drivers/iio/dummy/iio_simple_dummy.c   | 2 +-
 drivers/iio/industrialio-configfs.c| 2 +-
 drivers/iio/industrialio-sw-device.c   | 6 +++---
 drivers/iio/industrialio-sw-trigger.c  | 6 +++---
 drivers/iio/trigger/iio-trig-hrtimer.c | 2 +-
 drivers/iio/trigger/iio-trig-loop.c| 2 +-
 include/linux/iio/sw_device.h  | 2 +-
 include/linux/iio/sw_trigger.h | 2 +-
 8 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/iio/dummy/iio_simple_dummy.c 
b/drivers/iio/dummy/iio_simple_dummy.c
index a45d01e..6205247 100644
--- a/drivers/iio/dummy/iio_simple_dummy.c
+++ b/drivers/iio/dummy/iio_simple_dummy.c
@@ -26,7 +26,7 @@
 #include 
 #include "iio_simple_dummy.h"
 
-static struct config_item_type iio_dummy_type = {
+static const struct config_item_type iio_dummy_type = {
.ct_owner = THIS_MODULE,
 };
 
diff --git a/drivers/iio/industrialio-configfs.c 
b/drivers/iio/industrialio-configfs.c
index 45ce2bc..5a0aae1 100644
--- a/drivers/iio/industrialio-configfs.c
+++ b/drivers/iio/industrialio-configfs.c
@@ -17,7 +17,7 @@
 #include 
 #include 
 
-static struct config_item_type iio_root_group_type = {
+static const struct config_item_type iio_root_group_type = {
.ct_owner   = THIS_MODULE,
 };
 
diff --git a/drivers/iio/industrialio-sw-device.c 
b/drivers/iio/industrialio-sw-device.c
index 81b49cf..90df97c 100644
--- a/drivers/iio/industrialio-sw-device.c
+++ b/drivers/iio/industrialio-sw-device.c
@@ -19,9 +19,9 @@
 #include 
 
 static struct config_group *iio_devices_group;
-static struct config_item_type iio_device_type_group_type;
+static const struct config_item_type iio_device_type_group_type;
 
-static struct config_item_type iio_devices_group_type = {
+static const struct config_item_type iio_devices_group_type = {
.ct_owner = THIS_MODULE,
 };
 
@@ -156,7 +156,7 @@ static void device_drop_group(struct config_group *group,
.drop_item  = _drop_group,
 };
 
-static struct config_item_type iio_device_type_group_type = {
+static const struct config_item_type iio_device_type_group_type = {
.ct_group_ops = _ops,
.ct_owner   = THIS_MODULE,
 };
diff --git a/drivers/iio/industrialio-sw-trigger.c 
b/drivers/iio/industrialio-sw-trigger.c
index 8d24fb1..bc6b7fb 100644
--- a/drivers/iio/industrialio-sw-trigger.c
+++ b/drivers/iio/industrialio-sw-trigger.c
@@ -19,9 +19,9 @@
 #include 
 
 static struct config_group *iio_triggers_group;
-static struct config_item_type iio_trigger_type_group_type;
+static const struct config_item_type iio_trigger_type_group_type;
 
-static struct config_item_type iio_triggers_group_type = {
+static const struct config_item_type iio_triggers_group_type = {
.ct_owner = THIS_MODULE,
 };
 
@@ -156,7 +156,7 @@ static void trigger_drop_group(struct config_group *group,
.drop_item  = _drop_group,
 };
 
-static struct config_item_type iio_trigger_type_group_type = {
+static const struct config_item_type iio_trigger_type_group_type = {
.ct_group_ops = _ops,
.ct_owner   = THIS_MODULE,
 };
diff --git a/drivers/iio/trigger/iio-trig-hrtimer.c 
b/drivers/iio/trigger/iio-trig-hrtimer.c
index 3ee9216..7accd01 100644
--- a/drivers/iio/trigger/iio-trig-hrtimer.c
+++ b/drivers/iio/trigger/iio-trig-hrtimer.c
@@ -30,7 +30,7 @@ struct iio_hrtimer_info {
ktime_t period;
 };
 
-static struct config_item_type iio_hrtimer_type = {
+static const struct config_item_type iio_hrtimer_type = {
.ct_owner = THIS_MODULE,
 };
 
diff --git a/drivers/iio/trigger/iio-trig-loop.c 
b/drivers/iio/trigger/iio-trig-loop.c
index b4b02db..94a90e0 100644
--- a/drivers/iio/trigger/iio-trig-loop.c
+++ b/drivers/iio/trigger/iio-trig-loop.c
@@ -36,7 +36,7 @@ struct iio_loop_info {
struct task_struct *task;
 };
 
-static struct config_item_type iio_loop_type = {
+static const struct config_item_type iio_loop_type = {
.ct_owner = THIS_MODULE,
 };
 
diff --git a/include/linux/iio/sw_device.h b/include/linux/iio/sw_device.h
index fa79319..8642b91 100644
--- a/include/linux/iio/sw_device.h
+++ b/include/linux/iio/sw_device.h
@@ -60,7 +60,7 @@ struct iio_sw_device *to_iio_sw_device(struct config_item 
*item)
 static inline
 void iio_swd_group_init_type_name(struct iio_sw_device *d,
  const char *name,
- struct config_item_type *type)
+ const str

[PATCH v2 08/15] nvmet: make config_item_type const

2017-10-16 Thread Bhumika Goyal
Make config_item_type structures const as they are either passed to a
function having the argument as const or used inside an if statement or
stored in the const "ci_type" field of a config_item structure.

Done using Coccinelle

Signed-off-by: Bhumika Goyal <bhumi...@gmail.com>
---
* Changes in v2- Combine all the followup patches and the constification
patches into a series.

 drivers/nvme/target/configfs.c | 30 +++---
 1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/drivers/nvme/target/configfs.c b/drivers/nvme/target/configfs.c
index b6aeb1d..e6b2d2a 100644
--- a/drivers/nvme/target/configfs.c
+++ b/drivers/nvme/target/configfs.c
@@ -20,8 +20,8 @@
 
 #include "nvmet.h"
 
-static struct config_item_type nvmet_host_type;
-static struct config_item_type nvmet_subsys_type;
+static const struct config_item_type nvmet_host_type;
+static const struct config_item_type nvmet_subsys_type;
 
 /*
  * nvmet_port Generic ConfigFS definitions.
@@ -425,7 +425,7 @@ static void nvmet_ns_release(struct config_item *item)
.release= nvmet_ns_release,
 };
 
-static struct config_item_type nvmet_ns_type = {
+static const struct config_item_type nvmet_ns_type = {
.ct_item_ops= _ns_item_ops,
.ct_attrs   = nvmet_ns_attrs,
.ct_owner   = THIS_MODULE,
@@ -464,7 +464,7 @@ static struct config_group *nvmet_ns_make(struct 
config_group *group,
.make_group = nvmet_ns_make,
 };
 
-static struct config_item_type nvmet_namespaces_type = {
+static const struct config_item_type nvmet_namespaces_type = {
.ct_group_ops   = _namespaces_group_ops,
.ct_owner   = THIS_MODULE,
 };
@@ -540,7 +540,7 @@ static void nvmet_port_subsys_drop_link(struct config_item 
*parent,
.drop_link  = nvmet_port_subsys_drop_link,
 };
 
-static struct config_item_type nvmet_port_subsys_type = {
+static const struct config_item_type nvmet_port_subsys_type = {
.ct_item_ops= _port_subsys_item_ops,
.ct_owner   = THIS_MODULE,
 };
@@ -613,7 +613,7 @@ static void nvmet_allowed_hosts_drop_link(struct 
config_item *parent,
.drop_link  = nvmet_allowed_hosts_drop_link,
 };
 
-static struct config_item_type nvmet_allowed_hosts_type = {
+static const struct config_item_type nvmet_allowed_hosts_type = {
.ct_item_ops= _allowed_hosts_item_ops,
.ct_owner   = THIS_MODULE,
 };
@@ -729,7 +729,7 @@ static void nvmet_subsys_release(struct config_item *item)
.release= nvmet_subsys_release,
 };
 
-static struct config_item_type nvmet_subsys_type = {
+static const struct config_item_type nvmet_subsys_type = {
.ct_item_ops= _subsys_item_ops,
.ct_attrs   = nvmet_subsys_attrs,
.ct_owner   = THIS_MODULE,
@@ -767,7 +767,7 @@ static struct config_group *nvmet_subsys_make(struct 
config_group *group,
.make_group = nvmet_subsys_make,
 };
 
-static struct config_item_type nvmet_subsystems_type = {
+static const struct config_item_type nvmet_subsystems_type = {
.ct_group_ops   = _subsystems_group_ops,
.ct_owner   = THIS_MODULE,
 };
@@ -827,7 +827,7 @@ static void nvmet_referral_release(struct config_item *item)
.release= nvmet_referral_release,
 };
 
-static struct config_item_type nvmet_referral_type = {
+static const struct config_item_type nvmet_referral_type = {
.ct_owner   = THIS_MODULE,
.ct_attrs   = nvmet_referral_attrs,
.ct_item_ops= _referral_item_ops,
@@ -852,7 +852,7 @@ static struct config_group *nvmet_referral_make(
.make_group = nvmet_referral_make,
 };
 
-static struct config_item_type nvmet_referrals_type = {
+static const struct config_item_type nvmet_referrals_type = {
.ct_owner   = THIS_MODULE,
.ct_group_ops   = _referral_group_ops,
 };
@@ -880,7 +880,7 @@ static void nvmet_port_release(struct config_item *item)
.release= nvmet_port_release,
 };
 
-static struct config_item_type nvmet_port_type = {
+static const struct config_item_type nvmet_port_type = {
.ct_attrs   = nvmet_port_attrs,
.ct_item_ops= _port_item_ops,
.ct_owner   = THIS_MODULE,
@@ -921,7 +921,7 @@ static struct config_group *nvmet_ports_make(struct 
config_group *group,
.make_group = nvmet_ports_make,
 };
 
-static struct config_item_type nvmet_ports_type = {
+static const struct config_item_type nvmet_ports_type = {
.ct_group_ops   = _ports_group_ops,
.ct_owner   = THIS_MODULE,
 };
@@ -940,7 +940,7 @@ static void nvmet_host_release(struct config_item *item)
.release= nvmet_host_release,
 };
 
-stat

[PATCH 2/2] [media] davinci: make ccdc_hw_device structures const

2017-10-17 Thread Bhumika Goyal
Make these structures const as they are only getting passed to the
functions vpfe_{register/unregister}_ccdc_device having the argument as
const.

Structures found using Coccinelle and changes done by hand.

Signed-off-by: Bhumika Goyal <bhumi...@gmail.com>
---
 drivers/media/platform/davinci/dm355_ccdc.c  | 2 +-
 drivers/media/platform/davinci/dm644x_ccdc.c | 2 +-
 drivers/media/platform/davinci/isif.c| 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/media/platform/davinci/dm355_ccdc.c 
b/drivers/media/platform/davinci/dm355_ccdc.c
index 6d492dc..89cb309 100644
--- a/drivers/media/platform/davinci/dm355_ccdc.c
+++ b/drivers/media/platform/davinci/dm355_ccdc.c
@@ -841,7 +841,7 @@ static int ccdc_set_hw_if_params(struct vpfe_hw_if_param 
*params)
return 0;
 }
 
-static struct ccdc_hw_device ccdc_hw_dev = {
+static const struct ccdc_hw_device ccdc_hw_dev = {
.name = "DM355 CCDC",
.owner = THIS_MODULE,
.hw_ops = {
diff --git a/drivers/media/platform/davinci/dm644x_ccdc.c 
b/drivers/media/platform/davinci/dm644x_ccdc.c
index 3b2d8a9..5fa0a1f 100644
--- a/drivers/media/platform/davinci/dm644x_ccdc.c
+++ b/drivers/media/platform/davinci/dm644x_ccdc.c
@@ -776,7 +776,7 @@ static void ccdc_restore_context(void)
regw(ccdc_ctx[CCDC_VP_OUT >> 2], CCDC_VP_OUT);
regw(ccdc_ctx[CCDC_PCR >> 2], CCDC_PCR);
 }
-static struct ccdc_hw_device ccdc_hw_dev = {
+static const struct ccdc_hw_device ccdc_hw_dev = {
.name = "DM6446 CCDC",
.owner = THIS_MODULE,
.hw_ops = {
diff --git a/drivers/media/platform/davinci/isif.c 
b/drivers/media/platform/davinci/isif.c
index 5813b49..d5ff584 100644
--- a/drivers/media/platform/davinci/isif.c
+++ b/drivers/media/platform/davinci/isif.c
@@ -1000,7 +1000,7 @@ static int isif_close(struct device *device)
return 0;
 }
 
-static struct ccdc_hw_device isif_hw_dev = {
+static const struct ccdc_hw_device isif_hw_dev = {
.name = "ISIF",
.owner = THIS_MODULE,
.hw_ops = {
-- 
1.9.1



[PATCH 0/2] [media] davinci: make function arguments and structures const

2017-10-17 Thread Bhumika Goyal
Make some function arguments as const. After this changes make ccdc_hw_device
structures as const.

Bhumika Goyal (2):
  [media] davinci: make function arguments const
  [media] davinci: make ccdc_hw_device structures const

 drivers/media/platform/davinci/ccdc_hw_device.h | 4 ++--
 drivers/media/platform/davinci/dm355_ccdc.c | 2 +-
 drivers/media/platform/davinci/dm644x_ccdc.c| 2 +-
 drivers/media/platform/davinci/isif.c   | 2 +-
 drivers/media/platform/davinci/vpfe_capture.c   | 6 +++---
 5 files changed, 8 insertions(+), 8 deletions(-)

-- 
1.9.1



[PATCH 1/2] [media] davinci: make function arguments const

2017-10-17 Thread Bhumika Goyal
Make the function arguments of functions vpfe_{register/unregister}_ccdc_device
const as the pointer dev does not modify the fields of the structure 
it points to. Also, declare the variable ccdc_dev const as it points to the 
same structure as dev but it does not modify the fields as well.

Signed-off-by: Bhumika Goyal <bhumi...@gmail.com>
---
 drivers/media/platform/davinci/ccdc_hw_device.h | 4 ++--
 drivers/media/platform/davinci/vpfe_capture.c   | 6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/media/platform/davinci/ccdc_hw_device.h 
b/drivers/media/platform/davinci/ccdc_hw_device.h
index f1b5210..3482178 100644
--- a/drivers/media/platform/davinci/ccdc_hw_device.h
+++ b/drivers/media/platform/davinci/ccdc_hw_device.h
@@ -82,8 +82,8 @@ struct ccdc_hw_device {
 };
 
 /* Used by CCDC module to register & unregister with vpfe capture driver */
-int vpfe_register_ccdc_device(struct ccdc_hw_device *dev);
-void vpfe_unregister_ccdc_device(struct ccdc_hw_device *dev);
+int vpfe_register_ccdc_device(const struct ccdc_hw_device *dev);
+void vpfe_unregister_ccdc_device(const struct ccdc_hw_device *dev);
 
 #endif
 #endif
diff --git a/drivers/media/platform/davinci/vpfe_capture.c 
b/drivers/media/platform/davinci/vpfe_capture.c
index 6792da1..7b3f6f8 100644
--- a/drivers/media/platform/davinci/vpfe_capture.c
+++ b/drivers/media/platform/davinci/vpfe_capture.c
@@ -115,7 +115,7 @@ struct ccdc_config {
 };
 
 /* ccdc device registered */
-static struct ccdc_hw_device *ccdc_dev;
+static const struct ccdc_hw_device *ccdc_dev;
 /* lock for accessing ccdc information */
 static DEFINE_MUTEX(ccdc_lock);
 /* ccdc configuration */
@@ -203,7 +203,7 @@ static const struct vpfe_pixel_format 
*vpfe_lookup_pix_format(u32 pix_format)
  * vpfe_register_ccdc_device. CCDC module calls this to
  * register with vpfe capture
  */
-int vpfe_register_ccdc_device(struct ccdc_hw_device *dev)
+int vpfe_register_ccdc_device(const struct ccdc_hw_device *dev)
 {
int ret = 0;
printk(KERN_NOTICE "vpfe_register_ccdc_device: %s\n", dev->name);
@@ -259,7 +259,7 @@ int vpfe_register_ccdc_device(struct ccdc_hw_device *dev)
  * vpfe_unregister_ccdc_device. CCDC module calls this to
  * unregister with vpfe capture
  */
-void vpfe_unregister_ccdc_device(struct ccdc_hw_device *dev)
+void vpfe_unregister_ccdc_device(const struct ccdc_hw_device *dev)
 {
if (!dev) {
printk(KERN_ERR "invalid ccdc device ptr\n");
-- 
1.9.1



[PATCH v2 01/15] configfs: make ci_type field, some pointers and function arguments const

2017-10-16 Thread Bhumika Goyal
The ci_type field of the config_item structure do not modify the fields
of the config_item_type structure it points to. And the other pointers
initialized with ci_type do not modify the fields as well.
So, make the ci_type field and the pointers initialized with ci_type
as const.

Make the struct config_item_type *type function argument of functions
config_{item/group}_init_type_name const as the argument in both the
functions is only stored in the ci_type field of a config_item structure
which is now made const.
Make the argument of configfs_register_default_group const as it is
only passed to the argument of the function config_group_init_type_name
which is now const.

Signed-off-by: Bhumika Goyal <bhumi...@gmail.com>
---
* Changes in v2- Combine all the followup patches and the constification
patches into a series.

 fs/configfs/dir.c| 10 +-
 fs/configfs/item.c   |  6 +++---
 fs/configfs/symlink.c|  4 ++--
 include/linux/configfs.h |  8 
 4 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/fs/configfs/dir.c b/fs/configfs/dir.c
index 56fb261..577cff2 100644
--- a/fs/configfs/dir.c
+++ b/fs/configfs/dir.c
@@ -584,7 +584,7 @@ static void detach_attrs(struct config_item * item)
 
 static int populate_attrs(struct config_item *item)
 {
-   struct config_item_type *t = item->ci_type;
+   const struct config_item_type *t = item->ci_type;
struct configfs_attribute *attr;
struct configfs_bin_attribute *bin_attr;
int error = 0;
@@ -901,7 +901,7 @@ static void configfs_detach_group(struct config_item *item)
 static void client_disconnect_notify(struct config_item *parent_item,
 struct config_item *item)
 {
-   struct config_item_type *type;
+   const struct config_item_type *type;
 
type = parent_item->ci_type;
BUG_ON(!type);
@@ -920,7 +920,7 @@ static void client_disconnect_notify(struct config_item 
*parent_item,
 static void client_drop_item(struct config_item *parent_item,
 struct config_item *item)
 {
-   struct config_item_type *type;
+   const struct config_item_type *type;
 
type = parent_item->ci_type;
BUG_ON(!type);
@@ -1260,7 +1260,7 @@ static int configfs_mkdir(struct inode *dir, struct 
dentry *dentry, umode_t mode
struct config_item *parent_item;
struct configfs_subsystem *subsys;
struct configfs_dirent *sd;
-   struct config_item_type *type;
+   const struct config_item_type *type;
struct module *subsys_owner = NULL, *new_item_owner = NULL;
char *name;
 
@@ -1810,7 +1810,7 @@ void configfs_unregister_group(struct config_group *group)
 struct config_group *
 configfs_register_default_group(struct config_group *parent_group,
const char *name,
-   struct config_item_type *item_type)
+   const struct config_item_type *item_type)
 {
int ret;
struct config_group *group;
diff --git a/fs/configfs/item.c b/fs/configfs/item.c
index a66f662..88f266e 100644
--- a/fs/configfs/item.c
+++ b/fs/configfs/item.c
@@ -113,7 +113,7 @@ int config_item_set_name(struct config_item *item, const 
char *fmt, ...)
 
 void config_item_init_type_name(struct config_item *item,
const char *name,
-   struct config_item_type *type)
+   const struct config_item_type *type)
 {
config_item_set_name(item, "%s", name);
item->ci_type = type;
@@ -122,7 +122,7 @@ void config_item_init_type_name(struct config_item *item,
 EXPORT_SYMBOL(config_item_init_type_name);
 
 void config_group_init_type_name(struct config_group *group, const char *name,
-struct config_item_type *type)
+const struct config_item_type *type)
 {
config_item_set_name(>cg_item, "%s", name);
group->cg_item.ci_type = type;
@@ -148,7 +148,7 @@ struct config_item *config_item_get_unless_zero(struct 
config_item *item)
 
 static void config_item_cleanup(struct config_item *item)
 {
-   struct config_item_type *t = item->ci_type;
+   const struct config_item_type *t = item->ci_type;
struct config_group *s = item->ci_group;
struct config_item *parent = item->ci_parent;
 
diff --git a/fs/configfs/symlink.c b/fs/configfs/symlink.c
index c8aabba..78ffc26 100644
--- a/fs/configfs/symlink.c
+++ b/fs/configfs/symlink.c
@@ -138,7 +138,7 @@ int configfs_symlink(struct inode *dir, struct dentry 
*dentry, const char *symna
struct configfs_dirent *sd;
struct config_item *parent_item;
struct config_item *target_item = NULL;
-   struct config_item_type *type;
+   const struct config_item_type *type;
 
sd = dentry->d_parent->d_fsdata;
/*
@@ -186,7 +186,7

[PATCH 1/2] CLK: SPEAr: make structure field and function argument as const

2017-10-17 Thread Bhumika Goyal
Make the masks field of clk_aux structure const as it do not modify the
fields of the aux_clk_masks structure it points to.

Make the struct aux_clk_masks *aux argument of the function
clk_register_aux as const as the argument is only stored in the masks
field of a clk_aux structure which is now made const.

Signed-off-by: Bhumika Goyal <bhumi...@gmail.com>
---
 drivers/clk/spear/clk-aux-synth.c | 2 +-
 drivers/clk/spear/clk.h   | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/clk/spear/clk-aux-synth.c 
b/drivers/clk/spear/clk-aux-synth.c
index f271c35..8bea5df 100644
--- a/drivers/clk/spear/clk-aux-synth.c
+++ b/drivers/clk/spear/clk-aux-synth.c
@@ -136,7 +136,7 @@ static int clk_aux_set_rate(struct clk_hw *hw, unsigned 
long drate,
 
 struct clk *clk_register_aux(const char *aux_name, const char *gate_name,
const char *parent_name, unsigned long flags, void __iomem *reg,
-   struct aux_clk_masks *masks, struct aux_rate_tbl *rtbl,
+   const struct aux_clk_masks *masks, struct aux_rate_tbl *rtbl,
u8 rtbl_cnt, spinlock_t *lock, struct clk **gate_clk)
 {
struct clk_aux *aux;
diff --git a/drivers/clk/spear/clk.h b/drivers/clk/spear/clk.h
index 9834944..b9d28b3 100644
--- a/drivers/clk/spear/clk.h
+++ b/drivers/clk/spear/clk.h
@@ -49,7 +49,7 @@ struct aux_rate_tbl {
 struct clk_aux {
struct  clk_hw hw;
void __iomem*reg;
-   struct aux_clk_masks*masks;
+const struct aux_clk_masks *masks;
struct aux_rate_tbl *rtbl;
u8  rtbl_cnt;
spinlock_t  *lock;
@@ -112,7 +112,7 @@ typedef unsigned long (*clk_calc_rate)(struct clk_hw *hw, 
unsigned long prate,
 /* clk register routines */
 struct clk *clk_register_aux(const char *aux_name, const char *gate_name,
const char *parent_name, unsigned long flags, void __iomem *reg,
-   struct aux_clk_masks *masks, struct aux_rate_tbl *rtbl,
+   const struct aux_clk_masks *masks, struct aux_rate_tbl *rtbl,
u8 rtbl_cnt, spinlock_t *lock, struct clk **gate_clk);
 struct clk *clk_register_frac(const char *name, const char *parent_name,
unsigned long flags, void __iomem *reg,
-- 
1.9.1



[PATCH 2/2] CLK: SPEAr: make aux_clk_masks structures const

2017-10-17 Thread Bhumika Goyal
Make these const as they are either stored in the masks 'const' field
of a clk_aux structure or passed to the function clk_register_aux 
having the argument as const.

Signed-off-by: Bhumika Goyal <bhumi...@gmail.com>
---
 drivers/clk/spear/clk-aux-synth.c   | 2 +-
 drivers/clk/spear/spear1310_clock.c | 2 +-
 drivers/clk/spear/spear1340_clock.c | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/clk/spear/clk-aux-synth.c 
b/drivers/clk/spear/clk-aux-synth.c
index 8bea5df..2f145e3 100644
--- a/drivers/clk/spear/clk-aux-synth.c
+++ b/drivers/clk/spear/clk-aux-synth.c
@@ -29,7 +29,7 @@
 
 #define to_clk_aux(_hw) container_of(_hw, struct clk_aux, hw)
 
-static struct aux_clk_masks default_aux_masks = {
+static const  struct aux_clk_masks default_aux_masks = {
.eq_sel_mask = AUX_EQ_SEL_MASK,
.eq_sel_shift = AUX_EQ_SEL_SHIFT,
.eq1_mask = AUX_EQ1_SEL,
diff --git a/drivers/clk/spear/spear1310_clock.c 
b/drivers/clk/spear/spear1310_clock.c
index 2f86e3f..591248c 100644
--- a/drivers/clk/spear/spear1310_clock.c
+++ b/drivers/clk/spear/spear1310_clock.c
@@ -284,7 +284,7 @@
 };
 
 /* i2s prescaler1 masks */
-static struct aux_clk_masks i2s_prs1_masks = {
+static const struct aux_clk_masks i2s_prs1_masks = {
.eq_sel_mask = AUX_EQ_SEL_MASK,
.eq_sel_shift = SPEAR1310_I2S_PRS1_EQ_SEL_SHIFT,
.eq1_mask = AUX_EQ1_SEL,
diff --git a/drivers/clk/spear/spear1340_clock.c 
b/drivers/clk/spear/spear1340_clock.c
index cbb19a9..e5bc8c8 100644
--- a/drivers/clk/spear/spear1340_clock.c
+++ b/drivers/clk/spear/spear1340_clock.c
@@ -323,7 +323,7 @@
 };
 
 /* i2s prescaler1 masks */
-static struct aux_clk_masks i2s_prs1_masks = {
+static const struct aux_clk_masks i2s_prs1_masks = {
.eq_sel_mask = AUX_EQ_SEL_MASK,
.eq_sel_shift = SPEAR1340_I2S_PRS1_EQ_SEL_SHIFT,
.eq1_mask = AUX_EQ1_SEL,
-- 
1.9.1



[PATCH 0/2] CLK: SPEAr: make structure field, function arg and strutcure const

2017-10-17 Thread Bhumika Goyal
Make structure field and function argument as const. After this change, 
make the structures as const.

Bhumika Goyal (2):
  CLK: SPEAr: make structure field and function argument as const
  CLK: SPEAr: make aux_clk_masks structures const

 drivers/clk/spear/clk-aux-synth.c   | 4 ++--
 drivers/clk/spear/clk.h | 4 ++--
 drivers/clk/spear/spear1310_clock.c | 2 +-
 drivers/clk/spear/spear1340_clock.c | 2 +-
 4 files changed, 6 insertions(+), 6 deletions(-)

-- 
1.9.1



Re: [PATCH] powerpc/eeh: make eeh_ops structures _ro_after_init

2017-10-13 Thread Bhumika Goyal
On Fri, Oct 13, 2017 at 6:08 PM, Julia Lawall <julia.law...@lip6.fr> wrote:
>
>
> On Fri, 13 Oct 2017, Bhumika Goyal wrote:
>
>> These structures are passed to the eeh_ops_register function during the
>> initialization phase. There they get stored in a structure variable
>> which only makes function calls through function pointers. There is no
>> other usage of these eeh_ops structures and their fields are never
>> modified after init phase. So, make them __ro_after_init.
>
> I think they could be const.
>

Yes. I will send a patch for const.

> julia
>
>> Signed-off-by: Bhumika Goyal <bhumi...@gmail.com>
>> ---
>>  arch/powerpc/platforms/powernv/eeh-powernv.c | 2 +-
>>  arch/powerpc/platforms/pseries/eeh_pseries.c | 2 +-
>>  2 files changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/arch/powerpc/platforms/powernv/eeh-powernv.c 
>> b/arch/powerpc/platforms/powernv/eeh-powernv.c
>> index 4650fb2..d2a53df 100644
>> --- a/arch/powerpc/platforms/powernv/eeh-powernv.c
>> +++ b/arch/powerpc/platforms/powernv/eeh-powernv.c
>> @@ -1731,7 +1731,7 @@ static int pnv_eeh_restore_config(struct pci_dn *pdn)
>>   return 0;
>>  }
>>
>> -static struct eeh_ops pnv_eeh_ops = {
>> +static struct eeh_ops pnv_eeh_ops __ro_after_init = {
>>   .name   = "powernv",
>>   .init   = pnv_eeh_init,
>>   .probe  = pnv_eeh_probe,
>> diff --git a/arch/powerpc/platforms/pseries/eeh_pseries.c 
>> b/arch/powerpc/platforms/pseries/eeh_pseries.c
>> index 6b812ad..6fedfc9 100644
>> --- a/arch/powerpc/platforms/pseries/eeh_pseries.c
>> +++ b/arch/powerpc/platforms/pseries/eeh_pseries.c
>> @@ -684,7 +684,7 @@ static int pseries_eeh_write_config(struct pci_dn *pdn, 
>> int where, int size, u32
>>   return rtas_write_config(pdn, where, size, val);
>>  }
>>
>> -static struct eeh_ops pseries_eeh_ops = {
>> +static struct eeh_ops pseries_eeh_ops __ro_after_init = {
>>   .name   = "pseries",
>>   .init   = pseries_eeh_init,
>>   .probe  = pseries_eeh_probe,
>> --
>> 1.9.1
>>
>>


[PATCH 1/2] sound: oss: make the function argument as const

2017-10-13 Thread Bhumika Goyal
Make the function argument struct audio_driver *driver of the function
sound_install_audiodrv as const as it's memory contents are only copied
during a memcpy call. So, the fields of the structure to which driver
points to never gets modified and therefore the argument can be made
const.
Add const to the prototype too.

Signed-off-by: Bhumika Goyal <bhumi...@gmail.com>
---
 sound/oss/dev_table.c | 2 +-
 sound/oss/dev_table.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/oss/dev_table.c b/sound/oss/dev_table.c
index 6dad515..dbb9a3b 100644
--- a/sound/oss/dev_table.c
+++ b/sound/oss/dev_table.c
@@ -48,7 +48,7 @@ struct sound_timer_operations 
*sound_timer_devs[MAX_TIMER_DEV] = {
 
 static int sound_alloc_audiodev(void);
 
-int sound_install_audiodrv(int vers, char *name, struct audio_driver *driver,
+int sound_install_audiodrv(int vers, char *name, const struct audio_driver 
*driver,
int driver_size, int flags, unsigned int format_mask,
void *devc, int dma1, int dma2)
 {
diff --git a/sound/oss/dev_table.h b/sound/oss/dev_table.h
index 0199a31..b388ed0 100644
--- a/sound/oss/dev_table.h
+++ b/sound/oss/dev_table.h
@@ -371,7 +371,7 @@ struct sound_timer_operations
 
 #define AUDIO_DRIVER_VERSION   2
 #define MIXER_DRIVER_VERSION   2
-int sound_install_audiodrv(int vers, char *name, struct audio_driver *driver,
+int sound_install_audiodrv(int vers, char *name, const struct audio_driver 
*driver,
int driver_size, int flags, unsigned int format_mask,
void *devc, int dma1, int dma2);
 int sound_install_mixer(int vers, char *name, struct mixer_operations *driver,
-- 
1.9.1



[PATCH 0/2] sound: oss: make the function argument and structure const

2017-10-13 Thread Bhumika Goyal
Make the function argument of function sound_install_audiodrv const. 
After this change, make the structures audio_driver const as they are 
only passed to the const argument (made const in Patch[1/2])
of the function sound_install_audiodrv .

Bhumika Goyal (2):
  sound: oss: make the function argument as const
  sound: oss: make audio_driver structure const

 sound/oss/dev_table.c  | 2 +-
 sound/oss/dev_table.h  | 2 +-
 sound/oss/pas2_pcm.c   | 2 +-
 sound/oss/waveartist.c | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

-- 
1.9.1



[PATCH 2/2] sound: oss: make audio_driver structure const

2017-10-13 Thread Bhumika Goyal
This is a followup patch for [PATCH 1/2].

Make these structures const as they are only passed to the const
argument of the function sound_install_audiodrv.

Signed-off-by: Bhumika Goyal <bhumi...@gmail.com>
---
 sound/oss/pas2_pcm.c   | 2 +-
 sound/oss/waveartist.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/oss/pas2_pcm.c b/sound/oss/pas2_pcm.c
index 474803b..716c5c4 100644
--- a/sound/oss/pas2_pcm.c
+++ b/sound/oss/pas2_pcm.c
@@ -356,7 +356,7 @@ static int pas_audio_prepare_for_output(int dev, int bsize, 
int bcount)
return 0;
 }
 
-static struct audio_driver pas_audio_driver =
+static const struct audio_driver pas_audio_driver =
 {
.owner  = THIS_MODULE,
.open   = pas_audio_open,
diff --git a/sound/oss/waveartist.c b/sound/oss/waveartist.c
index 4f0c3a2..7509777 100644
--- a/sound/oss/waveartist.c
+++ b/sound/oss/waveartist.c
@@ -826,7 +826,7 @@ static void vnc_configure_mixer(struct wavnc_info *devc,
return arg;
 }
 
-static struct audio_driver waveartist_audio_driver = {
+static const struct audio_driver waveartist_audio_driver = {
.owner  = THIS_MODULE,
.open   = waveartist_open,
.close  = waveartist_close,
-- 
1.9.1



[PATCH] scsi: scsi_transport_fc: make the function argument as const

2017-10-13 Thread Bhumika Goyal
This is a followup patch for: https://lkml.org/lkml/2017/10/13/476

Make the function argument of fc_attach_transport as const as it is
only stored in the const field 'f' (made const in the patch in the link)
of a fc_internal structure.

Signed-off-by: Bhumika Goyal <bhumi...@gmail.com>
---
This change allows some fc_function_template structures to be const.
I will send the patches for structure constification after this gets 
applied.

 drivers/scsi/scsi_transport_fc.c | 2 +-
 include/scsi/scsi_transport_fc.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c
index 8c46a6d..fb30ede 100644
--- a/drivers/scsi/scsi_transport_fc.c
+++ b/drivers/scsi/scsi_transport_fc.c
@@ -2162,7 +2162,7 @@ enum blk_eh_timer_return
 }
 
 struct scsi_transport_template *
-fc_attach_transport(struct fc_function_template *ft)
+fc_attach_transport(const struct fc_function_template *ft)
 {
int count;
struct fc_internal *i = kzalloc(sizeof(struct fc_internal),
diff --git a/include/scsi/scsi_transport_fc.h b/include/scsi/scsi_transport_fc.h
index e8644ee..60fff05 100644
--- a/include/scsi/scsi_transport_fc.h
+++ b/include/scsi/scsi_transport_fc.h
@@ -784,7 +784,7 @@ static inline void u64_to_wwn(u64 inm, u8 *wwn)
 }
 
 struct scsi_transport_template *fc_attach_transport(
-   struct fc_function_template *);
+   const struct fc_function_template *);
 void fc_release_transport(struct scsi_transport_template *);
 void fc_remove_host(struct Scsi_Host *);
 struct fc_rport *fc_remote_port_add(struct Scsi_Host *shost,
-- 
1.9.1



[PATCH] scsi: scsi_transport_fc: make a field of fc_internal structure const

2017-10-13 Thread Bhumika Goyal
The 'f' field of the fc_internal structure do not modify the fields
of the fc_function_template structure it points to. And there are no
other pointers initialized with this field 'f'. So, the field 'f' is
never modified and therefore make it const.

Signed-off-by: Bhumika Goyal <bhumi...@gmail.com>
---
 drivers/scsi/scsi_transport_fc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c
index cbd4495..f38975f 100644
--- a/drivers/scsi/scsi_transport_fc.c
+++ b/drivers/scsi/scsi_transport_fc.c
@@ -323,7 +323,7 @@ struct device_attribute device_attr_##_prefix##_##_name =   
\
 
 struct fc_internal {
struct scsi_transport_template t;
-   struct fc_function_template *f;
+   const struct fc_function_template *f;
 
/*
 * For attributes : each object has :
-- 
1.9.1



[PATCH] configfs: make ci_type field and some pointers const

2017-10-11 Thread Bhumika Goyal
The ci_type field of the config_item structure do not modify the fields of
the config_item_type structure it points to. And the other pointers
initialized with ci_type do not modify the fields as well.
So, make the ci_type field and the pointers initialized with ci_type 
as const.

Signed-off-by: Bhumika Goyal <bhumi...@gmail.com>
---
 fs/configfs/dir.c| 8 
 fs/configfs/item.c   | 2 +-
 fs/configfs/symlink.c| 4 ++--
 include/linux/configfs.h | 2 +-
 4 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/fs/configfs/dir.c b/fs/configfs/dir.c
index 56fb261..ccdd33f 100644
--- a/fs/configfs/dir.c
+++ b/fs/configfs/dir.c
@@ -584,7 +584,7 @@ static void detach_attrs(struct config_item * item)
 
 static int populate_attrs(struct config_item *item)
 {
-   struct config_item_type *t = item->ci_type;
+   const struct config_item_type *t = item->ci_type;
struct configfs_attribute *attr;
struct configfs_bin_attribute *bin_attr;
int error = 0;
@@ -901,7 +901,7 @@ static void configfs_detach_group(struct config_item *item)
 static void client_disconnect_notify(struct config_item *parent_item,
 struct config_item *item)
 {
-   struct config_item_type *type;
+   const struct config_item_type *type;
 
type = parent_item->ci_type;
BUG_ON(!type);
@@ -920,7 +920,7 @@ static void client_disconnect_notify(struct config_item 
*parent_item,
 static void client_drop_item(struct config_item *parent_item,
 struct config_item *item)
 {
-   struct config_item_type *type;
+   const struct config_item_type *type;
 
type = parent_item->ci_type;
BUG_ON(!type);
@@ -1260,7 +1260,7 @@ static int configfs_mkdir(struct inode *dir, struct 
dentry *dentry, umode_t mode
struct config_item *parent_item;
struct configfs_subsystem *subsys;
struct configfs_dirent *sd;
-   struct config_item_type *type;
+   const struct config_item_type *type;
struct module *subsys_owner = NULL, *new_item_owner = NULL;
char *name;
 
diff --git a/fs/configfs/item.c b/fs/configfs/item.c
index a66f662..b1f57eb 100644
--- a/fs/configfs/item.c
+++ b/fs/configfs/item.c
@@ -148,7 +148,7 @@ struct config_item *config_item_get_unless_zero(struct 
config_item *item)
 
 static void config_item_cleanup(struct config_item *item)
 {
-   struct config_item_type *t = item->ci_type;
+   const struct config_item_type *t = item->ci_type;
struct config_group *s = item->ci_group;
struct config_item *parent = item->ci_parent;
 
diff --git a/fs/configfs/symlink.c b/fs/configfs/symlink.c
index c8aabba..78ffc26 100644
--- a/fs/configfs/symlink.c
+++ b/fs/configfs/symlink.c
@@ -138,7 +138,7 @@ int configfs_symlink(struct inode *dir, struct dentry 
*dentry, const char *symna
struct configfs_dirent *sd;
struct config_item *parent_item;
struct config_item *target_item = NULL;
-   struct config_item_type *type;
+   const struct config_item_type *type;
 
sd = dentry->d_parent->d_fsdata;
/*
@@ -186,7 +186,7 @@ int configfs_unlink(struct inode *dir, struct dentry 
*dentry)
struct configfs_dirent *sd = dentry->d_fsdata;
struct configfs_symlink *sl;
struct config_item *parent_item;
-   struct config_item_type *type;
+   const struct config_item_type *type;
int ret;
 
ret = -EPERM;  /* What lack-of-symlink returns */
diff --git a/include/linux/configfs.h b/include/linux/configfs.h
index c967090..c91ba94 100644
--- a/include/linux/configfs.h
+++ b/include/linux/configfs.h
@@ -58,7 +58,7 @@ struct config_item {
struct list_headci_entry;
struct config_item  *ci_parent;
struct config_group *ci_group;
-   struct config_item_type *ci_type;
+   const struct config_item_type   *ci_type;
struct dentry   *ci_dentry;
 };
 
-- 
1.9.1



[PATCH] IB/cma: make config_item_type const

2017-10-12 Thread Bhumika Goyal
This is a followup patch for: https://lkml.org/lkml/2017/10/11/375 and
https://patchwork.kernel.org/patch/649/

Make these structures const as they are either passed to the functions
having the argument as const or stored as a reference in the "ci_type"
const field of a config_item structure.

Done using Coccienlle.

Signed-off-by: Bhumika Goyal <bhumi...@gmail.com>
---
 drivers/infiniband/core/cma_configfs.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/infiniband/core/cma_configfs.c 
b/drivers/infiniband/core/cma_configfs.c
index 54076a3..31dfee0 100644
--- a/drivers/infiniband/core/cma_configfs.c
+++ b/drivers/infiniband/core/cma_configfs.c
@@ -186,7 +186,7 @@ static ssize_t default_roce_tos_store(struct config_item 
*item,
NULL,
 };
 
-static struct config_item_type cma_port_group_type = {
+static const struct config_item_type cma_port_group_type = {
.ct_attrs   = cma_configfs_attributes,
.ct_owner   = THIS_MODULE
 };
@@ -263,7 +263,7 @@ static void release_cma_ports_group(struct config_item  
*item)
.release = release_cma_ports_group
 };
 
-static struct config_item_type cma_ports_group_type = {
+static const struct config_item_type cma_ports_group_type = {
.ct_item_ops= _ports_item_ops,
.ct_owner   = THIS_MODULE
 };
@@ -272,7 +272,7 @@ static void release_cma_ports_group(struct config_item  
*item)
.release = release_cma_dev
 };
 
-static struct config_item_type cma_device_group_type = {
+static const struct config_item_type cma_device_group_type = {
.ct_item_ops= _device_item_ops,
.ct_owner   = THIS_MODULE
 };
@@ -323,7 +323,7 @@ static struct config_group *make_cma_dev(struct 
config_group *group,
.make_group = make_cma_dev,
 };
 
-static struct config_item_type cma_subsys_type = {
+static const struct config_item_type cma_subsys_type = {
.ct_group_ops   = _subsys_group_ops,
.ct_owner   = THIS_MODULE,
 };
-- 
1.9.1



[PATCH] nvmet: make config_item_type const

2017-10-12 Thread Bhumika Goyal
This is a followup patch for:
https://patchwork.kernel.org/patch/649/ and
https://lkml.org/lkml/2017/10/11/375

Make config_item_type structures const as they are either passed to a
function having the argument as const or used inside an if statement or
stored in the const "ci_type" field of a config_item structure.

Done using Coccinelle

Signed-off-by: Bhumika Goyal <bhumi...@gmail.com>
---
 drivers/nvme/target/configfs.c | 30 +++---
 1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/drivers/nvme/target/configfs.c b/drivers/nvme/target/configfs.c
index b6aeb1d..e6b2d2a 100644
--- a/drivers/nvme/target/configfs.c
+++ b/drivers/nvme/target/configfs.c
@@ -20,8 +20,8 @@
 
 #include "nvmet.h"
 
-static struct config_item_type nvmet_host_type;
-static struct config_item_type nvmet_subsys_type;
+static const struct config_item_type nvmet_host_type;
+static const struct config_item_type nvmet_subsys_type;
 
 /*
  * nvmet_port Generic ConfigFS definitions.
@@ -425,7 +425,7 @@ static void nvmet_ns_release(struct config_item *item)
.release= nvmet_ns_release,
 };
 
-static struct config_item_type nvmet_ns_type = {
+static const struct config_item_type nvmet_ns_type = {
.ct_item_ops= _ns_item_ops,
.ct_attrs   = nvmet_ns_attrs,
.ct_owner   = THIS_MODULE,
@@ -464,7 +464,7 @@ static struct config_group *nvmet_ns_make(struct 
config_group *group,
.make_group = nvmet_ns_make,
 };
 
-static struct config_item_type nvmet_namespaces_type = {
+static const struct config_item_type nvmet_namespaces_type = {
.ct_group_ops   = _namespaces_group_ops,
.ct_owner   = THIS_MODULE,
 };
@@ -540,7 +540,7 @@ static void nvmet_port_subsys_drop_link(struct config_item 
*parent,
.drop_link  = nvmet_port_subsys_drop_link,
 };
 
-static struct config_item_type nvmet_port_subsys_type = {
+static const struct config_item_type nvmet_port_subsys_type = {
.ct_item_ops= _port_subsys_item_ops,
.ct_owner   = THIS_MODULE,
 };
@@ -613,7 +613,7 @@ static void nvmet_allowed_hosts_drop_link(struct 
config_item *parent,
.drop_link  = nvmet_allowed_hosts_drop_link,
 };
 
-static struct config_item_type nvmet_allowed_hosts_type = {
+static const struct config_item_type nvmet_allowed_hosts_type = {
.ct_item_ops= _allowed_hosts_item_ops,
.ct_owner   = THIS_MODULE,
 };
@@ -729,7 +729,7 @@ static void nvmet_subsys_release(struct config_item *item)
.release= nvmet_subsys_release,
 };
 
-static struct config_item_type nvmet_subsys_type = {
+static const struct config_item_type nvmet_subsys_type = {
.ct_item_ops= _subsys_item_ops,
.ct_attrs   = nvmet_subsys_attrs,
.ct_owner   = THIS_MODULE,
@@ -767,7 +767,7 @@ static struct config_group *nvmet_subsys_make(struct 
config_group *group,
.make_group = nvmet_subsys_make,
 };
 
-static struct config_item_type nvmet_subsystems_type = {
+static const struct config_item_type nvmet_subsystems_type = {
.ct_group_ops   = _subsystems_group_ops,
.ct_owner   = THIS_MODULE,
 };
@@ -827,7 +827,7 @@ static void nvmet_referral_release(struct config_item *item)
.release= nvmet_referral_release,
 };
 
-static struct config_item_type nvmet_referral_type = {
+static const struct config_item_type nvmet_referral_type = {
.ct_owner   = THIS_MODULE,
.ct_attrs   = nvmet_referral_attrs,
.ct_item_ops= _referral_item_ops,
@@ -852,7 +852,7 @@ static struct config_group *nvmet_referral_make(
.make_group = nvmet_referral_make,
 };
 
-static struct config_item_type nvmet_referrals_type = {
+static const struct config_item_type nvmet_referrals_type = {
.ct_owner   = THIS_MODULE,
.ct_group_ops   = _referral_group_ops,
 };
@@ -880,7 +880,7 @@ static void nvmet_port_release(struct config_item *item)
.release= nvmet_port_release,
 };
 
-static struct config_item_type nvmet_port_type = {
+static const struct config_item_type nvmet_port_type = {
.ct_attrs   = nvmet_port_attrs,
.ct_item_ops= _port_item_ops,
.ct_owner   = THIS_MODULE,
@@ -921,7 +921,7 @@ static struct config_group *nvmet_ports_make(struct 
config_group *group,
.make_group = nvmet_ports_make,
 };
 
-static struct config_item_type nvmet_ports_type = {
+static const struct config_item_type nvmet_ports_type = {
.ct_group_ops   = _ports_group_ops,
.ct_owner   = THIS_MODULE,
 };
@@ -940,7 +940,7 @@ static void nvmet_host_release(struct config_item *item)
.release= nvmet_host_rel

[PATCH] PCI: endpoint: make config_item_type const

2017-10-12 Thread Bhumika Goyal
This is a followup patch for:
https://patchwork.kernel.org/patch/649/ and
https://lkml.org/lkml/2017/10/11/375

Make config_item_type structures const as they are either passed to a
function having the argument as const or stored in the const "ci_type"
field of a config_item structure.

Done using Coccinelle.

Signed-off-by: Bhumika Goyal <bhumi...@gmail.com>
---
 drivers/pci/endpoint/pci-ep-cfs.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/pci/endpoint/pci-ep-cfs.c 
b/drivers/pci/endpoint/pci-ep-cfs.c
index 424fdd6..4f74386 100644
--- a/drivers/pci/endpoint/pci-ep-cfs.c
+++ b/drivers/pci/endpoint/pci-ep-cfs.c
@@ -150,7 +150,7 @@ static void pci_epc_epf_unlink(struct config_item *epc_item,
.drop_link  = pci_epc_epf_unlink,
 };
 
-static struct config_item_type pci_epc_type = {
+static const struct config_item_type pci_epc_type = {
.ct_item_ops= _epc_item_ops,
.ct_attrs   = pci_epc_attrs,
.ct_owner   = THIS_MODULE,
@@ -361,7 +361,7 @@ static void pci_epf_release(struct config_item *item)
.release= pci_epf_release,
 };
 
-static struct config_item_type pci_epf_type = {
+static const struct config_item_type pci_epf_type = {
.ct_item_ops= _epf_ops,
.ct_attrs   = pci_epf_attrs,
.ct_owner   = THIS_MODULE,
@@ -400,7 +400,7 @@ static void pci_epf_drop(struct config_group *group, struct 
config_item *item)
.drop_item  = _epf_drop,
 };
 
-static struct config_item_type pci_epf_group_type = {
+static const struct config_item_type pci_epf_group_type = {
.ct_group_ops   = _epf_group_ops,
.ct_owner   = THIS_MODULE,
 };
@@ -428,15 +428,15 @@ void pci_ep_cfs_remove_epf_group(struct config_group 
*group)
 }
 EXPORT_SYMBOL(pci_ep_cfs_remove_epf_group);
 
-static struct config_item_type pci_functions_type = {
+static const struct config_item_type pci_functions_type = {
.ct_owner   = THIS_MODULE,
 };
 
-static struct config_item_type pci_controllers_type = {
+static const struct config_item_type pci_controllers_type = {
.ct_owner   = THIS_MODULE,
 };
 
-static struct config_item_type pci_ep_type = {
+static const struct config_item_type pci_ep_type = {
.ct_owner   = THIS_MODULE,
 };
 
-- 
1.9.1



[PATCH] iio: make config_item_type const

2017-10-12 Thread Bhumika Goyal
This is a followup patch for:
https://lkml.org/lkml/2017/10/11/375
https://patchwork.kernel.org/patch/649/
https://lkml.org/lkml/2017/10/11/469 and
https://lkml.org/lkml/2017/10/11/661

Make the config_item_type structures const as they are either passed to
the functions having the argument as const (link 2,3,4) or they are
stored in the const "ci_type" field of a config_item structure (link 1).

Done using Coccinelle.

Signed-off-by: Bhumika Goyal <bhumi...@gmail.com>
---
 drivers/iio/dummy/iio_simple_dummy.c   | 2 +-
 drivers/iio/industrialio-configfs.c| 2 +-
 drivers/iio/industrialio-sw-device.c   | 6 +++---
 drivers/iio/industrialio-sw-trigger.c  | 6 +++---
 drivers/iio/trigger/iio-trig-hrtimer.c | 2 +-
 drivers/iio/trigger/iio-trig-loop.c| 2 +-
 6 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/iio/dummy/iio_simple_dummy.c 
b/drivers/iio/dummy/iio_simple_dummy.c
index a45d01e..6205247 100644
--- a/drivers/iio/dummy/iio_simple_dummy.c
+++ b/drivers/iio/dummy/iio_simple_dummy.c
@@ -26,7 +26,7 @@
 #include 
 #include "iio_simple_dummy.h"
 
-static struct config_item_type iio_dummy_type = {
+static const struct config_item_type iio_dummy_type = {
.ct_owner = THIS_MODULE,
 };
 
diff --git a/drivers/iio/industrialio-configfs.c 
b/drivers/iio/industrialio-configfs.c
index 45ce2bc..5a0aae1 100644
--- a/drivers/iio/industrialio-configfs.c
+++ b/drivers/iio/industrialio-configfs.c
@@ -17,7 +17,7 @@
 #include 
 #include 
 
-static struct config_item_type iio_root_group_type = {
+static const struct config_item_type iio_root_group_type = {
.ct_owner   = THIS_MODULE,
 };
 
diff --git a/drivers/iio/industrialio-sw-device.c 
b/drivers/iio/industrialio-sw-device.c
index 81b49cf..90df97c 100644
--- a/drivers/iio/industrialio-sw-device.c
+++ b/drivers/iio/industrialio-sw-device.c
@@ -19,9 +19,9 @@
 #include 
 
 static struct config_group *iio_devices_group;
-static struct config_item_type iio_device_type_group_type;
+static const struct config_item_type iio_device_type_group_type;
 
-static struct config_item_type iio_devices_group_type = {
+static const struct config_item_type iio_devices_group_type = {
.ct_owner = THIS_MODULE,
 };
 
@@ -156,7 +156,7 @@ static void device_drop_group(struct config_group *group,
.drop_item  = _drop_group,
 };
 
-static struct config_item_type iio_device_type_group_type = {
+static const struct config_item_type iio_device_type_group_type = {
.ct_group_ops = _ops,
.ct_owner   = THIS_MODULE,
 };
diff --git a/drivers/iio/industrialio-sw-trigger.c 
b/drivers/iio/industrialio-sw-trigger.c
index 8d24fb1..bc6b7fb 100644
--- a/drivers/iio/industrialio-sw-trigger.c
+++ b/drivers/iio/industrialio-sw-trigger.c
@@ -19,9 +19,9 @@
 #include 
 
 static struct config_group *iio_triggers_group;
-static struct config_item_type iio_trigger_type_group_type;
+static const struct config_item_type iio_trigger_type_group_type;
 
-static struct config_item_type iio_triggers_group_type = {
+static const struct config_item_type iio_triggers_group_type = {
.ct_owner = THIS_MODULE,
 };
 
@@ -156,7 +156,7 @@ static void trigger_drop_group(struct config_group *group,
.drop_item  = _drop_group,
 };
 
-static struct config_item_type iio_trigger_type_group_type = {
+static const struct config_item_type iio_trigger_type_group_type = {
.ct_group_ops = _ops,
.ct_owner   = THIS_MODULE,
 };
diff --git a/drivers/iio/trigger/iio-trig-hrtimer.c 
b/drivers/iio/trigger/iio-trig-hrtimer.c
index 3ee9216..7accd01 100644
--- a/drivers/iio/trigger/iio-trig-hrtimer.c
+++ b/drivers/iio/trigger/iio-trig-hrtimer.c
@@ -30,7 +30,7 @@ struct iio_hrtimer_info {
ktime_t period;
 };
 
-static struct config_item_type iio_hrtimer_type = {
+static const struct config_item_type iio_hrtimer_type = {
.ct_owner = THIS_MODULE,
 };
 
diff --git a/drivers/iio/trigger/iio-trig-loop.c 
b/drivers/iio/trigger/iio-trig-loop.c
index b4b02db..94a90e0 100644
--- a/drivers/iio/trigger/iio-trig-loop.c
+++ b/drivers/iio/trigger/iio-trig-loop.c
@@ -36,7 +36,7 @@ struct iio_loop_info {
struct task_struct *task;
 };
 
-static struct config_item_type iio_loop_type = {
+static const struct config_item_type iio_loop_type = {
.ct_owner = THIS_MODULE,
 };
 
-- 
1.9.1



[PATCH] target: make config_item_type const

2017-10-12 Thread Bhumika Goyal
This is a followup patch for: https://lkml.org/lkml/2017/10/11/375 and
https://patchwork.kernel.org/patch/649/

Make these structures const as they are either passed to the functions
having the argument as const or stored as a reference in the "ci_type"
const field of a config_item structure.

Done using Coccinelle.

Signed-off-by: Bhumika Goyal <bhumi...@gmail.com>
---
 drivers/target/target_core_configfs.c | 14 +++---
 drivers/target/target_core_stat.c | 16 
 2 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/drivers/target/target_core_configfs.c 
b/drivers/target/target_core_configfs.c
index 7e87d95..bd87cc2 100644
--- a/drivers/target/target_core_configfs.c
+++ b/drivers/target/target_core_configfs.c
@@ -307,7 +307,7 @@ static void target_core_deregister_fabric(
 /*
  * Provides Fabrics Groups and Item Attributes for /sys/kernel/config/target/
  */
-static struct config_item_type target_core_fabrics_item = {
+static const struct config_item_type target_core_fabrics_item = {
.ct_group_ops   = _core_fabric_group_ops,
.ct_attrs   = target_core_fabric_item_attrs,
.ct_owner   = THIS_MODULE,
@@ -2376,7 +2376,7 @@ static void target_core_alua_lu_gp_release(struct 
config_item *item)
.release= target_core_alua_lu_gp_release,
 };
 
-static struct config_item_type target_core_alua_lu_gp_cit = {
+static const struct config_item_type target_core_alua_lu_gp_cit = {
.ct_item_ops= _core_alua_lu_gp_ops,
.ct_attrs   = target_core_alua_lu_gp_attrs,
.ct_owner   = THIS_MODULE,
@@ -2434,7 +2434,7 @@ static void target_core_alua_drop_lu_gp(
.drop_item  = _core_alua_drop_lu_gp,
 };
 
-static struct config_item_type target_core_alua_lu_gps_cit = {
+static const struct config_item_type target_core_alua_lu_gps_cit = {
.ct_item_ops= NULL,
.ct_group_ops   = _core_alua_lu_gps_group_ops,
.ct_owner   = THIS_MODULE,
@@ -2813,7 +2813,7 @@ static void target_core_alua_tg_pt_gp_release(struct 
config_item *item)
.release= target_core_alua_tg_pt_gp_release,
 };
 
-static struct config_item_type target_core_alua_tg_pt_gp_cit = {
+static const struct config_item_type target_core_alua_tg_pt_gp_cit = {
.ct_item_ops= _core_alua_tg_pt_gp_ops,
.ct_attrs   = target_core_alua_tg_pt_gp_attrs,
.ct_owner   = THIS_MODULE,
@@ -2884,7 +2884,7 @@ static void target_core_alua_drop_tg_pt_gp(
  * core/alua/lu_gps and core/alua/tg_pt_gps that are attached to
  * target_core_alua_cit in target_core_init_configfs() below.
  */
-static struct config_item_type target_core_alua_cit = {
+static const struct config_item_type target_core_alua_cit = {
.ct_item_ops= NULL,
.ct_attrs   = NULL,
.ct_owner   = THIS_MODULE,
@@ -3105,7 +3105,7 @@ static void target_core_hba_release(struct config_item 
*item)
.release= target_core_hba_release,
 };
 
-static struct config_item_type target_core_hba_cit = {
+static const struct config_item_type target_core_hba_cit = {
.ct_item_ops= _core_hba_item_ops,
.ct_group_ops   = _core_hba_group_ops,
.ct_attrs   = target_core_hba_attrs,
@@ -3188,7 +3188,7 @@ static void target_core_call_delhbafromtarget(
.drop_item  = target_core_call_delhbafromtarget,
 };
 
-static struct config_item_type target_core_cit = {
+static const struct config_item_type target_core_cit = {
.ct_item_ops= NULL,
.ct_group_ops   = _core_group_ops,
.ct_attrs   = NULL,
diff --git a/drivers/target/target_core_stat.c 
b/drivers/target/target_core_stat.c
index 8038255..f0db91e 100644
--- a/drivers/target/target_core_stat.c
+++ b/drivers/target/target_core_stat.c
@@ -96,7 +96,7 @@ static ssize_t target_stat_ports_show(struct config_item 
*item, char *page)
NULL,
 };
 
-static struct config_item_type target_stat_scsi_dev_cit = {
+static const struct config_item_type target_stat_scsi_dev_cit = {
.ct_attrs   = target_stat_scsi_dev_attrs,
.ct_owner   = THIS_MODULE,
 };
@@ -193,7 +193,7 @@ static ssize_t target_stat_tgt_aborts_no_task_show(struct 
config_item *item,
NULL,
 };
 
-static struct config_item_type target_stat_scsi_tgt_dev_cit = {
+static const struct config_item_type target_stat_scsi_tgt_dev_cit = {
.ct_attrs   = target_stat_scsi_tgt_dev_attrs,
.ct_owner   = THIS_MODULE,
 };
@@ -414,7 +414,7 @@ static ssize_t target_stat_lu_creation_time_show(struct 
config_item *item,
NULL,
 };
 
-static struct config_item_type target_stat_scsi_lu_cit = {
+static const struct config_item_type target_stat_scsi_lu_cit = {
.ct_attrs   = target_st

[PATCH] ocfs2/cluster: make config_item_type const

2017-10-12 Thread Bhumika Goyal
This is a followup patch for: https://lkml.org/lkml/2017/10/11/375 and
https://patchwork.kernel.org/patch/649/

Make these structures const as they are either passed to the functions
having the argument as const or stored as a reference in the "ci_type"
const field of a config_item structure.

Done using Coccinelle.

Signed-off-by: Bhumika Goyal <bhumi...@gmail.com>
---
 fs/ocfs2/cluster/heartbeat.c   | 4 ++--
 fs/ocfs2/cluster/nodemanager.c | 8 
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/fs/ocfs2/cluster/heartbeat.c b/fs/ocfs2/cluster/heartbeat.c
index d020604..ea8c551 100644
--- a/fs/ocfs2/cluster/heartbeat.c
+++ b/fs/ocfs2/cluster/heartbeat.c
@@ -2025,7 +2025,7 @@ static ssize_t o2hb_region_pid_show(struct config_item 
*item, char *page)
.release= o2hb_region_release,
 };
 
-static struct config_item_type o2hb_region_type = {
+static const struct config_item_type o2hb_region_type = {
.ct_item_ops= _region_item_ops,
.ct_attrs   = o2hb_region_attrs,
.ct_owner   = THIS_MODULE,
@@ -2310,7 +2310,7 @@ static ssize_t o2hb_heartbeat_group_mode_store(struct 
config_item *item,
.drop_item  = o2hb_heartbeat_group_drop_item,
 };
 
-static struct config_item_type o2hb_heartbeat_group_type = {
+static const struct config_item_type o2hb_heartbeat_group_type = {
.ct_group_ops   = _heartbeat_group_group_ops,
.ct_attrs   = o2hb_heartbeat_group_attrs,
.ct_owner   = THIS_MODULE,
diff --git a/fs/ocfs2/cluster/nodemanager.c b/fs/ocfs2/cluster/nodemanager.c
index b17d180..3f2f87e 100644
--- a/fs/ocfs2/cluster/nodemanager.c
+++ b/fs/ocfs2/cluster/nodemanager.c
@@ -378,7 +378,7 @@ static ssize_t o2nm_node_local_store(struct config_item 
*item, const char *page,
.release= o2nm_node_release,
 };
 
-static struct config_item_type o2nm_node_type = {
+static const struct config_item_type o2nm_node_type = {
.ct_item_ops= _node_item_ops,
.ct_attrs   = o2nm_node_attrs,
.ct_owner   = THIS_MODULE,
@@ -619,7 +619,7 @@ static void o2nm_node_group_drop_item(struct config_group 
*group,
.drop_item  = o2nm_node_group_drop_item,
 };
 
-static struct config_item_type o2nm_node_group_type = {
+static const struct config_item_type o2nm_node_group_type = {
.ct_group_ops   = _node_group_group_ops,
.ct_owner   = THIS_MODULE,
 };
@@ -637,7 +637,7 @@ static void o2nm_cluster_release(struct config_item *item)
.release= o2nm_cluster_release,
 };
 
-static struct config_item_type o2nm_cluster_type = {
+static const struct config_item_type o2nm_cluster_type = {
.ct_item_ops= _cluster_item_ops,
.ct_attrs   = o2nm_cluster_attrs,
.ct_owner   = THIS_MODULE,
@@ -727,7 +727,7 @@ static void o2nm_cluster_group_drop_item(struct 
config_group *group, struct conf
.ct_owner   = THIS_MODULE,
 };
 
-static struct o2nm_cluster_group o2nm_cluster_group = {
+static const struct o2nm_cluster_group o2nm_cluster_group = {
.cs_subsys = {
.su_group = {
.cg_item = {
-- 
1.9.1



[PATCH] ACPI: configfs: make config_item_type const

2017-10-12 Thread Bhumika Goyal
This is a followup patch for: https://lkml.org/lkml/2017/10/11/375 and
https://patchwork.kernel.org/patch/649/

Make these structures const as they are either passed to the functions
having the argument as const or stored as a reference in the "ci_type"
const field of a config_item structure.

Done using Coccienlle.

Signed-off-by: Bhumika Goyal <bhumi...@gmail.com>
---
 drivers/acpi/acpi_configfs.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/acpi/acpi_configfs.c b/drivers/acpi/acpi_configfs.c
index 853bc7f..b588503 100644
--- a/drivers/acpi/acpi_configfs.c
+++ b/drivers/acpi/acpi_configfs.c
@@ -204,7 +204,7 @@ struct configfs_attribute *acpi_table_attrs[] = {
NULL,
 };
 
-static struct config_item_type acpi_table_type = {
+static const struct config_item_type acpi_table_type = {
.ct_owner = THIS_MODULE,
.ct_bin_attrs = acpi_table_bin_attrs,
.ct_attrs = acpi_table_attrs,
@@ -237,12 +237,12 @@ struct configfs_group_operations acpi_table_group_ops = {
.drop_item = acpi_table_drop_item,
 };
 
-static struct config_item_type acpi_tables_type = {
+static const struct config_item_type acpi_tables_type = {
.ct_owner = THIS_MODULE,
.ct_group_ops = _table_group_ops,
 };
 
-static struct config_item_type acpi_root_group_type = {
+static const struct config_item_type acpi_root_group_type = {
.ct_owner = THIS_MODULE,
 };
 
-- 
1.9.1



[PATCH] nullb: make config_item_type const

2017-10-12 Thread Bhumika Goyal
This is a followup patch for: https://lkml.org/lkml/2017/10/11/375 and
https://patchwork.kernel.org/patch/649/

Make these structures const as they are either passed to the functions
having the argument as const or stored as a reference in the "ci_type"
const field of a config_item structure.

Done using Coccienlle.

Signed-off-by: Bhumika Goyal <bhumi...@gmail.com>
---
 drivers/block/null_blk.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/block/null_blk.c b/drivers/block/null_blk.c
index bf2c8ca..46b6008 100644
--- a/drivers/block/null_blk.c
+++ b/drivers/block/null_blk.c
@@ -480,7 +480,7 @@ static void nullb_device_release(struct config_item *item)
.release= nullb_device_release,
 };
 
-static struct config_item_type nullb_device_type = {
+static const struct config_item_type nullb_device_type = {
.ct_item_ops= _device_ops,
.ct_attrs   = nullb_device_attrs,
.ct_owner   = THIS_MODULE,
@@ -532,7 +532,7 @@ static ssize_t memb_group_features_show(struct config_item 
*item, char *page)
.drop_item  = nullb_group_drop_item,
 };
 
-static struct config_item_type nullb_group_type = {
+static const struct config_item_type nullb_group_type = {
.ct_group_ops   = _group_ops,
.ct_attrs   = nullb_group_attrs,
.ct_owner   = THIS_MODULE,
-- 
1.9.1



[PATCH] stm class: make config_item_type const

2017-10-12 Thread Bhumika Goyal
This is a followup patch for:
https://patchwork.kernel.org/patch/649/ and 
https://lkml.org/lkml/2017/10/11/375

Make config_item_type structures const as they are either passed to a
function having the argument as const or used inside a if statement or 
stored in the const "ci_type" field of a config_item structure.

Done using Coccinelle.

Signed-off-by: Bhumika Goyal <bhumi...@gmail.com>
---
 drivers/hwtracing/stm/policy.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/hwtracing/stm/policy.c b/drivers/hwtracing/stm/policy.c
index 6c0ae29..33e9a1b 100644
--- a/drivers/hwtracing/stm/policy.c
+++ b/drivers/hwtracing/stm/policy.c
@@ -187,8 +187,8 @@ static void stp_policy_node_release(struct config_item 
*item)
NULL,
 };
 
-static struct config_item_type stp_policy_type;
-static struct config_item_type stp_policy_node_type;
+static const struct config_item_type stp_policy_type;
+static const struct config_item_type stp_policy_node_type;
 
 static struct config_group *
 stp_policy_node_make(struct config_group *group, const char *name)
@@ -236,7 +236,7 @@ static void stp_policy_node_release(struct config_item 
*item)
.drop_item  = stp_policy_node_drop,
 };
 
-static struct config_item_type stp_policy_node_type = {
+static const struct config_item_type stp_policy_node_type = {
.ct_item_ops= _policy_node_item_ops,
.ct_group_ops   = _policy_node_group_ops,
.ct_attrs   = stp_policy_node_attrs,
@@ -311,7 +311,7 @@ static void stp_policy_release(struct config_item *item)
.make_group = stp_policy_node_make,
 };
 
-static struct config_item_type stp_policy_type = {
+static const struct config_item_type stp_policy_type = {
.ct_item_ops= _policy_item_ops,
.ct_group_ops   = _policy_group_ops,
.ct_attrs   = stp_policy_attrs,
@@ -380,7 +380,7 @@ static void stp_policy_release(struct config_item *item)
.make_group = stp_policies_make,
 };
 
-static struct config_item_type stp_policies_type = {
+static const struct config_item_type stp_policies_type = {
.ct_group_ops   = _policies_group_ops,
.ct_owner   = THIS_MODULE,
 };
-- 
1.9.1



[PATCH] usb: gadget: configfs: make config_item_type const

2017-10-12 Thread Bhumika Goyal
This is a followup patch for:
https://patchwork.kernel.org/patch/649/ and
https://lkml.org/lkml/2017/10/11/375

Make config_item_type structures const as they are either passed to a
function having the argument as const or stored in the const "ci_type"
field of a config_item structure.

Done using Coccinelle.

Signed-off-by: Bhumika Goyal <bhumi...@gmail.com>
---
 drivers/usb/gadget/configfs.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/usb/gadget/configfs.c b/drivers/usb/gadget/configfs.c
index a22a892..c90a266 100644
--- a/drivers/usb/gadget/configfs.c
+++ b/drivers/usb/gadget/configfs.c
@@ -505,13 +505,13 @@ static ssize_t 
gadget_config_desc_bmAttributes_store(struct config_item *item,
NULL,
 };
 
-static struct config_item_type gadget_config_type = {
+static const struct config_item_type gadget_config_type = {
.ct_item_ops= _config_item_ops,
.ct_attrs   = gadget_config_attrs,
.ct_owner   = THIS_MODULE,
 };
 
-static struct config_item_type gadget_root_type = {
+static const struct config_item_type gadget_root_type = {
.ct_item_ops= _root_item_ops,
.ct_attrs   = gadget_root_attrs,
.ct_owner   = THIS_MODULE,
@@ -593,7 +593,7 @@ static void function_drop(
.drop_item  = _drop,
 };
 
-static struct config_item_type functions_type = {
+static const struct config_item_type functions_type = {
.ct_group_ops   = _ops,
.ct_owner   = THIS_MODULE,
 };
@@ -694,7 +694,7 @@ static void config_desc_drop(
.drop_item  = _desc_drop,
 };
 
-static struct config_item_type config_desc_type = {
+static const struct config_item_type config_desc_type = {
.ct_group_ops   = _desc_ops,
.ct_owner   = THIS_MODULE,
 };
@@ -1475,7 +1475,7 @@ static void gadgets_drop(struct config_group *group, 
struct config_item *item)
.drop_item  = _drop,
 };
 
-static struct config_item_type gadgets_type = {
+static const struct config_item_type gadgets_type = {
.ct_group_ops   = _ops,
.ct_owner   = THIS_MODULE,
 };
-- 
1.9.1



[PATCH] dlm: make config_item_type const

2017-10-12 Thread Bhumika Goyal
This is a followup patch for:
https://patchwork.kernel.org/patch/649/ and
https://lkml.org/lkml/2017/10/11/375

Make config_item_type structures const as they are either passed to a
function having the argument as const or stored in the const "ci_type"
field of a config_item structure.

Done using Coccinelle.

Signed-off-by: Bhumika Goyal <bhumi...@gmail.com>
---
 fs/dlm/config.c | 16 
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/fs/dlm/config.c b/fs/dlm/config.c
index 7211e82..1270551 100644
--- a/fs/dlm/config.c
+++ b/fs/dlm/config.c
@@ -282,44 +282,44 @@ struct dlm_node {
.release = release_node,
 };
 
-static struct config_item_type clusters_type = {
+static const struct config_item_type clusters_type = {
.ct_group_ops = _ops,
.ct_owner = THIS_MODULE,
 };
 
-static struct config_item_type cluster_type = {
+static const struct config_item_type cluster_type = {
.ct_item_ops = _ops,
.ct_attrs = cluster_attrs,
.ct_owner = THIS_MODULE,
 };
 
-static struct config_item_type spaces_type = {
+static const struct config_item_type spaces_type = {
.ct_group_ops = _ops,
.ct_owner = THIS_MODULE,
 };
 
-static struct config_item_type space_type = {
+static const struct config_item_type space_type = {
.ct_item_ops = _ops,
.ct_owner = THIS_MODULE,
 };
 
-static struct config_item_type comms_type = {
+static const struct config_item_type comms_type = {
.ct_group_ops = _ops,
.ct_owner = THIS_MODULE,
 };
 
-static struct config_item_type comm_type = {
+static const struct config_item_type comm_type = {
.ct_item_ops = _ops,
.ct_attrs = comm_attrs,
.ct_owner = THIS_MODULE,
 };
 
-static struct config_item_type nodes_type = {
+static const struct config_item_type nodes_type = {
.ct_group_ops = _ops,
.ct_owner = THIS_MODULE,
 };
 
-static struct config_item_type node_type = {
+static const struct config_item_type node_type = {
.ct_item_ops = _ops,
.ct_attrs = node_attrs,
.ct_owner = THIS_MODULE,
-- 
1.9.1



[PATCH] configfs: make config_item_type const

2017-10-12 Thread Bhumika Goyal
This is a followup patch for:
https://patchwork.kernel.org/patch/649/ and
https://lkml.org/lkml/2017/10/11/375

Make config_item_type structures const as they are either passed to a
function having the argument as const or stored in the const "ci_type"
field of a config_item structure.

Done using Coccinelle.

Signed-off-by: Bhumika Goyal <bhumi...@gmail.com>
---
 samples/configfs/configfs_sample.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/samples/configfs/configfs_sample.c 
b/samples/configfs/configfs_sample.c
index 1ea3311..004a4e2 100644
--- a/samples/configfs/configfs_sample.c
+++ b/samples/configfs/configfs_sample.c
@@ -115,7 +115,7 @@ static ssize_t childless_description_show(struct 
config_item *item, char *page)
NULL,
 };
 
-static struct config_item_type childless_type = {
+static const struct config_item_type childless_type = {
.ct_attrs   = childless_attrs,
.ct_owner   = THIS_MODULE,
 };
@@ -193,7 +193,7 @@ static void simple_child_release(struct config_item *item)
.release= simple_child_release,
 };
 
-static struct config_item_type simple_child_type = {
+static const struct config_item_type simple_child_type = {
.ct_item_ops= _child_item_ops,
.ct_attrs   = simple_child_attrs,
.ct_owner   = THIS_MODULE,
@@ -261,7 +261,7 @@ static void simple_children_release(struct config_item 
*item)
.make_item  = simple_children_make_item,
 };
 
-static struct config_item_type simple_children_type = {
+static const struct config_item_type simple_children_type = {
.ct_item_ops= _children_item_ops,
.ct_group_ops   = _children_group_ops,
.ct_attrs   = simple_children_attrs,
@@ -331,7 +331,7 @@ static ssize_t group_children_description_show(struct 
config_item *item,
.make_group = group_children_make_group,
 };
 
-static struct config_item_type group_children_type = {
+static const struct config_item_type group_children_type = {
.ct_group_ops   = _children_group_ops,
.ct_attrs   = group_children_attrs,
.ct_owner   = THIS_MODULE,
-- 
1.9.1



[PATCH] target/iscsi: make config_item_type const

2017-10-12 Thread Bhumika Goyal
This is a followup patch for:
https://patchwork.kernel.org/patch/649/

Make config_item_type structures const as they are only passed to the
functions having the argument as const. Make the declaration const too.

Signed-off-by: Bhumika Goyal <bhumi...@gmail.com>
---
 drivers/target/iscsi/iscsi_target_stat.c | 12 ++--
 include/target/iscsi/iscsi_target_stat.h | 12 ++--
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/target/iscsi/iscsi_target_stat.c 
b/drivers/target/iscsi/iscsi_target_stat.c
index 411cb26..df0a398 100644
--- a/drivers/target/iscsi/iscsi_target_stat.c
+++ b/drivers/target/iscsi/iscsi_target_stat.c
@@ -187,7 +187,7 @@ static ssize_t iscsi_stat_instance_version_show(struct 
config_item *item,
NULL,
 };
 
-struct config_item_type iscsi_stat_instance_cit = {
+const struct config_item_type iscsi_stat_instance_cit = {
.ct_attrs   = iscsi_stat_instance_attrs,
.ct_owner   = THIS_MODULE,
 };
@@ -249,7 +249,7 @@ static ssize_t 
iscsi_stat_sess_err_format_errors_show(struct config_item *item,
NULL,
 };
 
-struct config_item_type iscsi_stat_sess_err_cit = {
+const struct config_item_type iscsi_stat_sess_err_cit = {
.ct_attrs   = iscsi_stat_sess_err_attrs,
.ct_owner   = THIS_MODULE,
 };
@@ -390,7 +390,7 @@ static ssize_t 
iscsi_stat_tgt_attr_fail_intr_addr_show(struct config_item *item,
NULL,
 };
 
-struct config_item_type iscsi_stat_tgt_attr_cit = {
+const struct config_item_type iscsi_stat_tgt_attr_cit = {
.ct_attrs   = iscsi_stat_tgt_attr_attrs,
.ct_owner   = THIS_MODULE,
 };
@@ -522,7 +522,7 @@ static ssize_t iscsi_stat_login_negotiate_fails_show(struct 
config_item *item,
NULL,
 };
 
-struct config_item_type iscsi_stat_login_cit = {
+const struct config_item_type iscsi_stat_login_cit = {
.ct_attrs   = iscsi_stat_login_stats_attrs,
.ct_owner   = THIS_MODULE,
 };
@@ -579,7 +579,7 @@ static ssize_t 
iscsi_stat_logout_abnormal_logouts_show(struct config_item *item,
NULL,
 };
 
-struct config_item_type iscsi_stat_logout_cit = {
+const struct config_item_type iscsi_stat_logout_cit = {
.ct_attrs   = iscsi_stat_logout_stats_attrs,
.ct_owner   = THIS_MODULE,
 };
@@ -801,7 +801,7 @@ static ssize_t iscsi_stat_sess_conn_timeout_errors_show(
NULL,
 };
 
-struct config_item_type iscsi_stat_sess_cit = {
+const struct config_item_type iscsi_stat_sess_cit = {
.ct_attrs   = iscsi_stat_sess_stats_attrs,
.ct_owner   = THIS_MODULE,
 };
diff --git a/include/target/iscsi/iscsi_target_stat.h 
b/include/target/iscsi/iscsi_target_stat.h
index c27dd47..36e9c9a 100644
--- a/include/target/iscsi/iscsi_target_stat.h
+++ b/include/target/iscsi/iscsi_target_stat.h
@@ -8,16 +8,16 @@
 /*
  * For struct iscsi_tiqn->tiqn_wwn default groups
  */
-extern struct config_item_type iscsi_stat_instance_cit;
-extern struct config_item_type iscsi_stat_sess_err_cit;
-extern struct config_item_type iscsi_stat_tgt_attr_cit;
-extern struct config_item_type iscsi_stat_login_cit;
-extern struct config_item_type iscsi_stat_logout_cit;
+extern const struct config_item_type iscsi_stat_instance_cit;
+extern const struct config_item_type iscsi_stat_sess_err_cit;
+extern const struct config_item_type iscsi_stat_tgt_attr_cit;
+extern const struct config_item_type iscsi_stat_login_cit;
+extern const struct config_item_type iscsi_stat_logout_cit;
 
 /*
  * For struct iscsi_session->se_sess default groups
  */
-extern struct config_item_type iscsi_stat_sess_cit;
+extern const struct config_item_type iscsi_stat_sess_cit;
 
 /* iSCSI session error types */
 #define ISCSI_SESS_ERR_UNKNOWN 0
-- 
1.9.1



<    1   2   3   4   5   6   7   8   9   10   >