[PATCH v2] drivers:char:Removed unnecessary braces

2015-12-21 Thread Bhumika Goyal
Removed braces from single statement if condition.Fixed checkpatch.pl
warning.

Signed-off-by: Bhumika Goyal <bhumi...@gmail.com>
---
Changes in v2:
-Correct the subject and also send to a public mailing list.
---
 drivers/char/raw.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/char/raw.c b/drivers/char/raw.c
index 60316fb..c8bf17b 100644
--- a/drivers/char/raw.c
+++ b/drivers/char/raw.c
@@ -334,10 +334,8 @@ static int __init raw_init(void)
 
cdev_init(_cdev, _fops);
ret = cdev_add(_cdev, dev, max_raw_minors);
-   if (ret) {
+   if (ret)
goto error_region;
-   }
-
raw_class = class_create(THIS_MODULE, "raw");
if (IS_ERR(raw_class)) {
printk(KERN_ERR "Error creating raw class.\n");
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] Staging:wlan-ng:Merged two lines into one

2016-02-08 Thread Bhumika Goyal
The last two lines of these functions are compressed into one.
Also removed the variable ret as it is now not used.
Found using coccinelle:
@@
expression e, ret;
@@

-ret =
+return
 e;
-return ret;

Signed-off-by: Bhumika Goyal <bhumi...@gmail.com>
---
 drivers/staging/wlan-ng/hfa384x_usb.c | 20 
 1 file changed, 4 insertions(+), 16 deletions(-)

diff --git a/drivers/staging/wlan-ng/hfa384x_usb.c 
b/drivers/staging/wlan-ng/hfa384x_usb.c
index 682de77..fda8a95 100644
--- a/drivers/staging/wlan-ng/hfa384x_usb.c
+++ b/drivers/staging/wlan-ng/hfa384x_usb.c
@@ -1012,7 +1012,6 @@ int hfa384x_cmd_initialize(hfa384x_t *hw)
 */
 int hfa384x_cmd_disable(hfa384x_t *hw, u16 macport)
 {
-   int result = 0;
hfa384x_metacmd_t cmd;
 
cmd.cmd = HFA384x_CMD_CMDCODE_SET(HFA384x_CMDCODE_DISABLE) |
@@ -1021,9 +1020,7 @@ int hfa384x_cmd_disable(hfa384x_t *hw, u16 macport)
cmd.parm1 = 0;
cmd.parm2 = 0;
 
-   result = hfa384x_docmd_wait(hw, );
-
-   return result;
+   return hfa384x_docmd_wait(hw, );
 }
 
 /*
@@ -1048,7 +1045,6 @@ int hfa384x_cmd_disable(hfa384x_t *hw, u16 macport)
 */
 int hfa384x_cmd_enable(hfa384x_t *hw, u16 macport)
 {
-   int result = 0;
hfa384x_metacmd_t cmd;
 
cmd.cmd = HFA384x_CMD_CMDCODE_SET(HFA384x_CMDCODE_ENABLE) |
@@ -1057,9 +1053,7 @@ int hfa384x_cmd_enable(hfa384x_t *hw, u16 macport)
cmd.parm1 = 0;
cmd.parm2 = 0;
 
-   result = hfa384x_docmd_wait(hw, );
-
-   return result;
+   return hfa384x_docmd_wait(hw, );
 }
 
 /*
@@ -1093,7 +1087,6 @@ int hfa384x_cmd_enable(hfa384x_t *hw, u16 macport)
 */
 int hfa384x_cmd_monitor(hfa384x_t *hw, u16 enable)
 {
-   int result = 0;
hfa384x_metacmd_t cmd;
 
cmd.cmd = HFA384x_CMD_CMDCODE_SET(HFA384x_CMDCODE_MONITOR) |
@@ -1102,9 +1095,7 @@ int hfa384x_cmd_monitor(hfa384x_t *hw, u16 enable)
cmd.parm1 = 0;
cmd.parm2 = 0;
 
-   result = hfa384x_docmd_wait(hw, );
-
-   return result;
+   return hfa384x_docmd_wait(hw, );
 }
 
 /*
@@ -1148,7 +1139,6 @@ int hfa384x_cmd_monitor(hfa384x_t *hw, u16 enable)
 int hfa384x_cmd_download(hfa384x_t *hw, u16 mode, u16 lowaddr,
 u16 highaddr, u16 codelen)
 {
-   int result = 0;
hfa384x_metacmd_t cmd;
 
pr_debug("mode=%d, lowaddr=0x%04x, highaddr=0x%04x, codelen=%d\n",
@@ -1161,9 +1151,7 @@ int hfa384x_cmd_download(hfa384x_t *hw, u16 mode, u16 
lowaddr,
cmd.parm1 = highaddr;
cmd.parm2 = codelen;
 
-   result = hfa384x_docmd_wait(hw, );
-
-   return result;
+   return hfa384x_docmd_wait(hw, );
 }
 
 /*
-- 
1.9.1



[PATCH] Staging:iio:Remove exceptional & on function name

2016-02-04 Thread Bhumika Goyal
In this file,function names are otherwise used as pointers without &.
Found using coccinelle.
// 
@r@
identifier f;
@@

f(...) { ... }
@@
identifier r.f;
@@

- 
+ f
// 

Signed-off-by: Bhumika Goyal <bhumi...@gmail.com>
---
 drivers/staging/iio/impedance-analyzer/ad5933.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/iio/impedance-analyzer/ad5933.c 
b/drivers/staging/iio/impedance-analyzer/ad5933.c
index 10c43dda..d1218d8 100644
--- a/drivers/staging/iio/impedance-analyzer/ad5933.c
+++ b/drivers/staging/iio/impedance-analyzer/ad5933.c
@@ -558,7 +558,7 @@ out:
 }
 
 static const struct iio_info ad5933_info = {
-   .read_raw = _read_raw,
+   .read_raw = ad5933_read_raw,
.attrs = _attribute_group,
.driver_module = THIS_MODULE,
 };
@@ -616,9 +616,9 @@ static int ad5933_ring_postdisable(struct iio_dev 
*indio_dev)
 }
 
 static const struct iio_buffer_setup_ops ad5933_ring_setup_ops = {
-   .preenable = _ring_preenable,
-   .postenable = _ring_postenable,
-   .postdisable = _ring_postdisable,
+   .preenable = ad5933_ring_preenable,
+   .postenable = ad5933_ring_postenable,
+   .postdisable = ad5933_ring_postdisable,
 };
 
 static int ad5933_register_ring_funcs_and_init(struct iio_dev *indio_dev)
-- 
1.9.1



[PATCH 0/2] Staging:iio:adc:Prefer using BIT macro

2016-02-07 Thread Bhumika Goyal
This patchset replaces bit shifting on 1 with the BIT(x) macro.
This was done with coccinelle:
@@ int g; @@ 
-(1 << g) 
+BIT(g)

Bhumika Goyal (2):
  Staging:iio:Prefer using BIT macro
  Staging: iio: adc: Prefer using the BIT macro

 drivers/staging/iio/adc/ad7280a.c | 4 ++--
 drivers/staging/iio/adc/ad7816.c  | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

-- 
1.9.1



[PATCH 2/2] Staging: iio: adc: Prefer using the BIT macro

2016-02-07 Thread Bhumika Goyal
This patch replaces bit shifting on 1 with the BIT(x) macro.

This was done with coccinelle:

@@ int g; @@

-(1 << g)
+BIT(g)

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

diff --git a/drivers/staging/iio/adc/ad7280a.c 
b/drivers/staging/iio/adc/ad7280a.c
index 0c73bce..ccf3157 100644
--- a/drivers/staging/iio/adc/ad7280a.c
+++ b/drivers/staging/iio/adc/ad7280a.c
@@ -117,7 +117,7 @@
  */
 #define POLYNOM0x2F
 #define POLYNOM_ORDER  8
-#define HIGHBIT(1 << (POLYNOM_ORDER - 1))
+#define HIGHBITBIT((POLYNOM_ORDER - 1))
 
 struct ad7280_state {
struct spi_device   *spi;
@@ -388,7 +388,7 @@ static ssize_t ad7280_show_balance_sw(struct device *dev,
 
return sprintf(buf, "%d\n",
   !!(st->cb_mask[this_attr->address >> 8] &
-  (1 << ((this_attr->address & 0xFF) + 2;
+  BIT(((this_attr->address & 0xFF) + 2;
 }
 
 static ssize_t ad7280_store_balance_sw(struct device *dev,
-- 
1.9.1



[PATCH 1/2] Staging:iio:Prefer using BIT macro

2016-02-07 Thread Bhumika Goyal
This patch replaces bit shifting on 1 with the BIT(x) macro.
This was done with coccinelle:
 @@ int g; @@
-(1 << g)
+BIT(g)

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

diff --git a/drivers/staging/iio/adc/ad7816.c b/drivers/staging/iio/adc/ad7816.c
index 2226051..f631012 100644
--- a/drivers/staging/iio/adc/ad7816.c
+++ b/drivers/staging/iio/adc/ad7816.c
@@ -222,7 +222,7 @@ static ssize_t ad7816_show_value(struct device *dev,
value = (s8)((data >> AD7816_TEMP_FLOAT_OFFSET) - 103);
data &= AD7816_TEMP_FLOAT_MASK;
if (value < 0)
-   data = (1 << AD7816_TEMP_FLOAT_OFFSET) - data;
+   data = BIT(AD7816_TEMP_FLOAT_OFFSET) - data;
return sprintf(buf, "%d.%.2d\n", value, data * 25);
}
return sprintf(buf, "%u\n", data);
-- 
1.9.1



[PATCH] Staging:lustre:lclient:Remove unused function

2016-01-29 Thread Bhumika Goyal
Discard the function ccc_vmpage_page_transient as it is not used
anywhere in the kernel.
Used grep to find occurences.
Problem found using sparse.

Signed-off-by: Bhumika Goyal <bhumi...@gmail.com>
---
 drivers/staging/lustre/lustre/lclient/lcommon_cl.c | 11 ---
 1 file changed, 11 deletions(-)

diff --git a/drivers/staging/lustre/lustre/lclient/lcommon_cl.c 
b/drivers/staging/lustre/lustre/lclient/lcommon_cl.c
index 34dde7d..4dfeb4e 100644
--- a/drivers/staging/lustre/lustre/lclient/lcommon_cl.c
+++ b/drivers/staging/lustre/lustre/lclient/lcommon_cl.c
@@ -986,17 +986,6 @@ struct inode *ccc_object_inode(const struct cl_object *obj)
 }
 
 /**
- * Returns a pointer to cl_page associated with \a vmpage, without acquiring
- * additional reference to the resulting page. This is an unsafe version of
- * cl_vmpage_page() that can only be used under vmpage lock.
- */
-struct cl_page *ccc_vmpage_page_transient(struct page *vmpage)
-{
-   KLASSERT(PageLocked(vmpage));
-   return (struct cl_page *)vmpage->private;
-}
-
-/**
  * Initialize or update CLIO structures for regular files when new
  * meta-data arrives from the server.
  *
-- 
1.9.1



[RESEND PATCH] Staging:speakup:add space around '|'

2016-02-01 Thread Bhumika Goyal
Fix checkpatch.pl check:CHECK: spaces preferred around that '|'.
Add spaces around operands to fix these warnings.

Signed-off-by: Bhumika Goyal <bhumi...@gmail.com>
---
 drivers/staging/speakup/speakup_decext.c | 24 
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/speakup/speakup_decext.c 
b/drivers/staging/speakup/speakup_decext.c
index fdd7488..1a5cf3d 100644
--- a/drivers/staging/speakup/speakup_decext.c
+++ b/drivers/staging/speakup/speakup_decext.c
@@ -67,30 +67,30 @@ static struct var_t vars[] = {
  * These attributes will appear in /sys/accessibility/speakup/decext.
  */
 static struct kobj_attribute caps_start_attribute =
-   __ATTR(caps_start, S_IWUSR|S_IRUGO, spk_var_show, spk_var_store);
+   __ATTR(caps_start, S_IWUSR | S_IRUGO, spk_var_show, spk_var_store);
 static struct kobj_attribute caps_stop_attribute =
-   __ATTR(caps_stop, S_IWUSR|S_IRUGO, spk_var_show, spk_var_store);
+   __ATTR(caps_stop, S_IWUSR | S_IRUGO, spk_var_show, spk_var_store);
 static struct kobj_attribute pitch_attribute =
-   __ATTR(pitch, S_IWUSR|S_IRUGO, spk_var_show, spk_var_store);
+   __ATTR(pitch, S_IWUSR | S_IRUGO, spk_var_show, spk_var_store);
 static struct kobj_attribute punct_attribute =
-   __ATTR(punct, S_IWUSR|S_IRUGO, spk_var_show, spk_var_store);
+   __ATTR(punct, S_IWUSR | S_IRUGO, spk_var_show, spk_var_store);
 static struct kobj_attribute rate_attribute =
-   __ATTR(rate, S_IWUSR|S_IRUGO, spk_var_show, spk_var_store);
+   __ATTR(rate, S_IWUSR | S_IRUGO, spk_var_show, spk_var_store);
 static struct kobj_attribute voice_attribute =
-   __ATTR(voice, S_IWUSR|S_IRUGO, spk_var_show, spk_var_store);
+   __ATTR(voice, S_IWUSR | S_IRUGO, spk_var_show, spk_var_store);
 static struct kobj_attribute vol_attribute =
-   __ATTR(vol, S_IWUSR|S_IRUGO, spk_var_show, spk_var_store);
+   __ATTR(vol, S_IWUSR | S_IRUGO, spk_var_show, spk_var_store);
 
 static struct kobj_attribute delay_time_attribute =
-   __ATTR(delay_time, S_IWUSR|S_IRUGO, spk_var_show, spk_var_store);
+   __ATTR(delay_time, S_IWUSR | S_IRUGO, spk_var_show, spk_var_store);
 static struct kobj_attribute direct_attribute =
-   __ATTR(direct, S_IWUSR|S_IRUGO, spk_var_show, spk_var_store);
+   __ATTR(direct, S_IWUSR | S_IRUGO, spk_var_show, spk_var_store);
 static struct kobj_attribute full_time_attribute =
-   __ATTR(full_time, S_IWUSR|S_IRUGO, spk_var_show, spk_var_store);
+   __ATTR(full_time, S_IWUSR | S_IRUGO, spk_var_show, spk_var_store);
 static struct kobj_attribute jiffy_delta_attribute =
-   __ATTR(jiffy_delta, S_IWUSR|S_IRUGO, spk_var_show, spk_var_store);
+   __ATTR(jiffy_delta, S_IWUSR | S_IRUGO, spk_var_show, spk_var_store);
 static struct kobj_attribute trigger_time_attribute =
-   __ATTR(trigger_time, S_IWUSR|S_IRUGO, spk_var_show, spk_var_store);
+   __ATTR(trigger_time, S_IWUSR | S_IRUGO, spk_var_show, spk_var_store);
 
 /*
  * Create a group of attributes so that we can create and destroy them all
-- 
1.9.1



[PATCH] Staging:octeon:removed blank line after {

2016-02-02 Thread Bhumika Goyal
Removed blank line after curly braces.
Found using checkpatch.pl.

Signed-off-by: Bhumika Goyal <bhumi...@gmail.com>
---
 drivers/staging/octeon/ethernet-rgmii.c | 4 
 1 file changed, 4 deletions(-)

diff --git a/drivers/staging/octeon/ethernet-rgmii.c 
b/drivers/staging/octeon/ethernet-rgmii.c
index 1055ee1..9353796 100644
--- a/drivers/staging/octeon/ethernet-rgmii.c
+++ b/drivers/staging/octeon/ethernet-rgmii.c
@@ -247,9 +247,7 @@ int cvm_oct_rgmii_init(struct net_device *dev)
if (((priv->imode == CVMX_HELPER_INTERFACE_MODE_GMII)
 && (priv->port == 0))
|| (priv->imode == CVMX_HELPER_INTERFACE_MODE_RGMII)) {
-
if (!octeon_is_simulation()) {
-
union cvmx_gmxx_rxx_int_en gmx_rx_int_en;
int interface = INTERFACE(priv->port);
int index = INDEX(priv->port);
@@ -283,9 +281,7 @@ void cvm_oct_rgmii_uninit(struct net_device *dev)
if (((priv->imode == CVMX_HELPER_INTERFACE_MODE_GMII)
 && (priv->port == 0))
|| (priv->imode == CVMX_HELPER_INTERFACE_MODE_RGMII)) {
-
if (!octeon_is_simulation()) {
-
union cvmx_gmxx_rxx_int_en gmx_rx_int_en;
int interface = INTERFACE(priv->port);
int index = INDEX(priv->port);
-- 
1.9.1



[PATCH] Staging:lustre:lustre:llite:Remove explicit NULL comparision

2016-01-23 Thread Bhumika Goyal
Replaced explicit NULL comparision with its simplier form.
Found using coccinelle:

@replace_rule@
expression e;
@@

-e == NULL
+ !e

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

diff --git a/drivers/staging/lustre/lustre/llite/dcache.c 
b/drivers/staging/lustre/lustre/llite/dcache.c
index 3d6745e..bc179e5 100644
--- a/drivers/staging/lustre/lustre/llite/dcache.c
+++ b/drivers/staging/lustre/lustre/llite/dcache.c
@@ -62,7 +62,7 @@ static void ll_release(struct dentry *de)
 
LASSERT(de != NULL);
lld = ll_d2d(de);
-   if (lld == NULL) /* NFS copies the de->d_op methods (bug 4655) */
+   if (!lld) /* NFS copies the de->d_op methods (bug 4655) */
return;
 
if (lld->lld_it) {
@@ -131,7 +131,7 @@ static int find_cbdata(struct inode *inode)
return rc;
 
lsm = ccc_inode_lsm_get(inode);
-   if (lsm == NULL)
+   if (!lsm)
return rc;
 
rc = obd_find_cbdata(sbi->ll_dt_exp, lsm, return_if_equal, NULL);
@@ -184,13 +184,13 @@ int ll_d_init(struct dentry *de)
de, de, de->d_parent, d_inode(de),
d_count(de));
 
-   if (de->d_fsdata == NULL) {
+   if (!de->d_fsdata) {
struct ll_dentry_data *lld;
 
lld = kzalloc(sizeof(*lld), GFP_NOFS);
if (likely(lld)) {
spin_lock(>d_lock);
-   if (likely(de->d_fsdata == NULL)) {
+   if (likely(!de->d_fsdata)) {
de->d_fsdata = lld;
__d_lustre_invalidate(de);
} else {
@@ -328,7 +328,7 @@ static int ll_revalidate_dentry(struct dentry *dentry,
if (lookup_flags & LOOKUP_RCU)
return -ECHILD;
 
-   do_statahead_enter(dir, , d_inode(dentry) == NULL);
+   do_statahead_enter(dir, , !d_inode(dentry));
ll_statahead_mark(dir, dentry);
return 1;
 }
-- 
1.9.1



[PATCH 0/2]Staging:lustre:obdclass:linux:fix checkpatch.pl warnings

2016-01-20 Thread Bhumika Goyal
This patch series addresses checkpatch.pl warnings in lustre driver.


Bhumika Goyal (2):
  Staging:lustre:obdclass:linux:remove unnecessary braces
  Staging:lustre:obdclass:linux:simplify NULL comparison

 drivers/staging/lustre/lustre/obdclass/linux/linux-module.c | 12 +---
 1 file changed, 5 insertions(+), 7 deletions(-)

-- 
1.9.1



[PATCH] staging:lustre:obdclass:linux:convert [0] to foo

2016-01-20 Thread Bhumika Goyal
Replace [0] with foo,to follow Linux coding style.

Signed-off-by: Bhumika Goyal <bhumi...@gmail.com>
---
 drivers/staging/lustre/lustre/obdclass/linux/linux-module.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c 
b/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c
index 11fe6cb..ecc2897 100644
--- a/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c
+++ b/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c
@@ -130,22 +130,22 @@ int obd_ioctl_getdata(char **buf, int *len, void *arg)
}
 
if (data->ioc_inllen1) {
-   data->ioc_inlbuf1 = >ioc_bulk[0];
+   data->ioc_inlbuf1 = data->ioc_bulk;
offset += cfs_size_round(data->ioc_inllen1);
}
 
if (data->ioc_inllen2) {
-   data->ioc_inlbuf2 = >ioc_bulk[0] + offset;
+   data->ioc_inlbuf2 = data->ioc_bulk + offset;
offset += cfs_size_round(data->ioc_inllen2);
}
 
if (data->ioc_inllen3) {
-   data->ioc_inlbuf3 = >ioc_bulk[0] + offset;
+   data->ioc_inlbuf3 = data->ioc_bulk + offset;
offset += cfs_size_round(data->ioc_inllen3);
}
 
if (data->ioc_inllen4)
-   data->ioc_inlbuf4 = >ioc_bulk[0] + offset;
+   data->ioc_inlbuf4 = data->ioc_bulk + offset;
 
return 0;
 
-- 
1.9.1



[PATCH 2/2] Staging:lustre:obdclass:linux:simplify NULL comparison

2016-01-20 Thread Bhumika Goyal
Remove explicit NULL comparision and replace it with a simpier form.
Detected using checkpatch.pl.

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

diff --git a/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c 
b/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c
index 9663ae3..11fe6cb 100644
--- a/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c
+++ b/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c
@@ -239,7 +239,7 @@ static ssize_t health_show(struct kobject *kobj, struct 
attribute *attr,
struct obd_device *obd;
 
obd = class_num2obd(i);
-   if (obd == NULL || !obd->obd_attached || !obd->obd_set_up)
+   if (!obd || !obd->obd_attached || !obd->obd_set_up)
continue;
 
LASSERT(obd->obd_magic == OBD_DEVICE_MAGIC);
@@ -358,7 +358,7 @@ static int obd_device_list_seq_show(struct seq_file *p, 
void *v)
struct obd_device *obd = class_num2obd((int)index);
char *status;
 
-   if (obd == NULL)
+   if (!obd)
return 0;
 
LASSERT(obd->obd_magic == OBD_DEVICE_MAGIC);
@@ -422,7 +422,7 @@ int class_procfs_init(void)
struct dentry *file;
 
lustre_kobj = kobject_create_and_add("lustre", fs_kobj);
-   if (lustre_kobj == NULL)
+   if (!lustre_kobj)
goto out;
 
/* Create the files associated with this kobject */
-- 
1.9.1



[PATCH 1/2] Staging:lustre:obdclass:linux:remove unnecessary braces

2016-01-20 Thread Bhumika Goyal
Fixed 'braces {} are not necessary for single statement blocks'
checkpatch.pl warning.

Signed-off-by: Bhumika Goyal <bhumi...@gmail.com>
---
 drivers/staging/lustre/lustre/obdclass/linux/linux-module.c | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c 
b/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c
index a055cbb..9663ae3 100644
--- a/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c
+++ b/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c
@@ -144,9 +144,8 @@ int obd_ioctl_getdata(char **buf, int *len, void *arg)
offset += cfs_size_round(data->ioc_inllen3);
}
 
-   if (data->ioc_inllen4) {
+   if (data->ioc_inllen4)
data->ioc_inlbuf4 = >ioc_bulk[0] + offset;
-   }
 
return 0;
 
@@ -250,9 +249,8 @@ static ssize_t health_show(struct kobject *kobj, struct 
attribute *attr,
class_incref(obd, __func__, current);
read_unlock(_dev_lock);
 
-   if (obd_health_check(NULL, obd)) {
+   if (obd_health_check(NULL, obd))
healthy = false;
-   }
class_decref(obd, __func__, current);
read_lock(_dev_lock);
}
-- 
1.9.1



[PATCH] Staging: rtl8723au: Remove function rtw_enqueue_{recvbuf23a/recvbuf23a_to_head}

2016-03-26 Thread Bhumika Goyal
The functions rtw_enqueue_recvbuf23a and rtw_enqueue_recvbuf23a_to_head
are never used anywhere in the kernel. So, remove their definition and
prototype.
Grepped to find occurences.

Signed-off-by: Bhumika Goyal <bhumi...@gmail.com>
---
 drivers/staging/rtl8723au/core/rtw_recv.c| 25 -
 drivers/staging/rtl8723au/include/rtw_recv.h |  2 --
 2 files changed, 27 deletions(-)

diff --git a/drivers/staging/rtl8723au/core/rtw_recv.c 
b/drivers/staging/rtl8723au/core/rtw_recv.c
index 989ed07..150dabc 100644
--- a/drivers/staging/rtl8723au/core/rtw_recv.c
+++ b/drivers/staging/rtl8723au/core/rtw_recv.c
@@ -211,31 +211,6 @@ u32 rtw_free_uc_swdec_pending_queue23a(struct rtw_adapter 
*adapter)
return cnt;
 }
 
-int rtw_enqueue_recvbuf23a_to_head(struct recv_buf *precvbuf, struct rtw_queue 
*queue)
-{
-   spin_lock_bh(>lock);
-
-   list_del_init(>list);
-   list_add(>list, get_list_head(queue));
-
-   spin_unlock_bh(>lock);
-
-   return _SUCCESS;
-}
-
-int rtw_enqueue_recvbuf23a(struct recv_buf *precvbuf, struct rtw_queue *queue)
-{
-   unsigned long irqL;
-
-   spin_lock_irqsave(>lock, irqL);
-
-   list_del_init(>list);
-
-   list_add_tail(>list, get_list_head(queue));
-   spin_unlock_irqrestore(>lock, irqL);
-   return _SUCCESS;
-}
-
 struct recv_buf *rtw_dequeue_recvbuf23a (struct rtw_queue *queue)
 {
unsigned long irqL;
diff --git a/drivers/staging/rtl8723au/include/rtw_recv.h 
b/drivers/staging/rtl8723au/include/rtw_recv.h
index dc784be..85a5edb 100644
--- a/drivers/staging/rtl8723au/include/rtw_recv.h
+++ b/drivers/staging/rtl8723au/include/rtw_recv.h
@@ -279,8 +279,6 @@ int rtw_enqueue_recvframe23a(struct recv_frame *precvframe, 
struct rtw_queue *qu
 
 u32 rtw_free_uc_swdec_pending_queue23a(struct rtw_adapter *adapter);
 
-int rtw_enqueue_recvbuf23a_to_head(struct recv_buf *precvbuf, struct rtw_queue 
*queue);
-int rtw_enqueue_recvbuf23a(struct recv_buf *precvbuf, struct rtw_queue *queue);
 struct recv_buf *rtw_dequeue_recvbuf23a(struct rtw_queue *queue);
 
 void rtw_reordering_ctrl_timeout_handler23a(unsigned long pcontext);
-- 
1.9.1



[PATCH] Staging: rtl8723au: Remove unused functions

2016-03-26 Thread Bhumika Goyal
The functions rtw_get_oper_bw23a and rtw_get_oper_ch23aoffset are never
used anywhere in the kernel. So, remove their definition and prototype.
Grepped to find occurences.

Signed-off-by: Bhumika Goyal <bhumi...@gmail.com>
---
 drivers/staging/rtl8723au/core/rtw_wlan_util.c   | 10 --
 drivers/staging/rtl8723au/include/rtw_mlme_ext.h |  2 --
 2 files changed, 12 deletions(-)

diff --git a/drivers/staging/rtl8723au/core/rtw_wlan_util.c 
b/drivers/staging/rtl8723au/core/rtw_wlan_util.c
index cc2b84b..694cf17 100644
--- a/drivers/staging/rtl8723au/core/rtw_wlan_util.c
+++ b/drivers/staging/rtl8723au/core/rtw_wlan_util.c
@@ -304,21 +304,11 @@ inline void rtw_set_oper_ch23a(struct rtw_adapter 
*adapter, u8 ch)
adapter_to_dvobj(adapter)->oper_channel = ch;
 }
 
-inline u8 rtw_get_oper_bw23a(struct rtw_adapter *adapter)
-{
-   return adapter_to_dvobj(adapter)->oper_bwmode;
-}
-
 inline void rtw_set_oper_bw23a(struct rtw_adapter *adapter, u8 bw)
 {
adapter_to_dvobj(adapter)->oper_bwmode = bw;
 }
 
-inline u8 rtw_get_oper_ch23aoffset(struct rtw_adapter *adapter)
-{
-   return adapter_to_dvobj(adapter)->oper_ch_offset;
-}
-
 inline void rtw_set_oper_ch23aoffset23a(struct rtw_adapter *adapter, u8 offset)
 {
adapter_to_dvobj(adapter)->oper_ch_offset = offset;
diff --git a/drivers/staging/rtl8723au/include/rtw_mlme_ext.h 
b/drivers/staging/rtl8723au/include/rtw_mlme_ext.h
index ea2a6c9..0e7d3da 100644
--- a/drivers/staging/rtl8723au/include/rtw_mlme_ext.h
+++ b/drivers/staging/rtl8723au/include/rtw_mlme_ext.h
@@ -461,9 +461,7 @@ void Update23aTblForSoftAP(u8 *bssrateset, u32 bssratelen);
 
 u8 rtw_get_oper_ch23a(struct rtw_adapter *adapter);
 void rtw_set_oper_ch23a(struct rtw_adapter *adapter, u8 ch);
-u8 rtw_get_oper_bw23a(struct rtw_adapter *adapter);
 void rtw_set_oper_bw23a(struct rtw_adapter *adapter, u8 bw);
-u8 rtw_get_oper_ch23aoffset(struct rtw_adapter *adapter);
 void rtw_set_oper_ch23aoffset23a(struct rtw_adapter *adapter, u8 offset);
 
 void set_channel_bwmode23a(struct rtw_adapter *padapter, unsigned char channel,
-- 
1.9.1



[PATCH] Staging: rts5208: Remove unused functions

2016-03-26 Thread Bhumika Goyal
The functions rtsx_disable_card_int, rtsx_undo_delink,
rtsx_check_link_ready are not used anywhere in the kernel. So,remove
their definition and prototype.

Signed-off-by: Bhumika Goyal <bhumi...@gmail.com>
---
 drivers/staging/rts5208/rtsx_chip.c | 35 ---
 drivers/staging/rts5208/rtsx_chip.h |  3 ---
 2 files changed, 38 deletions(-)

diff --git a/drivers/staging/rts5208/rtsx_chip.c 
b/drivers/staging/rts5208/rtsx_chip.c
index c0ce659..bcc4b66 100644
--- a/drivers/staging/rts5208/rtsx_chip.c
+++ b/drivers/staging/rts5208/rtsx_chip.c
@@ -43,14 +43,6 @@ static void rtsx_calibration(struct rtsx_chip *chip)
rtsx_write_phy_register(chip, 0x00, 0x0288);
 }
 
-void rtsx_disable_card_int(struct rtsx_chip *chip)
-{
-   u32 reg = rtsx_readl(chip, RTSX_BIER);
-
-   reg &= ~(XD_INT_EN | SD_INT_EN | MS_INT_EN);
-   rtsx_writel(chip, RTSX_BIER, reg);
-}
-
 void rtsx_enable_card_int(struct rtsx_chip *chip)
 {
u32 reg = rtsx_readl(chip, RTSX_BIER);
@@ -1447,12 +1439,6 @@ delink_stage:
rtsx_delink_stage(chip);
 }
 
-void rtsx_undo_delink(struct rtsx_chip *chip)
-{
-   chip->auto_delink_allowed = 0;
-   rtsx_write_register(chip, CHANGE_LINK_STATE, 0x0A, 0x00);
-}
-
 /**
  * rtsx_stop_cmd - stop command transfer and DMA transfer
  * @chip: Realtek's card reader chip
@@ -2000,27 +1986,6 @@ int rtsx_set_phy_reg_bit(struct rtsx_chip *chip, u8 reg, 
u8 bit)
return STATUS_SUCCESS;
 }
 
-int rtsx_check_link_ready(struct rtsx_chip *chip)
-{
-   int retval;
-   u8 val;
-
-   retval = rtsx_read_register(chip, IRQSTAT0, );
-   if (retval) {
-   rtsx_trace(chip);
-   return retval;
-   }
-
-   dev_dbg(rtsx_dev(chip), "IRQSTAT0: 0x%x\n", val);
-   if (val & LINK_RDY_INT) {
-   dev_dbg(rtsx_dev(chip), "Delinked!\n");
-   rtsx_write_register(chip, IRQSTAT0, LINK_RDY_INT, LINK_RDY_INT);
-   return STATUS_FAIL;
-   }
-
-   return STATUS_SUCCESS;
-}
-
 static void rtsx_handle_pm_dstate(struct rtsx_chip *chip, u8 dstate)
 {
u32 ultmp;
diff --git a/drivers/staging/rts5208/rtsx_chip.h 
b/drivers/staging/rts5208/rtsx_chip.h
index c295b1e..c08164f 100644
--- a/drivers/staging/rts5208/rtsx_chip.h
+++ b/drivers/staging/rts5208/rtsx_chip.h
@@ -950,7 +950,6 @@ do {
\
 int rtsx_force_power_on(struct rtsx_chip *chip, u8 ctl);
 int rtsx_force_power_down(struct rtsx_chip *chip, u8 ctl);
 
-void rtsx_disable_card_int(struct rtsx_chip *chip);
 void rtsx_enable_card_int(struct rtsx_chip *chip);
 void rtsx_enable_bus_int(struct rtsx_chip *chip);
 void rtsx_disable_bus_int(struct rtsx_chip *chip);
@@ -958,7 +957,6 @@ int rtsx_reset_chip(struct rtsx_chip *chip);
 int rtsx_init_chip(struct rtsx_chip *chip);
 void rtsx_release_chip(struct rtsx_chip *chip);
 void rtsx_polling_func(struct rtsx_chip *chip);
-void rtsx_undo_delink(struct rtsx_chip *chip);
 void rtsx_stop_cmd(struct rtsx_chip *chip, int card);
 int rtsx_write_register(struct rtsx_chip *chip, u16 addr, u8 mask, u8 data);
 int rtsx_read_register(struct rtsx_chip *chip, u16 addr, u8 *data);
@@ -975,7 +973,6 @@ int rtsx_read_efuse(struct rtsx_chip *chip, u8 addr, u8 
*val);
 int rtsx_write_efuse(struct rtsx_chip *chip, u8 addr, u8 val);
 int rtsx_clr_phy_reg_bit(struct rtsx_chip *chip, u8 reg, u8 bit);
 int rtsx_set_phy_reg_bit(struct rtsx_chip *chip, u8 reg, u8 bit);
-int rtsx_check_link_ready(struct rtsx_chip *chip);
 void rtsx_enter_ss(struct rtsx_chip *chip);
 void rtsx_exit_ss(struct rtsx_chip *chip);
 int rtsx_pre_handle_interrupt(struct rtsx_chip *chip);
-- 
1.9.1



[PATCH] Staging: rts5208: rtsx_card.c: Remove unused function

2016-03-26 Thread Bhumika Goyal
The functions double_depth, check_card_fail, check_card_ejected are not
used anywhere in the kernel. So, remove their prototype and definition.
Grepped to find occurences.

Signed-off-by: Bhumika Goyal <bhumi...@gmail.com>
---
 drivers/staging/rts5208/rtsx_card.c | 21 -
 drivers/staging/rts5208/rtsx_card.h |  2 --
 2 files changed, 23 deletions(-)

diff --git a/drivers/staging/rts5208/rtsx_card.c 
b/drivers/staging/rts5208/rtsx_card.c
index 437436f..231833a 100644
--- a/drivers/staging/rts5208/rtsx_card.c
+++ b/drivers/staging/rts5208/rtsx_card.c
@@ -628,11 +628,6 @@ void rtsx_init_cards(struct rtsx_chip *chip)
}
 }
 
-static inline u8 double_depth(u8 depth)
-{
-   return (depth > 1) ? (depth - 1) : depth;
-}
-
 int switch_ssc_clock(struct rtsx_chip *chip, int clk)
 {
int retval;
@@ -1184,22 +1179,6 @@ int check_card_wp(struct rtsx_chip *chip, unsigned int 
lun)
return 0;
 }
 
-int check_card_fail(struct rtsx_chip *chip, unsigned int lun)
-{
-   if (chip->card_fail & chip->lun2card[lun])
-   return 1;
-
-   return 0;
-}
-
-int check_card_ejected(struct rtsx_chip *chip, unsigned int lun)
-{
-   if (chip->card_ejected & chip->lun2card[lun])
-   return 1;
-
-   return 0;
-}
-
 u8 get_lun_card(struct rtsx_chip *chip, unsigned int lun)
 {
if ((chip->card_ready & chip->lun2card[lun]) == XD_CARD)
diff --git a/drivers/staging/rts5208/rtsx_card.h 
b/drivers/staging/rts5208/rtsx_card.h
index 8f2cf9a4e..56df9a4 100644
--- a/drivers/staging/rts5208/rtsx_card.h
+++ b/drivers/staging/rts5208/rtsx_card.h
@@ -1024,8 +1024,6 @@ int detect_card_cd(struct rtsx_chip *chip, int card);
 int check_card_exist(struct rtsx_chip *chip, unsigned int lun);
 int check_card_ready(struct rtsx_chip *chip, unsigned int lun);
 int check_card_wp(struct rtsx_chip *chip, unsigned int lun);
-int check_card_fail(struct rtsx_chip *chip, unsigned int lun);
-int check_card_ejected(struct rtsx_chip *chip, unsigned int lun);
 void eject_card(struct rtsx_chip *chip, unsigned int lun);
 u8 get_lun_card(struct rtsx_chip *chip, unsigned int lun);
 
-- 
1.9.1



[PATCH] media: platform: constify vb2_ops structures

2017-01-21 Thread Bhumika Goyal
Declare vb2_ops structures as const as they are only stored in
the ops field of a vb2_queue structure. This field is of type
const, so vb2_ops structures having same properties can be made
const too.
Done using Coccinelle:

@r1 disable optional_qualifier@
identifier i;
position p;
@@
static struct vb2_ops i@p={...};

@ok1@
identifier r1.i;
position p;
struct sta2x11_vip vip;
struct vb2_queue q;
@@
(
vip.vb_vidq.ops=@p
|
q.ops=@p
)

@bad@
position p!={r1.p,ok1.p};
identifier r1.i;
@@
i@p

@depends on !bad disable optional_qualifier@
identifier r1.i;
@@
+const
struct vb2_ops i;

Cross compiled the media/platform/blackfin/bfin_capture.o file for
blackfin architecture.

File size before:
  text data bss dec hex filename
  6776  176   069521b28 platform/blackfin/bfin_capture.o

File size after:
   textdata bss dec hex filename
   6816 136   069521b28 platform/blackfin/bfin_capture.o

File size before:
   textdata bss dec hex filename
  12852 456 272   13580350c platform/davinci/vpif_capture.o

File size after:
   textdata bss dec hex filename
  12932 360 272   1356434fc platform/davinci/vpif_capture.o

File size before:
   textdata bss dec hex filename
  12285 360 276   129213279 platform/davinci/vpif_display.o

File size after:
   textdata bss dec hex filename
  12365 296 276   129373289 platform/davinci/vpif_display.o

File size details before and after applying the patch remains the same for
drivers/media/platform/pxa_camera.o

Signed-off-by: Bhumika Goyal <bhumi...@gmail.com>
---
 drivers/media/platform/davinci/vpif_capture.c | 2 +-
 drivers/media/platform/davinci/vpif_display.c | 2 +-
 drivers/media/platform/mtk-mdp/mtk_mdp_m2m.c  | 2 +-
 drivers/media/platform/pxa_camera.c   | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/media/platform/davinci/vpif_capture.c 
b/drivers/media/platform/davinci/vpif_capture.c
index f791f5c..54c54d9 100644
--- a/drivers/media/platform/davinci/vpif_capture.c
+++ b/drivers/media/platform/davinci/vpif_capture.c
@@ -309,7 +309,7 @@ static void vpif_stop_streaming(struct vb2_queue *vq)
spin_unlock_irqrestore(>irqlock, flags);
 }
 
-static struct vb2_ops video_qops = {
+static const struct vb2_ops video_qops = {
.queue_setup= vpif_buffer_queue_setup,
.buf_prepare= vpif_buffer_prepare,
.start_streaming= vpif_start_streaming,
diff --git a/drivers/media/platform/davinci/vpif_display.c 
b/drivers/media/platform/davinci/vpif_display.c
index e5f1844..9604afd 100644
--- a/drivers/media/platform/davinci/vpif_display.c
+++ b/drivers/media/platform/davinci/vpif_display.c
@@ -289,7 +289,7 @@ static void vpif_stop_streaming(struct vb2_queue *vq)
spin_unlock_irqrestore(>irqlock, flags);
 }
 
-static struct vb2_ops video_qops = {
+static const struct vb2_ops video_qops = {
.queue_setup= vpif_buffer_queue_setup,
.wait_prepare   = vb2_ops_wait_prepare,
.wait_finish= vb2_ops_wait_finish,
diff --git a/drivers/media/platform/mtk-mdp/mtk_mdp_m2m.c 
b/drivers/media/platform/mtk-mdp/mtk_mdp_m2m.c
index 13afe48..3038d62 100644
--- a/drivers/media/platform/mtk-mdp/mtk_mdp_m2m.c
+++ b/drivers/media/platform/mtk-mdp/mtk_mdp_m2m.c
@@ -621,7 +621,7 @@ static void mtk_mdp_m2m_buf_queue(struct vb2_buffer *vb)
v4l2_m2m_buf_queue(ctx->m2m_ctx, to_vb2_v4l2_buffer(vb));
 }
 
-static struct vb2_ops mtk_mdp_m2m_qops = {
+static const struct vb2_ops mtk_mdp_m2m_qops = {
.queue_setup = mtk_mdp_m2m_queue_setup,
.buf_prepare = mtk_mdp_m2m_buf_prepare,
.buf_queue   = mtk_mdp_m2m_buf_queue,
diff --git a/drivers/media/platform/pxa_camera.c 
b/drivers/media/platform/pxa_camera.c
index 929006f..17167d1 100644
--- a/drivers/media/platform/pxa_camera.c
+++ b/drivers/media/platform/pxa_camera.c
@@ -1530,7 +1530,7 @@ static void pxac_vb2_stop_streaming(struct vb2_queue *vq)
pxa_camera_wakeup(pcdev, buf, VB2_BUF_STATE_ERROR);
 }
 
-static struct vb2_ops pxac_vb2_ops = {
+static const struct vb2_ops pxac_vb2_ops = {
.queue_setup= pxac_vb2_queue_setup,
.buf_init   = pxac_vb2_init,
.buf_prepare= pxac_vb2_prepare,
-- 
1.9.1



[PATCH] media: pci: constify vb2_ops structure

2017-01-21 Thread Bhumika Goyal
Declare vb2_ops structure as const as it is only stored in
the ops field of a vb2_queue structure. This field is of type
const, so vb2_ops structures having same properties can be made
const too.
Done using Coccinelle:

@r1 disable optional_qualifier@
identifier i;
position p;
@@
static struct vb2_ops i@p={...};

@ok1@
identifier r1.i;
position p;
struct sta2x11_vip vip;
struct vb2_queue q;
@@
(
vip.vb_vidq.ops=@p
|
q.ops=@p
)

@bad@
position p!={r1.p,ok1.p};
identifier r1.i;
@@
i@p

@depends on !bad disable optional_qualifier@
identifier r1.i;
@@
+const
struct vb2_ops i;

File size before:
   textdata bss dec hex filename
   8448 440   022b8 media/pci/sta2x11/sta2x11_vip.o

File size after:
   textdata bss dec hex filename
   8552 352   0890422c8 media/pci/sta2x11/sta2x11_vip.o

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

diff --git a/drivers/media/pci/sta2x11/sta2x11_vip.c 
b/drivers/media/pci/sta2x11/sta2x11_vip.c
index aeb2b4e..6343d24 100644
--- a/drivers/media/pci/sta2x11/sta2x11_vip.c
+++ b/drivers/media/pci/sta2x11/sta2x11_vip.c
@@ -377,7 +377,7 @@ static void stop_streaming(struct vb2_queue *vq)
spin_unlock(>lock);
 }
 
-static struct vb2_ops vip_video_qops = {
+static const struct vb2_ops vip_video_qops = {
.queue_setup= queue_setup,
.buf_init   = buffer_init,
.buf_prepare= buffer_prepare,
-- 
1.9.1



[PATCH] media: dvb-frontends: constify vb2_ops structure

2017-01-21 Thread Bhumika Goyal
Declare vb2_ops structure as const as it is only stored in
the ops field of a vb2_queue structure. This field is of type
const, so vb2_ops structures having same properties can be made
const too.
Done using Coccinelle:

@r1 disable optional_qualifier@
identifier i;
position p;
@@
static struct vb2_ops i@p={...};

@ok1@
identifier r1.i;
position p;
struct sta2x11_vip vip;
struct vb2_queue q;
@@
(
vip.vb_vidq.ops=@p
|
q.ops=@p
)

@bad@
position p!={r1.p,ok1.p};
identifier r1.i;
@@
i@p

@depends on !bad disable optional_qualifier@
identifier r1.i;
@@
+const
struct vb2_ops i;

File size details of media/dvb-frontends/rtl2832_sdr.o file remains the
same before and after applying the patch.

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

diff --git a/drivers/media/dvb-frontends/rtl2832_sdr.c 
b/drivers/media/dvb-frontends/rtl2832_sdr.c
index e038e88..c6e78d8 100644
--- a/drivers/media/dvb-frontends/rtl2832_sdr.c
+++ b/drivers/media/dvb-frontends/rtl2832_sdr.c
@@ -956,7 +956,7 @@ static void rtl2832_sdr_stop_streaming(struct vb2_queue *vq)
mutex_unlock(>v4l2_lock);
 }
 
-static struct vb2_ops rtl2832_sdr_vb2_ops = {
+static const struct vb2_ops rtl2832_sdr_vb2_ops = {
.queue_setup= rtl2832_sdr_queue_setup,
.buf_prepare= rtl2832_sdr_buf_prepare,
.buf_queue  = rtl2832_sdr_buf_queue,
-- 
1.9.1



[PATCH] mailbox: hi6220-mailbox: constify mbox_chan_ops structure

2017-01-21 Thread Bhumika Goyal
Declare mbox_chan_ops structure as const as it is only stored in the ops
field of a mbox_controller structure. This field is of type const, so
add const to structure declaration of mbox_chan_ops structure.

File size before:
   textdata bss dec hex filename
   2411 248   02659 a63 drivers/mailbox/hi6220-mailbox.o

File size after:
  text data bss dec hex filename
   2467 192   02659 a63 drivers/mailbox/hi6220-mailbox.o

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

diff --git a/drivers/mailbox/hi6220-mailbox.c b/drivers/mailbox/hi6220-mailbox.c
index 613722d..519376d 100644
--- a/drivers/mailbox/hi6220-mailbox.c
+++ b/drivers/mailbox/hi6220-mailbox.c
@@ -221,7 +221,7 @@ static void hi6220_mbox_shutdown(struct mbox_chan *chan)
mbox->irq_map_chan[mchan->ack_irq] = NULL;
 }
 
-static struct mbox_chan_ops hi6220_mbox_ops = {
+static const struct mbox_chan_ops hi6220_mbox_ops = {
.send_data= hi6220_mbox_send_data,
.startup  = hi6220_mbox_startup,
.shutdown = hi6220_mbox_shutdown,
-- 
2.7.4



[PATCH] firewire: core-device: constify device_type structures

2017-01-21 Thread Bhumika Goyal
Declare device_type structures as const as they are only stored in the type
field of a device structure. This field is of type const, so device_type
structures having similar properties can be declared const too.

File size before:
  text data bss dec hex filename
   8120 889  7290812379 drivers/firewire/core-device.o

File size after:
   textdata bss dec hex filename
   8248 761  7290812379 drivers/firewire/core-device.o

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

diff --git a/drivers/firewire/core-device.c b/drivers/firewire/core-device.c
index f9e3aee..9def58c 100644
--- a/drivers/firewire/core-device.c
+++ b/drivers/firewire/core-device.c
@@ -689,7 +689,7 @@ static void fw_unit_release(struct device *dev)
kfree(unit);
 }
 
-static struct device_type fw_unit_type = {
+static const struct device_type fw_unit_type = {
.uevent = fw_unit_uevent,
.release= fw_unit_release,
 };
@@ -849,7 +849,7 @@ static void fw_device_release(struct device *dev)
fw_card_put(card);
 }
 
-static struct device_type fw_device_type = {
+static const struct device_type fw_device_type = {
.release = fw_device_release,
 };
 
-- 
2.7.4



[PATCH] iio: industrialio-trigger: constify device_type structures

2017-01-21 Thread Bhumika Goyal
Declare device_type structure as const as it is only stored in the
type field of a device structure. This field is of type const, so add
const to declaration of device_type structure.

File size before:
   textdata bss dec hex filename
   5389 208  485645160d iio/industrialio-trigger.o

File size after:
   textdata bss dec hex filename
   5453 176  485677162d iio/industrialio-trigger.o

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

diff --git a/drivers/iio/industrialio-trigger.c 
b/drivers/iio/industrialio-trigger.c
index 978729f..3257f0e 100644
--- a/drivers/iio/industrialio-trigger.c
+++ b/drivers/iio/industrialio-trigger.c
@@ -487,7 +487,7 @@ static void iio_trig_release(struct device *device)
kfree(trig);
 }
 
-static struct device_type iio_trig_type = {
+static const struct device_type iio_trig_type = {
.release = iio_trig_release,
.groups = iio_trig_dev_groups,
 };
-- 
2.7.4



[PATCH] mailbox: mailbox-xgene-slimpro: constify mbox_chan_ops structure

2017-01-21 Thread Bhumika Goyal
Declare mbox_chan_ops structure as const as it is only stored in the ops
field of a mbox_controller structure. This field is of type const, so
add const to structure declaration of mbox_chan_ops structure.

File size before:
 text  data bss dec hex filename
   1592 248   01840 730 mailbox/mailbox-xgene-slimpro.o

File size after:
  text data bss dec hex filename
   1648 192   01840 730 mailbox/mailbox-xgene-slimpro.o

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

diff --git a/drivers/mailbox/mailbox-xgene-slimpro.c 
b/drivers/mailbox/mailbox-xgene-slimpro.c
index dd2afbc..a704016 100644
--- a/drivers/mailbox/mailbox-xgene-slimpro.c
+++ b/drivers/mailbox/mailbox-xgene-slimpro.c
@@ -174,7 +174,7 @@ static void slimpro_mbox_shutdown(struct mbox_chan *chan)
devm_free_irq(mb_chan->dev, mb_chan->irq, mb_chan);
 }
 
-static struct mbox_chan_ops slimpro_mbox_ops = {
+static const struct mbox_chan_ops slimpro_mbox_ops = {
.send_data = slimpro_mbox_send_data,
.startup = slimpro_mbox_startup,
.shutdown = slimpro_mbox_shutdown,
-- 
2.7.4



[PATCH] iio: adc: constify iio_info structures

2017-01-21 Thread Bhumika Goyal
Declare iio_info structures as const as they are only stored in
the info field of a iio_dev structure. This field is of type const,
so iio_info structures having similar properties can be made const too.

File size before:
   textdata bss dec hex filename
   6944 792   077361e38 drivers/iio/adc/ti-ads1015.o

File size after:
   text   data  bss dec hex filename
   7264 472   077361e38 drivers/iio/adc/ti-ads1015.o

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

diff --git a/drivers/iio/adc/ti-ads1015.c b/drivers/iio/adc/ti-ads1015.c
index cde6f13..422b314 100644
--- a/drivers/iio/adc/ti-ads1015.c
+++ b/drivers/iio/adc/ti-ads1015.c
@@ -472,14 +472,14 @@ static const struct attribute_group 
ads1115_attribute_group = {
.attrs = ads1115_attributes,
 };
 
-static struct iio_info ads1015_info = {
+static const struct iio_info ads1015_info = {
.driver_module  = THIS_MODULE,
.read_raw   = ads1015_read_raw,
.write_raw  = ads1015_write_raw,
.attrs  = _attribute_group,
 };
 
-static struct iio_info ads1115_info = {
+static const struct iio_info ads1115_info = {
.driver_module  = THIS_MODULE,
.read_raw   = ads1015_read_raw,
.write_raw  = ads1015_write_raw,
-- 
2.7.4



[PATCH] input: constify device_type structures

2017-01-23 Thread Bhumika Goyal
Declare device_type structures as const as they are only stored in the
type field of a device structure. This field is of type const, so add
const to declaration of device_type structures.

File size before:
   textdata bss dec hex filename
  171841344  80   1860848b0 drivers/input/input.o

File size after:
   textdata bss dec hex filename
  172481280  80   1860848b0 drivers/input/input.o

File size before:
   textdata bss dec hex filename
   2355 384   82747 abb drivers/input/rmi4/rmi_bus.o

File size after:
   textdata bss dec hex filename
   2483 264   82755 ac3 drivers/input/rmi4/rmi_bus.o

Signed-off-by: Bhumika Goyal <bhumi...@gmail.com>
---
 drivers/input/input.c| 2 +-
 drivers/input/rmi4/rmi_bus.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/input/input.c b/drivers/input/input.c
index d95c34e..6a75bb0 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -1749,7 +1749,7 @@ static int input_dev_poweroff(struct device *dev)
 };
 #endif /* CONFIG_PM */
 
-static struct device_type input_dev_type = {
+static const struct device_type input_dev_type = {
.groups = input_dev_attr_groups,
.release= input_dev_release,
.uevent = input_dev_uevent,
diff --git a/drivers/input/rmi4/rmi_bus.c b/drivers/input/rmi4/rmi_bus.c
index 1c40d94..213e318 100644
--- a/drivers/input/rmi4/rmi_bus.c
+++ b/drivers/input/rmi4/rmi_bus.c
@@ -55,7 +55,7 @@ static void rmi_release_device(struct device *dev)
kfree(rmi_dev);
 }
 
-static struct device_type rmi_device_type = {
+static const struct device_type rmi_device_type = {
.name   = "rmi4_sensor",
.release= rmi_release_device,
 };
@@ -134,7 +134,7 @@ static void rmi_release_function(struct device *dev)
kfree(fn);
 }
 
-static struct device_type rmi_function_type = {
+static const struct device_type rmi_function_type = {
.name   = "rmi4_function",
.release= rmi_release_function,
 };
-- 
1.9.1



[PATCH] nvdimm: constify device_type structures

2017-01-24 Thread Bhumika Goyal
Declare device_type structure as const as it is only stored in the
type field of a device structure. This field is of type const, so add
const to declaration of device_type structure.

File size before:
  text data bss dec hex filename
  192783199  16   2249357dd nvdimm/namespace_devs.o

File size after:
  text data bss dec hex filename
  199293160  16   231055a41 nvdimm/namespace_devs.o

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

diff --git a/drivers/nvdimm/namespace_devs.c b/drivers/nvdimm/namespace_devs.c
index 6307088..b8c40b8 100644
--- a/drivers/nvdimm/namespace_devs.c
+++ b/drivers/nvdimm/namespace_devs.c
@@ -52,17 +52,17 @@ static void namespace_blk_release(struct device *dev)
kfree(nsblk);
 }
 
-static struct device_type namespace_io_device_type = {
+static const struct device_type namespace_io_device_type = {
.name = "nd_namespace_io",
.release = namespace_io_release,
 };
 
-static struct device_type namespace_pmem_device_type = {
+static const struct device_type namespace_pmem_device_type = {
.name = "nd_namespace_pmem",
.release = namespace_pmem_release,
 };
 
-static struct device_type namespace_blk_device_type = {
+static const struct device_type namespace_blk_device_type = {
.name = "nd_namespace_blk",
.release = namespace_blk_release,
 };
-- 
2.7.4



[PATCH] mfd: constify regmap_irq_chip structures

2017-01-24 Thread Bhumika Goyal
Declare regmap_irq_chip structures as const as they are only stored
in the regmap_irq_chip field of a rk808 structure. This field is of
type const, so regmap_irq_chip structures having this property can be
made const too.
Done using Coccinelle:

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

@ok@
struct rk808 a;
identifier r.x;
position p;
@@
a.regmap_irq_chip=@p;

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

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

File size before:
   textdata bss dec hex filename
   5033 584  1656331601 drivers/mfd/rk808.o

File size after:
   textdata bss dec hex filename
   5225 392  1656331601 drivers/mfd/rk808.o

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

diff --git a/drivers/mfd/rk808.c b/drivers/mfd/rk808.c
index 2c9acdb..fd087cb 100644
--- a/drivers/mfd/rk808.c
+++ b/drivers/mfd/rk808.c
@@ -247,7 +247,7 @@ static const struct regmap_irq rk818_irqs[] = {
},
 };
 
-static struct regmap_irq_chip rk808_irq_chip = {
+static const struct regmap_irq_chip rk808_irq_chip = {
.name = "rk808",
.irqs = rk808_irqs,
.num_irqs = ARRAY_SIZE(rk808_irqs),
@@ -259,7 +259,7 @@ static struct regmap_irq_chip rk808_irq_chip = {
.init_ack_masked = true,
 };
 
-static struct regmap_irq_chip rk818_irq_chip = {
+static const struct regmap_irq_chip rk818_irq_chip = {
.name = "rk818",
.irqs = rk818_irqs,
.num_irqs = ARRAY_SIZE(rk818_irqs),
-- 
2.7.4



[PATCH] usb: musb: constify musb_hdrc_config structures

2017-01-24 Thread Bhumika Goyal
Declare musb_hdrc_config structures as const as they are only stored in
the config field of a musb_hdrc_platform_data structure. This field is of
type const, so musb_hdrc_config structures having this property can be
made const too.
Done using Coccinelle:

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

@ok@
struct musb_hdrc_platform_data pdata;
identifier r.x;
position p;
@@
pdata.config=@p;

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

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

File size before:
   textdata bss dec hex filename
   1212 338   01550 60e drivers/usb/musb/jz4740.o

File size after:
   textdata bss dec hex filename
   1268 290   01558 616 drivers/usb/musb/jz4740.o

File size before:
   textdata bss dec hex filename
   6151 333  1665001964 drivers/usb/musb/sunxi.o

File size after:
   textdata bss dec hex filename
   6215 269  1665001964 drivers/usb/musb/sunxi.o

File size before:
   textdata bss dec hex filename
   3668 864   0453211b4 drivers/usb/musb/ux500.o

File size after:
   textdata bss dec hex filename
   3724 808   0453211b4 drivers/usb/musb/ux500.o

Signed-off-by: Bhumika Goyal <bhumi...@gmail.com>
---
 drivers/usb/musb/jz4740.c | 2 +-
 drivers/usb/musb/sunxi.c  | 2 +-
 drivers/usb/musb/ux500.c  | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/musb/jz4740.c b/drivers/usb/musb/jz4740.c
index bc88899..40c68c2 100644
--- a/drivers/usb/musb/jz4740.c
+++ b/drivers/usb/musb/jz4740.c
@@ -63,7 +63,7 @@ static struct musb_fifo_cfg jz4740_musb_fifo_cfg[] = {
 { .hw_ep_num = 2, .style = FIFO_TX, .maxpacket = 64, },
 };
 
-static struct musb_hdrc_config jz4740_musb_config = {
+static const struct musb_hdrc_config jz4740_musb_config = {
/* Silicon does not implement USB OTG. */
.multipoint = 0,
/* Max EPs scanned, driver will decide which EP can be used. */
diff --git a/drivers/usb/musb/sunxi.c b/drivers/usb/musb/sunxi.c
index d0be0ea..64545de 100644
--- a/drivers/usb/musb/sunxi.c
+++ b/drivers/usb/musb/sunxi.c
@@ -645,7 +645,7 @@ static struct musb_fifo_cfg sunxi_musb_mode_cfg[] = {
MUSB_EP_FIFO_SINGLE(5, FIFO_RX, 512),
 };
 
-static struct musb_hdrc_config sunxi_musb_hdrc_config = {
+static const struct musb_hdrc_config sunxi_musb_hdrc_config = {
.fifo_cfg   = sunxi_musb_mode_cfg,
.fifo_cfg_size  = ARRAY_SIZE(sunxi_musb_mode_cfg),
.multipoint = true,
diff --git a/drivers/usb/musb/ux500.c b/drivers/usb/musb/ux500.c
index 3eaa4ba..5a57250 100644
--- a/drivers/usb/musb/ux500.c
+++ b/drivers/usb/musb/ux500.c
@@ -30,7 +30,7 @@
 
 #include "musb_core.h"
 
-static struct musb_hdrc_config ux500_musb_hdrc_config = {
+static const struct musb_hdrc_config ux500_musb_hdrc_config = {
.multipoint = true,
.dyn_fifo   = true,
.num_eps= 16,
-- 
2.7.4



[PATCH v2] sound: pci: cs46xx: constify snd_pcm_ops structures

2017-01-26 Thread Bhumika Goyal
Declare snd_pcm_ops structures as const as they are either stored in the
ops field of a snd_pcm_substream structure or passed as an argument to
the function snd_pcm_set_ops. The function argument and the ops field
are of type const, so snd_pcm_ops structures having this property
can be made const too.

File size before: sound/pci/cs46xx/cs46xx_lib.o
   textdata bss dec hex filename
  260475304  16   313677a87 sound/pci/cs46xx/cs46xx_lib.o

File size after: sound/pci/cs46xx/cs46xx_lib.o
   textdata bss dec hex filename
  273354036  16   313877a9b sound/pci/cs46xx/cs46xx_lib.o

Signed-off-by: Bhumika Goyal <bhumi...@gmail.com>
---
Changes in v2:
* test build the patch with CONFIG_SND_CS46XX_NEW_DSP=y

 sound/pci/cs46xx/cs46xx_lib.c | 40 
 1 file changed, 20 insertions(+), 20 deletions(-)

diff --git a/sound/pci/cs46xx/cs46xx_lib.c b/sound/pci/cs46xx/cs46xx_lib.c
index fde3cd4..9a8b41f 100644
--- a/sound/pci/cs46xx/cs46xx_lib.c
+++ b/sound/pci/cs46xx/cs46xx_lib.c
@@ -72,18 +72,18 @@
 static void amp_voyetra(struct snd_cs46xx *chip, int change);
 
 #ifdef CONFIG_SND_CS46XX_NEW_DSP
-static struct snd_pcm_ops snd_cs46xx_playback_rear_ops;
-static struct snd_pcm_ops snd_cs46xx_playback_indirect_rear_ops;
-static struct snd_pcm_ops snd_cs46xx_playback_clfe_ops;
-static struct snd_pcm_ops snd_cs46xx_playback_indirect_clfe_ops;
-static struct snd_pcm_ops snd_cs46xx_playback_iec958_ops;
-static struct snd_pcm_ops snd_cs46xx_playback_indirect_iec958_ops;
+static const struct snd_pcm_ops snd_cs46xx_playback_rear_ops;
+static const struct snd_pcm_ops snd_cs46xx_playback_indirect_rear_ops;
+static const struct snd_pcm_ops snd_cs46xx_playback_clfe_ops;
+static const struct snd_pcm_ops snd_cs46xx_playback_indirect_clfe_ops;
+static const struct snd_pcm_ops snd_cs46xx_playback_iec958_ops;
+static const struct snd_pcm_ops snd_cs46xx_playback_indirect_iec958_ops;
 #endif
 
-static struct snd_pcm_ops snd_cs46xx_playback_ops;
-static struct snd_pcm_ops snd_cs46xx_playback_indirect_ops;
-static struct snd_pcm_ops snd_cs46xx_capture_ops;
-static struct snd_pcm_ops snd_cs46xx_capture_indirect_ops;
+static const struct snd_pcm_ops snd_cs46xx_playback_ops;
+static const struct snd_pcm_ops snd_cs46xx_playback_indirect_ops;
+static const struct snd_pcm_ops snd_cs46xx_capture_ops;
+static const struct snd_pcm_ops snd_cs46xx_capture_indirect_ops;
 
 static unsigned short snd_cs46xx_codec_read(struct snd_cs46xx *chip,
unsigned short reg,
@@ -1654,7 +1654,7 @@ static int snd_cs46xx_capture_close(struct 
snd_pcm_substream *substream)
 }
 
 #ifdef CONFIG_SND_CS46XX_NEW_DSP
-static struct snd_pcm_ops snd_cs46xx_playback_rear_ops = {
+static const struct snd_pcm_ops snd_cs46xx_playback_rear_ops = {
.open = snd_cs46xx_playback_open_rear,
.close =snd_cs46xx_playback_close,
.ioctl =snd_pcm_lib_ioctl,
@@ -1665,7 +1665,7 @@ static int snd_cs46xx_capture_close(struct 
snd_pcm_substream *substream)
.pointer =  snd_cs46xx_playback_direct_pointer,
 };
 
-static struct snd_pcm_ops snd_cs46xx_playback_indirect_rear_ops = {
+static const struct snd_pcm_ops snd_cs46xx_playback_indirect_rear_ops = {
.open = snd_cs46xx_playback_open_rear,
.close =snd_cs46xx_playback_close,
.ioctl =snd_pcm_lib_ioctl,
@@ -1677,7 +1677,7 @@ static int snd_cs46xx_capture_close(struct 
snd_pcm_substream *substream)
.ack =  snd_cs46xx_playback_transfer,
 };
 
-static struct snd_pcm_ops snd_cs46xx_playback_clfe_ops = {
+static const struct snd_pcm_ops snd_cs46xx_playback_clfe_ops = {
.open = snd_cs46xx_playback_open_clfe,
.close =snd_cs46xx_playback_close,
.ioctl =snd_pcm_lib_ioctl,
@@ -1688,7 +1688,7 @@ static int snd_cs46xx_capture_close(struct 
snd_pcm_substream *substream)
.pointer =  snd_cs46xx_playback_direct_pointer,
 };
 
-static struct snd_pcm_ops snd_cs46xx_playback_indirect_clfe_ops = {
+static const struct snd_pcm_ops snd_cs46xx_playback_indirect_clfe_ops = {
.open = snd_cs46xx_playback_open_clfe,
.close =snd_cs46xx_playback_close,
.ioctl =snd_pcm_lib_ioctl,
@@ -1700,7 +1700,7 @@ static int snd_cs46xx_capture_close(struct 
snd_pcm_substream *substream)
.ack =  snd_cs46xx_playback_transfer,
 };
 
-static struct snd_pcm_ops snd_cs46xx_playback_iec958_ops = {
+static const struct snd_pcm_ops snd_cs46xx_playback_iec958_ops = {
.open = snd_cs46xx_playback_open_iec958,
.close =snd_cs46xx_playback_close_iec958,
.ioctl =snd_pcm_lib_ioctl,
@@ -1711,7 +1711,7 @@ static int snd_cs46xx_capture

[PATCH] sound: pci: cs46xx: constify snd_pcm_ops structures

2017-01-26 Thread Bhumika Goyal
Declare snd_pcm_ops structures as const as they are either stored in the
ops field of a snd_pcm_substream structure or passed as an argument to the
function snd_pcm_set_ops. The function argument and the ops field 
are of type const, so snd_pcm_ops structures having this property 
can be made const too.

File size before: sound/pci/cs46xx/cs46xx_lib.o
   textdata bss dec hex filename
  136691712   0   153813c15 sound/pci/cs46xx/cs46xx_lib.o

File size after: sound/pci/cs46xx/cs46xx_lib.o
   textdata bss dec hex filename
  141811216   0   153973c25 sound/pci/cs46xx/cs46xx_lib.o

Signed-off-by: Bhumika Goyal <bhumi...@gmail.com>
---
 sound/pci/cs46xx/cs46xx_lib.c | 38 +++---
 1 file changed, 19 insertions(+), 19 deletions(-)

diff --git a/sound/pci/cs46xx/cs46xx_lib.c b/sound/pci/cs46xx/cs46xx_lib.c
index fde3cd4..5d012f5 100644
--- a/sound/pci/cs46xx/cs46xx_lib.c
+++ b/sound/pci/cs46xx/cs46xx_lib.c
@@ -72,18 +72,18 @@
 static void amp_voyetra(struct snd_cs46xx *chip, int change);
 
 #ifdef CONFIG_SND_CS46XX_NEW_DSP
-static struct snd_pcm_ops snd_cs46xx_playback_rear_ops;
-static struct snd_pcm_ops snd_cs46xx_playback_indirect_rear_ops;
-static struct snd_pcm_ops snd_cs46xx_playback_clfe_ops;
-static struct snd_pcm_ops snd_cs46xx_playback_indirect_clfe_ops;
-static struct snd_pcm_ops snd_cs46xx_playback_iec958_ops;
-static struct snd_pcm_ops snd_cs46xx_playback_indirect_iec958_ops;
+static const struct snd_pcm_ops snd_cs46xx_playback_rear_ops;
+static const struct snd_pcm_ops snd_cs46xx_playback_indirect_rear_ops;
+static const struct snd_pcm_ops snd_cs46xx_playback_clfe_ops;
+static const struct snd_pcm_ops snd_cs46xx_playback_indirect_clfe_ops;
+static const struct snd_pcm_ops snd_cs46xx_playback_iec958_ops;
+static const struct snd_pcm_ops snd_cs46xx_playback_indirect_iec958_ops;
 #endif
 
-static struct snd_pcm_ops snd_cs46xx_playback_ops;
-static struct snd_pcm_ops snd_cs46xx_playback_indirect_ops;
-static struct snd_pcm_ops snd_cs46xx_capture_ops;
-static struct snd_pcm_ops snd_cs46xx_capture_indirect_ops;
+static const struct snd_pcm_ops snd_cs46xx_playback_ops;
+static const struct snd_pcm_ops snd_cs46xx_playback_indirect_ops;
+static const struct snd_pcm_ops snd_cs46xx_capture_ops;
+static const struct snd_pcm_ops snd_cs46xx_capture_indirect_ops;
 
 static unsigned short snd_cs46xx_codec_read(struct snd_cs46xx *chip,
unsigned short reg,
@@ -1665,7 +1665,7 @@ static struct snd_pcm_ops snd_cs46xx_playback_rear_ops = {
.pointer =  snd_cs46xx_playback_direct_pointer,
 };
 
-static struct snd_pcm_ops snd_cs46xx_playback_indirect_rear_ops = {
+static const struct snd_pcm_ops snd_cs46xx_playback_indirect_rear_ops = {
.open = snd_cs46xx_playback_open_rear,
.close =snd_cs46xx_playback_close,
.ioctl =snd_pcm_lib_ioctl,
@@ -1677,7 +1677,7 @@ static struct snd_pcm_ops 
snd_cs46xx_playback_indirect_rear_ops = {
.ack =  snd_cs46xx_playback_transfer,
 };
 
-static struct snd_pcm_ops snd_cs46xx_playback_clfe_ops = {
+static const struct snd_pcm_ops snd_cs46xx_playback_clfe_ops = {
.open = snd_cs46xx_playback_open_clfe,
.close =snd_cs46xx_playback_close,
.ioctl =snd_pcm_lib_ioctl,
@@ -1688,7 +1688,7 @@ static struct snd_pcm_ops snd_cs46xx_playback_clfe_ops = {
.pointer =  snd_cs46xx_playback_direct_pointer,
 };
 
-static struct snd_pcm_ops snd_cs46xx_playback_indirect_clfe_ops = {
+static const struct snd_pcm_ops snd_cs46xx_playback_indirect_clfe_ops = {
.open = snd_cs46xx_playback_open_clfe,
.close =snd_cs46xx_playback_close,
.ioctl =snd_pcm_lib_ioctl,
@@ -1700,7 +1700,7 @@ static struct snd_pcm_ops 
snd_cs46xx_playback_indirect_clfe_ops = {
.ack =  snd_cs46xx_playback_transfer,
 };
 
-static struct snd_pcm_ops snd_cs46xx_playback_iec958_ops = {
+static const struct snd_pcm_ops snd_cs46xx_playback_iec958_ops = {
.open = snd_cs46xx_playback_open_iec958,
.close =snd_cs46xx_playback_close_iec958,
.ioctl =snd_pcm_lib_ioctl,
@@ -1711,7 +1711,7 @@ static struct snd_pcm_ops snd_cs46xx_playback_iec958_ops 
= {
.pointer =  snd_cs46xx_playback_direct_pointer,
 };
 
-static struct snd_pcm_ops snd_cs46xx_playback_indirect_iec958_ops = {
+static const struct snd_pcm_ops snd_cs46xx_playback_indirect_iec958_ops = {
.open = snd_cs46xx_playback_open_iec958,
.close =snd_cs46xx_playback_close_iec958,
.ioctl =snd_pcm_lib_ioctl,
@@ -1725,7 +1725,7 @@ static struct snd_pcm_ops 
snd_cs46xx_playback_indirect_iec958_ops = {
 
 #endif
 
-static 

[PATCH] mmc: host: constify mmc_host_ops structures

2017-01-26 Thread Bhumika Goyal
Declare mmc_host_ops structures as const as they are only stored in the
ops field of a mmc_host structure. This field is of type const, so
mmc_host_ops structures having this property can be made const too.
Done using Coccinelle:

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

@ok@
struct mmc_host mmc;
identifier r.x;
position p;
@@
mmc.ops=@p;

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

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

File size details before and after patching.
First line of every .o file shows the file size before patching
and second line shows the size after patching.

   textdata bss dec hex filename

   4710 344   0505413be drivers/mmc/host/moxart-mmc.o
   4854 192   0504613b6 drivers/mmc/host/moxart-mmc.o

  10743 344   0   110872b4f drivers/mmc/host/mtk-sd.o
  10887 192   0   110792b47 drivers/mmc/host/mtk-sd.o

   2760 376   43140 c44 drivers/mmc/host/sdricoh_cs.o
   2920 240   43164 c5c drivers/mmc/host/sdricoh_cs.o

   9485 344   098292665 drivers/mmc/host/sh_mmcif.o
   9645 192   09837266d drivers/mmc/host/sh_mmcif.o

   7281 344   076251dc9 drivers/mmc/host/sunxi-mmc.o
   7441 192   076331dd1 drivers/mmc/host/sunxi-mmc.o

   4982 408   05390150e drivers/mmc/host/toshsd.o
   5142 264   05406151e drivers/mmc/host/toshsd.o

  11239 344   0   115832d3f drivers/mmc/host/usdhi6rol0.o
  11391 192   0   115832d3f drivers/mmc/host/usdhi6rol0.o

  19444 541  29   200144e2e drivers/mmc/host/vub300.o
  19604 381  29   200144e2e drivers/mmc/host/vub300.o

   5487 376   0586316e7 drivers/mmc/host/wmt-sdmmc.o
   5639 220   0585916e3 drivers/mmc/host/wmt-sdmmc.o

Signed-off-by: Bhumika Goyal <bhumi...@gmail.com>
---
 drivers/mmc/host/moxart-mmc.c | 2 +-
 drivers/mmc/host/mtk-sd.c | 2 +-
 drivers/mmc/host/sdricoh_cs.c | 2 +-
 drivers/mmc/host/sh_mmcif.c   | 2 +-
 drivers/mmc/host/sunxi-mmc.c  | 2 +-
 drivers/mmc/host/toshsd.c | 2 +-
 drivers/mmc/host/usdhi6rol0.c | 2 +-
 drivers/mmc/host/vub300.c | 2 +-
 drivers/mmc/host/wmt-sdmmc.c  | 2 +-
 9 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/mmc/host/moxart-mmc.c b/drivers/mmc/host/moxart-mmc.c
index bbad309..ac07dab 100644
--- a/drivers/mmc/host/moxart-mmc.c
+++ b/drivers/mmc/host/moxart-mmc.c
@@ -548,7 +548,7 @@ static int moxart_get_ro(struct mmc_host *mmc)
return !!(readl(host->base + REG_STATUS) & WRITE_PROT);
 }
 
-static struct mmc_host_ops moxart_ops = {
+static const struct mmc_host_ops moxart_ops = {
.request = moxart_request,
.set_ios = moxart_set_ios,
.get_ro = moxart_get_ro,
diff --git a/drivers/mmc/host/mtk-sd.c b/drivers/mmc/host/mtk-sd.c
index 10ef2ae..fa0c331 100644
--- a/drivers/mmc/host/mtk-sd.c
+++ b/drivers/mmc/host/mtk-sd.c
@@ -1467,7 +1467,7 @@ static void msdc_hw_reset(struct mmc_host *mmc)
sdr_clr_bits(host->base + EMMC_IOCON, 1);
 }
 
-static struct mmc_host_ops mt_msdc_ops = {
+static const struct mmc_host_ops mt_msdc_ops = {
.post_req = msdc_post_req,
.pre_req = msdc_pre_req,
.request = msdc_ops_request,
diff --git a/drivers/mmc/host/sdricoh_cs.c b/drivers/mmc/host/sdricoh_cs.c
index 5ff26ab..6732753 100644
--- a/drivers/mmc/host/sdricoh_cs.c
+++ b/drivers/mmc/host/sdricoh_cs.c
@@ -388,7 +388,7 @@ static int sdricoh_get_ro(struct mmc_host *mmc)
return (status & STATUS_CARD_LOCKED);
 }
 
-static struct mmc_host_ops sdricoh_ops = {
+static const struct mmc_host_ops sdricoh_ops = {
.request = sdricoh_request,
.set_ios = sdricoh_set_ios,
.get_ro = sdricoh_get_ro,
diff --git a/drivers/mmc/host/sh_mmcif.c b/drivers/mmc/host/sh_mmcif.c
index 9007784..93cff28 100644
--- a/drivers/mmc/host/sh_mmcif.c
+++ b/drivers/mmc/host/sh_mmcif.c
@@ -1095,7 +1095,7 @@ static int sh_mmcif_get_cd(struct mmc_host *mmc)
return p->get_cd(host->pd);
 }
 
-static struct mmc_host_ops sh_mmcif_ops = {
+static const struct mmc_host_ops sh_mmcif_ops = {
.request= sh_mmcif_request,
.set_ios= sh_mmcif_set_ios,
.get_cd = sh_mmcif_get_cd,
diff --git a/drivers/mmc/host/sunxi-mmc.c b/drivers/mmc/host/sunxi-mmc.c
index b1d1303..e75e11a 100644
--- a/drivers/mmc/host/sunxi-mmc.c
+++ b/drivers/mmc/host/sunxi-mmc.c
@@ -1033,7 +1033,7 @@ static int sunxi_mmc_card_busy(struct mmc_host *mmc)
return !!(mmc_readl(host, REG_STAS) & SDXC_CARD_DATA_BUSY);
 }
 
-static struct mmc_host_ops sunxi_mmc_ops = {
+static const struct mmc_host_ops sunxi_mmc_ops = {
.request = sunxi_mmc_request,
.set_ios = sunx

[PATCH] i2c: busses: constify i2c_algorithm structures

2017-01-27 Thread Bhumika Goyal
Declare i2c_algorithm structures as const as they are only stored in the
algo field of an i2c_adapter structure. This field is of type const, so
i2c_algorithm structures having this property can be made const too.
Done using Coccinelle:

@r disable optional_qualifier@
identifier i;
position p;
@@
static struct i2c_algorithm i@p={...};

@ok@
identifier r.i,x;
position p;
struct i2c_adapter adapter;
struct xlr_i2c_private  priv;
@@
(
adapter.algo=@p;
|
priv.adap.algo=@p;
)

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

@depends on !bad disable optional_qualifier@
identifier r.i;
@@
+const
struct i2c_algorithm i;

File size details before and after patching.
First line of every .o file shows the file size before patching
and second line shows the size after patching.

   textdata bss dec hex filename

   91381328   8   1047428ea drivers/i2c/busses/i2c-at91.o
   91781280   8   1046628e2 drivers/i2c/busses/i2c-at91.o

   7555 657   88220201c i2c/busses/i2c-designware-core.o
   7619 617   882442034 i2c/busses/i2c-designware-core.o

   72402240 12096002580 drivers/i2c/busses/i2c-eg20t.o
   73042176 12096002580 drivers/i2c/busses/i2c-eg20t.o

   2399 248   82655 a5f drivers/i2c/busses/i2c-emev2.o
   2455 192   82655 a5f drivers/i2c/busses/i2c-emev2.o

   3766 688   84462116e i2c/busses/i2c-imx-lpi2c.o
   3814 632   844541166 i2c/busses/i2c-imx-lpi2c.o

  117934280  16   160893ed9 drivers/i2c/busses/i2c-imx.o
  118574216  16   160893ed9 drivers/i2c/busses/i2c-imx.o

   4046 656   847101266 drivers/i2c/busses/i2c-nforce2.o
   4110 592   847101266 drivers/i2c/busses/i2c-nforce2.o

   1397 464   01861 745 i2c/busses/i2c-robotfuzz-osif.o
   1437 408   01845 735 i2c/busses/i2c-robotfuzz-osif.o

   96221216  16   108542a66 i2c/busses/i2c-sh_mobile.o
   96621160  16   108382a56 i2c/busses/i2c-sh_mobile.o

   4936 576   855201590 drivers/i2c/busses/i2c-st.o
   5000 512   855201590 drivers/i2c/busses/i2c-st.o

   3404 248   83660 e4c i2c/busses/i2c-xgene-slimpro.o
   3460 192   83660 e4c i2c/busses/i2c-xgene-slimpro.o

   2741 600   83349 d15 drivers/i2c/busses/i2c-xlp9xx.o
   2797 544   83349 d15 drivers/i2c/busses/i2c-xlp9xx.o

   2643 248   82899 b53 drivers/i2c/busses/i2c-xlr.o
   2707 192   82907 b5b drivers/i2c/busses/i2c-xlr.o

Signed-off-by: Bhumika Goyal <bhumi...@gmail.com>
---
 drivers/i2c/busses/i2c-at91.c| 2 +-
 drivers/i2c/busses/i2c-bfin-twi.c| 2 +-
 drivers/i2c/busses/i2c-designware-core.c | 2 +-
 drivers/i2c/busses/i2c-eg20t.c   | 2 +-
 drivers/i2c/busses/i2c-emev2.c   | 2 +-
 drivers/i2c/busses/i2c-imx-lpi2c.c   | 2 +-
 drivers/i2c/busses/i2c-imx.c | 2 +-
 drivers/i2c/busses/i2c-nforce2.c | 2 +-
 drivers/i2c/busses/i2c-robotfuzz-osif.c  | 2 +-
 drivers/i2c/busses/i2c-sh_mobile.c   | 2 +-
 drivers/i2c/busses/i2c-st.c  | 2 +-
 drivers/i2c/busses/i2c-xgene-slimpro.c   | 2 +-
 drivers/i2c/busses/i2c-xlp9xx.c  | 2 +-
 drivers/i2c/busses/i2c-xlr.c | 2 +-
 14 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/drivers/i2c/busses/i2c-at91.c b/drivers/i2c/busses/i2c-at91.c
index 0b86c61..e4fcb0c 100644
--- a/drivers/i2c/busses/i2c-at91.c
+++ b/drivers/i2c/busses/i2c-at91.c
@@ -820,7 +820,7 @@ static u32 at91_twi_func(struct i2c_adapter *adapter)
| I2C_FUNC_SMBUS_READ_BLOCK_DATA;
 }
 
-static struct i2c_algorithm at91_twi_algorithm = {
+static const struct i2c_algorithm at91_twi_algorithm = {
.master_xfer= at91_twi_xfer,
.functionality  = at91_twi_func,
 };
diff --git a/drivers/i2c/busses/i2c-bfin-twi.c 
b/drivers/i2c/busses/i2c-bfin-twi.c
index 29d00c4..9fe942b 100644
--- a/drivers/i2c/busses/i2c-bfin-twi.c
+++ b/drivers/i2c/busses/i2c-bfin-twi.c
@@ -563,7 +563,7 @@ static u32 bfin_twi_functionality(struct i2c_adapter *adap)
   I2C_FUNC_I2C | I2C_FUNC_SMBUS_I2C_BLOCK;
 }
 
-static struct i2c_algorithm bfin_twi_algorithm = {
+static const struct i2c_algorithm bfin_twi_algorithm = {
.master_xfer   = bfin_twi_master_xfer,
.smbus_xfer= bfin_twi_smbus_xfer,
.functionality = bfin_twi_functionality,
diff --git a/drivers/i2c/busses/i2c-designware-core.c 
b/drivers/i2c/busses/i2c-designware-core.c
index 6d81c56..a62c14c 100644
--- a/drivers/i2c/busses/i2c-designware-core.c
+++ b/drivers/i2c/busses/i2c-designware-core.c
@@ -822,7 +822,7 @@ static u32 i2c_dw_func(struct i2c_adapter *adap)
return dev->functionality;
 }
 
-static struct i2c_algorithm i2c_dw_algo = {
+static const struct i2c_algorithm i2

[PATCH] regulator: aat2870-regulator: constify regulator_ops structure

2017-01-28 Thread Bhumika Goyal
Declare regulator_ops structure as const as it is only stored in the ops
field of a regulator_desc structure. This field is of type const, so
regulator_ops structures having this property can be made const too.

File size before: drivers/regulator/aat2870-regulator.o
   textdata bss dec hex filename
9381424   02362 93a regulator/aat2870-regulator.o

File size after: drivers/regulator/aat2870-regulator.o
   textdata bss dec hex filename
   11941168   02362 93a regulator/aat2870-regulator.o

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

diff --git a/drivers/regulator/aat2870-regulator.c 
b/drivers/regulator/aat2870-regulator.c
index 9dfabda..afc5b59 100644
--- a/drivers/regulator/aat2870-regulator.c
+++ b/drivers/regulator/aat2870-regulator.c
@@ -97,7 +97,7 @@ static int aat2870_ldo_is_enabled(struct regulator_dev *rdev)
return val & ri->enable_mask ? 1 : 0;
 }
 
-static struct regulator_ops aat2870_ldo_ops = {
+static const struct regulator_ops aat2870_ldo_ops = {
.list_voltage = regulator_list_voltage_table,
.map_voltage = regulator_map_voltage_ascend,
.set_voltage_sel = aat2870_ldo_set_voltage_sel,
-- 
1.9.1



[PATCH] regulator: pcap-regulator: constify regulator_ops structure

2017-01-28 Thread Bhumika Goyal
Declare regulator_ops structure as const as it is only stored in the ops
field of a regulator_desc structure. This field is of type const, so
regulator_ops structures having this property can be made const too.

File size before: drivers/regulator/pcap-regulator.o
   textdata bss dec hex filename
   5503 564   0606717b3 regulator/pcap-regulator.o

File size after: drivers/regulator/pcap-regulator.o
   textdata bss dec hex filename
   5759 308   0606717b3 regulator/pcap-regulator.o

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

diff --git a/drivers/regulator/pcap-regulator.c 
b/drivers/regulator/pcap-regulator.c
index 9b16e61..79cb971 100644
--- a/drivers/regulator/pcap-regulator.c
+++ b/drivers/regulator/pcap-regulator.c
@@ -210,7 +210,7 @@ static int pcap_regulator_is_enabled(struct regulator_dev 
*rdev)
return (tmp >> vreg->en) & 1;
 }
 
-static struct regulator_ops pcap_regulator_ops = {
+static const struct regulator_ops pcap_regulator_ops = {
.list_voltage   = regulator_list_voltage_table,
.set_voltage_sel = pcap_regulator_set_voltage_sel,
.get_voltage_sel = pcap_regulator_get_voltage_sel,
-- 
1.9.1



[PATCH] regulator: pv88080-regulator: constify regulator_ops structure

2017-01-28 Thread Bhumika Goyal
Declare regulator_ops structure as const as it is only stored in the ops
field of a regulator_desc structure. This field is of type const, so
regulator_ops structures having this property can be made const too.

File size before: drivers/regulator/pv88080-regulator.o
   textdata bss dec hex filename
   38281808   85644160c regulator/pv88080-regulator.o

File size after: drivers/regulator/pv88080-regulator.o
   textdata bss dec hex filename
   43401296   85644160c regulator/pv88080-regulator.o

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

diff --git a/drivers/regulator/pv88080-regulator.c 
b/drivers/regulator/pv88080-regulator.c
index 954a20e..9a08cb2 100644
--- a/drivers/regulator/pv88080-regulator.c
+++ b/drivers/regulator/pv88080-regulator.c
@@ -306,7 +306,7 @@ static int pv88080_get_current_limit(struct regulator_dev 
*rdev)
return info->current_limits[data];
 }
 
-static struct regulator_ops pv88080_buck_ops = {
+static const struct regulator_ops pv88080_buck_ops = {
.get_mode = pv88080_buck_get_mode,
.set_mode = pv88080_buck_set_mode,
.enable = regulator_enable_regmap,
@@ -319,7 +319,7 @@ static int pv88080_get_current_limit(struct regulator_dev 
*rdev)
.get_current_limit = pv88080_get_current_limit,
 };
 
-static struct regulator_ops pv88080_hvbuck_ops = {
+static const struct regulator_ops pv88080_hvbuck_ops = {
.enable = regulator_enable_regmap,
.disable = regulator_disable_regmap,
.is_enabled = regulator_is_enabled_regmap,
-- 
1.9.1



[PATCH] regulator: ad5398: constify regulator_ops structure

2017-01-28 Thread Bhumika Goyal
Declare regulator_ops structure as const as it is only stored in the ops
field of a regulator_desc structure. This field is of type const, so
regulator_ops structures having this property can be made const too.

File size before: drivers/regulator/ad5398.o
   textdata bss dec hex filename
   1707 672   02379 94b drivers/regulator/ad5398.o

File size after: drivers/regulator/ad5398.o
   textdata bss dec hex filename
   1963 416   02379 94b drivers/regulator/ad5398.o

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

diff --git a/drivers/regulator/ad5398.c b/drivers/regulator/ad5398.c
index 8b0f788..11c1f88 100644
--- a/drivers/regulator/ad5398.c
+++ b/drivers/regulator/ad5398.c
@@ -181,7 +181,7 @@ static int ad5398_disable(struct regulator_dev *rdev)
return ret;
 }
 
-static struct regulator_ops ad5398_ops = {
+static const struct regulator_ops ad5398_ops = {
.get_current_limit = ad5398_get_current_limit,
.set_current_limit = ad5398_set_current_limit,
.enable = ad5398_enable,
-- 
1.9.1



[PATCH] regulator: act8945a-regulator: constify regulator_ops structure

2017-01-28 Thread Bhumika Goyal
Declare regulator_ops structure as const as it is only stored in the ops
field of a regulator_desc structure. This field is of type const, so
regulator_ops structures having this property can be made const too.

File size before: drivers/regulator/act8945a-regulator.o
   textdata bss dec hex filename
   3680 464   041441030 regulator/act8945a-regulator.o

File size after: drivers/regulator/act8945a-regulator.o
   textdata bss dec hex filename
   3936 192   041281020 regulator/act8945a-regulator.o

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

diff --git a/drivers/regulator/act8945a-regulator.c 
b/drivers/regulator/act8945a-regulator.c
index 441864b..43fda8b 100644
--- a/drivers/regulator/act8945a-regulator.c
+++ b/drivers/regulator/act8945a-regulator.c
@@ -69,7 +69,7 @@ enum {
REGULATOR_LINEAR_RANGE(240, 48, 63, 10),
 };
 
-static struct regulator_ops act8945a_ops = {
+static const struct regulator_ops act8945a_ops = {
.list_voltage   = regulator_list_voltage_linear_range,
.map_voltage= regulator_map_voltage_linear_range,
.get_voltage_sel= regulator_get_voltage_sel_regmap,
-- 
1.9.1



[PATCH] regulator: as3711-regulator: constify regulator_ops structure

2017-01-28 Thread Bhumika Goyal
Declare regulator_ops structure as const as it is only stored in the ops
field of a regulator_desc structure. This field is of type const, so
regulator_ops structures having this property can be made const too.

File size before: drivers/regulator/as3711-regulator.o
   textdata bss dec hex filename
   15174144   05661161d regulator/as3711-regulator.o

File size after: drivers/regulator/as3711-regulator.o
   textdata bss dec hex filename
   23013376   05677162d regulator/as3711-regulator.o

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

diff --git a/drivers/regulator/as3711-regulator.c 
b/drivers/regulator/as3711-regulator.c
index c0e93b1..874d415 100644
--- a/drivers/regulator/as3711-regulator.c
+++ b/drivers/regulator/as3711-regulator.c
@@ -82,7 +82,7 @@ static unsigned int as3711_get_mode_sd(struct regulator_dev 
*rdev)
return -EINVAL;
 }
 
-static struct regulator_ops as3711_sd_ops = {
+static const struct regulator_ops as3711_sd_ops = {
.is_enabled = regulator_is_enabled_regmap,
.enable = regulator_enable_regmap,
.disable= regulator_disable_regmap,
@@ -94,7 +94,7 @@ static unsigned int as3711_get_mode_sd(struct regulator_dev 
*rdev)
.set_mode   = as3711_set_mode_sd,
 };
 
-static struct regulator_ops as3711_aldo_ops = {
+static const struct regulator_ops as3711_aldo_ops = {
.is_enabled = regulator_is_enabled_regmap,
.enable = regulator_enable_regmap,
.disable= regulator_disable_regmap,
@@ -104,7 +104,7 @@ static unsigned int as3711_get_mode_sd(struct regulator_dev 
*rdev)
.map_voltage= regulator_map_voltage_linear_range,
 };
 
-static struct regulator_ops as3711_dldo_ops = {
+static const struct regulator_ops as3711_dldo_ops = {
.is_enabled = regulator_is_enabled_regmap,
.enable = regulator_enable_regmap,
.disable= regulator_disable_regmap,
-- 
1.9.1



[PATCH] regulator: max14577-regulator: constify regulator_ops structure

2017-01-28 Thread Bhumika Goyal
Declare regulator_ops structure as const as it is only stored in the ops
field of a regulator_desc structure. This field is of type const, so
regulator_ops structures having this property can be made const too.

File size before: drivers/regulator/max14577-regulator.o
   textdata bss dec hex filename
   2646 976   03622 e26 regulator/max14577-regulator.o

File size after: drivers/regulator/max14577-regulator.o
   textdata bss dec hex filename
   3414 192   03606 e16 regulator/max14577-regulator.o

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

diff --git a/drivers/regulator/max14577-regulator.c 
b/drivers/regulator/max14577-regulator.c
index c9ff261..0db288c 100644
--- a/drivers/regulator/max14577-regulator.c
+++ b/drivers/regulator/max14577-regulator.c
@@ -85,14 +85,14 @@ static int max14577_reg_set_current_limit(struct 
regulator_dev *rdev,
reg_data);
 }
 
-static struct regulator_ops max14577_safeout_ops = {
+static const struct regulator_ops max14577_safeout_ops = {
.is_enabled = regulator_is_enabled_regmap,
.enable = regulator_enable_regmap,
.disable= regulator_disable_regmap,
.list_voltage   = regulator_list_voltage_linear,
 };
 
-static struct regulator_ops max14577_charger_ops = {
+static const struct regulator_ops max14577_charger_ops = {
.is_enabled = max14577_reg_is_enabled,
.enable = regulator_enable_regmap,
.disable= regulator_disable_regmap,
@@ -130,7 +130,7 @@ static int max14577_reg_set_current_limit(struct 
regulator_dev *rdev,
[MAX14577_CHARGER] = MAX14577_CHARGER_REG,
 };
 
-static struct regulator_ops max77836_ldo_ops = {
+static const struct regulator_ops max77836_ldo_ops = {
.is_enabled = regulator_is_enabled_regmap,
.enable = regulator_enable_regmap,
.disable= regulator_disable_regmap,
-- 
1.9.1



[PATCH] regulator: max77802-regulator: constify regulator_ops structure

2017-01-28 Thread Bhumika Goyal
Declare regulator_ops structure as const as it is only stored in the ops
field of a regulator_desc structure. This field is of type const, so
regulator_ops structures having this property can be made const too.

File size before: drivers/regulator/max77802-regulator.o
   textdata bss dec hex filename
  118111552   0   133633433 regulator/max77802-regulator.o

File size after: drivers/regulator/max77802-regulator.o
   textdata bss dec hex filename
  13091 272   0   133633433 regulator/max77802-regulator.o

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

diff --git a/drivers/regulator/max77802-regulator.c 
b/drivers/regulator/max77802-regulator.c
index 1d35393..b626190 100644
--- a/drivers/regulator/max77802-regulator.c
+++ b/drivers/regulator/max77802-regulator.c
@@ -288,7 +288,7 @@ static int max77802_set_ramp_delay_4bit(struct 
regulator_dev *rdev,
 /*
  * LDOs 2, 4-19, 22-35
  */
-static struct regulator_ops max77802_ldo_ops_logic1 = {
+static const struct regulator_ops max77802_ldo_ops_logic1 = {
.list_voltage   = regulator_list_voltage_linear,
.map_voltage= regulator_map_voltage_linear,
.is_enabled = regulator_is_enabled_regmap,
@@ -304,7 +304,7 @@ static int max77802_set_ramp_delay_4bit(struct 
regulator_dev *rdev,
 /*
  * LDOs 1, 20, 21, 3
  */
-static struct regulator_ops max77802_ldo_ops_logic2 = {
+static const struct regulator_ops max77802_ldo_ops_logic2 = {
.list_voltage   = regulator_list_voltage_linear,
.map_voltage= regulator_map_voltage_linear,
.is_enabled = regulator_is_enabled_regmap,
@@ -319,7 +319,7 @@ static int max77802_set_ramp_delay_4bit(struct 
regulator_dev *rdev,
 };
 
 /* BUCKS 1, 6 */
-static struct regulator_ops max77802_buck_16_dvs_ops = {
+static const struct regulator_ops max77802_buck_16_dvs_ops = {
.list_voltage   = regulator_list_voltage_linear,
.map_voltage= regulator_map_voltage_linear,
.is_enabled = regulator_is_enabled_regmap,
@@ -333,7 +333,7 @@ static int max77802_set_ramp_delay_4bit(struct 
regulator_dev *rdev,
 };
 
 /* BUCKs 2-4 */
-static struct regulator_ops max77802_buck_234_ops = {
+static const struct regulator_ops max77802_buck_234_ops = {
.list_voltage   = regulator_list_voltage_linear,
.map_voltage= regulator_map_voltage_linear,
.is_enabled = regulator_is_enabled_regmap,
@@ -348,7 +348,7 @@ static int max77802_set_ramp_delay_4bit(struct 
regulator_dev *rdev,
 };
 
 /* BUCKs 5, 7-10 */
-static struct regulator_ops max77802_buck_dvs_ops = {
+static const struct regulator_ops max77802_buck_dvs_ops = {
.list_voltage   = regulator_list_voltage_linear,
.map_voltage= regulator_map_voltage_linear,
.is_enabled = regulator_is_enabled_regmap,
-- 
1.9.1



[PATCH] regulator: max8907-regulator: constify regulator_ops structure

2017-01-28 Thread Bhumika Goyal
Declare regulator_ops structure as const as it is only stored in the ops
field of a regulator_desc structure. This field is of type const, so
regulator_ops structures having this property can be made const too.

File size before: drivers/regulator/max8907-regulator.o
   textdata bss dec hex filename
   13849424 256   110642b38 regulator/max8907-regulator.o

File size after: drivers/regulator/max8907-regulator.o
   textdata bss dec hex filename
   26648400   0   110642b38 regulator/max8907-regulator.o

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

diff --git a/drivers/regulator/max8907-regulator.c 
b/drivers/regulator/max8907-regulator.c
index 5e941db..860400d 100644
--- a/drivers/regulator/max8907-regulator.c
+++ b/drivers/regulator/max8907-regulator.c
@@ -109,7 +109,7 @@ struct max8907_regulator {
 #define LDO_650_25(id, supply, base) REG_LDO(id, supply, (base), \
65, 2225000, 25000)
 
-static struct regulator_ops max8907_mbatt_ops = {
+static const struct regulator_ops max8907_mbatt_ops = {
 };
 
 static struct regulator_ops max8907_ldo_ops = {
@@ -121,13 +121,13 @@ struct max8907_regulator {
.is_enabled = regulator_is_enabled_regmap,
 };
 
-static struct regulator_ops max8907_ldo_hwctl_ops = {
+static const struct regulator_ops max8907_ldo_hwctl_ops = {
.list_voltage = regulator_list_voltage_linear,
.set_voltage_sel = regulator_set_voltage_sel_regmap,
.get_voltage_sel = regulator_get_voltage_sel_regmap,
 };
 
-static struct regulator_ops max8907_fixed_ops = {
+static const struct regulator_ops max8907_fixed_ops = {
.list_voltage = regulator_list_voltage_linear,
 };
 
@@ -138,11 +138,11 @@ struct max8907_regulator {
.is_enabled = regulator_is_enabled_regmap,
 };
 
-static struct regulator_ops max8907_out5v_hwctl_ops = {
+static const struct regulator_ops max8907_out5v_hwctl_ops = {
.list_voltage = regulator_list_voltage_linear,
 };
 
-static struct regulator_ops max8907_bbat_ops = {
+static const struct regulator_ops max8907_bbat_ops = {
.list_voltage = regulator_list_voltage_linear,
.set_voltage_sel = regulator_set_voltage_sel_regmap,
.get_voltage_sel = regulator_get_voltage_sel_regmap,
-- 
1.9.1



[PATCH] regulator: pfuze100-regulator: constify regulator_ops structure

2017-01-28 Thread Bhumika Goyal
Declare regulator_ops structure as const as it is only stored in the ops
field of a regulator_desc structure. This field is of type const, so
regulator_ops structures having this property can be made const too.

File size before: drivers/regulator/pfuze100-regulator.o
   textdata bss dec hex filename
   3552   12528  16   160963ee0 regulator/pfuze100-regulator.o

File size after: drivers/regulator/pfuze100-regulator.o
   textdata bss dec hex filename
   4576   11496  16   160883ed8 regulator/pfuze100-regulator.o

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

diff --git a/drivers/regulator/pfuze100-regulator.c 
b/drivers/regulator/pfuze100-regulator.c
index cb18b5c..e193bbb 100644
--- a/drivers/regulator/pfuze100-regulator.c
+++ b/drivers/regulator/pfuze100-regulator.c
@@ -126,7 +126,7 @@ static int pfuze100_set_ramp_delay(struct regulator_dev 
*rdev, int ramp_delay)
return ret;
 }
 
-static struct regulator_ops pfuze100_ldo_regulator_ops = {
+static const struct regulator_ops pfuze100_ldo_regulator_ops = {
.enable = regulator_enable_regmap,
.disable = regulator_disable_regmap,
.is_enabled = regulator_is_enabled_regmap,
@@ -135,14 +135,14 @@ static int pfuze100_set_ramp_delay(struct regulator_dev 
*rdev, int ramp_delay)
.get_voltage_sel = regulator_get_voltage_sel_regmap,
 };
 
-static struct regulator_ops pfuze100_fixed_regulator_ops = {
+static const struct regulator_ops pfuze100_fixed_regulator_ops = {
.enable = regulator_enable_regmap,
.disable = regulator_disable_regmap,
.is_enabled = regulator_is_enabled_regmap,
.list_voltage = regulator_list_voltage_linear,
 };
 
-static struct regulator_ops pfuze100_sw_regulator_ops = {
+static const struct regulator_ops pfuze100_sw_regulator_ops = {
.list_voltage = regulator_list_voltage_linear,
.set_voltage_sel = regulator_set_voltage_sel_regmap,
.get_voltage_sel = regulator_get_voltage_sel_regmap,
@@ -150,7 +150,7 @@ static int pfuze100_set_ramp_delay(struct regulator_dev 
*rdev, int ramp_delay)
.set_ramp_delay = pfuze100_set_ramp_delay,
 };
 
-static struct regulator_ops pfuze100_swb_regulator_ops = {
+static const struct regulator_ops pfuze100_swb_regulator_ops = {
.enable = regulator_enable_regmap,
.disable = regulator_disable_regmap,
.list_voltage = regulator_list_voltage_table,
-- 
1.9.1



[PATCH] regulator: rn5t618-regulator: constify regulator_ops structure

2017-01-28 Thread Bhumika Goyal
Declare regulator_ops structure as const as it is only stored in the ops
field of a regulator_desc structure. This field is of type const, so
regulator_ops structures having this property can be made const too.

File size before: drivers/regulator/rn5t618-regulator.o
   textdata bss dec hex filename
3755392   057671687 regulator/rn5t618-regulator.o

File size after: drivers/regulator/rn5t618-regulator.o
   textdata bss dec hex filename
6315136   057671687 regulator/rn5t618-regulator.o

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

diff --git a/drivers/regulator/rn5t618-regulator.c 
b/drivers/regulator/rn5t618-regulator.c
index 9c930eb..8d2819e 100644
--- a/drivers/regulator/rn5t618-regulator.c
+++ b/drivers/regulator/rn5t618-regulator.c
@@ -19,7 +19,7 @@
 #include 
 #include 
 
-static struct regulator_ops rn5t618_reg_ops = {
+static const struct regulator_ops rn5t618_reg_ops = {
.enable = regulator_enable_regmap,
.disable= regulator_disable_regmap,
.is_enabled = regulator_is_enabled_regmap,
-- 
1.9.1



[PATCH] regulator: anatop-regulator: constify regulator_ops structure

2017-01-28 Thread Bhumika Goyal
Declare regulator_ops structure as const as it is only stored in the ops
field of a regulator_desc structure. This field is of type const, so
regulator_ops structures having this property can be made const too.

File size before: drivers/regulator/anatop-regulator.o
   textdata bss dec hex filename
   2839 720   03559 de7 regulator/anatop-regulator.o

File size after: drivers/regulator/anatop-regulator.o
   textdata bss dec hex filename
   3367 192   03559 de7 regulator/anatop-regulator.o

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

diff --git a/drivers/regulator/anatop-regulator.c 
b/drivers/regulator/anatop-regulator.c
index 3a6d029..330136a 100644
--- a/drivers/regulator/anatop-regulator.c
+++ b/drivers/regulator/anatop-regulator.c
@@ -157,14 +157,14 @@ static int anatop_regmap_set_bypass(struct regulator_dev 
*reg, bool enable)
return regulator_set_voltage_sel_regmap(reg, sel);
 }
 
-static struct regulator_ops anatop_rops = {
+static const struct regulator_ops anatop_rops = {
.set_voltage_sel = regulator_set_voltage_sel_regmap,
.get_voltage_sel = regulator_get_voltage_sel_regmap,
.list_voltage = regulator_list_voltage_linear,
.map_voltage = regulator_map_voltage_linear,
 };
 
-static struct regulator_ops anatop_core_rops = {
+static const struct regulator_ops anatop_core_rops = {
.enable = anatop_regmap_enable,
.disable = anatop_regmap_disable,
.is_enabled = anatop_regmap_is_enabled,
-- 
1.9.1



[PATCH] regulator: ltc3676: constify regulator_ops structure

2017-01-28 Thread Bhumika Goyal
Declare regulator_ops structure as const as it is only stored in the ops
field of a regulator_desc structure. This field is of type const, so
regulator_ops structures having this property can be made const too.

File size before: drivers/regulator/ltc3676.o
   textdata bss dec hex filename
   23692808 28854651559 drivers/regulator/ltc3676.o

File size after: drivers/regulator/ltc3676.o
   textdata bss dec hex filename
   31452296   854491549 drivers/regulator/ltc3676.o

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

diff --git a/drivers/regulator/ltc3676.c b/drivers/regulator/ltc3676.c
index e2b476c..503cd90 100644
--- a/drivers/regulator/ltc3676.c
+++ b/drivers/regulator/ltc3676.c
@@ -161,7 +161,7 @@ static int ltc3676_of_parse_cb(struct device_node *np,
 }
 
 /* SW1, SW2, SW3, SW4 linear 0.8V-3.3V with scalar via R1/R2 feeback res */
-static struct regulator_ops ltc3676_linear_regulator_ops = {
+static const struct regulator_ops ltc3676_linear_regulator_ops = {
.enable = regulator_enable_regmap,
.disable = regulator_disable_regmap,
.is_enabled = regulator_is_enabled_regmap,
@@ -173,11 +173,11 @@ static int ltc3676_of_parse_cb(struct device_node *np,
 };
 
 /* LDO1 always on fixed 0.8V-3.3V via scalar via R1/R2 feeback res */
-static struct regulator_ops ltc3676_fixed_standby_regulator_ops = {
+static const struct regulator_ops ltc3676_fixed_standby_regulator_ops = {
 };
 
 /* LDO2, LDO3 fixed (LDO2 has external scalar via R1/R2 feedback res) */
-static struct regulator_ops ltc3676_fixed_regulator_ops = {
+static const struct regulator_ops ltc3676_fixed_regulator_ops = {
.enable = regulator_enable_regmap,
.disable = regulator_disable_regmap,
.is_enabled = regulator_is_enabled_regmap,
-- 
1.9.1



[PATCH] regulator: max77693-regulator: constify regulator_ops structure

2017-01-28 Thread Bhumika Goyal
Declare regulator_ops structure as const as it is only stored in the ops
field of a regulator_desc structure. This field is of type const, so
regulator_ops structures having this property can be made const too.

File size before: drivers/regulator/max77693-regulator.o
   textdata bss dec hex filename
   2230 720   02950 b86 regulator/max77693-regulator.o

File size after: drivers/regulator/max77693-regulator.o
   textdata bss dec hex filename
   2486 464   02950 b86 regulator/max77693-regulator.o

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

diff --git a/drivers/regulator/max77693-regulator.c 
b/drivers/regulator/max77693-regulator.c
index cfbb951..3fce679 100644
--- a/drivers/regulator/max77693-regulator.c
+++ b/drivers/regulator/max77693-regulator.c
@@ -141,7 +141,7 @@ static struct regmap *max77693_get_regmap(enum 
max77693_types type,
330,
 };
 
-static struct regulator_ops max77693_safeout_ops = {
+static const struct regulator_ops max77693_safeout_ops = {
.list_voltage   = regulator_list_voltage_table,
.is_enabled = regulator_is_enabled_regmap,
.enable = regulator_enable_regmap,
-- 
1.9.1



[PATCH] regulator: rc5t583-regulator: constify regulator_ops structure

2017-01-28 Thread Bhumika Goyal
Declare regulator_ops structure as const as it is only stored in the ops
field of a regulator_desc structure. This field is of type const, so
regulator_ops structures having this property can be made const too.

File size before: drivers/regulator/rc5t583-regulator.o
   textdata bss dec hex filename
9313824   047551293 regulator/rc5t583-regulator.o

File size after: drivers/regulator/rc5t583-regulator.o
   textdata bss dec hex filename
   11873568   047551293 regulator/rc5t583-regulator.o

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

diff --git a/drivers/regulator/rc5t583-regulator.c 
b/drivers/regulator/rc5t583-regulator.c
index d2e67c5..d0f1340 100644
--- a/drivers/regulator/rc5t583-regulator.c
+++ b/drivers/regulator/rc5t583-regulator.c
@@ -61,7 +61,7 @@ static int rc5t583_regulator_enable_time(struct regulator_dev 
*rdev)
return DIV_ROUND_UP(curr_uV, reg->reg_info->enable_uv_per_us);
 }
 
-static struct regulator_ops rc5t583_ops = {
+static const struct regulator_ops rc5t583_ops = {
.is_enabled = regulator_is_enabled_regmap,
.enable = regulator_enable_regmap,
.disable= regulator_disable_regmap,
-- 
1.9.1



[PATCH] regulator: 88pm800: constify regulator_ops structures

2017-01-28 Thread Bhumika Goyal
Declare regulator_ops structures as const as they are only stored in the
ops field of a regulator_desc structure. This field is of type const, so
regulator_ops structures having this property can be made const too.

File size before: drivers/regulator/88pm800.o
   textdata bss dec hex filename
   10016288   072891c79 drivers/regulator/88pm800.o

File size after: drivers/regulator/88pm800.o
   textdata bss dec hex filename
   15135776   072891c79 drivers/regulator/88pm800.o

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

diff --git a/drivers/regulator/88pm800.c b/drivers/regulator/88pm800.c
index a62a896..89bbd6e 100644
--- a/drivers/regulator/88pm800.c
+++ b/drivers/regulator/88pm800.c
@@ -180,7 +180,7 @@ static int pm800_get_current_limit(struct regulator_dev 
*rdev)
return info->max_ua;
 }
 
-static struct regulator_ops pm800_volt_range_ops = {
+static const struct regulator_ops pm800_volt_range_ops = {
.list_voltage   = regulator_list_voltage_linear_range,
.map_voltage= regulator_map_voltage_linear_range,
.set_voltage_sel= regulator_set_voltage_sel_regmap,
@@ -191,7 +191,7 @@ static int pm800_get_current_limit(struct regulator_dev 
*rdev)
.get_current_limit  = pm800_get_current_limit,
 };
 
-static struct regulator_ops pm800_volt_table_ops = {
+static const struct regulator_ops pm800_volt_table_ops = {
.list_voltage   = regulator_list_voltage_table,
.map_voltage= regulator_map_voltage_iterate,
.set_voltage_sel= regulator_set_voltage_sel_regmap,
-- 
1.9.1



[PATCH] regulator: fixed: constify regulator_ops structure

2017-01-28 Thread Bhumika Goyal
Declare regulator_ops structure as const as it is only stored in the ops
field of a regulator_desc structure. This field is of type const, so
regulator_ops structures having this property can be made const too.

File size before: drivers/regulator/fixed.o
   textdata bss dec hex filename
  1239  192   01431 597 drivers/regulator/fixed.o

File size after: drivers/regulator/fixed.o
   textdata bss dec hex filename
  1592  100 1281820 71c drivers/regulator/fixed.o

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

diff --git a/drivers/regulator/fixed.c b/drivers/regulator/fixed.c
index a43b0e8..9619022 100644
--- a/drivers/regulator/fixed.c
+++ b/drivers/regulator/fixed.c
@@ -135,7 +135,7 @@ struct fixed_voltage_data {
return config;
 }
 
-static struct regulator_ops fixed_voltage_ops = {
+static const struct regulator_ops fixed_voltage_ops = {
 };
 
 static int reg_fixed_voltage_probe(struct platform_device *pdev)
-- 
1.9.1



[PATCH] regulator: ltc3589: constify regulator_ops structure

2017-01-28 Thread Bhumika Goyal
Declare regulator_ops structure as const as it is only stored in the ops
field of a regulator_desc structure. This field is of type const, so
regulator_ops structures having this property can be made const too.

File size before: drivers/regulator/ltc3589.o
   textdata bss dec hex filename
   25643312 28861641814 drivers/regulator/ltc3589.o

File size after: drivers/regulator/ltc3589.o
   textdata bss dec hex filename
   36042544   86156180c drivers/regulator/ltc3589.o

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

diff --git a/drivers/regulator/ltc3589.c b/drivers/regulator/ltc3589.c
index 47bef32..a7a1a03 100644
--- a/drivers/regulator/ltc3589.c
+++ b/drivers/regulator/ltc3589.c
@@ -161,7 +161,7 @@ static int ltc3589_set_suspend_mode(struct regulator_dev 
*rdev,
 }
 
 /* SW1, SW2, SW3, LDO2 */
-static struct regulator_ops ltc3589_linear_regulator_ops = {
+static const struct regulator_ops ltc3589_linear_regulator_ops = {
.enable = regulator_enable_regmap,
.disable = regulator_disable_regmap,
.is_enabled = regulator_is_enabled_regmap,
@@ -175,18 +175,18 @@ static int ltc3589_set_suspend_mode(struct regulator_dev 
*rdev,
 };
 
 /* BB_OUT, LDO3 */
-static struct regulator_ops ltc3589_fixed_regulator_ops = {
+static const struct regulator_ops ltc3589_fixed_regulator_ops = {
.enable = regulator_enable_regmap,
.disable = regulator_disable_regmap,
.is_enabled = regulator_is_enabled_regmap,
 };
 
 /* LDO1 */
-static struct regulator_ops ltc3589_fixed_standby_regulator_ops = {
+static const struct regulator_ops ltc3589_fixed_standby_regulator_ops = {
 };
 
 /* LDO4 */
-static struct regulator_ops ltc3589_table_regulator_ops = {
+static const struct regulator_ops ltc3589_table_regulator_ops = {
.enable = regulator_enable_regmap,
.disable = regulator_disable_regmap,
.is_enabled = regulator_is_enabled_regmap,
-- 
1.9.1



[PATCH] regulator: max77686-regulator: constify regulator_ops structure

2017-01-28 Thread Bhumika Goyal
Declare regulator_ops structure as const as it is only stored in the ops
field of a regulator_desc structure. This field is of type const, so
regulator_ops structures having this property can be made const too.

File size before: drivers/regulator/max77686-regulator.o
   textdata bss dec hex filename
   99041320   0   112242bd8 regulator/max77686-regulator.o

File size after: drivers/regulator/max77686-regulator.o
   textdata bss dec hex filename
  10928 280   0   112082bc8 regulator/max77686-regulator.o

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

diff --git a/drivers/regulator/max77686-regulator.c 
b/drivers/regulator/max77686-regulator.c
index ac4fa58..c301f37 100644
--- a/drivers/regulator/max77686-regulator.c
+++ b/drivers/regulator/max77686-regulator.c
@@ -289,7 +289,7 @@ static int max77686_of_parse_cb(struct device_node *np,
return 0;
 }
 
-static struct regulator_ops max77686_ops = {
+static const struct regulator_ops max77686_ops = {
.list_voltage   = regulator_list_voltage_linear,
.map_voltage= regulator_map_voltage_linear,
.is_enabled = regulator_is_enabled_regmap,
@@ -301,7 +301,7 @@ static int max77686_of_parse_cb(struct device_node *np,
.set_suspend_mode   = max77686_set_suspend_mode,
 };
 
-static struct regulator_ops max77686_ldo_ops = {
+static const struct regulator_ops max77686_ldo_ops = {
.list_voltage   = regulator_list_voltage_linear,
.map_voltage= regulator_map_voltage_linear,
.is_enabled = regulator_is_enabled_regmap,
@@ -314,7 +314,7 @@ static int max77686_of_parse_cb(struct device_node *np,
.set_suspend_disable= max77686_set_suspend_disable,
 };
 
-static struct regulator_ops max77686_buck1_ops = {
+static const struct regulator_ops max77686_buck1_ops = {
.list_voltage   = regulator_list_voltage_linear,
.map_voltage= regulator_map_voltage_linear,
.is_enabled = regulator_is_enabled_regmap,
@@ -326,7 +326,7 @@ static int max77686_of_parse_cb(struct device_node *np,
.set_suspend_disable= max77686_set_suspend_disable,
 };
 
-static struct regulator_ops max77686_buck_dvs_ops = {
+static const struct regulator_ops max77686_buck_dvs_ops = {
.list_voltage   = regulator_list_voltage_linear,
.map_voltage= regulator_map_voltage_linear,
.is_enabled = regulator_is_enabled_regmap,
-- 
1.9.1



[PATCH] regulator: max77620-regulator: constify regulator_ops structure

2017-01-28 Thread Bhumika Goyal
Declare regulator_ops structure as const as it is only stored in the ops
field of a regulator_desc structure. This field is of type const, so
regulator_ops structures having this property can be made const too.

File size before: drivers/regulator/max77620-regulator.o
   textdata bss dec hex filename
   48116992   0   118032e1b regulator/max77620-regulator.o

File size after: drivers/regulator/max77620-regulator.o
   textdata bss dec hex filename
   50756720   0   117952e13 regulator/max77620-regulator.o

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

diff --git a/drivers/regulator/max77620-regulator.c 
b/drivers/regulator/max77620-regulator.c
index d088a7c..b94e3a7 100644
--- a/drivers/regulator/max77620-regulator.c
+++ b/drivers/regulator/max77620-regulator.c
@@ -644,7 +644,7 @@ static int max77620_of_parse_cb(struct device_node *np,
return max77620_init_pmic(pmic, desc->id);
 }
 
-static struct regulator_ops max77620_regulator_ops = {
+static const struct regulator_ops max77620_regulator_ops = {
.is_enabled = max77620_regulator_is_enabled,
.enable = max77620_regulator_enable,
.disable = max77620_regulator_disable,
-- 
1.9.1



[PATCH] regulator: pcf50633-regulator: constify regulator_ops structure

2017-01-28 Thread Bhumika Goyal
Declare regulator_ops structure as const as it is only stored in the ops
field of a regulator_desc structure. This field is of type const, so
regulator_ops structures having this property can be made const too.

File size before: drivers/regulator/pcf50633-regulator.o
   textdata bss dec hex filename
   2763 464   03227 c9b regulator/pcf50633-regulator.o

File size after: drivers/regulator/pcf50633-regulator.o
   textdata bss dec hex filename
   3019 192   03211 c8b regulator/pcf50633-regulator.o

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

diff --git a/drivers/regulator/pcf50633-regulator.c 
b/drivers/regulator/pcf50633-regulator.c
index 134f90e..762e184 100644
--- a/drivers/regulator/pcf50633-regulator.c
+++ b/drivers/regulator/pcf50633-regulator.c
@@ -41,7 +41,7 @@
.enable_mask = PCF50633_REGULATOR_ON,   \
}
 
-static struct regulator_ops pcf50633_regulator_ops = {
+static const struct regulator_ops pcf50633_regulator_ops = {
.set_voltage_sel = regulator_set_voltage_sel_regmap,
.get_voltage_sel = regulator_get_voltage_sel_regmap,
.list_voltage = regulator_list_voltage_linear,
-- 
1.9.1



[PATCH] regulator: max8925-regulator: constify regulator_ops structure

2017-01-28 Thread Bhumika Goyal
Declare regulator_ops structure as const as it is only stored in the ops
field of a regulator_desc structure. This field is of type const, so
regulator_ops structures having this property can be made const too.

File size before: drivers/regulator/max8925-regulator.o
   textdata bss dec hex filename
   13567184   08540215c regulator/max8925-regulator.o

File size after: drivers/regulator/max8925-regulator.o
   textdata bss dec hex filename
   18686664   085322154 regulator/max8925-regulator.o

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

diff --git a/drivers/regulator/max8925-regulator.c 
b/drivers/regulator/max8925-regulator.c
index c802f02..39b63dd 100644
--- a/drivers/regulator/max8925-regulator.c
+++ b/drivers/regulator/max8925-regulator.c
@@ -132,7 +132,7 @@ static int max8925_set_dvm_disable(struct regulator_dev 
*rdev)
return max8925_set_bits(info->i2c, info->vol_reg, 1 << SD1_DVM_EN, 0);
 }
 
-static struct regulator_ops max8925_regulator_sdv_ops = {
+static const struct regulator_ops max8925_regulator_sdv_ops = {
.map_voltage= regulator_map_voltage_linear,
.list_voltage   = regulator_list_voltage_linear,
.set_voltage_sel= max8925_set_voltage_sel,
@@ -145,7 +145,7 @@ static int max8925_set_dvm_disable(struct regulator_dev 
*rdev)
.set_suspend_disable= max8925_set_dvm_disable,
 };
 
-static struct regulator_ops max8925_regulator_ldo_ops = {
+static const struct regulator_ops max8925_regulator_ldo_ops = {
.map_voltage= regulator_map_voltage_linear,
.list_voltage   = regulator_list_voltage_linear,
.set_voltage_sel= max8925_set_voltage_sel,
-- 
1.9.1



[PATCH] regulator: 88pm8607: constify regulator_ops structure

2017-01-28 Thread Bhumika Goyal
Declare regulator_ops structures as const as it is only stored in the
ops field of a regulator_desc structure. This field is of type const, so
regulator_ops structures having this property can be made const too.

File size before: drivers/regulator/88pm8607.o
   textdata bss dec hex filename
   34665488   0895422fa drivers/regulator/88pm8607.o

File size after: drivers/regulator/88pm8607.o
   textdata bss dec hex filename
   39784976   0895422fa drivers/regulator/88pm8607.o

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

diff --git a/drivers/regulator/88pm8607.c b/drivers/regulator/88pm8607.c
index b100a63..fd86446 100644
--- a/drivers/regulator/88pm8607.c
+++ b/drivers/regulator/88pm8607.c
@@ -220,7 +220,7 @@ static int pm8607_list_voltage(struct regulator_dev *rdev, 
unsigned index)
return ret;
 }
 
-static struct regulator_ops pm8607_regulator_ops = {
+static const struct regulator_ops pm8607_regulator_ops = {
.list_voltage   = pm8607_list_voltage,
.set_voltage_sel = regulator_set_voltage_sel_regmap,
.get_voltage_sel = regulator_get_voltage_sel_regmap,
@@ -229,7 +229,7 @@ static int pm8607_list_voltage(struct regulator_dev *rdev, 
unsigned index)
.is_enabled = regulator_is_enabled_regmap,
 };
 
-static struct regulator_ops pm8606_preg_ops = {
+static const struct regulator_ops pm8606_preg_ops = {
.enable = regulator_enable_regmap,
.disable= regulator_disable_regmap,
.is_enabled = regulator_is_enabled_regmap,
-- 
1.9.1



[PATCH] regulator: arizona-ldo1: constify regulator_ops structure

2017-01-28 Thread Bhumika Goyal
Declare regulator_ops structure as const as it is only stored in the ops
field of a regulator_desc structure. This field is of type const, so
regulator_ops structures having this property can be made const too.

File size before: drivers/regulator/arizona-ldo1.o
   textdata bss dec hex filename
   1890 720   02610 a32 drivers/regulator/arizona-ldo1.o

File size after: drivers/regulator/arizona-ldo1.o
   textdata bss dec hex filename
   2402 192   02594 a22 drivers/regulator/arizona-ldo1.o

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

diff --git a/drivers/regulator/arizona-ldo1.c b/drivers/regulator/arizona-ldo1.c
index 302b57c..e76d094 100644
--- a/drivers/regulator/arizona-ldo1.c
+++ b/drivers/regulator/arizona-ldo1.c
@@ -109,7 +109,7 @@ static int arizona_ldo1_hc_get_voltage_sel(struct 
regulator_dev *rdev)
return (val & ARIZONA_LDO1_VSEL_MASK) >> ARIZONA_LDO1_VSEL_SHIFT;
 }
 
-static struct regulator_ops arizona_ldo1_hc_ops = {
+static const struct regulator_ops arizona_ldo1_hc_ops = {
.list_voltage = arizona_ldo1_hc_list_voltage,
.map_voltage = arizona_ldo1_hc_map_voltage,
.get_voltage_sel = arizona_ldo1_hc_get_voltage_sel,
@@ -135,7 +135,7 @@ static int arizona_ldo1_hc_get_voltage_sel(struct 
regulator_dev *rdev)
.owner = THIS_MODULE,
 };
 
-static struct regulator_ops arizona_ldo1_ops = {
+static const struct regulator_ops arizona_ldo1_ops = {
.list_voltage = regulator_list_voltage_linear,
.map_voltage = regulator_map_voltage_linear,
.get_voltage_sel = regulator_get_voltage_sel_regmap,
-- 
1.9.1



[PATCH] regulator: arizona-micsupp: constify regulator_ops structure

2017-01-28 Thread Bhumika Goyal
Declare regulator_ops structure as const as it is only stored in the ops
field of a regulator_desc structure. This field is of type const, so
regulator_ops structures having this property can be made const too.

File size before: drivers/regulator/arizona-micsupp.o
   textdata bss dec hex filename
   1738 464   82210 8a2 regulator/arizona-micsupp.o

File size after: drivers/regulator/arizona-micsupp.o
   textdata bss dec hex filename
   1994 192   82194 892 regulator/arizona-micsupp.o

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

diff --git a/drivers/regulator/arizona-micsupp.c 
b/drivers/regulator/arizona-micsupp.c
index fcb98db..ce90021 100644
--- a/drivers/regulator/arizona-micsupp.c
+++ b/drivers/regulator/arizona-micsupp.c
@@ -104,7 +104,7 @@ static int arizona_micsupp_set_bypass(struct regulator_dev 
*rdev, bool ena)
return ret;
 }
 
-static struct regulator_ops arizona_micsupp_ops = {
+static const struct regulator_ops arizona_micsupp_ops = {
.enable = arizona_micsupp_enable,
.disable = arizona_micsupp_disable,
.is_enabled = regulator_is_enabled_regmap,
-- 
1.9.1



[PATCH] regulator: axp20x-regulator: constify regulator_ops structure

2017-01-28 Thread Bhumika Goyal
Declare regulator_ops structure as const as it is only stored in the ops
field of a regulator_desc structure. This field is of type const, so
regulator_ops structures having this property can be made const too.

File size before: drivers/regulator/axp20x-regulator.o
   textdata bss dec hex filename
  168481232   0   1808046a0 regulator/axp20x-regulator.o

File size after: drivers/regulator/axp20x-regulator.o
   textdata bss dec hex filename
  17888 192   0   1808046a0 regulator/axp20x-regulator.o

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

diff --git a/drivers/regulator/axp20x-regulator.c 
b/drivers/regulator/axp20x-regulator.c
index e6a512e..5478151 100644
--- a/drivers/regulator/axp20x-regulator.c
+++ b/drivers/regulator/axp20x-regulator.c
@@ -128,11 +128,11 @@
.ops= _ops_range,
\
}
 
-static struct regulator_ops axp20x_ops_fixed = {
+static const struct regulator_ops axp20x_ops_fixed = {
.list_voltage   = regulator_list_voltage_linear,
 };
 
-static struct regulator_ops axp20x_ops_range = {
+static const struct regulator_ops axp20x_ops_range = {
.set_voltage_sel= regulator_set_voltage_sel_regmap,
.get_voltage_sel= regulator_get_voltage_sel_regmap,
.list_voltage   = regulator_list_voltage_linear_range,
@@ -141,7 +141,7 @@
.is_enabled = regulator_is_enabled_regmap,
 };
 
-static struct regulator_ops axp20x_ops = {
+static const struct regulator_ops axp20x_ops = {
.set_voltage_sel= regulator_set_voltage_sel_regmap,
.get_voltage_sel= regulator_get_voltage_sel_regmap,
.list_voltage   = regulator_list_voltage_linear,
@@ -150,7 +150,7 @@
.is_enabled = regulator_is_enabled_regmap,
 };
 
-static struct regulator_ops axp20x_ops_sw = {
+static const struct regulator_ops axp20x_ops_sw = {
.enable = regulator_enable_regmap,
.disable= regulator_disable_regmap,
.is_enabled = regulator_is_enabled_regmap,
-- 
1.9.1



[PATCH] regulator: bcm590xx-regulator: constify regulator_ops structure

2017-01-28 Thread Bhumika Goyal
Declare regulator_ops structure as const as it is only stored in the ops
field of a regulator_desc structure. This field is of type const, so
regulator_ops structures having this property can be made const too.

File size before: drivers/regulator/bcm590xx-regulator.o
   textdata bss dec hex filename
   18073360   05167142f regulator/bcm590xx-regulator.o

File size after: drivers/regulator/bcm590xx-regulator.o
   textdata bss dec hex filename
   25752592   05167142f regulator/bcm590xx-regulator.o

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

diff --git a/drivers/regulator/bcm590xx-regulator.c 
b/drivers/regulator/bcm590xx-regulator.c
index 76b0183..9dd7154 100644
--- a/drivers/regulator/bcm590xx-regulator.c
+++ b/drivers/regulator/bcm590xx-regulator.c
@@ -250,7 +250,7 @@ static int bcm590xx_get_enable_register(int id)
return reg;
 }
 
-static struct regulator_ops bcm590xx_ops_ldo = {
+static const struct regulator_ops bcm590xx_ops_ldo = {
.is_enabled = regulator_is_enabled_regmap,
.enable = regulator_enable_regmap,
.disable= regulator_disable_regmap,
@@ -260,7 +260,7 @@ static int bcm590xx_get_enable_register(int id)
.map_voltage= regulator_map_voltage_iterate,
 };
 
-static struct regulator_ops bcm590xx_ops_dcdc = {
+static const struct regulator_ops bcm590xx_ops_dcdc = {
.is_enabled = regulator_is_enabled_regmap,
.enable = regulator_enable_regmap,
.disable= regulator_disable_regmap,
@@ -270,7 +270,7 @@ static int bcm590xx_get_enable_register(int id)
.map_voltage= regulator_map_voltage_linear_range,
 };
 
-static struct regulator_ops bcm590xx_ops_vbus = {
+static const struct regulator_ops bcm590xx_ops_vbus = {
.is_enabled = regulator_is_enabled_regmap,
.enable = regulator_enable_regmap,
.disable= regulator_disable_regmap,
-- 
1.9.1



[PATCH] regulator: gpio-regulator: constify regulator_ops structure

2017-01-28 Thread Bhumika Goyal
Declare regulator_ops structure as const as it is only stored in the ops
field of a regulator_desc structure. This field is of type const, so
regulator_ops structures having this property can be made const too.

File size before: drivers/regulator/gpio-regulator.o
   textdata bss dec hex filename
   3273 720   03993 f99 regulator/gpio-regulator.o

File size after: drivers/regulator/gpio-regulator.o
   textdata bss dec hex filename
   3801 192   03993 f99 regulator/gpio-regulator.o

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

diff --git a/drivers/regulator/gpio-regulator.c 
b/drivers/regulator/gpio-regulator.c
index 0fce06a..3f9a3ec 100644
--- a/drivers/regulator/gpio-regulator.c
+++ b/drivers/regulator/gpio-regulator.c
@@ -126,7 +126,7 @@ static int gpio_regulator_set_current_limit(struct 
regulator_dev *dev,
return 0;
 }
 
-static struct regulator_ops gpio_regulator_voltage_ops = {
+static const struct regulator_ops gpio_regulator_voltage_ops = {
.get_voltage = gpio_regulator_get_value,
.set_voltage = gpio_regulator_set_voltage,
.list_voltage = gpio_regulator_list_voltage,
@@ -243,7 +243,7 @@ static int gpio_regulator_set_current_limit(struct 
regulator_dev *dev,
return config;
 }
 
-static struct regulator_ops gpio_regulator_current_ops = {
+static const struct regulator_ops gpio_regulator_current_ops = {
.get_current_limit = gpio_regulator_get_value,
.set_current_limit = gpio_regulator_set_current_limit,
 };
-- 
1.9.1



[PATCH] regulator: palmas-regulator: constify regulator_ops structure

2017-01-28 Thread Bhumika Goyal
Declare regulator_ops structure as const as it is only stored in the ops
field of a regulator_desc structure. This field is of type const, so
regulator_ops structures having this property can be made const too.

File size before: drivers/regulator/palmas-regulator.o
   textdata bss dec hex filename
   97526296 288   163363fd0 regulator/palmas-regulator.o

File size after: drivers/regulator/palmas-regulator.o
   textdata bss dec hex filename
  128563480   8   163443fd0 regulator/palmas-regulator.o

Signed-off-by: Bhumika Goyal <bhumi...@gmail.com>
---
 drivers/regulator/palmas-regulator.c | 24 
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/regulator/palmas-regulator.c 
b/drivers/regulator/palmas-regulator.c
index f11d41d..31ae5ee 100644
--- a/drivers/regulator/palmas-regulator.c
+++ b/drivers/regulator/palmas-regulator.c
@@ -528,7 +528,7 @@ static int palmas_smps_set_ramp_delay(struct regulator_dev 
*rdev,
return ret;
 }
 
-static struct regulator_ops palmas_ops_smps = {
+static const struct regulator_ops palmas_ops_smps = {
.is_enabled = regulator_is_enabled_regmap,
.enable = regulator_enable_regmap,
.disable= regulator_disable_regmap,
@@ -542,7 +542,7 @@ static int palmas_smps_set_ramp_delay(struct regulator_dev 
*rdev,
.set_ramp_delay = palmas_smps_set_ramp_delay,
 };
 
-static struct regulator_ops palmas_ops_ext_control_smps = {
+static const struct regulator_ops palmas_ops_ext_control_smps = {
.set_mode   = palmas_set_mode_smps,
.get_mode   = palmas_get_mode_smps,
.get_voltage_sel= regulator_get_voltage_sel_regmap,
@@ -553,7 +553,7 @@ static int palmas_smps_set_ramp_delay(struct regulator_dev 
*rdev,
.set_ramp_delay = palmas_smps_set_ramp_delay,
 };
 
-static struct regulator_ops palmas_ops_smps10 = {
+static const struct regulator_ops palmas_ops_smps10 = {
.is_enabled = regulator_is_enabled_regmap,
.enable = regulator_enable_regmap,
.disable= regulator_disable_regmap,
@@ -565,7 +565,7 @@ static int palmas_smps_set_ramp_delay(struct regulator_dev 
*rdev,
.get_bypass = regulator_get_bypass_regmap,
 };
 
-static struct regulator_ops tps65917_ops_smps = {
+static const struct regulator_ops tps65917_ops_smps = {
.is_enabled = regulator_is_enabled_regmap,
.enable = regulator_enable_regmap,
.disable= regulator_disable_regmap,
@@ -578,7 +578,7 @@ static int palmas_smps_set_ramp_delay(struct regulator_dev 
*rdev,
.set_voltage_time_sel   = regulator_set_voltage_time_sel,
 };
 
-static struct regulator_ops tps65917_ops_ext_control_smps = {
+static const struct regulator_ops tps65917_ops_ext_control_smps = {
.set_mode   = palmas_set_mode_smps,
.get_mode   = palmas_get_mode_smps,
.get_voltage_sel= regulator_get_voltage_sel_regmap,
@@ -602,7 +602,7 @@ static int palmas_is_enabled_ldo(struct regulator_dev *dev)
return !!(reg);
 }
 
-static struct regulator_ops palmas_ops_ldo = {
+static const struct regulator_ops palmas_ops_ldo = {
.is_enabled = palmas_is_enabled_ldo,
.enable = regulator_enable_regmap,
.disable= regulator_disable_regmap,
@@ -612,7 +612,7 @@ static int palmas_is_enabled_ldo(struct regulator_dev *dev)
.map_voltage= regulator_map_voltage_linear,
 };
 
-static struct regulator_ops palmas_ops_ldo9 = {
+static const struct regulator_ops palmas_ops_ldo9 = {
.is_enabled = palmas_is_enabled_ldo,
.enable = regulator_enable_regmap,
.disable= regulator_disable_regmap,
@@ -624,23 +624,23 @@ static int palmas_is_enabled_ldo(struct regulator_dev 
*dev)
.get_bypass = regulator_get_bypass_regmap,
 };
 
-static struct regulator_ops palmas_ops_ext_control_ldo = {
+static const struct regulator_ops palmas_ops_ext_control_ldo = {
.get_voltage_sel= regulator_get_voltage_sel_regmap,
.set_voltage_sel= regulator_set_voltage_sel_regmap,
.list_voltage   = regulator_list_voltage_linear,
.map_voltage= regulator_map_voltage_linear,
 };
 
-static struct regulator_ops palmas_ops_extreg = {
+static const struct regulator_ops palmas_ops_extreg = {
.is_enabled = regulator_is_enabled_regmap,
.enable = regulator_enable_regmap,
.disable= regulator_disable_regmap,
 };
 
-static struct regulator_ops palmas_ops_ext_control_extreg = {
+static const struct regulator_ops palmas_ops_ext_control_extreg = {
 };
 
-static struct regulat

[PATCH] regulator: pbias-regulator: constify regulator_ops structure

2017-01-28 Thread Bhumika Goyal
Declare regulator_ops structure as const as it is only stored in the ops
field of a regulator_desc structure. This field is of type const, so
regulator_ops structures having this property can be made const too.

File size before: drivers/regulator/pbias-regulator.o
   textdata bss dec hex filename
   2545 624   03169 c61 regulator/pbias-regulator.o

File size after: drivers/regulator/pbias-regulator.o
   textdata bss dec hex filename
   2801 368   03169 c61 regulator/pbias-regulator.o

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

diff --git a/drivers/regulator/pbias-regulator.c 
b/drivers/regulator/pbias-regulator.c
index f9d74d6..0cb76ba 100644
--- a/drivers/regulator/pbias-regulator.c
+++ b/drivers/regulator/pbias-regulator.c
@@ -54,7 +54,7 @@ struct pbias_of_data {
300
 };
 
-static struct regulator_ops pbias_regulator_voltage_ops = {
+static const struct regulator_ops pbias_regulator_voltage_ops = {
.list_voltage = regulator_list_voltage_table,
.get_voltage_sel = regulator_get_voltage_sel_regmap,
.set_voltage_sel = regulator_set_voltage_sel_regmap,
-- 
1.9.1



[PATCH] regulator: pv88060-regulator: constify regulator_ops structure

2017-01-28 Thread Bhumika Goyal
Declare regulator_ops structure as const as it is only stored in the ops
field of a regulator_desc structure. This field is of type const, so
regulator_ops structures having this property can be made const too.

File size before: drivers/regulator/pv88060-regulator.o
   textdata bss dec hex filename
   6195 752   869551b2b regulator/pv88060-regulator.o

File size after: drivers/regulator/pv88060-regulator.o
   textdata bss dec hex filename
   6739 240   869871b4b regulator/pv88060-regulator.o

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

diff --git a/drivers/regulator/pv88060-regulator.c 
b/drivers/regulator/pv88060-regulator.c
index 6c4afc7..a944605 100644
--- a/drivers/regulator/pv88060-regulator.c
+++ b/drivers/regulator/pv88060-regulator.c
@@ -162,7 +162,7 @@ static int pv88060_get_current_limit(struct regulator_dev 
*rdev)
return info->current_limits[data];
 }
 
-static struct regulator_ops pv88060_buck_ops = {
+static const struct regulator_ops pv88060_buck_ops = {
.get_mode = pv88060_buck_get_mode,
.set_mode = pv88060_buck_set_mode,
.enable = regulator_enable_regmap,
@@ -175,7 +175,7 @@ static int pv88060_get_current_limit(struct regulator_dev 
*rdev)
.get_current_limit = pv88060_get_current_limit,
 };
 
-static struct regulator_ops pv88060_ldo_ops = {
+static const struct regulator_ops pv88060_ldo_ops = {
.enable = regulator_enable_regmap,
.disable = regulator_disable_regmap,
.is_enabled = regulator_is_enabled_regmap,
-- 
1.9.1



Re: [PATCH] watchdog: constify watchdog_ops structures

2017-01-28 Thread Bhumika Goyal
On Sat, Jan 28, 2017 at 8:57 PM, Guenter Roeck <li...@roeck-us.net> wrote:
> On 01/27/2017 11:41 PM, Bhumika Goyal wrote:
>>
>> Declare watchdog_ops structures as const as they are only stored in the
>> ops field of a watchdog_device structure. This field is of type const, so
>> watchdog_ops structures having this property can be made const too.
>> Done using Coccinelle:
>>
>
> I have a very similar patch from you already in my queue, one that was acked
> and
> reviewed by several people. Is this one different or are you just resending
> ?
>

This is a different one. That patch was for watchdog_info structures
and this one is for watchdog_ops.

Thanks,
Bhumika

> Guenter
>
>
>> @r disable optional_qualifier@
>> identifier x;
>> position p;
>> @@
>> static struct watchdog_ops x@p={...};
>>
>> @ok@
>> struct watchdog_device w;
>> identifier r.x;
>> position p;
>> @@
>> w.ops=@p;
>>
>> @bad@
>> position p != {r.p,ok.p};
>> identifier r.x;
>> @@
>> x@p
>>
>> @depends on !bad disable optional_qualifier@
>> identifier r.x;
>> @@
>> +const
>> struct watchdog_ops x;
>>
>> File size details before and after patching.
>> First line of every .o file shows the file size before patching
>> and second line shows the size after patching.
>>
>>textdata bss dec hex filename
>>
>>1340 544   01884 75c drivers/watchdog/bcm_kona_wdt.o
>>1436 440   01876 754 drivers/watchdog/bcm_kona_wdt.o
>>
>>1176 544   41724 6bc drivers/watchdog/digicolor_wdt.o
>>1272 440   41716 6b4 drivers/watchdog/digicolor_wdt.o
>>
>> 925 580  891594 63a drivers/watchdog/ep93xx_wdt.o
>>1021 476  891586 632 drivers/watchdog/ep93xx_wdt.o
>>
>>4932 288  1752371475 drivers/watchdog/s3c2410_wdt.o
>>5028 192  1752371475 drivers/watchdog/s3c2410_wdt.o
>>
>>1977 292   12270 8de drivers/watchdog/sama5d4_wdt.o
>>2073 196   12270 8de drivers/watchdog/sama5d4_wdt.o
>>
>>1375 484   11860 744 drivers/watchdog/sirfsoc_wdt.o
>>1471 380   11852 73c drivers/watchdog/sirfsoc_wdt.o
>>
>> Size remains the same for the files drivers/watchdog/diag288_wdt.o
>> drivers/watchdog/asm9260_wdt.o and drivers/watchdog/atlas7_wdt.o
>>
>> The following .o files did not compile:
>> drivers/watchdog/sun4v_wdt.o, drivers/watchdog/sbsa_gwdt.o,
>> drivers/watchdog/rt2880_wdt.o, drivers/watchdog/booke_wdt.o
>> drivers/watchdog/mt7621_wdt.o
>>
>> Signed-off-by: Bhumika Goyal <bhumi...@gmail.com>
>> ---
>>  drivers/watchdog/asm9260_wdt.c   | 2 +-
>>  drivers/watchdog/atlas7_wdt.c| 2 +-
>>  drivers/watchdog/bcm_kona_wdt.c  | 2 +-
>>  drivers/watchdog/booke_wdt.c | 2 +-
>>  drivers/watchdog/diag288_wdt.c   | 2 +-
>>  drivers/watchdog/digicolor_wdt.c | 2 +-
>>  drivers/watchdog/ep93xx_wdt.c| 2 +-
>>  drivers/watchdog/mt7621_wdt.c| 2 +-
>>  drivers/watchdog/rt2880_wdt.c| 2 +-
>>  drivers/watchdog/s3c2410_wdt.c   | 2 +-
>>  drivers/watchdog/sama5d4_wdt.c   | 2 +-
>>  drivers/watchdog/sbsa_gwdt.c | 2 +-
>>  drivers/watchdog/sirfsoc_wdt.c   | 2 +-
>>  drivers/watchdog/sun4v_wdt.c | 2 +-
>>  14 files changed, 14 insertions(+), 14 deletions(-)
>>
>> diff --git a/drivers/watchdog/asm9260_wdt.c
>> b/drivers/watchdog/asm9260_wdt.c
>> index d0b59ba..233dfa9 100644
>> --- a/drivers/watchdog/asm9260_wdt.c
>> +++ b/drivers/watchdog/asm9260_wdt.c
>> @@ -189,7 +189,7 @@ static const struct watchdog_info asm9260_wdt_ident =
>> {
>> .identity = "Alphascale asm9260 Watchdog",
>>  };
>>
>> -static struct watchdog_ops asm9260_wdt_ops = {
>> +static const struct watchdog_ops asm9260_wdt_ops = {
>> .owner  = THIS_MODULE,
>> .start  = asm9260_wdt_enable,
>> .stop   = asm9260_wdt_disable,
>> diff --git a/drivers/watchdog/atlas7_wdt.c b/drivers/watchdog/atlas7_wdt.c
>> index ed80734..4abdcab 100644
>> --- a/drivers/watchdog/atlas7_wdt.c
>> +++ b/drivers/watchdog/atlas7_wdt.c
>> @@ -105,7 +105,7 @@ static const struct watchdog_info atlas7_wdt_ident = {
>> .identity = "atlas7 Watchdog",
>>  };
>>
>> -static struct watchdog_ops atlas7_wdt_ops = {
>> +static const struct watchd

[PATCH] regulator: max8952: constify regulator_ops structure

2017-01-28 Thread Bhumika Goyal
Declare regulator_ops structure as const as it is only stored in the ops
field of a regulator_desc structure. This field is of type const, so
regulator_ops structures having this property can be made const too.

File size before: drivers/regulator/max8952.o
   textdata bss dec hex filename
   3048 496   03544 dd8 drivers/regulator/max8952.o

File size after: drivers/regulator/max8952.o
   textdata bss dec hex filename
   3304 240   03544 dd8 drivers/regulator/max8952.o

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

diff --git a/drivers/regulator/max8952.c b/drivers/regulator/max8952.c
index 1af8f4a..1096546 100644
--- a/drivers/regulator/max8952.c
+++ b/drivers/regulator/max8952.c
@@ -113,7 +113,7 @@ static int max8952_set_voltage_sel(struct regulator_dev 
*rdev,
return 0;
 }
 
-static struct regulator_ops max8952_ops = {
+static const struct regulator_ops max8952_ops = {
.list_voltage   = max8952_list_voltage,
.get_voltage_sel= max8952_get_voltage_sel,
.set_voltage_sel= max8952_set_voltage_sel,
-- 
1.9.1



[PATCH] regulator: fan53555: constify regulator_ops structure

2017-01-28 Thread Bhumika Goyal
Declare regulator_ops structure as const as it is only stored in the ops
field of a regulator_desc structure. This field is of type const, so
regulator_ops structures having this property can be made const too.

File size before: drivers/regulator/fan53555.o
   textdata bss dec hex filename
   3512 496   84016 fb0 drivers/regulator/fan53555.o

File size after: drivers/regulator/fan53555.o
   textdata bss dec hex filename
   3768 240   84016 fb0 drivers/regulator/fan53555.o

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

diff --git a/drivers/regulator/fan53555.c b/drivers/regulator/fan53555.c
index d7da81a..60f4318 100644
--- a/drivers/regulator/fan53555.c
+++ b/drivers/regulator/fan53555.c
@@ -202,7 +202,7 @@ static int fan53555_set_ramp(struct regulator_dev *rdev, 
int ramp)
  CTL_SLEW_MASK, regval << CTL_SLEW_SHIFT);
 }
 
-static struct regulator_ops fan53555_regulator_ops = {
+static const struct regulator_ops fan53555_regulator_ops = {
.set_voltage_sel = regulator_set_voltage_sel_regmap,
.get_voltage_sel = regulator_get_voltage_sel_regmap,
.set_voltage_time_sel = regulator_set_voltage_time_sel,
-- 
1.9.1



[PATCH] regulator: lp8755: constify regulator_ops structure

2017-01-28 Thread Bhumika Goyal
Declare regulator_ops structure as const as it is only stored in the ops
field of a regulator_desc structure. This field is of type const, so
regulator_ops structures having this property can be made const too.

File size before: drivers/regulator/lp8755.o
   textdata bss dec hex filename
   35192800   8632718b7 drivers/regulator/lp8755.o

File size after: drivers/regulator/lp8755.o
   textdata bss dec hex filename
   37792544   8633118bb drivers/regulator/lp8755.o

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

diff --git a/drivers/regulator/lp8755.c b/drivers/regulator/lp8755.c
index d6773da..db34e1d 100644
--- a/drivers/regulator/lp8755.c
+++ b/drivers/regulator/lp8755.c
@@ -227,7 +227,7 @@ static int lp8755_buck_set_ramp(struct regulator_dev *rdev, 
int ramp)
return ret;
 }
 
-static struct regulator_ops lp8755_buck_ops = {
+static const struct regulator_ops lp8755_buck_ops = {
.map_voltage = regulator_map_voltage_linear,
.list_voltage = regulator_list_voltage_linear,
.set_voltage_sel = regulator_set_voltage_sel_regmap,
-- 
1.9.1



[PATCH] regulator: hi655x-regulator: constify regulator_ops structure

2017-01-28 Thread Bhumika Goyal
Declare regulator_ops structure as const as it is only stored in the ops
field of a regulator_desc structure. This field is of type const, so
regulator_ops structures having this property can be made const too.

File size before: drivers/regulator/hi655x-regulator.o
   textdata bss dec hex filename
6893120   03809 ee1 regulator/hi655x-regulator.o

File size after: drivers/regulator/hi655x-regulator.o
   textdata bss dec hex filename
   12012608   03809 ee1 regulator/hi655x-regulator.o

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

diff --git a/drivers/regulator/hi655x-regulator.c 
b/drivers/regulator/hi655x-regulator.c
index aca1846..065c100 100644
--- a/drivers/regulator/hi655x-regulator.c
+++ b/drivers/regulator/hi655x-regulator.c
@@ -96,7 +96,7 @@ static int hi655x_disable(struct regulator_dev *rdev)
return ret;
 }
 
-static struct regulator_ops hi655x_regulator_ops = {
+static const struct regulator_ops hi655x_regulator_ops = {
.enable = regulator_enable_regmap,
.disable = hi655x_disable,
.is_enabled = hi655x_is_enabled,
@@ -105,7 +105,7 @@ static int hi655x_disable(struct regulator_dev *rdev)
.set_voltage_sel = regulator_set_voltage_sel_regmap,
 };
 
-static struct regulator_ops hi655x_ldo_linear_ops = {
+static const struct regulator_ops hi655x_ldo_linear_ops = {
.enable = regulator_enable_regmap,
.disable = hi655x_disable,
.is_enabled = hi655x_is_enabled,
-- 
1.9.1



[PATCH] regulator: pv88090-regulator: constify regulator_ops structure

2017-01-28 Thread Bhumika Goyal
Declare regulator_ops structure as const as it is only stored in the ops
field of a regulator_desc structure. This field is of type const, so
regulator_ops structures having this property can be made const too.

File size before: drivers/regulator/pv88090-regulator.o
   textdata bss dec hex filename
   28292032   848691305 regulator/pv88090-regulator.o

File size after: drivers/regulator/pv88090-regulator.o
   textdata bss dec hex filename
   33411520   848691305 regulator/pv88090-regulator.o

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

diff --git a/drivers/regulator/pv88090-regulator.c 
b/drivers/regulator/pv88090-regulator.c
index 4216411..ab51e25 100644
--- a/drivers/regulator/pv88090-regulator.c
+++ b/drivers/regulator/pv88090-regulator.c
@@ -184,7 +184,7 @@ static int pv88090_get_current_limit(struct regulator_dev 
*rdev)
return info->current_limits[data];
 }
 
-static struct regulator_ops pv88090_buck_ops = {
+static const struct regulator_ops pv88090_buck_ops = {
.get_mode = pv88090_buck_get_mode,
.set_mode = pv88090_buck_set_mode,
.enable = regulator_enable_regmap,
@@ -197,7 +197,7 @@ static int pv88090_get_current_limit(struct regulator_dev 
*rdev)
.get_current_limit = pv88090_get_current_limit,
 };
 
-static struct regulator_ops pv88090_ldo_ops = {
+static const struct regulator_ops pv88090_ldo_ops = {
.enable = regulator_enable_regmap,
.disable = regulator_disable_regmap,
.is_enabled = regulator_is_enabled_regmap,
-- 
1.9.1



[PATCH] watchdog: constify watchdog_ops structures

2017-01-27 Thread Bhumika Goyal
Declare watchdog_ops structures as const as they are only stored in the
ops field of a watchdog_device structure. This field is of type const, so
watchdog_ops structures having this property can be made const too.
Done using Coccinelle:

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

@ok@
struct watchdog_device w;
identifier r.x;
position p;
@@
w.ops=@p;

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

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

File size details before and after patching.
First line of every .o file shows the file size before patching
and second line shows the size after patching.

   textdata bss dec hex filename

   1340 544   01884 75c drivers/watchdog/bcm_kona_wdt.o
   1436 440   01876 754 drivers/watchdog/bcm_kona_wdt.o

   1176 544   41724 6bc drivers/watchdog/digicolor_wdt.o
   1272 440   41716 6b4 drivers/watchdog/digicolor_wdt.o

925 580  891594 63a drivers/watchdog/ep93xx_wdt.o
   1021 476  891586 632 drivers/watchdog/ep93xx_wdt.o

   4932 288  1752371475 drivers/watchdog/s3c2410_wdt.o
   5028 192  1752371475 drivers/watchdog/s3c2410_wdt.o

   1977 292   12270 8de drivers/watchdog/sama5d4_wdt.o
   2073 196   12270 8de drivers/watchdog/sama5d4_wdt.o

   1375 484   11860 744 drivers/watchdog/sirfsoc_wdt.o
   1471 380   11852 73c drivers/watchdog/sirfsoc_wdt.o

Size remains the same for the files drivers/watchdog/diag288_wdt.o
drivers/watchdog/asm9260_wdt.o and drivers/watchdog/atlas7_wdt.o

The following .o files did not compile:
drivers/watchdog/sun4v_wdt.o, drivers/watchdog/sbsa_gwdt.o,
drivers/watchdog/rt2880_wdt.o, drivers/watchdog/booke_wdt.o
drivers/watchdog/mt7621_wdt.o

Signed-off-by: Bhumika Goyal <bhumi...@gmail.com>
---
 drivers/watchdog/asm9260_wdt.c   | 2 +-
 drivers/watchdog/atlas7_wdt.c| 2 +-
 drivers/watchdog/bcm_kona_wdt.c  | 2 +-
 drivers/watchdog/booke_wdt.c | 2 +-
 drivers/watchdog/diag288_wdt.c   | 2 +-
 drivers/watchdog/digicolor_wdt.c | 2 +-
 drivers/watchdog/ep93xx_wdt.c| 2 +-
 drivers/watchdog/mt7621_wdt.c| 2 +-
 drivers/watchdog/rt2880_wdt.c| 2 +-
 drivers/watchdog/s3c2410_wdt.c   | 2 +-
 drivers/watchdog/sama5d4_wdt.c   | 2 +-
 drivers/watchdog/sbsa_gwdt.c | 2 +-
 drivers/watchdog/sirfsoc_wdt.c   | 2 +-
 drivers/watchdog/sun4v_wdt.c | 2 +-
 14 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/drivers/watchdog/asm9260_wdt.c b/drivers/watchdog/asm9260_wdt.c
index d0b59ba..233dfa9 100644
--- a/drivers/watchdog/asm9260_wdt.c
+++ b/drivers/watchdog/asm9260_wdt.c
@@ -189,7 +189,7 @@ static const struct watchdog_info asm9260_wdt_ident = {
.identity = "Alphascale asm9260 Watchdog",
 };
 
-static struct watchdog_ops asm9260_wdt_ops = {
+static const struct watchdog_ops asm9260_wdt_ops = {
.owner  = THIS_MODULE,
.start  = asm9260_wdt_enable,
.stop   = asm9260_wdt_disable,
diff --git a/drivers/watchdog/atlas7_wdt.c b/drivers/watchdog/atlas7_wdt.c
index ed80734..4abdcab 100644
--- a/drivers/watchdog/atlas7_wdt.c
+++ b/drivers/watchdog/atlas7_wdt.c
@@ -105,7 +105,7 @@ static const struct watchdog_info atlas7_wdt_ident = {
.identity = "atlas7 Watchdog",
 };
 
-static struct watchdog_ops atlas7_wdt_ops = {
+static const struct watchdog_ops atlas7_wdt_ops = {
.owner = THIS_MODULE,
.start = atlas7_wdt_enable,
.stop = atlas7_wdt_disable,
diff --git a/drivers/watchdog/bcm_kona_wdt.c b/drivers/watchdog/bcm_kona_wdt.c
index e0c9842..80cdd16 100644
--- a/drivers/watchdog/bcm_kona_wdt.c
+++ b/drivers/watchdog/bcm_kona_wdt.c
@@ -266,7 +266,7 @@ static int bcm_kona_wdt_stop(struct watchdog_device *wdog)
SECWDOG_SRSTEN_MASK, 0);
 }
 
-static struct watchdog_ops bcm_kona_wdt_ops = {
+static const struct watchdog_ops bcm_kona_wdt_ops = {
.owner =THIS_MODULE,
.start =bcm_kona_wdt_start,
.stop = bcm_kona_wdt_stop,
diff --git a/drivers/watchdog/booke_wdt.c b/drivers/watchdog/booke_wdt.c
index 04da4b6..4925034 100644
--- a/drivers/watchdog/booke_wdt.c
+++ b/drivers/watchdog/booke_wdt.c
@@ -197,7 +197,7 @@ static struct watchdog_info booke_wdt_info = {
.identity = "PowerPC Book-E Watchdog",
 };
 
-static struct watchdog_ops booke_wdt_ops = {
+static const struct watchdog_ops booke_wdt_ops = {
.owner = THIS_MODULE,
.start = booke_wdt_start,
.stop = booke_wdt_stop,
diff --git a/drivers/watchdog/diag288_wdt.c b/drivers/watchdog/diag288_wdt.c
index 861d3d3..6f59108 100644
--- a/drivers/watchdog/diag288_wdt.c
+++ b/drivers/watchdog/diag288_wdt.c
@@ -205,7 +205,7 @@ static int wd

[PATCH] macintosh: windfarm_smu_sensors: constify wf_sensor_ops structures

2017-01-29 Thread Bhumika Goyal
Declare wf_sensor_ops structures as const as they are only stored in the
ops field of a wf_sensor structure. This field is of type const, so
wf_sensor_ops structures having this property can be made const too.
Done using Coccinelle:

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

@ok@
struct smu_ad_sensor ads;
struct smu_cpu_power_sensor pow;
identifier r.x;
position p;
@@
(
ads.sens.ops=@p;
|
pow.sens.ops=@p;
)

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

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

Size details after cross compiling the .o file for powerpc architecture.
File size before:
 text  data bss dec hex filename
   3700 408  484156103c macintosh/windfarm_smu_sensors.o

File size after:
 text  data bss dec hex filename
   3832 288  4841681048 macintosh/windfarm_smu_sensors.o

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

diff --git a/drivers/macintosh/windfarm_smu_sensors.c 
b/drivers/macintosh/windfarm_smu_sensors.c
index 1cc4e49..172fd26 100644
--- a/drivers/macintosh/windfarm_smu_sensors.c
+++ b/drivers/macintosh/windfarm_smu_sensors.c
@@ -172,22 +172,22 @@ static int smu_slotspow_get(struct wf_sensor *sr, s32 
*value)
 }
 
 
-static struct wf_sensor_ops smu_cputemp_ops = {
+static const struct wf_sensor_ops smu_cputemp_ops = {
.get_value  = smu_cputemp_get,
.release= smu_ads_release,
.owner  = THIS_MODULE,
 };
-static struct wf_sensor_ops smu_cpuamp_ops = {
+static const struct wf_sensor_ops smu_cpuamp_ops = {
.get_value  = smu_cpuamp_get,
.release= smu_ads_release,
.owner  = THIS_MODULE,
 };
-static struct wf_sensor_ops smu_cpuvolt_ops = {
+static const struct wf_sensor_ops smu_cpuvolt_ops = {
.get_value  = smu_cpuvolt_get,
.release= smu_ads_release,
.owner  = THIS_MODULE,
 };
-static struct wf_sensor_ops smu_slotspow_ops = {
+static const struct wf_sensor_ops smu_slotspow_ops = {
.get_value  = smu_slotspow_get,
.release= smu_ads_release,
.owner  = THIS_MODULE,
@@ -327,7 +327,7 @@ static int smu_cpu_power_get(struct wf_sensor *sr, s32 
*value)
return 0;
 }
 
-static struct wf_sensor_ops smu_cpu_power_ops = {
+static const struct wf_sensor_ops smu_cpu_power_ops = {
.get_value  = smu_cpu_power_get,
.release= smu_cpu_power_release,
.owner  = THIS_MODULE,
-- 
2.7.4



Re: [PATCH] nvdimm: constify device_type structures

2017-01-25 Thread Bhumika Goyal
On Wed, Jan 25, 2017 at 9:31 PM, Joe Perches  wrote:
> On Wed, 2017-01-25 at 07:49 +0100, Julia Lawall wrote:
>> What does the data column actually represent?  I tried size on the .o file
>> generated from:
>>
>> commit a65f0161f4d69d6738d4821e649448312cd818e2
>> Author: Stephen Rothwell 
>> Date:   Tue Jan 17 15:22:28 2017 +1100
>>
>> with CONFIG_X86_64=y and I get:
>>
>>text  data bss dec hex filename
>>   19726  3480  16   232225ab6 drivers/nvdimm/namespace_devs.o
>>
>> but when I run objdump -sh drivers/nvdimm/namespace_devs.o, I find a .data
>> segment of size 1008 and a .data.unlikely segment of size 8, which don't
>> match up with the results of size.
>
> Likely you have dynamic_debug enabled and you
> need to include these additional sections:
>
> __jump_table
> __verbose
>
> If user_mode_linux is enabled, add sections:
>
> .fini_array
> .init_array
>

Thanks for the explanation. I also compiled the patch for x86-64 but
couldn't find what went wrong but this solved the problem.

Thanks,
Bhumika


[PATCH] net: xilinx: constify net_device_ops structures

2017-01-20 Thread Bhumika Goyal
Declare net_device_ops structures as const as they are only stored in
the netdev_ops field of a net_device structure. This field is of type
const, so net_device_ops structures having same properties can be made
const too.
Done using Coccinelle:

@r1 disable optional_qualifier@
identifier i;
position p;
@@
static struct net_device_ops i@p={...};

@ok1@
identifier r1.i;
position p;
struct net_device ndev;
@@
ndev.netdev_ops=@p

@bad@
position p!={r1.p,ok1.p};
identifier r1.i;
@@
i@p

@depends on !bad disable optional_qualifier@
identifier r1.i;
@@
+const
struct net_device_ops i;

File size before:
   textdata bss dec hex filename
   6201 744   069451b21 ethernet/xilinx/xilinx_emaclite.o

File size after:
   textdata bss dec hex filename
   6745 192   069371b19 ethernet/xilinx/xilinx_emaclite.o

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

diff --git a/drivers/net/ethernet/xilinx/xilinx_emaclite.c 
b/drivers/net/ethernet/xilinx/xilinx_emaclite.c
index 93dc10b..546f569 100644
--- a/drivers/net/ethernet/xilinx/xilinx_emaclite.c
+++ b/drivers/net/ethernet/xilinx/xilinx_emaclite.c
@@ -1065,7 +1065,7 @@ static bool get_bool(struct platform_device *ofdev, const 
char *s)
}
 }
 
-static struct net_device_ops xemaclite_netdev_ops;
+static const struct net_device_ops xemaclite_netdev_ops;
 
 /**
  * xemaclite_of_probe - Probe method for the Emaclite device.
@@ -1219,7 +1219,7 @@ static int xemaclite_of_remove(struct platform_device 
*of_dev)
 }
 #endif
 
-static struct net_device_ops xemaclite_netdev_ops = {
+static const struct net_device_ops xemaclite_netdev_ops = {
.ndo_open   = xemaclite_open,
.ndo_stop   = xemaclite_close,
.ndo_start_xmit = xemaclite_send,
-- 
1.9.1



[PATCH] net: moxa: constify net_device_ops structures

2017-01-20 Thread Bhumika Goyal
Declare net_device_ops structures as const as they are only stored in
the netdev_ops field of a net_device structure. This field is of type
const, so net_device_ops structures having same properties can be made
const too.
Done using Coccinelle:

@r1 disable optional_qualifier@
identifier i;
position p;
@@
static struct net_device_ops i@p={...};

@ok1@
identifier r1.i;
position p;
struct net_device ndev;
@@
ndev.netdev_ops=@p

@bad@
position p!={r1.p,ok1.p};
identifier r1.i;
@@
i@p

@depends on !bad disable optional_qualifier@
identifier r1.i;
@@
+const
struct net_device_ops i;

File size before:
   textdata bss dec hex filename
   4821 744   0556515bd ethernet/moxa/moxart_ether.o

File size after:
   textdata bss dec hex filename
   5373 192   0556515bd ethernet/moxa/moxart_ether.o

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

diff --git a/drivers/net/ethernet/moxa/moxart_ether.c 
b/drivers/net/ethernet/moxa/moxart_ether.c
index 9774b50..6a6525f 100644
--- a/drivers/net/ethernet/moxa/moxart_ether.c
+++ b/drivers/net/ethernet/moxa/moxart_ether.c
@@ -436,7 +436,7 @@ static void moxart_mac_set_rx_mode(struct net_device *ndev)
spin_unlock_irq(>txlock);
 }
 
-static struct net_device_ops moxart_netdev_ops = {
+static const struct net_device_ops moxart_netdev_ops = {
.ndo_open   = moxart_mac_open,
.ndo_stop   = moxart_mac_stop,
.ndo_start_xmit = moxart_mac_start_xmit,
-- 
1.9.1



[PATCH v2] net: moxa: constify net_device_ops structures

2017-01-20 Thread Bhumika Goyal
Declare net_device_ops structure as const as it is only stored in
the netdev_ops field of a net_device structure. This field is of type
const, so net_device_ops structures having same properties can be made
const too.
Done using Coccinelle:

@r1 disable optional_qualifier@
identifier i;
position p;
@@
static struct net_device_ops i@p={...};

@ok1@
identifier r1.i;
position p;
struct net_device ndev;
@@
ndev.netdev_ops=@p

@bad@
position p!={r1.p,ok1.p};
identifier r1.i;
@@
i@p

@depends on !bad disable optional_qualifier@
identifier r1.i;
@@
+const
struct net_device_ops i;

File size before:
   textdata bss dec hex filename
   4821 744   0556515bd ethernet/moxa/moxart_ether.o

File size after:
   textdata bss dec hex filename
   5373 192   0556515bd ethernet/moxa/moxart_ether.o

Signed-off-by: Bhumika Goyal <bhumi...@gmail.com>
---
Changes in v2:
* Corrected the commit message.

 drivers/net/ethernet/moxa/moxart_ether.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/moxa/moxart_ether.c 
b/drivers/net/ethernet/moxa/moxart_ether.c
index 9774b50..6a6525f 100644
--- a/drivers/net/ethernet/moxa/moxart_ether.c
+++ b/drivers/net/ethernet/moxa/moxart_ether.c
@@ -436,7 +436,7 @@ static void moxart_mac_set_rx_mode(struct net_device *ndev)
spin_unlock_irq(>txlock);
 }
 
-static struct net_device_ops moxart_netdev_ops = {
+static const struct net_device_ops moxart_netdev_ops = {
.ndo_open   = moxart_mac_open,
.ndo_stop   = moxart_mac_stop,
.ndo_start_xmit = moxart_mac_start_xmit,
-- 
1.9.1



[PATCH v2] net: xilinx: constify net_device_ops structure

2017-01-20 Thread Bhumika Goyal
Declare net_device_ops structure as const as it is only stored in
the netdev_ops field of a net_device structure. This field is of type
const, so net_device_ops structures having same properties can be made
const too.
Done using Coccinelle:

@r1 disable optional_qualifier@
identifier i;
position p;
@@
static struct net_device_ops i@p={...};

@ok1@
identifier r1.i;
position p;
struct net_device ndev;
@@
ndev.netdev_ops=@p

@bad@
position p!={r1.p,ok1.p};
identifier r1.i;
@@
i@p

@depends on !bad disable optional_qualifier@
identifier r1.i;
@@
+const
struct net_device_ops i;

File size before:
   textdata bss dec hex filename
   6201 744   069451b21 ethernet/xilinx/xilinx_emaclite.o

File size after:
   textdata bss dec hex filename
   6745 192   069371b19 ethernet/xilinx/xilinx_emaclite.o

Signed-off-by: Bhumika Goyal <bhumi...@gmail.com>
---
Changes in v2:
* Corrected the commit message.

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

diff --git a/drivers/net/ethernet/xilinx/xilinx_emaclite.c 
b/drivers/net/ethernet/xilinx/xilinx_emaclite.c
index 93dc10b..546f569 100644
--- a/drivers/net/ethernet/xilinx/xilinx_emaclite.c
+++ b/drivers/net/ethernet/xilinx/xilinx_emaclite.c
@@ -1065,7 +1065,7 @@ static bool get_bool(struct platform_device *ofdev, const 
char *s)
}
 }
 
-static struct net_device_ops xemaclite_netdev_ops;
+static const struct net_device_ops xemaclite_netdev_ops;
 
 /**
  * xemaclite_of_probe - Probe method for the Emaclite device.
@@ -1219,7 +1219,7 @@ static int xemaclite_of_remove(struct platform_device 
*of_dev)
 }
 #endif
 
-static struct net_device_ops xemaclite_netdev_ops = {
+static const struct net_device_ops xemaclite_netdev_ops = {
.ndo_open   = xemaclite_open,
.ndo_stop   = xemaclite_close,
.ndo_start_xmit = xemaclite_send,
-- 
1.9.1



[PATCH] regulator: constify regulator_ops structures

2017-01-26 Thread Bhumika Goyal
   105162914 drivers/regulator/twl-regulator.o

864 356   01220 4c4 regulator/vexpress-regulator.o
   1120 100   01220 4c4 regulator/vexpress-regulator.o

   50044236   092402418 regulator/tps80031-regulator.o
   53923852   09244241c regulator/tps80031-regulator.o

   63951924   08319207f regulator/tps65910-regulator.o
   70351284   08319207f regulator/tps65910-regulator.o

   28562660 2565772168c regulator/tps65090-regulator.o
   29842660 1285772168c regulator/tps65090-regulator.o

   4420 252   046721240 regulator/tps62360-regulator.o
   4544 124   04668123c regulator/tps62360-regulator.o

   880  400   01280 500 drivers/regulator/stw481x-vmmc.o
   1008 272   01280 500 drivers/regulator/stw481x-vmmc.o

   11564580   057361668 drivers/regulator/88pm800.o
   14124324   057361668 drivers/regulator/88pm800.o

  2816  356   03172 c64 regulator/anatop-regulator.o
   3072 100   03172 c64 regulator/anatop-regulator.o

   3252 252   03504 db0 drivers/regulator/fan53555.o
   3380 124   03504 db0 drivers/regulator/fan53555.o

   33202100   05420152c drivers/regulator/lp8755.o
   34481972   05420152c drivers/regulator/lp8755.o

  114722120   0   135923518 regulator/qcom_spmi-regulator.o
  12624 968   0   135923518 regulator/qcom_spmi-regulator.o

   2448 252   02700 a8c regulator/tps51632-regulator.o
   2576 124   02700 a8c regulator/tps51632-regulator.o

2244   1756 12841281020 drivers/regulator/ltc3676.o
   26281500   041281020 drivers/regulator/ltc3676.o

   2940 252   03192 c78 drivers/regulator/max8952.o
   3068 124   03192 c78 drivers/regulator/max8952.o

   2672   134004012 fac regulator/pv88090-regulator.o
   29281084   04012 fac regulator/pv88090-regulator.o

   36521180   0483212e0 regulator/pv88080-regulator.o
   3908 924   0483212e0 regulator/pv88080-regulator.o

   5228 380   0560815e8 regulator/pv88060-regulator.o
   5484 124   0560815e8 regulator/pv88060-regulator.o

   35728672   4   122482fd8 regulator/pfuze100-regulator.o
   40848160   4   122482fd8 regulator/pfuze100-regulator.o

   2444 308   02752 ac0 drivers/regulator/pbias-regulator.o
   2568 180   02748 abc drivers/regulator/pbias-regulator.o

 10112 3544 132   1378835dc drivers/regulator/palmas-regulator.o
 11648 2136   4   1378835dc drivers/regulator/palmas-regulator.o

   29722204 128530414b8 drivers/regulator/ltc3589.o
   3484   18200530414b8 drivers/regulator/ltc3589.o

  6180  424   0660419cc regulator/ti-abb-regulator.o
  6308  296   0660419cc regulator/ti-abb-regulator.o

  1239  192   01431 597 drivers/regulator/fixed.o
  1592  100 1281820 71c drivers/regulator/fixed.o

Size details after cross compiling for blackfin architecture.

   1080 252   01332 534 drivers/regulator/ad5398.o
   1208 124   01332 534 drivers/regulator/ad5398.o

Signed-off-by: Bhumika Goyal <bhumi...@gmail.com>
---
 drivers/regulator/88pm800.c |  4 ++--
 drivers/regulator/88pm8607.c|  4 ++--
 drivers/regulator/aat2870-regulator.c   |  2 +-
 drivers/regulator/act8945a-regulator.c  |  2 +-
 drivers/regulator/ad5398.c  |  2 +-
 drivers/regulator/anatop-regulator.c|  4 ++--
 drivers/regulator/arizona-ldo1.c|  4 ++--
 drivers/regulator/arizona-micsupp.c |  2 +-
 drivers/regulator/as3711-regulator.c|  6 +++---
 drivers/regulator/axp20x-regulator.c|  8 
 drivers/regulator/bcm590xx-regulator.c  |  6 +++---
 drivers/regulator/fan53555.c|  2 +-
 drivers/regulator/fixed.c   |  2 +-
 drivers/regulator/gpio-regulator.c  |  4 ++--
 drivers/regulator/hi655x-regulator.c|  4 ++--
 drivers/regulator/lp8755.c  |  2 +-
 drivers/regulator/ltc3589.c |  8 
 drivers/regulator/ltc3676.c |  6 +++---
 drivers/regulator/max14577-regulator.c  |  6 +++---
 drivers/regulator/max77620-regulator.c  |  2 +-
 drivers/regulator/max77686-regulator.c  |  8 
 drivers/regulator/max77693-regulator.c  |  2 +-
 drivers/regulator/max77802-regulator.c  | 10 +-
 drivers/regulator/max8907-regulator.c   | 10 +-
 drivers/regulator/max8925-regulator.c   |  4 ++--
 drivers/regulator/max8952.c |  2 +-
 drivers/regulator/palmas-regulator.c| 24 
 drivers/regulator

[PATCH] tty: serial: constify uart_ops structures

2017-01-25 Thread Bhumika Goyal
Declare uart_ops structures as const as they are only stored in the ops
field of an uart_port structure. This field is of type const, so
uart_ops structures having this property can be made const too.

File size details before and after patching.
First line of every .o file shows the file size before patching
and second line shows the size after patching.

   textdata bss dec hex filename

   2977 456  643497 da9 drivers/tty/serial/amba-pl010.o
   3169 272  643505 db1 drivers/tty/serial/amba-pl010.o

   3109 456   03565 ded drivers/tty/serial/efm32-uart.o
   3301 272   03573 df5 drivers/tty/serial/efm32-uart.o

  10668 753   1   114222c9e drivers/tty/serial/icom.o
  10860 561   1   114222c9e drivers/tty/serial/icom.o

  23904 408   8   243205f00 drivers/tty/serial/ioc3_serial.o
  24088 224   8   243205f00 drivers/tty/serial/ioc3_serial.o

  10516 560   4   110802b48 drivers/tty/serial/ioc4_serial.o
  10709 368   4   110812b49 drivers/tty/serial/ioc4_serial.o

   7853 6481216971725f5 drivers/tty/serial/mpsc.o
   8037 4561216970925ed drivers/tty/serial/mpsc.o

  10248 456   0   1070429d0 drivers/tty/serial/omap-serial.o
  10440 272   0   1071229d8 drivers/tty/serial/omap-serial.o

   8122 5321984   10638298e drivers/tty/serial/pmac_zilog.o
   8306 3401984   106302986 drivers/tty/serial/pmac_zilog.o

   3808 456   0426410a8 drivers/tty/serial/pxa.o
   4000 264   0426410a8 drivers/tty/serial/pxa.o

  217813864   0   25645642d drivers/tty/serial/serial-tegra.o
  220373608   0   25645642d drivers/tty/serial/serial-tegra.o

   2481 456  963033 bd9 drivers/tty/serial/sprd_serial.o
   2673 272  963041 be1 drivers/tty/serial/sprd_serial.o

   5534 300 512634618ca drivers/tty/serial/vr41xx_siu.o
   5630 204 512634618ca drivers/tty/serial/vr41xx_siu.o

   67301576 128843420f2 drivers/tty/serial/vt8500_serial.o
   69861320 128843420f2 drivers/tty/serial/vt8500_serial.o

Cross compiled for mips architecture.

   3005 488   03493 da5 drivers/tty/serial/pnx8xxx_uart.o
   3189 304   03493 da5 drivers/tty/serial/pnx8xxx_uart.o

   4272 196105655241594 drivers/tty/serial/dz.o
   4368 100105655241594 drivers/tty/serial/dz.o

   6551 144  1667111a37 drivers/tty/serial/ip22zilog.o
   6647  48  1667111a37 drivers/tty/serial/ip22zilog.o

   9612 4281520   115602d28 drivers/tty/serial/serial_txx9.o
   9708 3321520   115602d28 drivers/tty/serial/serial_txx9.o

   4156 296  1644681174 drivers/tty/serial/ar933x_uart.o
   4252 200  1644681174 drivers/tty/serial/ar933x_uart.o

Cross compiled for arm archiecture.

  117161780  44   1354034e4 drivers/tty/serial/sirfsoc_uart.o
  118081688  44   1354034e4 drivers/tty/serial/sirfsoc_uart.o

  13352 596  56   1400436b4 drivers/tty/serial/amba-pl011.o
  13444 504  56   1400436b4 drivers/tty/serial/amba-pl011.o

Cross compiled for sparc architecture.

   4664 528  3252241468 drivers/tty/serial/sunhv.o
   4848 344  3252241468 drivers/tty/serial/sunhv.o

   8080 332  28844020f8 drivers/tty/serial/sunzilog.o
   8184 228  28844020f8 drivers/tty/serial/sunzilog.o

Cross compiled for ia64 architecture.

  10226 549 472   112472bef drivers/tty/serial/sn_console.o
  10414 365 472   112512bf3 drivers/tty/serial/sn_console.o

The files drivers/tty/serial/zs.o, drivers/tty/serial/lpc32xx_hs.o and
drivers/tty/serial/lantiq.o did not compile.

Signed-off-by: Bhumika Goyal <bhumi...@gmail.com>
---
 drivers/tty/serial/amba-pl010.c| 2 +-
 drivers/tty/serial/amba-pl011.c| 2 +-
 drivers/tty/serial/ar933x_uart.c   | 2 +-
 drivers/tty/serial/dz.c| 2 +-
 drivers/tty/serial/efm32-uart.c| 2 +-
 drivers/tty/serial/icom.c  | 2 +-
 drivers/tty/serial/ioc3_serial.c   | 2 +-
 drivers/tty/serial/ioc4_serial.c   | 2 +-
 drivers/tty/serial/ip22zilog.c | 2 +-
 drivers/tty/serial/lantiq.c| 2 +-
 drivers/tty/serial/lpc32xx_hs.c| 2 +-
 drivers/tty/serial/mpsc.c  | 2 +-
 drivers/tty/serial/omap-serial.c   | 2 +-
 drivers/tty/serial/pmac_zilog.c| 2 +-
 drivers/tty/serial/pnx8xxx_uart.c  | 2 +-
 drivers/tty/serial/pxa.c   | 2 +-
 drivers/tty/serial/serial-tegra.c  | 2 +-
 drivers/tty/serial/serial_txx9.c   | 2 +-
 drivers/tty/serial/sirfsoc_uart.c  | 2 +-
 drivers/tty/serial/sn_console.c| 2 +-
 drivers/tty/serial/sprd_serial.c   | 2 +-
 drivers/tty/serial/sunhv.c | 2 +-
 drivers/tty/

[PATCH] ALSA: usb-audio: constify snd_kcontrol_new structures

2017-02-21 Thread Bhumika Goyal
Declare snd_kcontrol_new structures as const as they are only passed as
an argument to the function add_new_ctl. This agrument is of type const,
so snd_kcontrol_new structures having this property can be made const
too.

Signed-off-by: Bhumika Goyal <bhumi...@gmail.com>
---
 sound/usb/mixer_scarlett.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/sound/usb/mixer_scarlett.c b/sound/usb/mixer_scarlett.c
index 7438e7c..c33e237 100644
--- a/sound/usb/mixer_scarlett.c
+++ b/sound/usb/mixer_scarlett.c
@@ -477,7 +477,7 @@ static int scarlett_ctl_meter_get(struct snd_kcontrol *kctl,
return 0;
 }
 
-static struct snd_kcontrol_new usb_scarlett_ctl_switch = {
+static const struct snd_kcontrol_new usb_scarlett_ctl_switch = {
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.name = "",
.info = scarlett_ctl_switch_info,
@@ -487,7 +487,7 @@ static int scarlett_ctl_meter_get(struct snd_kcontrol *kctl,
 
 static const DECLARE_TLV_DB_SCALE(db_scale_scarlett_gain, -12800, 100, 0);
 
-static struct snd_kcontrol_new usb_scarlett_ctl = {
+static const struct snd_kcontrol_new usb_scarlett_ctl = {
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.access = SNDRV_CTL_ELEM_ACCESS_READWRITE |
  SNDRV_CTL_ELEM_ACCESS_TLV_READ,
@@ -499,7 +499,7 @@ static int scarlett_ctl_meter_get(struct snd_kcontrol *kctl,
.tlv = { .p = db_scale_scarlett_gain }
 };
 
-static struct snd_kcontrol_new usb_scarlett_ctl_master = {
+static const struct snd_kcontrol_new usb_scarlett_ctl_master = {
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.access = SNDRV_CTL_ELEM_ACCESS_READWRITE |
  SNDRV_CTL_ELEM_ACCESS_TLV_READ,
@@ -511,7 +511,7 @@ static int scarlett_ctl_meter_get(struct snd_kcontrol *kctl,
.tlv = { .p = db_scale_scarlett_gain }
 };
 
-static struct snd_kcontrol_new usb_scarlett_ctl_enum = {
+static const struct snd_kcontrol_new usb_scarlett_ctl_enum = {
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.name = "",
.info = scarlett_ctl_enum_info,
@@ -519,7 +519,7 @@ static int scarlett_ctl_meter_get(struct snd_kcontrol *kctl,
.put =  scarlett_ctl_enum_put,
 };
 
-static struct snd_kcontrol_new usb_scarlett_ctl_dynamic_enum = {
+static const struct snd_kcontrol_new usb_scarlett_ctl_dynamic_enum = {
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.name = "",
.info = scarlett_ctl_enum_dynamic_info,
@@ -527,7 +527,7 @@ static int scarlett_ctl_meter_get(struct snd_kcontrol *kctl,
.put =  scarlett_ctl_enum_put,
 };
 
-static struct snd_kcontrol_new usb_scarlett_ctl_sync = {
+static const struct snd_kcontrol_new usb_scarlett_ctl_sync = {
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE,
.name = "",
-- 
1.9.1



[PATCH] ALSA: constify snd_kcontrol_new structures

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

@r1 disable optional_qualifier @
identifier i;
position p;
@@
static struct snd_kcontrol_new i@p = {...};

@ok1@
identifier r1.i;
position p;
expression e1;
@@
snd_ctl_new1(@p,e1)

@bad@
position p!={r1.p,ok1.p};
identifier r1.i;
@@
i@p

@depends on !bad disable optional_qualifier@
identifier r1.i;
@@
+const
struct snd_kcontrol_new i;

Signed-off-by: Bhumika Goyal <bhumi...@gmail.com>
---
 sound/pci/au88x0/au88x0_a3d.c|  2 +-
 sound/pci/au88x0/au88x0_eq.c |  6 +++---
 sound/pci/au88x0/au88x0_pcm.c|  2 +-
 sound/pci/aw2/aw2-alsa.c |  2 +-
 sound/pci/bt87x.c|  6 +++---
 sound/pci/ca0106/ca0106_mixer.c  |  4 ++--
 sound/pci/cmipci.c   |  6 +++---
 sound/pci/cs4281.c   |  4 ++--
 sound/pci/echoaudio/echoaudio.c  | 26 +-
 sound/pci/emu10k1/emu10k1x.c |  6 +++---
 sound/pci/emu10k1/emumixer.c | 30 +++---
 sound/pci/emu10k1/emupcm.c   |  2 +-
 sound/pci/ens1370.c  |  4 ++--
 sound/pci/hda/hda_codec.c|  4 ++--
 sound/pci/hda/patch_hdmi.c   |  2 +-
 sound/pci/ice1712/delta.c|  2 +-
 sound/pci/ice1712/ews.c  |  4 ++--
 sound/pci/ice1712/ice1712.c  | 30 +++---
 sound/pci/ice1712/ice1724.c  | 20 ++--
 sound/pci/lola/lola_mixer.c  |  2 +-
 sound/pci/lx6464es/lx6464es.c|  2 +-
 sound/pci/mixart/mixart_mixer.c  |  6 +++---
 sound/pci/pcxhr/pcxhr_mix22.c|  6 +++---
 sound/pci/pcxhr/pcxhr_mixer.c| 22 +++---
 sound/pci/trident/trident_main.c | 22 +++---
 sound/pci/via82xx.c  |  6 +++---
 sound/pci/vx222/vx222_ops.c  |  4 ++--
 sound/pci/ymfpci/ymfpci_main.c   | 14 +++---
 28 files changed, 123 insertions(+), 123 deletions(-)

diff --git a/sound/pci/au88x0/au88x0_a3d.c b/sound/pci/au88x0/au88x0_a3d.c
index ab0f873..7a4558a 100644
--- a/sound/pci/au88x0/au88x0_a3d.c
+++ b/sound/pci/au88x0/au88x0_a3d.c
@@ -846,7 +846,7 @@ static void vortex_a3d_translate_filter(a3d_atmos_t filter, 
int *params)
return changed;
 }
 
-static struct snd_kcontrol_new vortex_a3d_kcontrol = {
+static const struct snd_kcontrol_new vortex_a3d_kcontrol = {
.iface = SNDRV_CTL_ELEM_IFACE_PCM,
.name = "Playback PCM advanced processing",
.access = SNDRV_CTL_ELEM_ACCESS_READWRITE,
diff --git a/sound/pci/au88x0/au88x0_eq.c b/sound/pci/au88x0/au88x0_eq.c
index 9585c5c..b566b44 100644
--- a/sound/pci/au88x0/au88x0_eq.c
+++ b/sound/pci/au88x0/au88x0_eq.c
@@ -757,7 +757,7 @@ static void vortex_Eqlzr_shutdown(vortex_t * vortex)
return 1;   /* Allways changes */
 }
 
-static struct snd_kcontrol_new vortex_eqtoggle_kcontrol = {
+static const struct snd_kcontrol_new vortex_eqtoggle_kcontrol = {
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.name = "EQ Enable",
.index = 0,
@@ -815,7 +815,7 @@ static void vortex_Eqlzr_shutdown(vortex_t * vortex)
return changed;
 }
 
-static struct snd_kcontrol_new vortex_eq_kcontrol = {
+static const struct snd_kcontrol_new vortex_eq_kcontrol = {
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.name = ".",
.index = 0,
@@ -855,7 +855,7 @@ static void vortex_Eqlzr_shutdown(vortex_t * vortex)
return 0;
 }
 
-static struct snd_kcontrol_new vortex_levels_kcontrol = {
+static const struct snd_kcontrol_new vortex_levels_kcontrol = {
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.name = "EQ Peaks",
.access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE,
diff --git a/sound/pci/au88x0/au88x0_pcm.c b/sound/pci/au88x0/au88x0_pcm.c
index df5741a..335979a 100644
--- a/sound/pci/au88x0/au88x0_pcm.c
+++ b/sound/pci/au88x0/au88x0_pcm.c
@@ -601,7 +601,7 @@ static int snd_vortex_pcm_vol_put(struct snd_kcontrol 
*kcontrol,
 
 static const DECLARE_TLV_DB_MINMAX(vortex_pcm_vol_db_scale, -9600, 2400);
 
-static struct snd_kcontrol_new snd_vortex_pcm_vol = {
+static const struct snd_kcontrol_new snd_vortex_pcm_vol = {
.iface = SNDRV_CTL_ELEM_IFACE_PCM,
.name = "PCM Playback Volume",
.access = SNDRV_CTL_ELEM_ACCESS_READWRITE |
diff --git a/sound/pci/aw2/aw2-alsa.c b/sound/pci/aw2/aw2-alsa.c
index 57bbb87..8356180 100644
--- a/sound/pci/aw2/aw2-alsa.c
+++ b/sound/pci/aw2/aw2-alsa.c
@@ -202,7 +202,7 @@ static int snd_aw2_control_switch_capture_put(struct 
snd_kcontrol *kcontrol,
.pointer = snd_aw2_pcm_pointer_capture,
 };
 
-static struct snd_kcontrol_new aw2_control = {
+static const struct snd_kcontrol_new aw2_control = {
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.name = "PCM Capture Route

[PATCH] ASLA: emu10k1: constify snd_emux_operators structure

2017-02-19 Thread Bhumika Goyal
Declare snd_emux_operators structure as const as it is only copied into
another structure. So, snd_emux_operators structures having this property
can be made const.

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

diff --git a/sound/pci/emu10k1/emu10k1_callback.c 
b/sound/pci/emu10k1/emu10k1_callback.c
index d2c7ea3..aa2cc27 100644
--- a/sound/pci/emu10k1/emu10k1_callback.c
+++ b/sound/pci/emu10k1/emu10k1_callback.c
@@ -61,7 +61,7 @@ static struct snd_emux_voice *get_voice(struct snd_emux *emux,
 /*
  * set up operators
  */
-static struct snd_emux_operators emu10k1_ops = {
+static const struct snd_emux_operators emu10k1_ops = {
.owner =THIS_MODULE,
.get_voice =get_voice,
.prepare =  start_voice,
-- 
1.9.1



[PATCH] fs/pstore: constify pstore_zbackend structures

2017-02-19 Thread Bhumika Goyal
The references of pstore_zbackend structures are stored into the
pointer zbackend of type struct pstore_zbackend. The pointer zbackend
can be made const as it is only dereferenced. After making this change
the pstore_zbackend structures whose references are stored into the
pointer zbackend can be made const too.

File size before:
   textdata bss dec hex filename
   4817 541 1725530159a fs/pstore/platform.o

File size after:
   textdata bss dec hex filename
   4865 477 1725514158a fs/pstore/platform.o

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

diff --git a/fs/pstore/platform.c b/fs/pstore/platform.c
index 729677e..92e8728 100644
--- a/fs/pstore/platform.c
+++ b/fs/pstore/platform.c
@@ -267,7 +267,7 @@ static void free_zlib(void)
big_oops_buf_sz = 0;
 }
 
-static struct pstore_zbackend backend_zlib = {
+static const struct pstore_zbackend backend_zlib = {
.compress   = compress_zlib,
.decompress = decompress_zlib,
.allocate   = allocate_zlib,
@@ -328,7 +328,7 @@ static void free_lzo(void)
big_oops_buf_sz = 0;
 }
 
-static struct pstore_zbackend backend_lzo = {
+static const struct pstore_zbackend backend_lzo = {
.compress   = compress_lzo,
.decompress = decompress_lzo,
.allocate   = allocate_lzo,
@@ -389,7 +389,7 @@ static void free_lz4(void)
big_oops_buf_sz = 0;
 }
 
-static struct pstore_zbackend backend_lz4 = {
+static const struct pstore_zbackend backend_lz4 = {
.compress   = compress_lz4,
.decompress = decompress_lz4,
.allocate   = allocate_lz4,
@@ -398,7 +398,7 @@ static void free_lz4(void)
 };
 #endif
 
-static struct pstore_zbackend *zbackend =
+static const struct pstore_zbackend *zbackend =
 #if defined(CONFIG_PSTORE_ZLIB_COMPRESS)
_zlib;
 #elif defined(CONFIG_PSTORE_LZO_COMPRESS)
-- 
1.9.1



[PATCH] b2c2: constify nxt200x_config structure

2017-02-19 Thread Bhumika Goyal
Declare nxt200x_config structure as const as it is only passed as
an argument to the function dvb_attach. dvb_attach calls its first
argument on the rest of its arguments. The first argument of
dvb_attach in the changed case is nxt200x_attach and the parameter of
this function to which the object reference is passed is of type
const. So, nxt200x_config structures having this property can be made 
const.

File size before:
   textdata bss dec hex filename
   7566 568   081341fc6 common/b2c2/flexcop-fe-tuner.o

File size after:
   textdata bss dec hex filename
   7582 536   081181fb6 common/b2c2/flexcop-fe-tuner.o

Signed-off-by: Bhumika Goyal <bhumi...@gmail.com>
---
 drivers/media/common/b2c2/flexcop-fe-tuner.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/common/b2c2/flexcop-fe-tuner.c 
b/drivers/media/common/b2c2/flexcop-fe-tuner.c
index f595640..e846a97 100644
--- a/drivers/media/common/b2c2/flexcop-fe-tuner.c
+++ b/drivers/media/common/b2c2/flexcop-fe-tuner.c
@@ -474,7 +474,7 @@ static int airstar_atsc1_attach(struct flexcop_device *fc,
 
 /* AirStar ATSC 2nd generation */
 #if FE_SUPPORTED(NXT200X) && FE_SUPPORTED(PLL)
-static struct nxt200x_config samsung_tbmv_config = {
+static const struct nxt200x_config samsung_tbmv_config = {
.demod_address = 0x0a,
 };
 
-- 
1.9.1



[PATCH] saa7134: constify nxt200x_config structures

2017-02-19 Thread Bhumika Goyal
Declare nxt200x_config structures as const as they are only passed as
an argument to the function dvb_attach. dvb_attach calls its first
argument on the rest of its arguments. The first argument of
dvb_attach in the changed cases is nxt200x_attach and the parameter of
this function to which the object references are passed is of type
const. So, nxt200x_config structures having this property can be made
const.

File size before:
   textdata bss dec hex filename
  213203776  16   251126218 saa7134/saa7134-dvb.o

File size after:
   textdata bss dec hex filename
  213843744  16   251446238 saa7134/saa7134-dvb.o

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

diff --git a/drivers/media/pci/saa7134/saa7134-dvb.c 
b/drivers/media/pci/saa7134/saa7134-dvb.c
index 598b8bb..36156f1 100644
--- a/drivers/media/pci/saa7134/saa7134-dvb.c
+++ b/drivers/media/pci/saa7134/saa7134-dvb.c
@@ -1046,11 +1046,11 @@ static int md8800_set_high_voltage2(struct dvb_frontend 
*fe, long arg)
  * nxt200x based ATSC cards, helper functions
  */
 
-static struct nxt200x_config avertvhda180 = {
+static const struct nxt200x_config avertvhda180 = {
.demod_address= 0x0a,
 };
 
-static struct nxt200x_config kworldatsc110 = {
+static const struct nxt200x_config kworldatsc110 = {
.demod_address= 0x0a,
 };
 
-- 
1.9.1



[PATCH] media: pci: constify stv0299_config structures

2017-02-19 Thread Bhumika Goyal
Declare stv0299_config structures as const as they are only passed as
an argument to the function dvb_attach. dvb_attach
calls its first argument on the rest of its arguments. The first
argument of dvb_attach in the changed cases is stv0299_attach and 
the parameter of this function to which the object references are passed
is of type const. So, stv0299_config structures having this property 
can be made const.

First line shows the file size before patching and second one shows size 
after patching.

   textdata bss dec hex filename
   9572 926  40   10538292a media/pci/dm1105/dm1105.o
   9636 862  40   10538292a media/pci/dm1105/dm1105.o

  151335408   0   20541503d media/pci/ttpci/budget-av.o
  153895152   0   20541503d media/pci/ttpci/budget-av.o

  157032326  36   180654691 media/pci/ttpci/budget-ci.o
  157672262  36   180654691 media/pci/ttpci/budget-ci.o

  105551918   4   1247730bd drivers/media/pci/ttpci/budget.o
  106831822   4   1250930dd drivers/media/pci/ttpci/budget.o

Signed-off-by: Bhumika Goyal <bhumi...@gmail.com>
---
 drivers/media/pci/dm1105/dm1105.c   | 2 +-
 drivers/media/pci/ttpci/budget-av.c | 8 
 drivers/media/pci/ttpci/budget-ci.c | 2 +-
 drivers/media/pci/ttpci/budget.c| 4 ++--
 4 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/media/pci/dm1105/dm1105.c 
b/drivers/media/pci/dm1105/dm1105.c
index a589aa7..c97a98b 100644
--- a/drivers/media/pci/dm1105/dm1105.c
+++ b/drivers/media/pci/dm1105/dm1105.c
@@ -820,7 +820,7 @@ static void dm1105_hw_exit(struct dm1105_dev *dev)
dm1105_dma_unmap(dev);
 }
 
-static struct stv0299_config sharp_z0194a_config = {
+static const struct stv0299_config sharp_z0194a_config = {
.demod_address = 0x68,
.inittab = sharp_z0194a_inittab,
.mclk = 8800UL,
diff --git a/drivers/media/pci/ttpci/budget-av.c 
b/drivers/media/pci/ttpci/budget-av.c
index 896c66d..48ea605 100644
--- a/drivers/media/pci/ttpci/budget-av.c
+++ b/drivers/media/pci/ttpci/budget-av.c
@@ -580,7 +580,7 @@ static int philips_su1278_ty_ci_tuner_set_params(struct 
dvb_frontend *fe)
0xff, 0xff
 };
 
-static struct stv0299_config typhoon_config = {
+static const struct stv0299_config typhoon_config = {
.demod_address = 0x68,
.inittab = typhoon_cinergy1200s_inittab,
.mclk = 8800UL,
@@ -593,7 +593,7 @@ static int philips_su1278_ty_ci_tuner_set_params(struct 
dvb_frontend *fe)
 };
 
 
-static struct stv0299_config cinergy_1200s_config = {
+static const struct stv0299_config cinergy_1200s_config = {
.demod_address = 0x68,
.inittab = typhoon_cinergy1200s_inittab,
.mclk = 8800UL,
@@ -605,7 +605,7 @@ static int philips_su1278_ty_ci_tuner_set_params(struct 
dvb_frontend *fe)
.set_symbol_rate = philips_su1278_ty_ci_set_symbol_rate,
 };
 
-static struct stv0299_config cinergy_1200s_1894_0010_config = {
+static const struct stv0299_config cinergy_1200s_1894_0010_config = {
.demod_address = 0x68,
.inittab = typhoon_cinergy1200s_inittab,
.mclk = 8800UL,
@@ -879,7 +879,7 @@ static int philips_sd1878_ci_set_symbol_rate(struct 
dvb_frontend *fe,
return 0;
 }
 
-static struct stv0299_config philips_sd1878_config = {
+static const struct stv0299_config philips_sd1878_config = {
.demod_address = 0x68,
  .inittab = philips_sd1878_inittab,
.mclk = 8800UL,
diff --git a/drivers/media/pci/ttpci/budget-ci.c 
b/drivers/media/pci/ttpci/budget-ci.c
index 20ad93b..ff8a60e 100644
--- a/drivers/media/pci/ttpci/budget-ci.c
+++ b/drivers/media/pci/ttpci/budget-ci.c
@@ -696,7 +696,7 @@ static int philips_su1278_tt_tuner_set_params(struct 
dvb_frontend *fe)
return 0;
 }
 
-static struct stv0299_config philips_su1278_tt_config = {
+static const struct stv0299_config philips_su1278_tt_config = {
 
.demod_address = 0x68,
.inittab = philips_su1278_tt_inittab,
diff --git a/drivers/media/pci/ttpci/budget.c b/drivers/media/pci/ttpci/budget.c
index 3091b48..83510df 100644
--- a/drivers/media/pci/ttpci/budget.c
+++ b/drivers/media/pci/ttpci/budget.c
@@ -400,7 +400,7 @@ static int s5h1420_tuner_set_params(struct dvb_frontend *fe)
.xtal_freq = TDA10086_XTAL_16M,
 };
 
-static struct stv0299_config alps_bsru6_config_activy = {
+static const struct stv0299_config alps_bsru6_config_activy = {
.demod_address = 0x68,
.inittab = alps_bsru6_inittab,
.mclk = 8800UL,
@@ -410,7 +410,7 @@ static int s5h1420_tuner_set_params(struct dvb_frontend *fe)
.set_symbol_rate = alps_bsru6_set_symbol_rate,
 };
 
-static struct stv0299_config alps_bsbe1_config_activy = {
+static const struct stv0299_config alps_bsbe1_config_activy = {
.demod_address = 0x68,
.inittab = alps_bsbe1_inittab,
.mclk = 8800UL,
-- 
1.9.1



[PATCH] ocfs2: Add const to various occurrences of struct ocfs2_lock_res_ops

2017-02-19 Thread Bhumika Goyal
The field l_ops of structure ocfs2_lock_res can be made const as it
never modified after getting initialized. After making this change the
parameter struct ocfs2_lock_res_ops *ops of function
ocfs2_lock_res_init_common can be made const as ops is only stored
in l_ops. Now the structures of type ocfs2_lock_res_ops can be made
const as they are only passed as an argument to the above updated function.

Signed-off-by: Bhumika Goyal <bhumi...@gmail.com>
---
 fs/ocfs2/dlmglue.c | 26 +-
 fs/ocfs2/ocfs2.h   |  2 +-
 2 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/fs/ocfs2/dlmglue.c b/fs/ocfs2/dlmglue.c
index 77d1632..885f200 100644
--- a/fs/ocfs2/dlmglue.c
+++ b/fs/ocfs2/dlmglue.c
@@ -233,12 +233,12 @@ struct ocfs2_lock_res_ops {
  */
 #define LOCK_TYPE_USES_LVB 0x2
 
-static struct ocfs2_lock_res_ops ocfs2_inode_rw_lops = {
+static const struct ocfs2_lock_res_ops ocfs2_inode_rw_lops = {
.get_osb= ocfs2_get_inode_osb,
.flags  = 0,
 };
 
-static struct ocfs2_lock_res_ops ocfs2_inode_inode_lops = {
+static const struct ocfs2_lock_res_ops ocfs2_inode_inode_lops = {
.get_osb= ocfs2_get_inode_osb,
.check_downconvert = ocfs2_check_meta_downconvert,
.set_lvb= ocfs2_set_meta_lvb,
@@ -246,46 +246,46 @@ struct ocfs2_lock_res_ops {
.flags  = LOCK_TYPE_REQUIRES_REFRESH|LOCK_TYPE_USES_LVB,
 };
 
-static struct ocfs2_lock_res_ops ocfs2_super_lops = {
+static const struct ocfs2_lock_res_ops ocfs2_super_lops = {
.flags  = LOCK_TYPE_REQUIRES_REFRESH,
 };
 
-static struct ocfs2_lock_res_ops ocfs2_rename_lops = {
+static const struct ocfs2_lock_res_ops ocfs2_rename_lops = {
.flags  = 0,
 };
 
-static struct ocfs2_lock_res_ops ocfs2_nfs_sync_lops = {
+static const struct ocfs2_lock_res_ops ocfs2_nfs_sync_lops = {
.flags  = 0,
 };
 
-static struct ocfs2_lock_res_ops ocfs2_orphan_scan_lops = {
+static const struct ocfs2_lock_res_ops ocfs2_orphan_scan_lops = {
.flags  = LOCK_TYPE_REQUIRES_REFRESH|LOCK_TYPE_USES_LVB,
 };
 
-static struct ocfs2_lock_res_ops ocfs2_dentry_lops = {
+static const struct ocfs2_lock_res_ops ocfs2_dentry_lops = {
.get_osb= ocfs2_get_dentry_osb,
.post_unlock= ocfs2_dentry_post_unlock,
.downconvert_worker = ocfs2_dentry_convert_worker,
.flags  = 0,
 };
 
-static struct ocfs2_lock_res_ops ocfs2_inode_open_lops = {
+static const struct ocfs2_lock_res_ops ocfs2_inode_open_lops = {
.get_osb= ocfs2_get_inode_osb,
.flags  = 0,
 };
 
-static struct ocfs2_lock_res_ops ocfs2_flock_lops = {
+static const struct ocfs2_lock_res_ops ocfs2_flock_lops = {
.get_osb= ocfs2_get_file_osb,
.flags  = 0,
 };
 
-static struct ocfs2_lock_res_ops ocfs2_qinfo_lops = {
+static const struct ocfs2_lock_res_ops ocfs2_qinfo_lops = {
.set_lvb= ocfs2_set_qinfo_lvb,
.get_osb= ocfs2_get_qinfo_osb,
.flags  = LOCK_TYPE_REQUIRES_REFRESH | LOCK_TYPE_USES_LVB,
 };
 
-static struct ocfs2_lock_res_ops ocfs2_refcount_block_lops = {
+static const struct ocfs2_lock_res_ops ocfs2_refcount_block_lops = {
.check_downconvert = ocfs2_check_refcount_downconvert,
.downconvert_worker = ocfs2_refcount_convert_worker,
.flags  = 0,
@@ -497,7 +497,7 @@ static inline void ocfs2_init_start_time(struct 
ocfs2_mask_waiter *mw)
 static void ocfs2_lock_res_init_common(struct ocfs2_super *osb,
   struct ocfs2_lock_res *res,
   enum ocfs2_lock_type type,
-  struct ocfs2_lock_res_ops *ops,
+  const struct ocfs2_lock_res_ops *ops,
   void *priv)
 {
res->l_type  = type;
@@ -539,7 +539,7 @@ void ocfs2_inode_lock_res_init(struct ocfs2_lock_res *res,
   unsigned int generation,
   struct inode *inode)
 {
-   struct ocfs2_lock_res_ops *ops;
+   const struct ocfs2_lock_res_ops *ops;
 
switch(type) {
case OCFS2_LOCK_TYPE_RW:
diff --git a/fs/ocfs2/ocfs2.h b/fs/ocfs2/ocfs2.h
index 7e5958b..691e0813 100644
--- a/fs/ocfs2/ocfs2.h
+++ b/fs/ocfs2/ocfs2.h
@@ -167,7 +167,7 @@ struct ocfs2_lock_stats {
 
 struct ocfs2_lock_res {
void*l_priv;
-   struct ocfs2_lock_res_ops *l_ops;
+   const struct ocfs2_lock_res_ops *l_ops;
 
 
struct list_head l_blocked_list;
-- 
1.9.1



[PATCH] cx88: constify mb86a16_config structure

2017-02-19 Thread Bhumika Goyal
Declare mb86a16_config structure as const as it is only passed as
an argument to the function dvb_attach. dvb_attach calls its first
argument on the rest of its arguments. The first argument of
dvb_attach in the changed case is mb86a16_attach and the parameter of
this function to which the object reference is passed is of type
const. So, mb86a16_config structures having this property can be made
const.

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

diff --git a/drivers/media/pci/cx88/cx88-dvb.c 
b/drivers/media/pci/cx88/cx88-dvb.c
index ddf9067..49a335f 100644
--- a/drivers/media/pci/cx88/cx88-dvb.c
+++ b/drivers/media/pci/cx88/cx88-dvb.c
@@ -306,7 +306,7 @@ static int dntv_live_dvbt_demod_init(struct dvb_frontend 
*fe)
.if2   = 45600,
 };
 
-static struct mb86a16_config twinhan_vp1027 = {
+static const struct mb86a16_config twinhan_vp1027 = {
.demod_address  = 0x08,
 };
 
-- 
1.9.1



[PATCH] pci: mantis: constify mb86a16_config structure

2017-02-19 Thread Bhumika Goyal
Declare mb86a16_config structure as const as it is either passed as
an argument to the function dvb_attach or is dereferenced. dvb_attach
calls its first argument on the rest of its arguments. The first argument
of dvb_attach in the changed case is mb86a16_attach and the parameter of
this function to which the object reference is passed is of type
const. So, mb86a16_config structures having this property can be made
const.

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

diff --git a/drivers/media/pci/mantis/mantis_vp1034.c 
b/drivers/media/pci/mantis/mantis_vp1034.c
index 3b19285..e4972ff 100644
--- a/drivers/media/pci/mantis/mantis_vp1034.c
+++ b/drivers/media/pci/mantis/mantis_vp1034.c
@@ -36,7 +36,7 @@
 #include "mantis_vp1034.h"
 #include "mantis_reg.h"
 
-static struct mb86a16_config vp1034_mb86a16_config = {
+static const struct mb86a16_config vp1034_mb86a16_config = {
.demod_address  = 0x08,
.set_voltage= vp1034_set_voltage,
 };
-- 
1.9.1



[PATCH] qlogic: qlcnic_sysfs: constify bin_attribute structures

2017-02-21 Thread Bhumika Goyal
Declare bin_attribute structures as const as they are only passed as an
arguments to the functions device_remove_bin_file and
device_create_bin_file. These function arguments are of type const, so
bin_attribute structures having this property can be made const too.
Done using Coccinelle:

@r1 disable optional_qualifier @
identifier i;
position p;
@@
static struct bin_attribute i@p = {...};

@ok1@
identifier r1.i;
position p,p1;
@@
(
device_remove_bin_file(...,@p)
|
device_create_bin_file(..., @p1)
)

@bad@
position p!={r1.p,ok1.p,ok1.p1};
identifier r1.i;
@@
i@p


@depends on !bad disable optional_qualifier@
identifier r1.i;
@@
+const
struct bin_attribute i;

Signed-off-by: Bhumika Goyal <bhumi...@gmail.com>
---
 drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c | 16 
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c 
b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c
index ccbb045..73027a6 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c
@@ -1192,56 +1192,56 @@ static ssize_t 
qlcnic_83xx_sysfs_flash_write_handler(struct file *filp,
.store = qlcnic_store_beacon,
 };
 
-static struct bin_attribute bin_attr_crb = {
+static const struct bin_attribute bin_attr_crb = {
.attr = {.name = "crb", .mode = (S_IRUGO | S_IWUSR)},
.size = 0,
.read = qlcnic_sysfs_read_crb,
.write = qlcnic_sysfs_write_crb,
 };
 
-static struct bin_attribute bin_attr_mem = {
+static const struct bin_attribute bin_attr_mem = {
.attr = {.name = "mem", .mode = (S_IRUGO | S_IWUSR)},
.size = 0,
.read = qlcnic_sysfs_read_mem,
.write = qlcnic_sysfs_write_mem,
 };
 
-static struct bin_attribute bin_attr_npar_config = {
+static const struct bin_attribute bin_attr_npar_config = {
.attr = {.name = "npar_config", .mode = (S_IRUGO | S_IWUSR)},
.size = 0,
.read = qlcnic_sysfs_read_npar_config,
.write = qlcnic_sysfs_write_npar_config,
 };
 
-static struct bin_attribute bin_attr_pci_config = {
+static const struct bin_attribute bin_attr_pci_config = {
.attr = {.name = "pci_config", .mode = (S_IRUGO | S_IWUSR)},
.size = 0,
.read = qlcnic_sysfs_read_pci_config,
.write = NULL,
 };
 
-static struct bin_attribute bin_attr_port_stats = {
+static const struct bin_attribute bin_attr_port_stats = {
.attr = {.name = "port_stats", .mode = (S_IRUGO | S_IWUSR)},
.size = 0,
.read = qlcnic_sysfs_get_port_stats,
.write = qlcnic_sysfs_clear_port_stats,
 };
 
-static struct bin_attribute bin_attr_esw_stats = {
+static const struct bin_attribute bin_attr_esw_stats = {
.attr = {.name = "esw_stats", .mode = (S_IRUGO | S_IWUSR)},
.size = 0,
.read = qlcnic_sysfs_get_esw_stats,
.write = qlcnic_sysfs_clear_esw_stats,
 };
 
-static struct bin_attribute bin_attr_esw_config = {
+static const struct bin_attribute bin_attr_esw_config = {
.attr = {.name = "esw_config", .mode = (S_IRUGO | S_IWUSR)},
.size = 0,
.read = qlcnic_sysfs_read_esw_config,
.write = qlcnic_sysfs_write_esw_config,
 };
 
-static struct bin_attribute bin_attr_pm_config = {
+static const struct bin_attribute bin_attr_pm_config = {
.attr = {.name = "pm_config", .mode = (S_IRUGO | S_IWUSR)},
.size = 0,
.read = qlcnic_sysfs_read_pm_config,
-- 
1.9.1



[PATCH] qlogic: netxen: constify bin_attribute structures

2017-02-21 Thread Bhumika Goyal
Declare bin_attribute structures as const as they are only passed as an
arguments to the functions device_remove_bin_file and
device_create_bin_file. These function arguments are of type const, so
bin_attribute structures having this property can be made const too.
Done using Coccinelle:

@r1 disable optional_qualifier @
identifier i;
position p;
@@
static struct bin_attribute i@p = {...};

@ok1@
identifier r1.i;
position p,p1;
@@
(
device_remove_bin_file(...,@p)
|
device_create_bin_file(..., @p1)
)

@bad@
position p!={r1.p,ok1.p,ok1.p1};
identifier r1.i;
@@
i@p

@depends on !bad disable optional_qualifier@
identifier r1.i;
@@
+const
struct bin_attribute i;

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

diff --git a/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c 
b/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c
index 561fb94..ee5376e 100644
--- a/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c
+++ b/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c
@@ -3007,14 +3007,14 @@ static ssize_t netxen_sysfs_write_mem(struct file 
*filp, struct kobject *kobj,
 }
 
 
-static struct bin_attribute bin_attr_crb = {
+static const struct bin_attribute bin_attr_crb = {
.attr = {.name = "crb", .mode = (S_IRUGO | S_IWUSR)},
.size = 0,
.read = netxen_sysfs_read_crb,
.write = netxen_sysfs_write_crb,
 };
 
-static struct bin_attribute bin_attr_mem = {
+static const struct bin_attribute bin_attr_mem = {
.attr = {.name = "mem", .mode = (S_IRUGO | S_IWUSR)},
.size = 0,
.read = netxen_sysfs_read_mem,
@@ -3143,7 +3143,7 @@ static ssize_t netxen_sysfs_write_mem(struct file *filp, 
struct kobject *kobj,
 
 }
 
-static struct bin_attribute bin_attr_dimm = {
+static const struct bin_attribute bin_attr_dimm = {
.attr = { .name = "dimm", .mode = (S_IRUGO | S_IWUSR) },
.size = sizeof(struct netxen_dimm_cfg),
.read = netxen_sysfs_read_dimm,
-- 
1.9.1



[PATCH] clocksource: add __ro_after_init to cyclecounter

2017-02-11 Thread Bhumika Goyal
The object cyclecounter of type cyclecounter is not getting modified
after getting initialized by arch_counter_register. Apart from
initialization in arch_counter_register it is also passed as an argument
to the function timecounter_init but this argument is of type const.
Therefore, add __ro_after_init to its declaration.

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

diff --git a/drivers/clocksource/arm_arch_timer.c 
b/drivers/clocksource/arm_arch_timer.c
index 4c8c3fb..a10506b 100644
--- a/drivers/clocksource/arm_arch_timer.c
+++ b/drivers/clocksource/arm_arch_timer.c
@@ -580,7 +580,7 @@ static u64 arch_counter_read_cc(const struct cyclecounter 
*cc)
.flags  = CLOCK_SOURCE_IS_CONTINUOUS,
 };
 
-static struct cyclecounter cyclecounter = {
+static struct cyclecounter cyclecounter __ro_after_init = {
.read   = arch_counter_read_cc,
.mask   = CLOCKSOURCE_MASK(56),
 };
-- 
1.9.1



[PATCH] kernel: ksysfs: add __ro_after_init to bin_attribute structure

2017-02-11 Thread Bhumika Goyal
The object notes_attr of type bin_attribute is not modified after
getting initailized by ksysfs_init. Apart from initialization in
ksysfs_init it is also passed as an argument to the function
sysfs_create_bin_file but this argument is of type const. Therefore, add
__ro_after_init to its declaration.

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

diff --git a/kernel/ksysfs.c b/kernel/ksysfs.c
index ee1bc1b..0999679 100644
--- a/kernel/ksysfs.c
+++ b/kernel/ksysfs.c
@@ -195,7 +195,7 @@ static ssize_t notes_read(struct file *filp, struct kobject 
*kobj,
return count;
 }
 
-static struct bin_attribute notes_attr = {
+static struct bin_attribute notes_attr __ro_after_init  = {
.attr = {
.name = "notes",
.mode = S_IRUGO,
-- 
1.9.1



Re: [PATCH] clocksource: add __ro_after_init to cyclecounter

2017-02-12 Thread Bhumika Goyal
On Sun, Feb 12, 2017 at 2:01 AM, Ard Biesheuvel
<ard.biesheu...@linaro.org> wrote:
> On 11 February 2017 at 19:20, Bhumika Goyal <bhumi...@gmail.com> wrote:
>> The object cyclecounter of type cyclecounter is not getting modified
>> after getting initialized by arch_counter_register. Apart from
>> initialization in arch_counter_register it is also passed as an argument
>> to the function timecounter_init but this argument is of type const.
>> Therefore, add __ro_after_init to its declaration.
>>
>
> I think adding __ro_after_init is fine if this struct is never
> modified after init. But the reference in the commit log to the
> constness of the timecounter_init() argument  makes no sense: that
> only means timecounter_init() will not modify the object, which allows
> pointers to const objects to be passed to it as well. The opposite is
> not true, though: there is no requirement whatsoever that objects
> passed into const pointer arguments should be const themselves.
>
>

Yes, true. I will change the commit log and send a v2. Thanks for explaining.

Thanks,
Bhumika

>> Signed-off-by: Bhumika Goyal <bhumi...@gmail.com>
>> ---
>>  drivers/clocksource/arm_arch_timer.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/clocksource/arm_arch_timer.c 
>> b/drivers/clocksource/arm_arch_timer.c
>> index 4c8c3fb..a10506b 100644
>> --- a/drivers/clocksource/arm_arch_timer.c
>> +++ b/drivers/clocksource/arm_arch_timer.c
>> @@ -580,7 +580,7 @@ static u64 arch_counter_read_cc(const struct 
>> cyclecounter *cc)
>> .flags  = CLOCK_SOURCE_IS_CONTINUOUS,
>>  };
>>
>> -static struct cyclecounter cyclecounter = {
>> +static struct cyclecounter cyclecounter __ro_after_init = {
>> .read   = arch_counter_read_cc,
>> .mask   = CLOCKSOURCE_MASK(56),
>>  };
>> --
>> 1.9.1
>>
>>
>> ___
>> linux-arm-kernel mailing list
>> linux-arm-ker...@lists.infradead.org
>> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel


Re: [PATCH] clocksource: add __ro_after_init to cyclecounter

2017-02-12 Thread Bhumika Goyal
On Sun, Feb 12, 2017 at 2:05 AM, Thomas Gleixner <t...@linutronix.de> wrote:
> On Sun, 12 Feb 2017, Bhumika Goyal wrote:
>
> Please be more careful with your subject line. The prefix for this is
> definitely not 'clocksource'. git log would have told you the proper one:
>
> clocksource/drivers/arm_arch_timer
>
> 'clocksource' is the general subsystem and used for system wide changes or
> core changes, but not for a particular driver.
>

I will be more careful about this in future.

Thanks,
Bhumika

>> The object cyclecounter of type cyclecounter is not getting modified
>> after getting initialized by arch_counter_register. Apart from
>> initialization in arch_counter_register it is also passed as an argument
>> to the function timecounter_init but this argument is of type const.
>> Therefore, add __ro_after_init to its declaration.
>
> Other than that this is fine. I'll fix it up when applying.
>
> Thanks,
>
> tglx


Re: [PATCH] clocksource: add __ro_after_init to cyclecounter

2017-02-12 Thread Bhumika Goyal
On Mon, Feb 13, 2017 at 12:26 AM, Thomas Gleixner <t...@linutronix.de> wrote:
> On Sun, 12 Feb 2017, Bhumika Goyal wrote:
>
>> On Sun, Feb 12, 2017 at 2:01 AM, Ard Biesheuvel
>> <ard.biesheu...@linaro.org> wrote:
>> > On 11 February 2017 at 19:20, Bhumika Goyal <bhumi...@gmail.com> wrote:
>> >> The object cyclecounter of type cyclecounter is not getting modified
>> >> after getting initialized by arch_counter_register. Apart from
>> >> initialization in arch_counter_register it is also passed as an argument
>> >> to the function timecounter_init but this argument is of type const.
>> >> Therefore, add __ro_after_init to its declaration.
>> >>
>> >
>> > I think adding __ro_after_init is fine if this struct is never
>> > modified after init. But the reference in the commit log to the
>> > constness of the timecounter_init() argument  makes no sense: that
>> > only means timecounter_init() will not modify the object, which allows
>> > pointers to const objects to be passed to it as well. The opposite is
>> > not true, though: there is no requirement whatsoever that objects
>> > passed into const pointer arguments should be const themselves.
>> >
>> >
>>
>> Yes, true. I will change the commit log and send a v2. Thanks for explaining.
>
> I've applied it already and fixed up the subject/changelog. You should have
> mail from tip-bot ...

Okay. Thanks. I thought the patch is not applied yet because I haven't
received a mail from tip-bot yet.

Thanks,
Bhumika


[PATCH] rbd: constify device_type structure

2017-02-10 Thread Bhumika Goyal
Declare device_type structure as const as it is only stored in the
type field of a device structure. This field is of type const, so add
const to the declaration of device_type structure.

File size before:
   textdata bss dec hex filename
  61546   11610 208   73364   11e94 drivers/block/rbd.o

File size after:
   textdata bss dec hex filename
  61610   11578 208   73396   11eb4 drivers/block/rbd.o

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

diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index 36d2b9f..dfc708b 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -4779,7 +4779,7 @@ static ssize_t rbd_image_refresh(struct device *dev,
 
 static void rbd_dev_release(struct device *dev);
 
-static struct device_type rbd_device_type = {
+static const struct device_type rbd_device_type = {
.name   = "rbd",
.groups = rbd_attr_groups,
.release= rbd_dev_release,
-- 
1.9.1



[PATCH] HID: intel-ish-hid: constify device_type structure

2017-02-10 Thread Bhumika Goyal
Declare device_type structure as const as it is only stored in the
type field of a device structure. This field is of type const, so add
const to the declaration of device_type structure.

File size before: drivers/hid/intel-ish-hid/ishtp/bus.o
   textdata bss dec hex filename
   4260 336  1646121204 hid/intel-ish-hid/ishtp/bus.o

File size after: drivers/hid/intel-ish-hid/ishtp/bus.o
   textdata bss dec hex filename
   4324 272  1646121204 hid/intel-ish-hid/ishtp/bus.o

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

diff --git a/drivers/hid/intel-ish-hid/ishtp/bus.c 
b/drivers/hid/intel-ish-hid/ishtp/bus.c
index f4cbc74..5f382fe 100644
--- a/drivers/hid/intel-ish-hid/ishtp/bus.c
+++ b/drivers/hid/intel-ish-hid/ishtp/bus.c
@@ -358,7 +358,7 @@ static void ishtp_cl_dev_release(struct device *dev)
kfree(to_ishtp_cl_device(dev));
 }
 
-static struct device_type ishtp_cl_device_type = {
+static const struct device_type ishtp_cl_device_type = {
.release= ishtp_cl_dev_release,
 };
 
-- 
1.9.1



[PATCH] f2fs: super: constify fscrypt_operations structure

2017-02-11 Thread Bhumika Goyal
Declare fscrypt_operations structure as const as it is only stored in
the s_cop field of a super_block structure. This field is of type const,
so fscrypt_operations structure having this property can be made const
too.

File size before: fs/f2fs/super.o
   textdata bss dec hex filename
  54131   31355 184   85670   14ea6 fs/f2fs/super.o

File size after: fs/f2fs/super.o
   textdata bss dec hex filename
  54227   31259 184   85670   14ea6 fs/f2fs/super.o

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

diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index 46fd30d..b17ca61 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -1176,7 +1176,7 @@ static unsigned f2fs_max_namelen(struct inode *inode)
inode->i_sb->s_blocksize : F2FS_NAME_LEN;
 }
 
-static struct fscrypt_operations f2fs_cryptops = {
+static const struct fscrypt_operations f2fs_cryptops = {
.get_context= f2fs_get_context,
.key_prefix = f2fs_key_prefix,
.set_context= f2fs_set_context,
@@ -1185,7 +1185,7 @@ static unsigned f2fs_max_namelen(struct inode *inode)
.max_namelen= f2fs_max_namelen,
 };
 #else
-static struct fscrypt_operations f2fs_cryptops = {
+static const struct fscrypt_operations f2fs_cryptops = {
.is_encrypted   = f2fs_encrypted_inode,
 };
 #endif
-- 
1.9.1



  1   2   3   4   5   6   7   8   9   10   >