[PATCH] platform/x86: wmi: declare device_type structure as constant

2018-10-27 Thread Bhumika Goyal
The only usage of device_type structure is getting stored as
a reference in the type field of device structure. This type
field is declared const. Therefore, the device_type structure
can never be modified and can be declared as const.

Signed-off-by: Bhumika Goyal 
---
 drivers/platform/x86/wmi.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c
index 04791ea5d97b..bea35be68706 100644
--- a/drivers/platform/x86/wmi.c
+++ b/drivers/platform/x86/wmi.c
@@ -987,19 +987,19 @@ static struct bus_type wmi_bus_type = {
.remove = wmi_dev_remove,
 };
 
-static struct device_type wmi_type_event = {
+static const struct device_type wmi_type_event = {
.name = "event",
.groups = wmi_event_groups,
.release = wmi_dev_release,
 };
 
-static struct device_type wmi_type_method = {
+static const struct device_type wmi_type_method = {
.name = "method",
.groups = wmi_method_groups,
.release = wmi_dev_release,
 };
 
-static struct device_type wmi_type_data = {
+static const struct device_type wmi_type_data = {
.name = "data",
.groups = wmi_data_groups,
.release = wmi_dev_release,
-- 
2.14.5



[PATCH 0/2] ARM: OMAP2+: CM: make some structures, function arguments and pointers as const

2017-11-06 Thread Bhumika Goyal
Make some pointers and function arguments as const. After this change,
make the structures of type cm_ll_data as const.

Bhumika Goyal (2):
  ARM: OMAP2+: CM: make some pointers and function arguments as const
  ARM: OMAP2+: CM: make cm_ll_data structures as const

 arch/arm/mach-omap2/cm.h | 4 ++--
 arch/arm/mach-omap2/cm2xxx.c | 2 +-
 arch/arm/mach-omap2/cm33xx.c | 2 +-
 arch/arm/mach-omap2/cm3xxx.c | 2 +-
 arch/arm/mach-omap2/cm_common.c  | 6 +++---
 arch/arm/mach-omap2/cminst44xx.c | 2 +-
 6 files changed, 9 insertions(+), 9 deletions(-)

-- 
1.9.1



[PATCH 2/2] ARM: OMAP2+: CM: make cm_ll_data structures as const

2017-11-06 Thread Bhumika Goyal
Make these const as they are only getting passed to the functions
cm_register and cm_unregister having the arguments as const.

Signed-off-by: Bhumika Goyal 
---
 arch/arm/mach-omap2/cm2xxx.c | 2 +-
 arch/arm/mach-omap2/cm33xx.c | 2 +-
 arch/arm/mach-omap2/cm3xxx.c | 2 +-
 arch/arm/mach-omap2/cminst44xx.c | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/arm/mach-omap2/cm2xxx.c b/arch/arm/mach-omap2/cm2xxx.c
index cd90b4c..d5b87f4 100644
--- a/arch/arm/mach-omap2/cm2xxx.c
+++ b/arch/arm/mach-omap2/cm2xxx.c
@@ -385,7 +385,7 @@ void omap2xxx_cm_set_mod_dividers(u32 mpu, u32 dsp, u32 
gfx, u32 core, u32 mdm)
  *
  */
 
-static struct cm_ll_data omap2xxx_cm_ll_data = {
+static const struct cm_ll_data omap2xxx_cm_ll_data = {
.split_idlest_reg   = &omap2xxx_cm_split_idlest_reg,
.wait_module_ready  = &omap2xxx_cm_wait_module_ready,
 };
diff --git a/arch/arm/mach-omap2/cm33xx.c b/arch/arm/mach-omap2/cm33xx.c
index a9e08d8..0c9750f 100644
--- a/arch/arm/mach-omap2/cm33xx.c
+++ b/arch/arm/mach-omap2/cm33xx.c
@@ -342,7 +342,7 @@ struct clkdm_ops am33xx_clkdm_operations = {
.clkdm_clk_disable  = am33xx_clkdm_clk_disable,
 };
 
-static struct cm_ll_data am33xx_cm_ll_data = {
+static const struct cm_ll_data am33xx_cm_ll_data = {
.wait_module_ready  = &am33xx_cm_wait_module_ready,
.wait_module_idle   = &am33xx_cm_wait_module_idle,
.module_enable  = &am33xx_cm_module_enable,
diff --git a/arch/arm/mach-omap2/cm3xxx.c b/arch/arm/mach-omap2/cm3xxx.c
index 961bc47..ec580fd 100644
--- a/arch/arm/mach-omap2/cm3xxx.c
+++ b/arch/arm/mach-omap2/cm3xxx.c
@@ -662,7 +662,7 @@ void omap3_cm_save_scratchpad_contents(u32 *ptr)
  *
  */
 
-static struct cm_ll_data omap3xxx_cm_ll_data = {
+static const struct cm_ll_data omap3xxx_cm_ll_data = {
.split_idlest_reg   = &omap3xxx_cm_split_idlest_reg,
.wait_module_ready  = &omap3xxx_cm_wait_module_ready,
 };
diff --git a/arch/arm/mach-omap2/cminst44xx.c b/arch/arm/mach-omap2/cminst44xx.c
index 8774e98..2e2274f 100644
--- a/arch/arm/mach-omap2/cminst44xx.c
+++ b/arch/arm/mach-omap2/cminst44xx.c
@@ -512,7 +512,7 @@ struct clkdm_ops am43xx_clkdm_operations = {
.clkdm_xlate_address= omap4_clkdm_xlate_address,
 };
 
-static struct cm_ll_data omap4xxx_cm_ll_data = {
+static const struct cm_ll_data omap4xxx_cm_ll_data = {
.wait_module_ready  = &omap4_cminst_wait_module_ready,
.wait_module_idle   = &omap4_cminst_wait_module_idle,
.module_enable  = &omap4_cminst_module_enable,
-- 
1.9.1



[PATCH 1/2] ARM: OMAP2+: CM: make some pointers and function arguments as const

2017-11-06 Thread Bhumika Goyal
Make the pointer cm_ll_data of type cm_ll_data as const as it does not
modify the fields of the structure it points too.
After this change, make the argument of cm_register function as const as
it is used to initialise cm_ll_data or used inside an if condition.
Make the pointer argument of cm_unregister function as const as it is only
used inside an if condition.
Add const to the function prototypes too.

Signed-off-by: Bhumika Goyal 
---
 arch/arm/mach-omap2/cm.h| 4 ++--
 arch/arm/mach-omap2/cm_common.c | 6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/arm/mach-omap2/cm.h b/arch/arm/mach-omap2/cm.h
index e833984..7b66e17 100644
--- a/arch/arm/mach-omap2/cm.h
+++ b/arch/arm/mach-omap2/cm.h
@@ -72,8 +72,8 @@ int omap_cm_wait_module_idle(u8 part, s16 prcm_mod, u16 
idlest_reg,
 u8 idlest_shift);
 int omap_cm_module_enable(u8 mode, u8 part, u16 inst, u16 clkctrl_offs);
 int omap_cm_module_disable(u8 part, u16 inst, u16 clkctrl_offs);
-extern int cm_register(struct cm_ll_data *cld);
-extern int cm_unregister(struct cm_ll_data *cld);
+extern int cm_register(const struct cm_ll_data *cld);
+extern int cm_unregister(const struct cm_ll_data *cld);
 int omap_cm_init(void);
 int omap2_cm_base_init(void);
 
diff --git a/arch/arm/mach-omap2/cm_common.c b/arch/arm/mach-omap2/cm_common.c
index 83c6fa7..adf8858 100644
--- a/arch/arm/mach-omap2/cm_common.c
+++ b/arch/arm/mach-omap2/cm_common.c
@@ -29,7 +29,7 @@
  * common CM functions
  */
 static struct cm_ll_data null_cm_ll_data;
-static struct cm_ll_data *cm_ll_data = &null_cm_ll_data;
+static const struct cm_ll_data *cm_ll_data = &null_cm_ll_data;
 
 /* cm_base: base virtual address of the CM IP block */
 struct omap_domain_base cm_base;
@@ -189,7 +189,7 @@ int omap_cm_module_disable(u8 part, u16 inst, u16 
clkctrl_offs)
  * is NULL, or -EEXIST if cm_register() has already been called
  * without an intervening cm_unregister().
  */
-int cm_register(struct cm_ll_data *cld)
+int cm_register(const struct cm_ll_data *cld)
 {
if (!cld)
return -EINVAL;
@@ -213,7 +213,7 @@ int cm_register(struct cm_ll_data *cld)
  * -EINVAL if @cld is NULL or if @cld does not match the struct
  * cm_ll_data * previously registered by cm_register().
  */
-int cm_unregister(struct cm_ll_data *cld)
+int cm_unregister(const struct cm_ll_data *cld)
 {
if (!cld || cm_ll_data != cld)
return -EINVAL;
-- 
1.9.1



[PATCH 2/2] ACPI / PMIC: make intel_pmic_opregion_data structures const

2017-11-03 Thread Bhumika Goyal
Make these structures as const as they are only passed to the function
intel_pmic_install_opregion_handler having the argument as const.

Signed-off-by: Bhumika Goyal 
---
 drivers/acpi/pmic/intel_pmic_bxtwc.c  | 2 +-
 drivers/acpi/pmic/intel_pmic_chtwc.c  | 2 +-
 drivers/acpi/pmic/intel_pmic_crc.c| 2 +-
 drivers/acpi/pmic/intel_pmic_xpower.c | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/acpi/pmic/intel_pmic_bxtwc.c 
b/drivers/acpi/pmic/intel_pmic_bxtwc.c
index 90011aa..fd698c6 100644
--- a/drivers/acpi/pmic/intel_pmic_bxtwc.c
+++ b/drivers/acpi/pmic/intel_pmic_bxtwc.c
@@ -377,7 +377,7 @@ static int intel_bxtwc_pmic_get_raw_temp(struct regmap 
*regmap, int reg)
return regmap_update_bits(regmap, reg, mask, val);
 }
 
-static struct intel_pmic_opregion_data intel_bxtwc_pmic_opregion_data = {
+static const struct intel_pmic_opregion_data intel_bxtwc_pmic_opregion_data = {
.get_power  = intel_bxtwc_pmic_get_power,
.update_power   = intel_bxtwc_pmic_update_power,
.get_raw_temp   = intel_bxtwc_pmic_get_raw_temp,
diff --git a/drivers/acpi/pmic/intel_pmic_chtwc.c 
b/drivers/acpi/pmic/intel_pmic_chtwc.c
index 85636d7..240359b 100644
--- a/drivers/acpi/pmic/intel_pmic_chtwc.c
+++ b/drivers/acpi/pmic/intel_pmic_chtwc.c
@@ -243,7 +243,7 @@ static int intel_cht_wc_pmic_update_power(struct regmap 
*regmap, int reg,
  * The thermal table and ops are empty, we do not support the Thermal opregion
  * (DPTF) due to lacking documentation.
  */
-static struct intel_pmic_opregion_data intel_cht_wc_pmic_opregion_data = {
+static const struct intel_pmic_opregion_data intel_cht_wc_pmic_opregion_data = 
{
.get_power  = intel_cht_wc_pmic_get_power,
.update_power   = intel_cht_wc_pmic_update_power,
.power_table= power_table,
diff --git a/drivers/acpi/pmic/intel_pmic_crc.c 
b/drivers/acpi/pmic/intel_pmic_crc.c
index d7f1761..cad1fe1 100644
--- a/drivers/acpi/pmic/intel_pmic_crc.c
+++ b/drivers/acpi/pmic/intel_pmic_crc.c
@@ -174,7 +174,7 @@ static int intel_crc_pmic_update_policy(struct regmap 
*regmap,
return 0;
 }
 
-static struct intel_pmic_opregion_data intel_crc_pmic_opregion_data = {
+static const struct intel_pmic_opregion_data intel_crc_pmic_opregion_data = {
.get_power  = intel_crc_pmic_get_power,
.update_power   = intel_crc_pmic_update_power,
.get_raw_temp   = intel_crc_pmic_get_raw_temp,
diff --git a/drivers/acpi/pmic/intel_pmic_xpower.c 
b/drivers/acpi/pmic/intel_pmic_xpower.c
index 6c99d3f..96718af 100644
--- a/drivers/acpi/pmic/intel_pmic_xpower.c
+++ b/drivers/acpi/pmic/intel_pmic_xpower.c
@@ -231,7 +231,7 @@ static int intel_xpower_pmic_get_raw_temp(struct regmap 
*regmap, int reg)
return ret;
 }
 
-static struct intel_pmic_opregion_data intel_xpower_pmic_opregion_data = {
+static const struct intel_pmic_opregion_data intel_xpower_pmic_opregion_data = 
{
.get_power = intel_xpower_pmic_get_power,
.update_power = intel_xpower_pmic_update_power,
.get_raw_temp = intel_xpower_pmic_get_raw_temp,
-- 
1.9.1



[PATCH 0/2] ACPI / PMIC: make some structures and function argument as const

2017-11-03 Thread Bhumika Goyal
Make some structures and the argument of the function 
intel_pmic_install_opregion_handler as const. After this change,
make the structures of type intel_pmic_opregion_data as const. 

Bhumika Goyal (2):
  ACPI / PMIC: Make some pointers, structure field and function argument
as const
  ACPI / PMIC: make intel_pmic_opregion_data structures const

 drivers/acpi/pmic/intel_pmic.c| 10 +-
 drivers/acpi/pmic/intel_pmic.h|  4 +++-
 drivers/acpi/pmic/intel_pmic_bxtwc.c  |  2 +-
 drivers/acpi/pmic/intel_pmic_chtwc.c  |  2 +-
 drivers/acpi/pmic/intel_pmic_crc.c|  2 +-
 drivers/acpi/pmic/intel_pmic_xpower.c |  2 +-
 6 files changed, 12 insertions(+), 10 deletions(-)

-- 
1.9.1



[PATCH 1/2] ACPI / PMIC: Make some pointers, structure field and function argument as const

2017-11-03 Thread Bhumika Goyal
Make some pointers of type intel_pmic_opregion_data as const as they
do not modify the fields of the structure they point too.
After this change, make the data field of intel_pmic_opregion
structure const as this data field is used for initializing the above pointers
that are now const.
Finally, make the struct intel_pmic_opregion_data * argument of the
function intel_pmic_install_opregion_handler as const as it is only
getting stored in the data field of the intel_pmic_opregion
structure which is now made const.

Signed-off-by: Bhumika Goyal 
---
 drivers/acpi/pmic/intel_pmic.c | 10 +-
 drivers/acpi/pmic/intel_pmic.h |  4 +++-
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/acpi/pmic/intel_pmic.c b/drivers/acpi/pmic/intel_pmic.c
index ca18e0d..553fa4f 100644
--- a/drivers/acpi/pmic/intel_pmic.c
+++ b/drivers/acpi/pmic/intel_pmic.c
@@ -32,7 +32,7 @@ struct intel_pmic_opregion {
struct mutex lock;
struct acpi_lpat_conversion_table *lpat_table;
struct regmap *regmap;
-   struct intel_pmic_opregion_data *data;
+   const struct intel_pmic_opregion_data *data;
struct intel_pmic_regs_handler_ctx ctx;
 };
 
@@ -58,7 +58,7 @@ static acpi_status intel_pmic_power_handler(u32 function,
 {
struct intel_pmic_opregion *opregion = region_context;
struct regmap *regmap = opregion->regmap;
-   struct intel_pmic_opregion_data *d = opregion->data;
+   const struct intel_pmic_opregion_data *d = opregion->data;
int reg, bit, result;
 
if (bits != 32 || !value64)
@@ -140,7 +140,7 @@ static int pmic_thermal_aux(struct intel_pmic_opregion 
*opregion, int reg,
 static int pmic_thermal_pen(struct intel_pmic_opregion *opregion, int reg,
int bit, u32 function, u64 *value)
 {
-   struct intel_pmic_opregion_data *d = opregion->data;
+   const struct intel_pmic_opregion_data *d = opregion->data;
struct regmap *regmap = opregion->regmap;
 
if (!d->get_policy || !d->update_policy)
@@ -176,7 +176,7 @@ static acpi_status intel_pmic_thermal_handler(u32 function,
void *handler_context, void *region_context)
 {
struct intel_pmic_opregion *opregion = region_context;
-   struct intel_pmic_opregion_data *d = opregion->data;
+   const struct intel_pmic_opregion_data *d = opregion->data;
int reg, bit, result;
 
if (bits != 32 || !value64)
@@ -255,7 +255,7 @@ static acpi_status intel_pmic_regs_handler(u32 function,
 
 int intel_pmic_install_opregion_handler(struct device *dev, acpi_handle handle,
struct regmap *regmap,
-   struct intel_pmic_opregion_data *d)
+   const struct intel_pmic_opregion_data 
*d)
 {
acpi_status status;
struct intel_pmic_opregion *opregion;
diff --git a/drivers/acpi/pmic/intel_pmic.h b/drivers/acpi/pmic/intel_pmic.h
index e8bfa7b..754b7bd 100644
--- a/drivers/acpi/pmic/intel_pmic.h
+++ b/drivers/acpi/pmic/intel_pmic.h
@@ -20,6 +20,8 @@ struct intel_pmic_opregion_data {
int thermal_table_count;
 };
 
-int intel_pmic_install_opregion_handler(struct device *dev, acpi_handle 
handle, struct regmap *regmap, struct intel_pmic_opregion_data *d);
+int intel_pmic_install_opregion_handler(struct device *dev, acpi_handle handle,
+   struct regmap *regmap,
+   const struct intel_pmic_opregion_data 
*d);
 
 #endif
-- 
1.9.1



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

2017-10-20 Thread Bhumika Goyal
On Thu, Oct 19, 2017 at 5:05 PM, Laurent Pinchart
 wrote:
> Hi Christoph,
>
> On Thursday, 19 October 2017 17:06:57 EEST Christoph Hellwig wrote:
>> > Now we have 9 const instances of the config_item_type structure that are
>> > identical, with only the .ct_owner field set. Should they be all merged
>> > into a single structure ?
>>
>> I think that's a good idea.
>>
>> But I'm about to slurp up this whole series into my tree, how about making
>> that an incremental patch?
>
> I'm fine with that.
>
> Bhumika, would you like to submit an incremental patch, or should I do it ?
>

I will submit a patch for merging these structures.
But should I make a separate patch for this particular change or send
a v3 for the whole series?

Thanks,
Bhumika

> --
> Regards,
>
> Laurent Pinchart
>


[tip:x86/cleanups] x86/events/amd/iommu: Make iommu_pmu const and __initconst

2017-10-19 Thread tip-bot for Bhumika Goyal
Commit-ID:  642e641cbea57e559720b9df09889ffcf525cf04
Gitweb: https://git.kernel.org/tip/642e641cbea57e559720b9df09889ffcf525cf04
Author: Bhumika Goyal 
AuthorDate: Tue, 19 Sep 2017 16:40:43 +0530
Committer:  Thomas Gleixner 
CommitDate: Thu, 19 Oct 2017 16:15:47 +0200

x86/events/amd/iommu: Make iommu_pmu const and __initconst

iommu_pmu is only used as source for a copy operation in the init code
path.

Mark it const and __initconst.

Signed-off-by: Bhumika Goyal 
Signed-off-by: Thomas Gleixner 
Cc: julia.law...@lip6.fr
Link: 
https://lkml.kernel.org/r/1505819443-670-1-git-send-email-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 @@ const struct attribute_group *amd_iommu_attr_groups[] = {
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,


[PATCH 1/2] cpufreq: arm_big_little: make function arguments and structure pointer const

2017-10-19 Thread Bhumika Goyal
Make the arguments of functions bL_cpufreq_{register/unregister} as
const as the ops pointer does not modify the fields of the
cpufreq_arm_bL_ops structure it points to. The pointer arm_bL_ops is
also getting initialized with ops but the pointer does not modify the
fields. So, make the function argument and the structure pointer const.
Add const to function prototypes too.

Signed-off-by: Bhumika Goyal 
---
 drivers/cpufreq/arm_big_little.c | 6 +++---
 drivers/cpufreq/arm_big_little.h | 4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/cpufreq/arm_big_little.c b/drivers/cpufreq/arm_big_little.c
index 0c41ab3..65ec5f0 100644
--- a/drivers/cpufreq/arm_big_little.c
+++ b/drivers/cpufreq/arm_big_little.c
@@ -57,7 +57,7 @@
 #define VIRT_FREQ(cluster, freq)((cluster == A7_CLUSTER) ? freq >> 1 : 
freq)
 
 static struct thermal_cooling_device *cdev[MAX_CLUSTERS];
-static struct cpufreq_arm_bL_ops *arm_bL_ops;
+static const struct cpufreq_arm_bL_ops *arm_bL_ops;
 static struct clk *clk[MAX_CLUSTERS];
 static struct cpufreq_frequency_table *freq_table[MAX_CLUSTERS + 1];
 static atomic_t cluster_usage[MAX_CLUSTERS + 1];
@@ -617,7 +617,7 @@ static int __bLs_unregister_notifier(void)
 static int __bLs_unregister_notifier(void) { return 0; }
 #endif
 
-int bL_cpufreq_register(struct cpufreq_arm_bL_ops *ops)
+int bL_cpufreq_register(const struct cpufreq_arm_bL_ops *ops)
 {
int ret, i;
 
@@ -661,7 +661,7 @@ int bL_cpufreq_register(struct cpufreq_arm_bL_ops *ops)
 }
 EXPORT_SYMBOL_GPL(bL_cpufreq_register);
 
-void bL_cpufreq_unregister(struct cpufreq_arm_bL_ops *ops)
+void bL_cpufreq_unregister(const struct cpufreq_arm_bL_ops *ops)
 {
if (arm_bL_ops != ops) {
pr_err("%s: Registered with: %s, can't unregister, exiting\n",
diff --git a/drivers/cpufreq/arm_big_little.h b/drivers/cpufreq/arm_big_little.h
index 184d7c3..88a176e 100644
--- a/drivers/cpufreq/arm_big_little.h
+++ b/drivers/cpufreq/arm_big_little.h
@@ -37,7 +37,7 @@ struct cpufreq_arm_bL_ops {
void (*free_opp_table)(const struct cpumask *cpumask);
 };
 
-int bL_cpufreq_register(struct cpufreq_arm_bL_ops *ops);
-void bL_cpufreq_unregister(struct cpufreq_arm_bL_ops *ops);
+int bL_cpufreq_register(const struct cpufreq_arm_bL_ops *ops);
+void bL_cpufreq_unregister(const struct cpufreq_arm_bL_ops *ops);
 
 #endif /* CPUFREQ_ARM_BIG_LITTLE_H */
-- 
1.9.1



[PATCH 2/2] cpufreq: arm_big_little: make cpufreq_arm_bL_ops structures const

2017-10-19 Thread Bhumika Goyal
Make these const as they are only getting passed to the functions
bL_cpufreq_{register/unregister} having the arguments as const.

Signed-off-by: Bhumika Goyal 
---
 drivers/cpufreq/arm_big_little_dt.c| 2 +-
 drivers/cpufreq/scpi-cpufreq.c | 2 +-
 drivers/cpufreq/vexpress-spc-cpufreq.c | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/cpufreq/arm_big_little_dt.c 
b/drivers/cpufreq/arm_big_little_dt.c
index 39b3f51..b944f29 100644
--- a/drivers/cpufreq/arm_big_little_dt.c
+++ b/drivers/cpufreq/arm_big_little_dt.c
@@ -61,7 +61,7 @@ static int dt_get_transition_latency(struct device *cpu_dev)
return transition_latency;
 }
 
-static struct cpufreq_arm_bL_ops dt_bL_ops = {
+static const struct cpufreq_arm_bL_ops dt_bL_ops = {
.name   = "dt-bl",
.get_transition_latency = dt_get_transition_latency,
.init_opp_table = dev_pm_opp_of_cpumask_add_table,
diff --git a/drivers/cpufreq/scpi-cpufreq.c b/drivers/cpufreq/scpi-cpufreq.c
index 8de2364..05d2990 100644
--- a/drivers/cpufreq/scpi-cpufreq.c
+++ b/drivers/cpufreq/scpi-cpufreq.c
@@ -53,7 +53,7 @@ static int scpi_init_opp_table(const struct cpumask *cpumask)
return ret;
 }
 
-static struct cpufreq_arm_bL_ops scpi_cpufreq_ops = {
+static const struct cpufreq_arm_bL_ops scpi_cpufreq_ops = {
.name   = "scpi",
.get_transition_latency = scpi_get_transition_latency,
.init_opp_table = scpi_init_opp_table,
diff --git a/drivers/cpufreq/vexpress-spc-cpufreq.c 
b/drivers/cpufreq/vexpress-spc-cpufreq.c
index 87e5bdc..5323728 100644
--- a/drivers/cpufreq/vexpress-spc-cpufreq.c
+++ b/drivers/cpufreq/vexpress-spc-cpufreq.c
@@ -42,7 +42,7 @@ static int ve_spc_get_transition_latency(struct device 
*cpu_dev)
return 100; /* 1 ms */
 }
 
-static struct cpufreq_arm_bL_ops ve_spc_cpufreq_ops = {
+static const struct cpufreq_arm_bL_ops ve_spc_cpufreq_ops = {
.name   = "vexpress-spc",
.get_transition_latency = ve_spc_get_transition_latency,
.init_opp_table = ve_spc_init_opp_table,
-- 
1.9.1



[PATCH 0/2] cpufreq: arm_big_little: make function arguments and structures const

2017-10-19 Thread Bhumika Goyal
Make some function arguments as const. After this change make the 
cpufreq_arm_bL_ops structures const.

Bhumika Goyal (2):
  cpufreq: arm_big_little: make function argument and structure const
  cpufreq: arm_big_little: make cpufreq_arm_bL_ops structures const

 drivers/cpufreq/arm_big_little.c   | 6 +++---
 drivers/cpufreq/arm_big_little.h   | 4 ++--
 drivers/cpufreq/arm_big_little_dt.c| 2 +-
 drivers/cpufreq/scpi-cpufreq.c | 2 +-
 drivers/cpufreq/vexpress-spc-cpufreq.c | 2 +-
 5 files changed, 8 insertions(+), 8 deletions(-)

-- 
1.9.1



[PATCH 1/4] sunrpc: make the function arg as const

2017-10-17 Thread Bhumika Goyal
Make the struct cache_detail *tmpl argument of the function
cache_create_net as const as it is only getting passed to kmemup having
the argument as const void *.
Add const to the prototype too.

Signed-off-by: Bhumika Goyal 
---
 include/linux/sunrpc/cache.h | 2 +-
 net/sunrpc/cache.c   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/linux/sunrpc/cache.h b/include/linux/sunrpc/cache.h
index 270bad0..40d2822 100644
--- a/include/linux/sunrpc/cache.h
+++ b/include/linux/sunrpc/cache.h
@@ -213,7 +213,7 @@ extern int cache_check(struct cache_detail *detail,
 extern int cache_register_net(struct cache_detail *cd, struct net *net);
 extern void cache_unregister_net(struct cache_detail *cd, struct net *net);
 
-extern struct cache_detail *cache_create_net(struct cache_detail *tmpl, struct 
net *net);
+extern struct cache_detail *cache_create_net(const struct cache_detail *tmpl, 
struct net *net);
 extern void cache_destroy_net(struct cache_detail *cd, struct net *net);
 
 extern void sunrpc_init_cache_detail(struct cache_detail *cd);
diff --git a/net/sunrpc/cache.c b/net/sunrpc/cache.c
index 79d55d9..e689438 100644
--- a/net/sunrpc/cache.c
+++ b/net/sunrpc/cache.c
@@ -1674,7 +1674,7 @@ void cache_unregister_net(struct cache_detail *cd, struct 
net *net)
 }
 EXPORT_SYMBOL_GPL(cache_unregister_net);
 
-struct cache_detail *cache_create_net(struct cache_detail *tmpl, struct net 
*net)
+struct cache_detail *cache_create_net(const struct cache_detail *tmpl, struct 
net *net)
 {
struct cache_detail *cd;
int i;
-- 
1.9.1



[PATCH 3/4] NFSD: make cache_detail structures const

2017-10-17 Thread Bhumika Goyal
Make these const as they are only getting passed to the function
cache_create_net having the argument as const.

Signed-off-by: Bhumika Goyal 
---
 fs/nfsd/export.c| 4 ++--
 fs/nfsd/nfs4idmap.c | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/fs/nfsd/export.c b/fs/nfsd/export.c
index 3bc08c3..06bb39c 100644
--- a/fs/nfsd/export.c
+++ b/fs/nfsd/export.c
@@ -231,7 +231,7 @@ static struct cache_head *expkey_alloc(void)
return NULL;
 }
 
-static struct cache_detail svc_expkey_cache_template = {
+static const struct cache_detail svc_expkey_cache_template = {
.owner  = THIS_MODULE,
.hash_size  = EXPKEY_HASHMAX,
.name   = "nfsd.fh",
@@ -747,7 +747,7 @@ static struct cache_head *svc_export_alloc(void)
return NULL;
 }
 
-static struct cache_detail svc_export_cache_template = {
+static const struct cache_detail svc_export_cache_template = {
.owner  = THIS_MODULE,
.hash_size  = EXPORT_HASHMAX,
.name   = "nfsd.export",
diff --git a/fs/nfsd/nfs4idmap.c b/fs/nfsd/nfs4idmap.c
index 6b9b6cc..a5bb765 100644
--- a/fs/nfsd/nfs4idmap.c
+++ b/fs/nfsd/nfs4idmap.c
@@ -178,7 +178,7 @@ struct ent {
 static struct ent *idtoname_update(struct cache_detail *, struct ent *,
   struct ent *);
 
-static struct cache_detail idtoname_cache_template = {
+static const struct cache_detail idtoname_cache_template = {
.owner  = THIS_MODULE,
.hash_size  = ENT_HASHMAX,
.name   = "nfs4.idtoname",
@@ -341,7 +341,7 @@ static struct ent *nametoid_update(struct cache_detail *, 
struct ent *,
   struct ent *);
 static int nametoid_parse(struct cache_detail *, char *, int);
 
-static struct cache_detail nametoid_cache_template = {
+static const struct cache_detail nametoid_cache_template = {
.owner  = THIS_MODULE,
.hash_size  = ENT_HASHMAX,
.name   = "nfs4.nametoid",
-- 
1.9.1



[PATCH 2/4] NFS: make cache_detail structure const

2017-10-17 Thread Bhumika Goyal
Make it const as it is only getting passed to the function
cache_create_net having the argument as const.

Signed-off-by: Bhumika Goyal 
---
 fs/nfs/dns_resolve.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/nfs/dns_resolve.c b/fs/nfs/dns_resolve.c
index d25f10f..477934a 100644
--- a/fs/nfs/dns_resolve.c
+++ b/fs/nfs/dns_resolve.c
@@ -353,7 +353,7 @@ ssize_t nfs_dns_resolve_name(struct net *net, char *name,
return ret;
 }
 
-static struct cache_detail nfs_dns_resolve_template = {
+static const struct cache_detail nfs_dns_resolve_template = {
.owner  = THIS_MODULE,
.hash_size  = NFS_DNS_HASHTBL_SIZE,
.name   = "dns_resolve",
-- 
1.9.1



[PATCH 4/4] SUNRPC: make cache_detail structures const

2017-10-17 Thread Bhumika Goyal
Make these const as they are only getting passed to the function
cache_create_net having the argument as const.

Signed-off-by: Bhumika Goyal 
---
 net/sunrpc/auth_gss/svcauth_gss.c | 4 ++--
 net/sunrpc/svcauth_unix.c | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/net/sunrpc/auth_gss/svcauth_gss.c 
b/net/sunrpc/auth_gss/svcauth_gss.c
index 7b1ee5a..e242cb4 100644
--- a/net/sunrpc/auth_gss/svcauth_gss.c
+++ b/net/sunrpc/auth_gss/svcauth_gss.c
@@ -264,7 +264,7 @@ static int rsi_parse(struct cache_detail *cd,
return status;
 }
 
-static struct cache_detail rsi_cache_template = {
+static const struct cache_detail rsi_cache_template = {
.owner  = THIS_MODULE,
.hash_size  = RSI_HASHMAX,
.name   = "auth.rpcsec.init",
@@ -524,7 +524,7 @@ static int rsc_parse(struct cache_detail *cd,
return status;
 }
 
-static struct cache_detail rsc_cache_template = {
+static const struct cache_detail rsc_cache_template = {
.owner  = THIS_MODULE,
.hash_size  = RSC_HASHMAX,
.name   = "auth.rpcsec.context",
diff --git a/net/sunrpc/svcauth_unix.c b/net/sunrpc/svcauth_unix.c
index f81eaa8..740b67d 100644
--- a/net/sunrpc/svcauth_unix.c
+++ b/net/sunrpc/svcauth_unix.c
@@ -569,7 +569,7 @@ static int unix_gid_show(struct seq_file *m,
return 0;
 }
 
-static struct cache_detail unix_gid_cache_template = {
+static const struct cache_detail unix_gid_cache_template = {
.owner  = THIS_MODULE,
.hash_size  = GID_HASHMAX,
.name   = "auth.unix.gid",
@@ -862,7 +862,7 @@ struct auth_ops svcauth_unix = {
.set_client = svcauth_unix_set_client,
 };
 
-static struct cache_detail ip_map_cache_template = {
+static const struct cache_detail ip_map_cache_template = {
.owner  = THIS_MODULE,
.hash_size  = IP_HASHMAX,
.name   = "auth.unix.ip",
-- 
1.9.1



[PATCH 0/4] make function arg and structures as const

2017-10-17 Thread Bhumika Goyal
Make the function argument as const. After thing change, make
the cache_detail structures as const.

Bhumika Goyal (4):
  sunrpc: make the function arg as const
  NFS: make cache_detail structures const
  NFSD: make cache_detail structures const
  SUNRPC: make cache_detail structures const

 fs/nfs/dns_resolve.c  | 2 +-
 fs/nfsd/export.c  | 4 ++--
 fs/nfsd/nfs4idmap.c   | 4 ++--
 include/linux/sunrpc/cache.h  | 2 +-
 net/sunrpc/auth_gss/svcauth_gss.c | 4 ++--
 net/sunrpc/cache.c| 2 +-
 net/sunrpc/svcauth_unix.c | 4 ++--
 7 files changed, 11 insertions(+), 11 deletions(-)

-- 
1.9.1



[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 
---
 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 
---
 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



[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 
---
 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 
---
 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 
---
* 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(&group->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 @@ int configfs_u

[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 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 
---
* 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= &acm_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= &ecm_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= &eem_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= &ffs_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= &hidg_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= &lb_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 +

[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 
---
* 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  = &device_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 = &device_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  = &trigger_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 = &trigger_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)
+

[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 
---
* 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   = &target_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= &target_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  = &target_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   = &target_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= &target_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_alu

[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 
---
* 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= &o2hb_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   = &o2hb_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= &o2nm_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   = &o2nm_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= &o2nm_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   = &o2nm_cluster_group_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 
---
* 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= &pci_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= &pci_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  = &pci_epf_drop,
 };
 
-static struct config_item_type pci_epf_group_type = {
+static const struct config_item_type pci_epf_group_type = {
.ct_group_ops   = &pci_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 
---
* 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= &gadget_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= &gadget_root_item_ops,
.ct_attrs   = gadget_root_attrs,
.ct_owner   = THIS_MODULE,
@@ -593,7 +593,7 @@ static void function_drop(
.drop_item  = &function_drop,
 };
 
-static struct config_item_type functions_type = {
+static const struct config_item_type functions_type = {
.ct_group_ops   = &functions_ops,
.ct_owner   = THIS_MODULE,
 };
@@ -694,7 +694,7 @@ static void config_desc_drop(
.drop_item  = &config_desc_drop,
 };
 
-static struct config_item_type config_desc_type = {
+static const struct config_item_type config_desc_type = {
.ct_group_ops   = &config_desc_ops,
.ct_owner   = THIS_MODULE,
 };
@@ -1476,7 +1476,7 @@ static void gadgets_drop(struct config_group *group, 
struct config_item *item)
.drop_item  = &gadgets_drop,
 };
 
-static struct config_item_type gadgets_type = {
+static const struct config_item_type gadgets_type = {
.ct_group_ops   = &gadgets_ops,
.ct_owner   = THIS_MODULE,
 };
-- 
1.9.1



[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 
---
* 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= &nvmet_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   = &nvmet_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= &nvmet_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= &nvmet_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= &nvmet_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   = &nvmet_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= &nvmet_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   = &nvmet_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= &nvmet_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   = &nvmet_ports_group_ops,
.ct_owner   = THIS_MODULE,
 };
@@ -940,7 +940,7 @@ static void nvmet_host_release(struct config_item

[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 
---
* 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 = &acpi_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 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 
---
* 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= &nullb_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   = &nullb_group_ops,
.ct_attrs   = nullb_group_attrs,
.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 
---
* 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= &cma_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= &cma_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   = &cma_subsys_group_ops,
.ct_owner   = THIS_MODULE,
 };
-- 
1.9.1



[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 
---
* 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= &stp_policy_node_item_ops,
.ct_group_ops   = &stp_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= &stp_policy_item_ops,
.ct_group_ops   = &stp_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   = &stp_policies_group_ops,
.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 
---
* 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 = &clusters_ops,
.ct_owner = THIS_MODULE,
 };
 
-static struct config_item_type cluster_type = {
+static const struct config_item_type cluster_type = {
.ct_item_ops = &cluster_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 = &spaces_ops,
.ct_owner = THIS_MODULE,
 };
 
-static struct config_item_type space_type = {
+static const struct config_item_type space_type = {
.ct_item_ops = &space_ops,
.ct_owner = THIS_MODULE,
 };
 
-static struct config_item_type comms_type = {
+static const struct config_item_type comms_type = {
.ct_group_ops = &comms_ops,
.ct_owner = THIS_MODULE,
 };
 
-static struct config_item_type comm_type = {
+static const struct config_item_type comm_type = {
.ct_item_ops = &comm_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 = &nodes_ops,
.ct_owner = THIS_MODULE,
 };
 
-static struct config_item_type node_type = {
+static const struct config_item_type node_type = {
.ct_item_ops = &node_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 
---
* 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= &netconsole_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   = &netconsole_subsys_group_ops,
.ct_owner   = THIS_MODULE,
 };
-- 
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 
---
* 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= &simple_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= &simple_children_item_ops,
.ct_group_ops   = &simple_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   = &group_children_group_ops,
.ct_attrs   = group_children_attrs,
.ct_owner   = THIS_MODULE,
-- 
1.9.1



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


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
 wrote:
> Bhumika Goyal  writes:
>
>> On Thu, Oct 12, 2017 at 2:12 PM, Bhumika Goyal  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


[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



[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 
---
 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(&da850_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 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 
---
 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 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 
---
 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 
---
 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



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  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 
>> ---
>>  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] 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 
---
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 
---
 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] powerpc/eeh: make eeh_ops structures _ro_after_init

2017-10-13 Thread Bhumika Goyal
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.

Signed-off-by: Bhumika Goyal 
---
 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] misc: 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

Make this const as it is only stored in the const "ci_type" field of a
config_item structure.

Signed-off-by: Bhumika Goyal 
---
It does not seem to be possible to compile this driver and it has not
received many patches in the last few years, so I wonder if it is still
useful to keep it in the kernel.

 drivers/misc/spear13xx_pcie_gadget.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/misc/spear13xx_pcie_gadget.c 
b/drivers/misc/spear13xx_pcie_gadget.c
index ee120dc..b9d2649 100644
--- a/drivers/misc/spear13xx_pcie_gadget.c
+++ b/drivers/misc/spear13xx_pcie_gadget.c
@@ -598,7 +598,7 @@ static ssize_t pcie_gadget_bar0_data_store(struct 
config_item *item,
NULL,
 };
 
-static struct config_item_type pcie_gadget_target_type = {
+static const struct config_item_type pcie_gadget_target_type = {
.ct_attrs   = pcie_gadget_target_attrs,
.ct_owner   = THIS_MODULE,
 };
-- 
1.9.1



Re: [PATCH] iio: make config_item_type const

2017-10-12 Thread Bhumika Goyal
On Thu, Oct 12, 2017 at 11:41 AM, Bhumika Goyal  wrote:
> 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.
>

Actually, this patch is dependent on the links given in the patch.
Therefore, this patch
won't be correct unless the patches in these links gets applied.

> Signed-off-by: Bhumika Goyal 
> ---
>  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  = &device_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 = &device_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  = &trigger_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 = &trigger_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
>


Re: [PATCH] ACPI: configfs: make config_item_type const

2017-10-12 Thread Bhumika Goyal
On Thu, Oct 12, 2017 at 12:02 PM, Bhumika Goyal  wrote:
> 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.
>

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.

> Signed-off-by: Bhumika Goyal 
> ---
>  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 = &acpi_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
>


Re: [PATCH] stm class: make config_item_type const

2017-10-12 Thread Bhumika Goyal
On Thu, Oct 12, 2017 at 2:12 PM, Bhumika Goyal  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.

> Signed-off-by: Bhumika Goyal 
> ---
>  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= &stp_policy_node_item_ops,
> .ct_group_ops   = &stp_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= &stp_policy_item_ops,
> .ct_group_ops   = &stp_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   = &stp_policies_group_ops,
> .ct_owner   = THIS_MODULE,
>  };
> --
> 1.9.1
>


Re: [PATCH] IB/cma: make config_item_type const

2017-10-12 Thread Bhumika Goyal
On Thu, Oct 12, 2017 at 2:20 PM, Bhumika Goyal  wrote:
> 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.
>

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.

> Signed-off-by: Bhumika Goyal 
> ---
>  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= &cma_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= &cma_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   = &cma_subsys_group_ops,
> .ct_owner   = THIS_MODULE,
>  };
> --
> 1.9.1
>


Re: [PATCH] PCI: endpoint: make config_item_type const

2017-10-12 Thread Bhumika Goyal
On Thu, Oct 12, 2017 at 2:50 PM, Bhumika Goyal  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 stored in the const "ci_type"
> field of a config_item structure.
>
> Done using Coccinelle.
>

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.

> Signed-off-by: Bhumika Goyal 
> ---
>  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= &pci_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= &pci_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  = &pci_epf_drop,
>  };
>
> -static struct config_item_type pci_epf_group_type = {
> +static const struct config_item_type pci_epf_group_type = {
> .ct_group_ops   = &pci_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
>


Re: [PATCH] nvmet: make config_item_type const

2017-10-12 Thread Bhumika Goyal
On Thu, Oct 12, 2017 at 2:38 PM, Bhumika Goyal  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 an if statement or
> stored in the const "ci_type" field of a config_item structure.
>
> Done using Coccinelle
>

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.

> Signed-off-by: Bhumika Goyal 
> ---
>  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= &nvmet_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   = &nvmet_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= &nvmet_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= &nvmet_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= &nvmet_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   = &nvmet_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= &nvmet_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   = &nvmet_referral_group_ops,
>  };
> @@ -8

Re: [PATCH] netconsole: make config_item_type const

2017-10-12 Thread Bhumika Goyal
On Thu, Oct 12, 2017 at 2:29 PM, Bhumika Goyal  wrote:
> 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.
>

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.

> Signed-off-by: Bhumika Goyal 
> ---
>  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= &netconsole_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   = &netconsole_subsys_group_ops,
> .ct_owner   = THIS_MODULE,
>  };
> --
> 1.9.1
>


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

2017-10-12 Thread Bhumika Goyal
On Thu, Oct 12, 2017 at 3:03 PM, Bhumika Goyal  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 stored in the const "ci_type"
> field of a config_item structure.
>
> Done using Coccinelle.
>

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.

> Signed-off-by: Bhumika Goyal 
> ---
>  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= &gadget_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= &gadget_root_item_ops,
> .ct_attrs   = gadget_root_attrs,
> .ct_owner   = THIS_MODULE,
> @@ -593,7 +593,7 @@ static void function_drop(
> .drop_item  = &function_drop,
>  };
>
> -static struct config_item_type functions_type = {
> +static const struct config_item_type functions_type = {
> .ct_group_ops   = &functions_ops,
> .ct_owner   = THIS_MODULE,
>  };
> @@ -694,7 +694,7 @@ static void config_desc_drop(
> .drop_item  = &config_desc_drop,
>  };
>
> -static struct config_item_type config_desc_type = {
> +static const struct config_item_type config_desc_type = {
> .ct_group_ops   = &config_desc_ops,
> .ct_owner   = THIS_MODULE,
>  };
> @@ -1475,7 +1475,7 @@ static void gadgets_drop(struct config_group *group, 
> struct config_item *item)
> .drop_item  = &gadgets_drop,
>  };
>
> -static struct config_item_type gadgets_type = {
> +static const struct config_item_type gadgets_type = {
> .ct_group_ops   = &gadgets_ops,
> .ct_owner   = THIS_MODULE,
>  };
> --
> 1.9.1
>


Re: [PATCH] dlm: make config_item_type const

2017-10-12 Thread Bhumika Goyal
On Thu, Oct 12, 2017 at 3:22 PM, Bhumika Goyal  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 stored in the const "ci_type"
> field of a config_item structure.
>
> Done using Coccinelle.
>

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.

> Signed-off-by: Bhumika Goyal 
> ---
>  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 = &clusters_ops,
> .ct_owner = THIS_MODULE,
>  };
>
> -static struct config_item_type cluster_type = {
> +static const struct config_item_type cluster_type = {
> .ct_item_ops = &cluster_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 = &spaces_ops,
> .ct_owner = THIS_MODULE,
>  };
>
> -static struct config_item_type space_type = {
> +static const struct config_item_type space_type = {
> .ct_item_ops = &space_ops,
> .ct_owner = THIS_MODULE,
>  };
>
> -static struct config_item_type comms_type = {
> +static const struct config_item_type comms_type = {
> .ct_group_ops = &comms_ops,
> .ct_owner = THIS_MODULE,
>  };
>
> -static struct config_item_type comm_type = {
> +static const struct config_item_type comm_type = {
> .ct_item_ops = &comm_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 = &nodes_ops,
> .ct_owner = THIS_MODULE,
>  };
>
> -static struct config_item_type node_type = {
> +static const struct config_item_type node_type = {
> .ct_item_ops = &node_ops,
> .ct_attrs = node_attrs,
> .ct_owner = THIS_MODULE,
> --
> 1.9.1
>


Re: [PATCH] configfs: make config_item_type const

2017-10-12 Thread Bhumika Goyal
On Thu, Oct 12, 2017 at 3:29 PM, Bhumika Goyal  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 stored in the const "ci_type"
> field of a config_item structure.
>
> Done using Coccinelle.
>

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.

> Signed-off-by: Bhumika Goyal 
> ---
>  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= &simple_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= &simple_children_item_ops,
> .ct_group_ops   = &simple_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   = &group_children_group_ops,
> .ct_attrs   = group_children_attrs,
> .ct_owner   = THIS_MODULE,
> --
> 1.9.1
>


Re: [PATCH] target/iscsi: make config_item_type const

2017-10-12 Thread Bhumika Goyal
On Thu, Oct 12, 2017 at 3:48 PM, Bhumika Goyal  wrote:
> 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 
> ---

Hello,

This patch is dependent on the patch in the link
https://patchwork.kernel.org/patch/649/. Therefore, this patch
won't be correct unless the patch in this links gets applied.

Thanks,
Bhumika

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


Re: [PATCH] nullb: make config_item_type const

2017-10-12 Thread Bhumika Goyal
On Thu, Oct 12, 2017 at 4:47 PM, Jens Axboe  wrote:
> On 10/12/2017 08:42 AM, Bhumika Goyal wrote:
>> On Thu, Oct 12, 2017 at 4:27 PM, Jens Axboe  wrote:
>>> On 10/12/2017 04:19 AM, Bhumika Goyal wrote:
>>>> 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.
>>>
>>> Thanks, applied.
>>>
>>
>> Hello,
>>
>> 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.
>
> Gah, I do see that now. That should have been made much clearer in
> the patch description!
>
> When you send out patches with hard dependencies like that, either
> wait until the dependency has been solved in mainline, or make it
> explicitly clear in the patch submission.
>

Sorry, for not mentioning the dependencies clearly. I will keep the
pointer in mind.

Thanks,
Bhumika

> --
> Jens Axboe
>


Re: [PATCH] nullb: make config_item_type const

2017-10-12 Thread Bhumika Goyal
On Thu, Oct 12, 2017 at 4:27 PM, Jens Axboe  wrote:
> On 10/12/2017 04:19 AM, Bhumika Goyal wrote:
>> 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.
>
> Thanks, applied.
>

Hello,

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.

Thanks,
Bhumika

> --
> Jens Axboe
>


[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 
---
 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



[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 
---
 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= &simple_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= &simple_children_item_ops,
.ct_group_ops   = &simple_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   = &group_children_group_ops,
.ct_attrs   = group_children_attrs,
.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 
---
 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 = &clusters_ops,
.ct_owner = THIS_MODULE,
 };
 
-static struct config_item_type cluster_type = {
+static const struct config_item_type cluster_type = {
.ct_item_ops = &cluster_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 = &spaces_ops,
.ct_owner = THIS_MODULE,
 };
 
-static struct config_item_type space_type = {
+static const struct config_item_type space_type = {
.ct_item_ops = &space_ops,
.ct_owner = THIS_MODULE,
 };
 
-static struct config_item_type comms_type = {
+static const struct config_item_type comms_type = {
.ct_group_ops = &comms_ops,
.ct_owner = THIS_MODULE,
 };
 
-static struct config_item_type comm_type = {
+static const struct config_item_type comm_type = {
.ct_item_ops = &comm_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 = &nodes_ops,
.ct_owner = THIS_MODULE,
 };
 
-static struct config_item_type node_type = {
+static const struct config_item_type node_type = {
.ct_item_ops = &node_ops,
.ct_attrs = node_attrs,
.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 
---
 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= &gadget_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= &gadget_root_item_ops,
.ct_attrs   = gadget_root_attrs,
.ct_owner   = THIS_MODULE,
@@ -593,7 +593,7 @@ static void function_drop(
.drop_item  = &function_drop,
 };
 
-static struct config_item_type functions_type = {
+static const struct config_item_type functions_type = {
.ct_group_ops   = &functions_ops,
.ct_owner   = THIS_MODULE,
 };
@@ -694,7 +694,7 @@ static void config_desc_drop(
.drop_item  = &config_desc_drop,
 };
 
-static struct config_item_type config_desc_type = {
+static const struct config_item_type config_desc_type = {
.ct_group_ops   = &config_desc_ops,
.ct_owner   = THIS_MODULE,
 };
@@ -1475,7 +1475,7 @@ static void gadgets_drop(struct config_group *group, 
struct config_item *item)
.drop_item  = &gadgets_drop,
 };
 
-static struct config_item_type gadgets_type = {
+static const struct config_item_type gadgets_type = {
.ct_group_ops   = &gadgets_ops,
.ct_owner   = THIS_MODULE,
 };
-- 
1.9.1



[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 
---
 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= &pci_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= &pci_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  = &pci_epf_drop,
 };
 
-static struct config_item_type pci_epf_group_type = {
+static const struct config_item_type pci_epf_group_type = {
.ct_group_ops   = &pci_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] 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 
---
 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= &nvmet_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   = &nvmet_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= &nvmet_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= &nvmet_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= &nvmet_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   = &nvmet_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= &nvmet_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   = &nvmet_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= &nvmet_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   = &nvmet_ports_group_ops,
.ct_owner   = THIS_MODULE,
 };
@@ -940,7 +940,7 @@ static void n

[PATCH] netconsole: 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 
---
 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= &netconsole_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   = &netconsole_subsys_group_ops,
.ct_owner   = THIS_MODULE,
 };
-- 
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 
---
 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= &cma_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= &cma_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   = &cma_subsys_group_ops,
.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 
---
 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= &stp_policy_node_item_ops,
.ct_group_ops   = &stp_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= &stp_policy_item_ops,
.ct_group_ops   = &stp_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   = &stp_policies_group_ops,
.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 
---
 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= &nullb_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   = &nullb_group_ops,
.ct_attrs   = nullb_group_attrs,
.ct_owner   = THIS_MODULE,
-- 
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 
---
 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 = &acpi_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] 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 
---
 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  = &device_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 = &device_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  = &trigger_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 = &trigger_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 
---
 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   = &target_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= &target_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  = &target_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   = &target_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= &target_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= &target_core_hba_item_ops,
.ct_group_ops   = &target_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   = &target_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 tar

[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 
---
 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= &o2hb_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   = &o2hb_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= &o2nm_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   = &o2nm_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= &o2nm_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] iio: sw_trigger: make the function argument as const

2017-10-11 Thread Bhumika Goyal
This is a follow-up patch for:
https://patchwork.kernel.org/patch/649/

Make the argument of the function iio_swt_group_init_type_name const as
it is only passed to the function config_group_init_type_name having the
argument as const.

Signed-off-by: Bhumika Goyal 
---
 include/linux/iio/sw_trigger.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/iio/sw_trigger.h b/include/linux/iio/sw_trigger.h
index c97eab6..0c43738 100644
--- a/include/linux/iio/sw_trigger.h
+++ b/include/linux/iio/sw_trigger.h
@@ -60,7 +60,7 @@ struct iio_sw_trigger *to_iio_sw_trigger(struct config_item 
*item)
 static inline
 void iio_swt_group_init_type_name(struct iio_sw_trigger *t,
  const char *name,
- struct config_item_type *type)
+ const struct config_item_type *type)
 {
 #if IS_ENABLED(CONFIG_CONFIGFS_FS)
config_group_init_type_name(&t->group, name, type);
-- 
1.9.1



[PATCH] usb: gadget: make config_item_type structures const

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

Make these structures const as they are only passed to the const
argument of the functions config_{group/item}_init_type_name.

Done using Coccinelle:

@rule1 disable optional_qualifier @
identifier x;
@@
static struct config_item_type x={...};

@ref@
position p;
identifier rule1.x;
@@
x@p

@good1@
position ref.p;
identifier rule1.x;
@@
(
config_group_init_type_name(...,&x@p,...)
|
config_item_init_type_name(...,&x@p,...)
|
configfs_register_default_group(...,&x@p,...)
)

@bad depends on !good1@
position ref.p;
identifier rule1.x;
@@
x@p

@depends on forall !bad disable optional_qualifier@
identifier rule1.x;
@@
static
+ const
struct config_item_type x={...};

Signed-off-by: Bhumika Goyal 
---
 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= &acm_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= &ecm_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= &eem_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= &ffs_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= &hidg_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 

[PATCH] iio: sw_device: make the function argument as const

2017-10-11 Thread Bhumika Goyal
This is a follow-up patch for:
https://patchwork.kernel.org/patch/649/

Make the argument of the function iio_swd_group_init_type_name const as
it is only passed to the function config_group_init_type_name having the
argument as const.

Signed-off-by: Bhumika Goyal 
---
This change allows a lot of config_item_type structures to be const.

 include/linux/iio/sw_device.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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 struct config_item_type *type)
 {
 #if IS_ENABLED(CONFIG_CONFIGFS_FS)
config_group_init_type_name(&d->group, name, type);
-- 
1.9.1



[PATCH] configfs: make function arguments const

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

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 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 
---
This change allows lots of config_item_type structure to be const.

 fs/configfs/dir.c| 2 +-
 fs/configfs/item.c   | 4 ++--
 include/linux/configfs.h | 6 +++---
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/fs/configfs/dir.c b/fs/configfs/dir.c
index 56fb261..46935fe 100644
--- a/fs/configfs/dir.c
+++ b/fs/configfs/dir.c
@@ -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..b375b5e 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(&group->cg_item, "%s", name);
group->cg_item.ci_type = type;
diff --git a/include/linux/configfs.h b/include/linux/configfs.h
index c967090..acfc96f 100644
--- a/include/linux/configfs.h
+++ b/include/linux/configfs.h
@@ -72,7 +72,7 @@ static inline char *config_item_name(struct config_item * 
item)
 
 extern void config_item_init_type_name(struct config_item *item,
   const char *name,
-  struct config_item_type *type);
+  const struct config_item_type *type);
 
 extern struct config_item *config_item_get(struct config_item *);
 extern struct config_item *config_item_get_unless_zero(struct config_item *);
@@ -101,7 +101,7 @@ struct config_group {
 extern void config_group_init(struct config_group *group);
 extern void config_group_init_type_name(struct config_group *group,
const char *name,
-   struct config_item_type *type);
+   const struct config_item_type *type);
 
 static inline struct config_group *to_config_group(struct config_item *item)
 {
@@ -261,7 +261,7 @@ int configfs_register_group(struct config_group 
*parent_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);
 void configfs_unregister_default_group(struct config_group *group);
 
 /* These functions can sleep and can alloc with GFP_KERNEL */
-- 
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 
---
 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] 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 
---
 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



Re: [PATCH] nvme: make config_item_type __ro_after_init

2017-10-02 Thread Bhumika Goyal
On Mon, Oct 2, 2017 at 12:44 AM, Bhumika Goyal  wrote:
> Make these __ro_after_init as they are only stored as a reference in the
> ci_type field of a config_item structure during the init phase in the
> function config_group_init_type_name. None of the fields of these
> structures are modified after the init phase, so they can be
> __ro_after_init.
>
> Structures found using Coccinelle and changes done by hand.
>

Hello all,

This patch should be dropped as the structures can also be made const
instead of __ro_after_init. I will send a patch making them const.

Thanks,
Bhumika

> Signed-off-by: Bhumika Goyal 
> ---
>  drivers/nvme/target/configfs.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/nvme/target/configfs.c b/drivers/nvme/target/configfs.c
> index b6aeb1d..075d9b5 100644
> --- a/drivers/nvme/target/configfs.c
> +++ b/drivers/nvme/target/configfs.c
> @@ -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 struct config_item_type nvmet_subsystems_type __ro_after_init = {
> .ct_group_ops   = &nvmet_subsystems_group_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 struct config_item_type nvmet_ports_type __ro_after_init = {
> .ct_group_ops   = &nvmet_ports_group_ops,
> .ct_owner   = THIS_MODULE,
>  };
> @@ -963,7 +963,7 @@ static struct config_group *nvmet_hosts_make_group(struct 
> config_group *group,
> .make_group = nvmet_hosts_make_group,
>  };
>
> -static struct config_item_type nvmet_hosts_type = {
> +static struct config_item_type nvmet_hosts_type __ro_after_init = {
> .ct_group_ops   = &nvmet_hosts_group_ops,
> .ct_owner   = THIS_MODULE,
>  };
> --
> 1.9.1
>


[PATCH] nvme: make config_item_type __ro_after_init

2017-10-01 Thread Bhumika Goyal
Make these __ro_after_init as they are only stored as a reference in the
ci_type field of a config_item structure during the init phase in the
function config_group_init_type_name. None of the fields of these
structures are modified after the init phase, so they can be
__ro_after_init.

Structures found using Coccinelle and changes done by hand.

Signed-off-by: Bhumika Goyal 
---
 drivers/nvme/target/configfs.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/nvme/target/configfs.c b/drivers/nvme/target/configfs.c
index b6aeb1d..075d9b5 100644
--- a/drivers/nvme/target/configfs.c
+++ b/drivers/nvme/target/configfs.c
@@ -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 struct config_item_type nvmet_subsystems_type __ro_after_init = {
.ct_group_ops   = &nvmet_subsystems_group_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 struct config_item_type nvmet_ports_type __ro_after_init = {
.ct_group_ops   = &nvmet_ports_group_ops,
.ct_owner   = THIS_MODULE,
 };
@@ -963,7 +963,7 @@ static struct config_group *nvmet_hosts_make_group(struct 
config_group *group,
.make_group = nvmet_hosts_make_group,
 };
 
-static struct config_item_type nvmet_hosts_type = {
+static struct config_item_type nvmet_hosts_type __ro_after_init = {
.ct_group_ops   = &nvmet_hosts_group_ops,
.ct_owner   = THIS_MODULE,
 };
-- 
1.9.1



[PATCH] scsi: esas2r: make bin_attr_default_nvram const

2017-09-30 Thread Bhumika Goyal
Make this const as it is only passed to the const arguments of the
functions sysfs_remove_bin_file and sysfs_create_bin_file. Make the
declaration const too.

Structure found using Coccinelle and changes done by hand.

Signed-off-by: Bhumika Goyal 
---
 drivers/scsi/esas2r/esas2r.h  | 2 +-
 drivers/scsi/esas2r/esas2r_main.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/esas2r/esas2r.h b/drivers/scsi/esas2r/esas2r.h
index 1da6407..f9acf54 100644
--- a/drivers/scsi/esas2r/esas2r.h
+++ b/drivers/scsi/esas2r/esas2r.h
@@ -1421,6 +1421,6 @@ static inline void esas2r_comp_list_drain(struct 
esas2r_adapter *a,
 extern struct bin_attribute bin_attr_vda;
 extern struct bin_attribute bin_attr_hw;
 extern struct bin_attribute bin_attr_live_nvram;
-extern struct bin_attribute bin_attr_default_nvram;
+extern const struct bin_attribute bin_attr_default_nvram;
 
 #endif /* ESAS2R_H */
diff --git a/drivers/scsi/esas2r/esas2r_main.c 
b/drivers/scsi/esas2r/esas2r_main.c
index 81f226b..9291768 100644
--- a/drivers/scsi/esas2r/esas2r_main.c
+++ b/drivers/scsi/esas2r/esas2r_main.c
@@ -224,7 +224,7 @@ static ssize_t write_hw(struct file *file, struct kobject 
*kobj,
 ESAS2R_RW_BIN_ATTR(hw);
 ESAS2R_RW_BIN_ATTR(live_nvram);
 
-struct bin_attribute bin_attr_default_nvram = {
+const struct bin_attribute bin_attr_default_nvram = {
.attr   = { .name = "default_nvram", .mode = S_IRUGO },
.size   = 0,
.read   = read_default_nvram,
-- 
1.9.1



[PATCH] libata: make ata_port_type const

2017-09-30 Thread Bhumika Goyal
Make this const as it is only stored in the const field of a device
structure. Make the declaration in header const too.

Structure found using Coccinelle and changes done by hand.

Signed-off-by: Bhumika Goyal 
---
 drivers/ata/libata-core.c | 2 +-
 drivers/ata/libata.h  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 65f7574..29e3516 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -5824,7 +5824,7 @@ void ata_host_resume(struct ata_host *host)
 }
 #endif
 
-struct device_type ata_port_type = {
+const struct device_type ata_port_type = {
.name = "ata_port",
 #ifdef CONFIG_PM
.pm = &ata_port_pm_ops,
diff --git a/drivers/ata/libata.h b/drivers/ata/libata.h
index 839d487..18bf1e9 100644
--- a/drivers/ata/libata.h
+++ b/drivers/ata/libata.h
@@ -51,7 +51,7 @@ enum {
 extern int libata_fua;
 extern int libata_noacpi;
 extern int libata_allow_tpm;
-extern struct device_type ata_port_type;
+extern const struct device_type ata_port_type;
 extern struct ata_link *ata_dev_phys_link(struct ata_device *dev);
 extern void ata_force_cbl(struct ata_port *ap);
 extern u64 ata_tf_to_lba(const struct ata_taskfile *tf);
-- 
1.9.1



[PATCH] thunderbolt: make tb_domain_type const

2017-09-30 Thread Bhumika Goyal
Make this const as it is only stored in the const field of a device
structure. Make the declaration in header const too.

Structure found using Coccinelle and changes done by hand.

Signed-off-by: Bhumika Goyal 
---
 drivers/thunderbolt/domain.c | 2 +-
 drivers/thunderbolt/tb.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/thunderbolt/domain.c b/drivers/thunderbolt/domain.c
index 9f2dcd4..f8b11a3 100644
--- a/drivers/thunderbolt/domain.c
+++ b/drivers/thunderbolt/domain.c
@@ -65,7 +65,7 @@ static void tb_domain_release(struct device *dev)
kfree(tb);
 }
 
-struct device_type tb_domain_type = {
+const struct device_type tb_domain_type = {
.name = "thunderbolt_domain",
.release = tb_domain_release,
 };
diff --git a/drivers/thunderbolt/tb.h b/drivers/thunderbolt/tb.h
index e0deee4..fa65049 100644
--- a/drivers/thunderbolt/tb.h
+++ b/drivers/thunderbolt/tb.h
@@ -369,7 +369,7 @@ static inline int tb_port_write(struct tb_port *port, const 
void *buffer,
 struct tb *tb_probe(struct tb_nhi *nhi);
 
 extern struct bus_type tb_bus_type;
-extern struct device_type tb_domain_type;
+extern const struct device_type tb_domain_type;
 extern struct device_type tb_switch_type;
 
 int tb_domain_init(void);
-- 
1.9.1



[PATCH] FS-Cache: make fscache_fsdef_netfs_def const

2017-09-30 Thread Bhumika Goyal
Make fscache_fsdef_netfs_def const as it is only stored in a const field
of a fscache_cookie structure. Make the declaration const too.

Structure found using Coccinelle and changes done by hand.

Signed-off-by: Bhumika Goyal 
---
 fs/fscache/fsdef.c| 2 +-
 fs/fscache/internal.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/fscache/fsdef.c b/fs/fscache/fsdef.c
index 5a117df..7c86f37 100644
--- a/fs/fscache/fsdef.c
+++ b/fs/fscache/fsdef.c
@@ -68,7 +68,7 @@ struct fscache_cookie fscache_fsdef_index = {
  * a specific netfs and only applicable to a particular version of the index
  * structure used by that netfs.
  */
-struct fscache_cookie_def fscache_fsdef_netfs_def = {
+const struct fscache_cookie_def fscache_fsdef_netfs_def = {
.name   = "FSDEF.netfs",
.type   = FSCACHE_COOKIE_TYPE_INDEX,
.get_key= fscache_fsdef_netfs_get_key,
diff --git a/fs/fscache/internal.h b/fs/fscache/internal.h
index 97ec451..d485473 100644
--- a/fs/fscache/internal.h
+++ b/fs/fscache/internal.h
@@ -55,7 +55,7 @@ extern struct fscache_cache *fscache_select_cache_for_object(
  * fsdef.c
  */
 extern struct fscache_cookie fscache_fsdef_index;
-extern struct fscache_cookie_def fscache_fsdef_netfs_def;
+extern const struct fscache_cookie_def fscache_fsdef_netfs_def;
 
 /*
  * histogram.c
-- 
1.9.1



[PATCH] staging: rtl8192u: make r8192_wx_handlers_def structure const

2017-09-30 Thread Bhumika Goyal
Make this const as it is only stored in a const field of a pci_dev
structure. Make the declaration in the header const too.

Structure found using Coccinelle and changes done by hand.

Signed-off-by: Bhumika Goyal 
---
 drivers/staging/rtl8192u/r8192U_wx.c | 2 +-
 drivers/staging/rtl8192u/r8192U_wx.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8192u/r8192U_wx.c 
b/drivers/staging/rtl8192u/r8192U_wx.c
index a954538..e4e6c97 100644
--- a/drivers/staging/rtl8192u/r8192U_wx.c
+++ b/drivers/staging/rtl8192u/r8192U_wx.c
@@ -964,7 +964,7 @@ struct iw_statistics *r8192_get_wireless_stats(struct 
net_device *dev)
return wstats;
 }
 
-struct iw_handler_def  r8192_wx_handlers_def = {
+const struct iw_handler_def  r8192_wx_handlers_def = {
.standard = r8192_wx_handlers,
.num_standard = ARRAY_SIZE(r8192_wx_handlers),
.private = r8192_private_handler,
diff --git a/drivers/staging/rtl8192u/r8192U_wx.h 
b/drivers/staging/rtl8192u/r8192U_wx.h
index fb5f808..a6c2b95 100644
--- a/drivers/staging/rtl8192u/r8192U_wx.h
+++ b/drivers/staging/rtl8192u/r8192U_wx.h
@@ -17,7 +17,7 @@
 #ifndef R8180_WX_H
 #define R8180_WX_H
 
-extern struct iw_handler_def r8192_wx_handlers_def;
+extern const struct iw_handler_def r8192_wx_handlers_def;
 /* Enable  the rtl819x_core.c to share this function, david 2008.9.22 */
 struct iw_statistics *r8192_get_wireless_stats(struct net_device *dev);
 
-- 
1.9.1



[PATCH] vfio-mdev: make mdev_fops const and static

2017-09-30 Thread Bhumika Goyal
Make this const as it is only passed to a const argument of the function
mdev_register_device. Make it static as it is not referenced in any
other file.

Structure found using Coccinelle and changes done by hand.

Signed-off-by: Bhumika Goyal 
---
 samples/vfio-mdev/mtty.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/samples/vfio-mdev/mtty.c b/samples/vfio-mdev/mtty.c
index ca49568..09f255b 100644
--- a/samples/vfio-mdev/mtty.c
+++ b/samples/vfio-mdev/mtty.c
@@ -1413,7 +1413,7 @@ struct attribute_group *mdev_type_groups[] = {
NULL,
 };
 
-struct mdev_parent_ops mdev_fops = {
+static const struct mdev_parent_ops mdev_fops = {
.owner  = THIS_MODULE,
.dev_attr_groups= mtty_dev_groups,
.mdev_attr_groups   = mdev_dev_groups,
-- 
1.9.1



[PATCH] [IA64] sn: make sn_screen_info const, static and __initconst

2017-09-28 Thread Bhumika Goyal
Make this structure static as it is only used in the file in which it is
defined. Make it const as it is only used during a copy operation. Make
it __initconst as this usage is during the init phase.

Structure found using Coccinelle and changes done by hand.

Signed-off-by: Bhumika Goyal 
---
 arch/ia64/sn/kernel/setup.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/ia64/sn/kernel/setup.c b/arch/ia64/sn/kernel/setup.c
index 5f6b6b4..5f4b15f 100644
--- a/arch/ia64/sn/kernel/setup.c
+++ b/arch/ia64/sn/kernel/setup.c
@@ -110,7 +110,7 @@
  * code. This is just enough to make the console code think we're on a
  * VGA color display.
  */
-struct screen_info sn_screen_info = {
+static const struct screen_info sn_screen_info __initconst = {
.orig_x = 0,
.orig_y = 0,
.orig_video_mode = 3,
-- 
1.9.1



[PATCH] usb: gadget: f_uvc: make uvc_v4l2_fops const

2017-09-27 Thread Bhumika Goyal
Make this const as it is only stored in the const field of a structure
video_device in the file referencing it. Make the declaration const too.

Done using Coccinelle.

Signed-off-by: Bhumika Goyal 
---
 drivers/usb/gadget/function/uvc_v4l2.c | 2 +-
 drivers/usb/gadget/function/uvc_v4l2.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/gadget/function/uvc_v4l2.c 
b/drivers/usb/gadget/function/uvc_v4l2.c
index 3e22b45..6612402 100644
--- a/drivers/usb/gadget/function/uvc_v4l2.c
+++ b/drivers/usb/gadget/function/uvc_v4l2.c
@@ -354,7 +354,7 @@ static unsigned long uvcg_v4l2_get_unmapped_area(struct 
file *file,
 }
 #endif
 
-struct v4l2_file_operations uvc_v4l2_fops = {
+const struct v4l2_file_operations uvc_v4l2_fops = {
.owner  = THIS_MODULE,
.open   = uvc_v4l2_open,
.release= uvc_v4l2_release,
diff --git a/drivers/usb/gadget/function/uvc_v4l2.h 
b/drivers/usb/gadget/function/uvc_v4l2.h
index 2683b92..ad6ca06 100644
--- a/drivers/usb/gadget/function/uvc_v4l2.h
+++ b/drivers/usb/gadget/function/uvc_v4l2.h
@@ -17,6 +17,6 @@
 #define __UVC_V4L2_H__
 
 extern const struct v4l2_ioctl_ops uvc_v4l2_ioctl_ops;
-extern struct v4l2_file_operations uvc_v4l2_fops;
+extern const struct v4l2_file_operations uvc_v4l2_fops;
 
 #endif /* __UVC_V4L2_H__ */
-- 
1.9.1



[PATCH] [media] vb2: make vb2_ops

2017-09-27 Thread Bhumika Goyal
Make vb2_ops const as they are only stored in the const field of a
vb2_queue structure. Make the declarations const too.

Done using Coccinelle.

Signed-off-by: Bhumika Goyal 
---
 drivers/media/usb/au0828/au0828-vbi.c | 2 +-
 drivers/media/usb/au0828/au0828.h | 2 +-
 drivers/media/usb/em28xx/em28xx-v4l.h | 2 +-
 drivers/media/usb/em28xx/em28xx-vbi.c | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/media/usb/au0828/au0828-vbi.c 
b/drivers/media/usb/au0828/au0828-vbi.c
index e0930ce..9dd6bdb 100644
--- a/drivers/media/usb/au0828/au0828-vbi.c
+++ b/drivers/media/usb/au0828/au0828-vbi.c
@@ -79,7 +79,7 @@ static int vbi_buffer_prepare(struct vb2_buffer *vb)
spin_unlock_irqrestore(&dev->slock, flags);
 }
 
-struct vb2_ops au0828_vbi_qops = {
+const struct vb2_ops au0828_vbi_qops = {
.queue_setup = vbi_queue_setup,
.buf_prepare = vbi_buffer_prepare,
.buf_queue   = vbi_buffer_queue,
diff --git a/drivers/media/usb/au0828/au0828.h 
b/drivers/media/usb/au0828/au0828.h
index 05e445f..f6f37e8 100644
--- a/drivers/media/usb/au0828/au0828.h
+++ b/drivers/media/usb/au0828/au0828.h
@@ -358,7 +358,7 @@ static inline int au0828_analog_unregister(struct 
au0828_dev *dev)
 void au0828_dvb_resume(struct au0828_dev *dev);
 
 /* au0828-vbi.c */
-extern struct vb2_ops au0828_vbi_qops;
+extern const struct vb2_ops au0828_vbi_qops;
 
 #define dprintk(level, fmt, arg...)\
do { if (au0828_debug & level)\
diff --git a/drivers/media/usb/em28xx/em28xx-v4l.h 
b/drivers/media/usb/em28xx/em28xx-v4l.h
index 8dfcb56..9c411aa 100644
--- a/drivers/media/usb/em28xx/em28xx-v4l.h
+++ b/drivers/media/usb/em28xx/em28xx-v4l.h
@@ -16,4 +16,4 @@
 
 int em28xx_start_analog_streaming(struct vb2_queue *vq, unsigned int count);
 void em28xx_stop_vbi_streaming(struct vb2_queue *vq);
-extern struct vb2_ops em28xx_vbi_qops;
+extern const struct vb2_ops em28xx_vbi_qops;
diff --git a/drivers/media/usb/em28xx/em28xx-vbi.c 
b/drivers/media/usb/em28xx/em28xx-vbi.c
index 0bac552..f512365 100644
--- a/drivers/media/usb/em28xx/em28xx-vbi.c
+++ b/drivers/media/usb/em28xx/em28xx-vbi.c
@@ -93,7 +93,7 @@ static int vbi_buffer_prepare(struct vb2_buffer *vb)
spin_unlock_irqrestore(&dev->slock, flags);
 }
 
-struct vb2_ops em28xx_vbi_qops = {
+const struct vb2_ops em28xx_vbi_qops = {
.queue_setup= vbi_queue_setup,
.buf_prepare= vbi_buffer_prepare,
.buf_queue  = vbi_buffer_queue,
-- 
1.9.1



[PATCH] [media] vb2: make vb2_ops const

2017-09-27 Thread Bhumika Goyal
Make vb2_ops const as they are only stored in the const field of a
vb2_queue structure. Make the declarations const too.

Done using Coccinelle.

Signed-off-by: Bhumika Goyal 
---
 drivers/media/pci/cx23885/cx23885-vbi.c | 2 +-
 drivers/media/pci/cx23885/cx23885.h | 2 +-
 drivers/media/pci/saa7134/saa7134-vbi.c | 2 +-
 drivers/media/pci/saa7134/saa7134.h | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/media/pci/cx23885/cx23885-vbi.c 
b/drivers/media/pci/cx23885/cx23885-vbi.c
index 369e545..70f9f13 100644
--- a/drivers/media/pci/cx23885/cx23885-vbi.c
+++ b/drivers/media/pci/cx23885/cx23885-vbi.c
@@ -254,7 +254,7 @@ static void cx23885_stop_streaming(struct vb2_queue *q)
 }
 
 
-struct vb2_ops cx23885_vbi_qops = {
+const struct vb2_ops cx23885_vbi_qops = {
.queue_setup= queue_setup,
.buf_prepare  = buffer_prepare,
.buf_finish = buffer_finish,
diff --git a/drivers/media/pci/cx23885/cx23885.h 
b/drivers/media/pci/cx23885/cx23885.h
index cb714ab..6aab713 100644
--- a/drivers/media/pci/cx23885/cx23885.h
+++ b/drivers/media/pci/cx23885/cx23885.h
@@ -591,7 +591,7 @@ extern void cx23885_video_wakeup(struct cx23885_dev *dev,
 extern int cx23885_vbi_fmt(struct file *file, void *priv,
struct v4l2_format *f);
 extern void cx23885_vbi_timeout(unsigned long data);
-extern struct vb2_ops cx23885_vbi_qops;
+extern const struct vb2_ops cx23885_vbi_qops;
 extern int cx23885_vbi_irq(struct cx23885_dev *dev, u32 status);
 
 /* cx23885-i2c.c*/
diff --git a/drivers/media/pci/saa7134/saa7134-vbi.c 
b/drivers/media/pci/saa7134/saa7134-vbi.c
index bcad9b2..07a397b 100644
--- a/drivers/media/pci/saa7134/saa7134-vbi.c
+++ b/drivers/media/pci/saa7134/saa7134-vbi.c
@@ -165,7 +165,7 @@ static int buffer_init(struct vb2_buffer *vb2)
return 0;
 }
 
-struct vb2_ops saa7134_vbi_qops = {
+const struct vb2_ops saa7134_vbi_qops = {
.queue_setup= queue_setup,
.buf_init   = buffer_init,
.buf_prepare= buffer_prepare,
diff --git a/drivers/media/pci/saa7134/saa7134.h 
b/drivers/media/pci/saa7134/saa7134.h
index 816b528..545f7ad 100644
--- a/drivers/media/pci/saa7134/saa7134.h
+++ b/drivers/media/pci/saa7134/saa7134.h
@@ -870,7 +870,7 @@ int saa7134_ts_queue_setup(struct vb2_queue *q,
 /* --- */
 /* saa7134-vbi.c   */
 
-extern struct vb2_ops saa7134_vbi_qops;
+extern const struct vb2_ops saa7134_vbi_qops;
 extern struct video_device saa7134_vbi_template;
 
 int saa7134_vbi_init1(struct saa7134_dev *dev);
-- 
1.9.1



[PATCH] ASoC: kirkwood: make kirkwood_soc_platform const

2017-09-27 Thread Bhumika Goyal
Make kirkwood_soc_platform const as it only passed to a const argument
of the function snd_soc_register_platform in the file referencing it.
Make the declaration const too.

Done using Coccinelle.

Signed-off-by: Bhumika Goyal 
---
 sound/soc/kirkwood/kirkwood-dma.c | 2 +-
 sound/soc/kirkwood/kirkwood.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/kirkwood/kirkwood-dma.c 
b/sound/soc/kirkwood/kirkwood-dma.c
index cf23af1..505b0ff 100644
--- a/sound/soc/kirkwood/kirkwood-dma.c
+++ b/sound/soc/kirkwood/kirkwood-dma.c
@@ -318,7 +318,7 @@ static void kirkwood_dma_free_dma_buffers(struct snd_pcm 
*pcm)
}
 }
 
-struct snd_soc_platform_driver kirkwood_soc_platform = {
+const struct snd_soc_platform_driver kirkwood_soc_platform = {
.ops= &kirkwood_dma_ops,
.pcm_new= kirkwood_dma_new,
.pcm_free   = kirkwood_dma_free_dma_buffers,
diff --git a/sound/soc/kirkwood/kirkwood.h b/sound/soc/kirkwood/kirkwood.h
index 90e32a7..783cb1a4 100644
--- a/sound/soc/kirkwood/kirkwood.h
+++ b/sound/soc/kirkwood/kirkwood.h
@@ -143,6 +143,6 @@ struct kirkwood_dma_data {
int burst;
 };
 
-extern struct snd_soc_platform_driver kirkwood_soc_platform;
+extern const struct snd_soc_platform_driver kirkwood_soc_platform;
 
 #endif
-- 
1.9.1



[PATCH v2] [media] zoran: make zoran_template const

2017-09-27 Thread Bhumika Goyal
Make this const as it is only used in a copy operation in the file
referencing it. Make the declaration const too.

Done using Coccinelle.

Signed-off-by: Bhumika Goyal 
---
Changes in v2:
* Fix spelling mistake in the commit message. 

 drivers/media/pci/zoran/zoran_card.h   | 2 +-
 drivers/media/pci/zoran/zoran_driver.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/pci/zoran/zoran_card.h 
b/drivers/media/pci/zoran/zoran_card.h
index 81cba17..0cdb7d3 100644
--- a/drivers/media/pci/zoran/zoran_card.h
+++ b/drivers/media/pci/zoran/zoran_card.h
@@ -37,7 +37,7 @@
 /* Anybody who uses more than four? */
 #define BUZ_MAX 4
 
-extern struct video_device zoran_template;
+extern const struct video_device zoran_template;
 
 extern int zoran_check_jpg_settings(struct zoran *zr,
struct zoran_jpg_settings *settings,
diff --git a/drivers/media/pci/zoran/zoran_driver.c 
b/drivers/media/pci/zoran/zoran_driver.c
index a11cb50..d078400 100644
--- a/drivers/media/pci/zoran/zoran_driver.c
+++ b/drivers/media/pci/zoran/zoran_driver.c
@@ -2839,7 +2839,7 @@ static int zoran_s_jpegcomp(struct file *file, void *__fh,
.poll = zoran_poll,
 };
 
-struct video_device zoran_template = {
+const struct video_device zoran_template = {
.name = ZORAN_NAME,
.fops = &zoran_fops,
.ioctl_ops = &zoran_ioctl_ops,
-- 
1.9.1



[PATCH] [media] zoran: make zoran_template const

2017-09-27 Thread Bhumika Goyal
Make this constas it is only used in a copy operation in the file
referencing it. Make the declaration const too.

Done using Coccinelle.

Signed-off-by: Bhumika Goyal 
---
 drivers/media/pci/zoran/zoran_card.h   | 2 +-
 drivers/media/pci/zoran/zoran_driver.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/pci/zoran/zoran_card.h 
b/drivers/media/pci/zoran/zoran_card.h
index 81cba17..0cdb7d3 100644
--- a/drivers/media/pci/zoran/zoran_card.h
+++ b/drivers/media/pci/zoran/zoran_card.h
@@ -37,7 +37,7 @@
 /* Anybody who uses more than four? */
 #define BUZ_MAX 4
 
-extern struct video_device zoran_template;
+extern const struct video_device zoran_template;
 
 extern int zoran_check_jpg_settings(struct zoran *zr,
struct zoran_jpg_settings *settings,
diff --git a/drivers/media/pci/zoran/zoran_driver.c 
b/drivers/media/pci/zoran/zoran_driver.c
index a11cb50..d078400 100644
--- a/drivers/media/pci/zoran/zoran_driver.c
+++ b/drivers/media/pci/zoran/zoran_driver.c
@@ -2839,7 +2839,7 @@ static int zoran_s_jpegcomp(struct file *file, void *__fh,
.poll = zoran_poll,
 };
 
-struct video_device zoran_template = {
+const struct video_device zoran_template = {
.name = ZORAN_NAME,
.fops = &zoran_fops,
.ioctl_ops = &zoran_ioctl_ops,
-- 
1.9.1



  1   2   3   4   5   6   7   >