linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] constify lustre attribute_group structures
@ 2017-07-17  5:48 Arvind Yadav
  2017-07-17  5:48 ` [PATCH 1/4] staging: lustre: constify " Arvind Yadav
                   ` (4 more replies)
  0 siblings, 5 replies; 12+ messages in thread
From: Arvind Yadav @ 2017-07-17  5:48 UTC (permalink / raw)
  To: oleg.drokin, andreas.dilger, jsimmons, gregkh, lustre-devel,
	devel, linux-kernel
  Cc: john.hammond, dmitry.eremin, fan.yong

attribute_groups are not supposed to change at runtime. All functions
working with attribute_groups provided by <linux/sysfs.h> work
with const attribute_group. So mark the non-const structs as const.

Arvind Yadav (4):
  [PATCH 1/4] staging: lustre: constify attribute_group structures.
  [PATCH 2/4] staging: lustre: ldlm: constify attribute_group structures.
  [PATCH 3/4] staging: lustre: obdclass: linux: constify attribute_group structures.
  [PATCH 4/4] staging: lustre: obdclass: constify attribute_group structures.

 drivers/staging/lustre/lustre/include/lprocfs_status.h      | 4 ++--
 drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c             | 2 +-
 drivers/staging/lustre/lustre/lmv/lproc_lmv.c               | 2 +-
 drivers/staging/lustre/lustre/lov/lproc_lov.c               | 2 +-
 drivers/staging/lustre/lustre/mdc/lproc_mdc.c               | 2 +-
 drivers/staging/lustre/lustre/obdclass/linux/linux-module.c | 2 +-
 drivers/staging/lustre/lustre/obdclass/lprocfs_status.c     | 2 +-
 drivers/staging/lustre/lustre/osc/lproc_osc.c               | 2 +-
 8 files changed, 9 insertions(+), 9 deletions(-)

-- 
1.9.1

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 1/4] staging: lustre: constify attribute_group structures.
  2017-07-17  5:48 [PATCH 0/4] constify lustre attribute_group structures Arvind Yadav
@ 2017-07-17  5:48 ` Arvind Yadav
  2017-07-17  7:15   ` kbuild test robot
  2017-07-17  5:48 ` [PATCH 2/4] staging: lustre: ldlm: " Arvind Yadav
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 12+ messages in thread
From: Arvind Yadav @ 2017-07-17  5:48 UTC (permalink / raw)
  To: oleg.drokin, andreas.dilger, jsimmons, gregkh, lustre-devel,
	devel, linux-kernel
  Cc: john.hammond, dmitry.eremin, fan.yong

attribute_groups are not supposed to change at runtime. All functions
working with attribute_groups provided by <linux/sysfs.h> work
with const attribute_group. So mark the non-const structs as const.

File size before:
   text	   data	    bss	    dec	    hex	filename
   9489	    992	     40	  10521	   2919	lustre/lustre/osc/lproc_osc.o
   1289	    288	      0	   1577	    629	lustre/lustre/lmv/lproc_lmv.o
   3794	    928	     40	   4762	   129a	lustre/lustre/lov/lproc_lov.o
   3802	    576	     40	   4418	   1142	lustre/lustre/mdc/lproc_mdc.o

File size After adding 'const':
   text	   data	    bss	    dec	    hex	filename
   9553	    928	     40	  10521	   2919	lustre/lustre/osc/lproc_osc.o
   1353	    224	      0	   1577	    629	lustre/lustre/lmv/lproc_lmv.o
   3858	    864	     40	   4762	   129a	lustre/lustre/lov/lproc_lov.o
   3866	    512	     40	   4418	   1142	lustre/lustre/mdc/lproc_mdc.o

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
---
 drivers/staging/lustre/lustre/include/lprocfs_status.h | 4 ++--
 drivers/staging/lustre/lustre/lmv/lproc_lmv.c          | 2 +-
 drivers/staging/lustre/lustre/lov/lproc_lov.c          | 2 +-
 drivers/staging/lustre/lustre/mdc/lproc_mdc.c          | 2 +-
 drivers/staging/lustre/lustre/osc/lproc_osc.c          | 2 +-
 5 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/lprocfs_status.h b/drivers/staging/lustre/lustre/include/lprocfs_status.h
index 915283c..9054d37 100644
--- a/drivers/staging/lustre/lustre/include/lprocfs_status.h
+++ b/drivers/staging/lustre/lustre/include/lprocfs_status.h
@@ -59,7 +59,7 @@ struct lprocfs_vars {
 
 struct lprocfs_static_vars {
 	struct lprocfs_vars *obd_vars;
-	struct attribute_group *sysfs_vars;
+	const struct attribute_group *sysfs_vars;
 };
 
 /* if we find more consumers this could be generalized */
@@ -468,7 +468,7 @@ struct dentry *ldebugfs_register(const char *name,
 void ldebugfs_remove(struct dentry **entryp);
 
 int lprocfs_obd_setup(struct obd_device *obd, struct lprocfs_vars *list,
-		      struct attribute_group *attrs);
+		      const struct attribute_group *attrs);
 int lprocfs_obd_cleanup(struct obd_device *obd);
 
 int ldebugfs_seq_create(struct dentry *parent,
diff --git a/drivers/staging/lustre/lustre/lmv/lproc_lmv.c b/drivers/staging/lustre/lustre/lmv/lproc_lmv.c
index bf25f88..4c13e39 100644
--- a/drivers/staging/lustre/lustre/lmv/lproc_lmv.c
+++ b/drivers/staging/lustre/lustre/lmv/lproc_lmv.c
@@ -161,7 +161,7 @@ static int lmv_target_seq_open(struct inode *inode, struct file *file)
 	NULL,
 };
 
-static struct attribute_group lmv_attr_group = {
+static const struct attribute_group lmv_attr_group = {
 	.attrs = lmv_attrs,
 };
 
diff --git a/drivers/staging/lustre/lustre/lov/lproc_lov.c b/drivers/staging/lustre/lustre/lov/lproc_lov.c
index eb6d30d..ce46821 100644
--- a/drivers/staging/lustre/lustre/lov/lproc_lov.c
+++ b/drivers/staging/lustre/lustre/lov/lproc_lov.c
@@ -279,7 +279,7 @@ static int lov_target_seq_open(struct inode *inode, struct file *file)
 	NULL,
 };
 
-static struct attribute_group lov_attr_group = {
+static const struct attribute_group lov_attr_group = {
 	.attrs = lov_attrs,
 };
 
diff --git a/drivers/staging/lustre/lustre/mdc/lproc_mdc.c b/drivers/staging/lustre/lustre/mdc/lproc_mdc.c
index 9021c46..9fea535 100644
--- a/drivers/staging/lustre/lustre/mdc/lproc_mdc.c
+++ b/drivers/staging/lustre/lustre/mdc/lproc_mdc.c
@@ -219,7 +219,7 @@ static ssize_t max_pages_per_rpc_show(struct kobject *kobj,
 	NULL,
 };
 
-static struct attribute_group mdc_attr_group = {
+static const struct attribute_group mdc_attr_group = {
 	.attrs = mdc_attrs,
 };
 
diff --git a/drivers/staging/lustre/lustre/osc/lproc_osc.c b/drivers/staging/lustre/lustre/osc/lproc_osc.c
index 86f252d..6e0fd15 100644
--- a/drivers/staging/lustre/lustre/osc/lproc_osc.c
+++ b/drivers/staging/lustre/lustre/osc/lproc_osc.c
@@ -831,7 +831,7 @@ int lproc_osc_attach_seqstat(struct obd_device *dev)
 	NULL,
 };
 
-static struct attribute_group osc_attr_group = {
+static const struct attribute_group osc_attr_group = {
 	.attrs = osc_attrs,
 };
 
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 2/4] staging: lustre: ldlm: constify attribute_group structures.
  2017-07-17  5:48 [PATCH 0/4] constify lustre attribute_group structures Arvind Yadav
  2017-07-17  5:48 ` [PATCH 1/4] staging: lustre: constify " Arvind Yadav
@ 2017-07-17  5:48 ` Arvind Yadav
  2017-07-17  7:42   ` Arvind Yadav
  2017-07-17  5:48 ` [PATCH 3/4] staging: lustre: obdclass: linux: " Arvind Yadav
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 12+ messages in thread
From: Arvind Yadav @ 2017-07-17  5:48 UTC (permalink / raw)
  To: oleg.drokin, andreas.dilger, jsimmons, gregkh, lustre-devel,
	devel, linux-kernel
  Cc: john.hammond, dmitry.eremin, fan.yong

attribute_groups are not supposed to change at runtime. All functions
working with attribute_groups provided by <linux/sysfs.h> work
with const attribute_group. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
---
 drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c b/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c
index fff930f..e0c3e5d 100644
--- a/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c
+++ b/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c
@@ -926,7 +926,7 @@ static ssize_t cancel_unused_locks_before_replay_store(struct kobject *kobj,
 	NULL,
 };
 
-static struct attribute_group ldlm_attr_group = {
+static const struct attribute_group ldlm_attr_group = {
 	.attrs = ldlm_attrs,
 };
 
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 3/4] staging: lustre: obdclass: linux: constify attribute_group structures.
  2017-07-17  5:48 [PATCH 0/4] constify lustre attribute_group structures Arvind Yadav
  2017-07-17  5:48 ` [PATCH 1/4] staging: lustre: constify " Arvind Yadav
  2017-07-17  5:48 ` [PATCH 2/4] staging: lustre: ldlm: " Arvind Yadav
@ 2017-07-17  5:48 ` Arvind Yadav
  2017-07-17  7:41   ` Arvind Yadav
  2017-07-17  7:41   ` Arvind Yadav
  2017-07-17  5:49 ` [PATCH 4/4] staging: lustre: obdclass: " Arvind Yadav
  2017-07-17  7:44 ` [PATCH 0/4] constify lustre " Arvind Yadav
  4 siblings, 2 replies; 12+ messages in thread
From: Arvind Yadav @ 2017-07-17  5:48 UTC (permalink / raw)
  To: oleg.drokin, andreas.dilger, jsimmons, gregkh, lustre-devel,
	devel, linux-kernel
  Cc: john.hammond, dmitry.eremin, fan.yong

attribute_groups are not supposed to change at runtime. All functions
working with attribute_groups provided by <linux/sysfs.h> work
with const attribute_group. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
---
 drivers/staging/lustre/lustre/obdclass/linux/linux-module.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c b/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c
index 9f5e829..eb88bd9 100644
--- a/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c
+++ b/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c
@@ -405,7 +405,7 @@ static int obd_device_list_open(struct inode *inode, struct file *file)
 struct kobject *lustre_kobj;
 EXPORT_SYMBOL_GPL(lustre_kobj);
 
-static struct attribute_group lustre_attr_group = {
+static const struct attribute_group lustre_attr_group = {
 	.attrs = lustre_attrs,
 };
 
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 4/4] staging: lustre: obdclass: constify attribute_group structures.
  2017-07-17  5:48 [PATCH 0/4] constify lustre attribute_group structures Arvind Yadav
                   ` (2 preceding siblings ...)
  2017-07-17  5:48 ` [PATCH 3/4] staging: lustre: obdclass: linux: " Arvind Yadav
@ 2017-07-17  5:49 ` Arvind Yadav
  2017-07-17  7:41   ` Arvind Yadav
  2017-07-17  7:44 ` [PATCH 0/4] constify lustre " Arvind Yadav
  4 siblings, 1 reply; 12+ messages in thread
From: Arvind Yadav @ 2017-07-17  5:49 UTC (permalink / raw)
  To: oleg.drokin, andreas.dilger, jsimmons, gregkh, lustre-devel,
	devel, linux-kernel
  Cc: john.hammond, dmitry.eremin, fan.yong

attribute_groups are not supposed to change at runtime. All functions
working with attribute_groups provided by <linux/sysfs.h> work
with const attribute_group. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
---
 drivers/staging/lustre/lustre/obdclass/lprocfs_status.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c b/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c
index bc19f19..ba41983 100644
--- a/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c
+++ b/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c
@@ -1031,7 +1031,7 @@ static void obd_sysfs_release(struct kobject *kobj)
 };
 
 int lprocfs_obd_setup(struct obd_device *obd, struct lprocfs_vars *list,
-		      struct attribute_group *attrs)
+		      const struct attribute_group *attrs)
 {
 	int rc = 0;
 
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH 1/4] staging: lustre: constify attribute_group structures.
  2017-07-17  5:48 ` [PATCH 1/4] staging: lustre: constify " Arvind Yadav
@ 2017-07-17  7:15   ` kbuild test robot
  2017-07-17  7:45     ` Arvind Yadav
  0 siblings, 1 reply; 12+ messages in thread
From: kbuild test robot @ 2017-07-17  7:15 UTC (permalink / raw)
  To: Arvind Yadav
  Cc: kbuild-all, oleg.drokin, andreas.dilger, jsimmons, gregkh,
	lustre-devel, devel, linux-kernel, dmitry.eremin, john.hammond,
	fan.yong

[-- Attachment #1: Type: text/plain, Size: 6261 bytes --]

Hi Arvind,

[auto build test ERROR on staging/staging-testing]
[also build test ERROR on v4.13-rc1 next-20170717]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Arvind-Yadav/constify-lustre-attribute_group-structures/20170717-142957
config: sparc64-allyesconfig (attached as .config)
compiler: sparc64-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
        wget https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=sparc64 

Note: the linux-review/Arvind-Yadav/constify-lustre-attribute_group-structures/20170717-142957 HEAD a6df15f5fc00a12dffbac94e0ccc52155118946e builds fine.
      It only hurts bisectibility.

All error/warnings (new ones prefixed by >>):

>> drivers/staging/lustre/lustre/obdclass/lprocfs_status.c:1033:5: error: conflicting types for 'lprocfs_obd_setup'
    int lprocfs_obd_setup(struct obd_device *obd, struct lprocfs_vars *list,
        ^~~~~~~~~~~~~~~~~
   In file included from drivers/staging/lustre/lustre/obdclass/../include/obd_support.h:41:0,
                    from drivers/staging/lustre/lustre/obdclass/../include/obd_class.h:35,
                    from drivers/staging/lustre/lustre/obdclass/lprocfs_status.c:39:
   drivers/staging/lustre/lustre/obdclass/../include/lprocfs_status.h:470:5: note: previous declaration of 'lprocfs_obd_setup' was here
    int lprocfs_obd_setup(struct obd_device *obd, struct lprocfs_vars *list,
        ^~~~~~~~~~~~~~~~~
   In file included from include/linux/linkage.h:6:0,
                    from include/linux/kernel.h:6,
                    from include/asm-generic/bug.h:15,
                    from arch/sparc/include/asm/bug.h:20,
                    from include/linux/bug.h:4,
                    from include/linux/mmdebug.h:4,
                    from include/linux/gfp.h:4,
                    from include/linux/slab.h:14,
                    from drivers/staging/lustre/lustre/obdclass/../include/obd_support.h:36,
                    from drivers/staging/lustre/lustre/obdclass/../include/obd_class.h:35,
                    from drivers/staging/lustre/lustre/obdclass/lprocfs_status.c:39:
   drivers/staging/lustre/lustre/obdclass/lprocfs_status.c:1066:19: error: conflicting types for 'lprocfs_obd_setup'
    EXPORT_SYMBOL_GPL(lprocfs_obd_setup);
                      ^
   include/linux/export.h:65:21: note: in definition of macro '___EXPORT_SYMBOL'
     extern typeof(sym) sym;      \
                        ^~~
>> drivers/staging/lustre/lustre/obdclass/lprocfs_status.c:1066:1: note: in expansion of macro 'EXPORT_SYMBOL_GPL'
    EXPORT_SYMBOL_GPL(lprocfs_obd_setup);
    ^~~~~~~~~~~~~~~~~
   In file included from drivers/staging/lustre/lustre/obdclass/../include/obd_support.h:41:0,
                    from drivers/staging/lustre/lustre/obdclass/../include/obd_class.h:35,
                    from drivers/staging/lustre/lustre/obdclass/lprocfs_status.c:39:
   drivers/staging/lustre/lustre/obdclass/../include/lprocfs_status.h:470:5: note: previous declaration of 'lprocfs_obd_setup' was here
    int lprocfs_obd_setup(struct obd_device *obd, struct lprocfs_vars *list,
        ^~~~~~~~~~~~~~~~~

vim +/lprocfs_obd_setup +1033 drivers/staging/lustre/lustre/obdclass/lprocfs_status.c

9b8013023 Oleg Drokin   2015-05-21  1032  
9b8013023 Oleg Drokin   2015-05-21 @1033  int lprocfs_obd_setup(struct obd_device *obd, struct lprocfs_vars *list,
9b8013023 Oleg Drokin   2015-05-21  1034  		      struct attribute_group *attrs)
d7e09d039 Peng Tao      2013-05-02  1035  {
d7e09d039 Peng Tao      2013-05-02  1036  	int rc = 0;
d7e09d039 Peng Tao      2013-05-02  1037  
9b8013023 Oleg Drokin   2015-05-21  1038  	init_completion(&obd->obd_kobj_unregister);
9b8013023 Oleg Drokin   2015-05-21  1039  	rc = kobject_init_and_add(&obd->obd_kobj, &obd_ktype,
9b8013023 Oleg Drokin   2015-05-21  1040  				  obd->obd_type->typ_kobj,
9b8013023 Oleg Drokin   2015-05-21  1041  				  "%s", obd->obd_name);
9b8013023 Oleg Drokin   2015-05-21  1042  	if (rc)
9b8013023 Oleg Drokin   2015-05-21  1043  		return rc;
9b8013023 Oleg Drokin   2015-05-21  1044  
9b8013023 Oleg Drokin   2015-05-21  1045  	if (attrs) {
9b8013023 Oleg Drokin   2015-05-21  1046  		rc = sysfs_create_group(&obd->obd_kobj, attrs);
9b8013023 Oleg Drokin   2015-05-21  1047  		if (rc) {
9b8013023 Oleg Drokin   2015-05-21  1048  			kobject_put(&obd->obd_kobj);
9b8013023 Oleg Drokin   2015-05-21  1049  			return rc;
9b8013023 Oleg Drokin   2015-05-21  1050  		}
9b8013023 Oleg Drokin   2015-05-21  1051  	}
9b8013023 Oleg Drokin   2015-05-21  1052  
61e87ab0f Dmitry Eremin 2015-05-21  1053  	obd->obd_debugfs_entry = ldebugfs_register(obd->obd_name,
61e87ab0f Dmitry Eremin 2015-05-21  1054  						   obd->obd_type->typ_debugfs_entry,
d7e09d039 Peng Tao      2013-05-02  1055  						   list, obd);
61e87ab0f Dmitry Eremin 2015-05-21  1056  	if (IS_ERR_OR_NULL(obd->obd_debugfs_entry)) {
61e87ab0f Dmitry Eremin 2015-05-21  1057  		rc = obd->obd_debugfs_entry ? PTR_ERR(obd->obd_debugfs_entry)
61e87ab0f Dmitry Eremin 2015-05-21  1058  					    : -ENOMEM;
1d8cb70c7 Greg Donald   2014-08-25  1059  		CERROR("error %d setting up lprocfs for %s\n",
1d8cb70c7 Greg Donald   2014-08-25  1060  		       rc, obd->obd_name);
61e87ab0f Dmitry Eremin 2015-05-21  1061  		obd->obd_debugfs_entry = NULL;
d7e09d039 Peng Tao      2013-05-02  1062  	}
9b8013023 Oleg Drokin   2015-05-21  1063  
d7e09d039 Peng Tao      2013-05-02  1064  	return rc;
d7e09d039 Peng Tao      2013-05-02  1065  }
da33f1dd9 Oleg Drokin   2016-02-06 @1066  EXPORT_SYMBOL_GPL(lprocfs_obd_setup);
d7e09d039 Peng Tao      2013-05-02  1067  

:::::: The code at line 1033 was first introduced by commit
:::::: 9b8013023cb62360b56c04313687e93a1c2bf3d6 staging/lustre/obdclass: Prepare for procfs to sysfs migration

:::::: TO: Oleg Drokin <green@linuxhacker.ru>
:::::: CC: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 51477 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 4/4] staging: lustre: obdclass: constify attribute_group structures.
  2017-07-17  5:49 ` [PATCH 4/4] staging: lustre: obdclass: " Arvind Yadav
@ 2017-07-17  7:41   ` Arvind Yadav
  0 siblings, 0 replies; 12+ messages in thread
From: Arvind Yadav @ 2017-07-17  7:41 UTC (permalink / raw)
  To: oleg.drokin, andreas.dilger, jsimmons, gregkh, lustre-devel,
	devel, linux-kernel
  Cc: john.hammond, dmitry.eremin, fan.yong

Sorry for noise. Please ignore this. This change should not be separate.

~arvind

On Monday 17 July 2017 11:19 AM, Arvind Yadav wrote:
> attribute_groups are not supposed to change at runtime. All functions
> working with attribute_groups provided by <linux/sysfs.h> work
> with const attribute_group. So mark the non-const structs as const.
>
> Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
> ---
>   drivers/staging/lustre/lustre/obdclass/lprocfs_status.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c b/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c
> index bc19f19..ba41983 100644
> --- a/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c
> +++ b/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c
> @@ -1031,7 +1031,7 @@ static void obd_sysfs_release(struct kobject *kobj)
>   };
>   
>   int lprocfs_obd_setup(struct obd_device *obd, struct lprocfs_vars *list,
> -		      struct attribute_group *attrs)
> +		      const struct attribute_group *attrs)
>   {
>   	int rc = 0;
>   

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 3/4] staging: lustre: obdclass: linux: constify attribute_group structures.
  2017-07-17  5:48 ` [PATCH 3/4] staging: lustre: obdclass: linux: " Arvind Yadav
@ 2017-07-17  7:41   ` Arvind Yadav
  2017-07-17  7:41   ` Arvind Yadav
  1 sibling, 0 replies; 12+ messages in thread
From: Arvind Yadav @ 2017-07-17  7:41 UTC (permalink / raw)
  To: oleg.drokin, andreas.dilger, jsimmons, gregkh, lustre-devel,
	devel, linux-kernel
  Cc: john.hammond, dmitry.eremin, fan.yong

Sorry for noise. Please ignore this.

~arvind


On Monday 17 July 2017 11:18 AM, Arvind Yadav wrote:
> attribute_groups are not supposed to change at runtime. All functions
> working with attribute_groups provided by <linux/sysfs.h> work
> with const attribute_group. So mark the non-const structs as const.
>
> Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
> ---
>   drivers/staging/lustre/lustre/obdclass/linux/linux-module.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c b/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c
> index 9f5e829..eb88bd9 100644
> --- a/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c
> +++ b/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c
> @@ -405,7 +405,7 @@ static int obd_device_list_open(struct inode *inode, struct file *file)
>   struct kobject *lustre_kobj;
>   EXPORT_SYMBOL_GPL(lustre_kobj);
>   
> -static struct attribute_group lustre_attr_group = {
> +static const struct attribute_group lustre_attr_group = {
>   	.attrs = lustre_attrs,
>   };
>   

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 3/4] staging: lustre: obdclass: linux: constify attribute_group structures.
  2017-07-17  5:48 ` [PATCH 3/4] staging: lustre: obdclass: linux: " Arvind Yadav
  2017-07-17  7:41   ` Arvind Yadav
@ 2017-07-17  7:41   ` Arvind Yadav
  1 sibling, 0 replies; 12+ messages in thread
From: Arvind Yadav @ 2017-07-17  7:41 UTC (permalink / raw)
  To: oleg.drokin, andreas.dilger, jsimmons, gregkh, lustre-devel,
	devel, linux-kernel
  Cc: john.hammond, dmitry.eremin, fan.yong

Sorry for noise. Please ignore this.

~arvind


On Monday 17 July 2017 11:18 AM, Arvind Yadav wrote:
> attribute_groups are not supposed to change at runtime. All functions
> working with attribute_groups provided by <linux/sysfs.h> work
> with const attribute_group. So mark the non-const structs as const.
>
> Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
> ---
>   drivers/staging/lustre/lustre/obdclass/linux/linux-module.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c b/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c
> index 9f5e829..eb88bd9 100644
> --- a/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c
> +++ b/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c
> @@ -405,7 +405,7 @@ static int obd_device_list_open(struct inode *inode, struct file *file)
>   struct kobject *lustre_kobj;
>   EXPORT_SYMBOL_GPL(lustre_kobj);
>   
> -static struct attribute_group lustre_attr_group = {
> +static const struct attribute_group lustre_attr_group = {
>   	.attrs = lustre_attrs,
>   };
>   

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 2/4] staging: lustre: ldlm: constify attribute_group structures.
  2017-07-17  5:48 ` [PATCH 2/4] staging: lustre: ldlm: " Arvind Yadav
@ 2017-07-17  7:42   ` Arvind Yadav
  0 siblings, 0 replies; 12+ messages in thread
From: Arvind Yadav @ 2017-07-17  7:42 UTC (permalink / raw)
  To: oleg.drokin, andreas.dilger, jsimmons, gregkh, lustre-devel,
	devel, linux-kernel
  Cc: john.hammond, dmitry.eremin, fan.yong

Sorry for noise. Please ignore this.

~arvind


On Monday 17 July 2017 11:18 AM, Arvind Yadav wrote:
> attribute_groups are not supposed to change at runtime. All functions
> working with attribute_groups provided by <linux/sysfs.h> work
> with const attribute_group. So mark the non-const structs as const.
>
> Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
> ---
>   drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c b/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c
> index fff930f..e0c3e5d 100644
> --- a/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c
> +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c
> @@ -926,7 +926,7 @@ static ssize_t cancel_unused_locks_before_replay_store(struct kobject *kobj,
>   	NULL,
>   };
>   
> -static struct attribute_group ldlm_attr_group = {
> +static const struct attribute_group ldlm_attr_group = {
>   	.attrs = ldlm_attrs,
>   };
>   

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 0/4] constify lustre attribute_group structures
  2017-07-17  5:48 [PATCH 0/4] constify lustre attribute_group structures Arvind Yadav
                   ` (3 preceding siblings ...)
  2017-07-17  5:49 ` [PATCH 4/4] staging: lustre: obdclass: " Arvind Yadav
@ 2017-07-17  7:44 ` Arvind Yadav
  4 siblings, 0 replies; 12+ messages in thread
From: Arvind Yadav @ 2017-07-17  7:44 UTC (permalink / raw)
  To: oleg.drokin, andreas.dilger, jsimmons, gregkh, lustre-devel,
	devel, linux-kernel
  Cc: john.hammond, dmitry.eremin, fan.yong

Sorry for noise. Please ignore this. It's having build error. Again, I 
will push all changes.

~arvind


On Monday 17 July 2017 11:18 AM, Arvind Yadav wrote:
> attribute_groups are not supposed to change at runtime. All functions
> working with attribute_groups provided by <linux/sysfs.h> work
> with const attribute_group. So mark the non-const structs as const.
>
> Arvind Yadav (4):
>    [PATCH 1/4] staging: lustre: constify attribute_group structures.
>    [PATCH 2/4] staging: lustre: ldlm: constify attribute_group structures.
>    [PATCH 3/4] staging: lustre: obdclass: linux: constify attribute_group structures.
>    [PATCH 4/4] staging: lustre: obdclass: constify attribute_group structures.
>
>   drivers/staging/lustre/lustre/include/lprocfs_status.h      | 4 ++--
>   drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c             | 2 +-
>   drivers/staging/lustre/lustre/lmv/lproc_lmv.c               | 2 +-
>   drivers/staging/lustre/lustre/lov/lproc_lov.c               | 2 +-
>   drivers/staging/lustre/lustre/mdc/lproc_mdc.c               | 2 +-
>   drivers/staging/lustre/lustre/obdclass/linux/linux-module.c | 2 +-
>   drivers/staging/lustre/lustre/obdclass/lprocfs_status.c     | 2 +-
>   drivers/staging/lustre/lustre/osc/lproc_osc.c               | 2 +-
>   8 files changed, 9 insertions(+), 9 deletions(-)
>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 1/4] staging: lustre: constify attribute_group structures.
  2017-07-17  7:15   ` kbuild test robot
@ 2017-07-17  7:45     ` Arvind Yadav
  0 siblings, 0 replies; 12+ messages in thread
From: Arvind Yadav @ 2017-07-17  7:45 UTC (permalink / raw)
  To: kbuild test robot
  Cc: kbuild-all, oleg.drokin, andreas.dilger, jsimmons, gregkh,
	lustre-devel, devel, linux-kernel, dmitry.eremin, john.hammond,
	fan.yong

Sorry for noise. Please ignore this. I will fix this error and push again.

~arvind


On Monday 17 July 2017 12:45 PM, kbuild test robot wrote:
> Hi Arvind,
>
> [auto build test ERROR on staging/staging-testing]
> [also build test ERROR on v4.13-rc1 next-20170717]
> [if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
>
> url:    https://github.com/0day-ci/linux/commits/Arvind-Yadav/constify-lustre-attribute_group-structures/20170717-142957
> config: sparc64-allyesconfig (attached as .config)
> compiler: sparc64-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705
> reproduce:
>          wget https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
>          chmod +x ~/bin/make.cross
>          # save the attached .config to linux build tree
>          make.cross ARCH=sparc64
>
> Note: the linux-review/Arvind-Yadav/constify-lustre-attribute_group-structures/20170717-142957 HEAD a6df15f5fc00a12dffbac94e0ccc52155118946e builds fine.
>        It only hurts bisectibility.
>
> All error/warnings (new ones prefixed by >>):
>
>>> drivers/staging/lustre/lustre/obdclass/lprocfs_status.c:1033:5: error: conflicting types for 'lprocfs_obd_setup'
>      int lprocfs_obd_setup(struct obd_device *obd, struct lprocfs_vars *list,
>          ^~~~~~~~~~~~~~~~~
>     In file included from drivers/staging/lustre/lustre/obdclass/../include/obd_support.h:41:0,
>                      from drivers/staging/lustre/lustre/obdclass/../include/obd_class.h:35,
>                      from drivers/staging/lustre/lustre/obdclass/lprocfs_status.c:39:
>     drivers/staging/lustre/lustre/obdclass/../include/lprocfs_status.h:470:5: note: previous declaration of 'lprocfs_obd_setup' was here
>      int lprocfs_obd_setup(struct obd_device *obd, struct lprocfs_vars *list,
>          ^~~~~~~~~~~~~~~~~
>     In file included from include/linux/linkage.h:6:0,
>                      from include/linux/kernel.h:6,
>                      from include/asm-generic/bug.h:15,
>                      from arch/sparc/include/asm/bug.h:20,
>                      from include/linux/bug.h:4,
>                      from include/linux/mmdebug.h:4,
>                      from include/linux/gfp.h:4,
>                      from include/linux/slab.h:14,
>                      from drivers/staging/lustre/lustre/obdclass/../include/obd_support.h:36,
>                      from drivers/staging/lustre/lustre/obdclass/../include/obd_class.h:35,
>                      from drivers/staging/lustre/lustre/obdclass/lprocfs_status.c:39:
>     drivers/staging/lustre/lustre/obdclass/lprocfs_status.c:1066:19: error: conflicting types for 'lprocfs_obd_setup'
>      EXPORT_SYMBOL_GPL(lprocfs_obd_setup);
>                        ^
>     include/linux/export.h:65:21: note: in definition of macro '___EXPORT_SYMBOL'
>       extern typeof(sym) sym;      \
>                          ^~~
>>> drivers/staging/lustre/lustre/obdclass/lprocfs_status.c:1066:1: note: in expansion of macro 'EXPORT_SYMBOL_GPL'
>      EXPORT_SYMBOL_GPL(lprocfs_obd_setup);
>      ^~~~~~~~~~~~~~~~~
>     In file included from drivers/staging/lustre/lustre/obdclass/../include/obd_support.h:41:0,
>                      from drivers/staging/lustre/lustre/obdclass/../include/obd_class.h:35,
>                      from drivers/staging/lustre/lustre/obdclass/lprocfs_status.c:39:
>     drivers/staging/lustre/lustre/obdclass/../include/lprocfs_status.h:470:5: note: previous declaration of 'lprocfs_obd_setup' was here
>      int lprocfs_obd_setup(struct obd_device *obd, struct lprocfs_vars *list,
>          ^~~~~~~~~~~~~~~~~
>
> vim +/lprocfs_obd_setup +1033 drivers/staging/lustre/lustre/obdclass/lprocfs_status.c
>
> 9b8013023 Oleg Drokin   2015-05-21  1032
> 9b8013023 Oleg Drokin   2015-05-21 @1033  int lprocfs_obd_setup(struct obd_device *obd, struct lprocfs_vars *list,
> 9b8013023 Oleg Drokin   2015-05-21  1034  		      struct attribute_group *attrs)
> d7e09d039 Peng Tao      2013-05-02  1035  {
> d7e09d039 Peng Tao      2013-05-02  1036  	int rc = 0;
> d7e09d039 Peng Tao      2013-05-02  1037
> 9b8013023 Oleg Drokin   2015-05-21  1038  	init_completion(&obd->obd_kobj_unregister);
> 9b8013023 Oleg Drokin   2015-05-21  1039  	rc = kobject_init_and_add(&obd->obd_kobj, &obd_ktype,
> 9b8013023 Oleg Drokin   2015-05-21  1040  				  obd->obd_type->typ_kobj,
> 9b8013023 Oleg Drokin   2015-05-21  1041  				  "%s", obd->obd_name);
> 9b8013023 Oleg Drokin   2015-05-21  1042  	if (rc)
> 9b8013023 Oleg Drokin   2015-05-21  1043  		return rc;
> 9b8013023 Oleg Drokin   2015-05-21  1044
> 9b8013023 Oleg Drokin   2015-05-21  1045  	if (attrs) {
> 9b8013023 Oleg Drokin   2015-05-21  1046  		rc = sysfs_create_group(&obd->obd_kobj, attrs);
> 9b8013023 Oleg Drokin   2015-05-21  1047  		if (rc) {
> 9b8013023 Oleg Drokin   2015-05-21  1048  			kobject_put(&obd->obd_kobj);
> 9b8013023 Oleg Drokin   2015-05-21  1049  			return rc;
> 9b8013023 Oleg Drokin   2015-05-21  1050  		}
> 9b8013023 Oleg Drokin   2015-05-21  1051  	}
> 9b8013023 Oleg Drokin   2015-05-21  1052
> 61e87ab0f Dmitry Eremin 2015-05-21  1053  	obd->obd_debugfs_entry = ldebugfs_register(obd->obd_name,
> 61e87ab0f Dmitry Eremin 2015-05-21  1054  						   obd->obd_type->typ_debugfs_entry,
> d7e09d039 Peng Tao      2013-05-02  1055  						   list, obd);
> 61e87ab0f Dmitry Eremin 2015-05-21  1056  	if (IS_ERR_OR_NULL(obd->obd_debugfs_entry)) {
> 61e87ab0f Dmitry Eremin 2015-05-21  1057  		rc = obd->obd_debugfs_entry ? PTR_ERR(obd->obd_debugfs_entry)
> 61e87ab0f Dmitry Eremin 2015-05-21  1058  					    : -ENOMEM;
> 1d8cb70c7 Greg Donald   2014-08-25  1059  		CERROR("error %d setting up lprocfs for %s\n",
> 1d8cb70c7 Greg Donald   2014-08-25  1060  		       rc, obd->obd_name);
> 61e87ab0f Dmitry Eremin 2015-05-21  1061  		obd->obd_debugfs_entry = NULL;
> d7e09d039 Peng Tao      2013-05-02  1062  	}
> 9b8013023 Oleg Drokin   2015-05-21  1063
> d7e09d039 Peng Tao      2013-05-02  1064  	return rc;
> d7e09d039 Peng Tao      2013-05-02  1065  }
> da33f1dd9 Oleg Drokin   2016-02-06 @1066  EXPORT_SYMBOL_GPL(lprocfs_obd_setup);
> d7e09d039 Peng Tao      2013-05-02  1067
>
> :::::: The code at line 1033 was first introduced by commit
> :::::: 9b8013023cb62360b56c04313687e93a1c2bf3d6 staging/lustre/obdclass: Prepare for procfs to sysfs migration
>
> :::::: TO: Oleg Drokin <green@linuxhacker.ru>
> :::::: CC: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
>
> ---
> 0-DAY kernel test infrastructure                Open Source Technology Center
> https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2017-07-17  7:46 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-17  5:48 [PATCH 0/4] constify lustre attribute_group structures Arvind Yadav
2017-07-17  5:48 ` [PATCH 1/4] staging: lustre: constify " Arvind Yadav
2017-07-17  7:15   ` kbuild test robot
2017-07-17  7:45     ` Arvind Yadav
2017-07-17  5:48 ` [PATCH 2/4] staging: lustre: ldlm: " Arvind Yadav
2017-07-17  7:42   ` Arvind Yadav
2017-07-17  5:48 ` [PATCH 3/4] staging: lustre: obdclass: linux: " Arvind Yadav
2017-07-17  7:41   ` Arvind Yadav
2017-07-17  7:41   ` Arvind Yadav
2017-07-17  5:49 ` [PATCH 4/4] staging: lustre: obdclass: " Arvind Yadav
2017-07-17  7:41   ` Arvind Yadav
2017-07-17  7:44 ` [PATCH 0/4] constify lustre " Arvind Yadav

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).