Re: [PATCH] target: make config_item_type const

2017-10-12 Thread kbuild test robot
Hi Bhumika,

[auto build test WARNING on target/master]
[also build test WARNING on v4.14-rc4 next-20171009]
[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/Bhumika-Goyal/target-make-config_item_type-const/20171013-120027
base:   https://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending.git 
master
config: x86_64-randconfig-x012-201741 (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64 

All warnings (new ones prefixed by >>):

>> drivers/target/target_core_configfs.c:320:15: warning: initialization 
>> discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
   .ci_type = _core_fabrics_item,
  ^
   drivers/target/target_core_configfs.c: In function 
'target_core_alua_create_lu_gp':
>> drivers/target/target_core_configfs.c:2405:4: warning: passing argument 3 of 
>> 'config_group_init_type_name' discards 'const' qualifier from pointer target 
>> type [-Wdiscarded-qualifiers]
   _core_alua_lu_gp_cit);
   ^
   In file included from drivers/target/target_core_configfs.c:37:0:
   include/linux/configfs.h:102:13: note: expected 'struct config_item_type *' 
but argument is of type 'const struct config_item_type *'
extern void config_group_init_type_name(struct config_group *group,
^~~
   drivers/target/target_core_configfs.c: In function 
'target_core_alua_create_tg_pt_gp':
   drivers/target/target_core_configfs.c:2844:4: warning: passing argument 3 of 
'config_group_init_type_name' discards 'const' qualifier from pointer target 
type [-Wdiscarded-qualifiers]
   _core_alua_tg_pt_gp_cit);
   ^
   In file included from drivers/target/target_core_configfs.c:37:0:
   include/linux/configfs.h:102:13: note: expected 'struct config_item_type *' 
but argument is of type 'const struct config_item_type *'
extern void config_group_init_type_name(struct config_group *group,
^~~
   drivers/target/target_core_configfs.c: In function 'target_core_make_subdev':
   drivers/target/target_core_configfs.c:2975:24: warning: passing argument 3 
of 'config_group_init_type_name' discards 'const' qualifier from pointer target 
type [-Wdiscarded-qualifiers]
   "default_tg_pt_gp", _core_alua_tg_pt_gp_cit);
   ^
   In file included from drivers/target/target_core_configfs.c:37:0:
   include/linux/configfs.h:102:13: note: expected 'struct config_item_type *' 
but argument is of type 'const struct config_item_type *'
extern void config_group_init_type_name(struct config_group *group,
^~~
   drivers/target/target_core_configfs.c: In function 
'target_core_call_addhbatotarget':
   drivers/target/target_core_configfs.c:3170:4: warning: passing argument 3 of 
'config_group_init_type_name' discards 'const' qualifier from pointer target 
type [-Wdiscarded-qualifiers]
   _core_hba_cit);
   ^
   In file included from drivers/target/target_core_configfs.c:37:0:
   include/linux/configfs.h:102:13: note: expected 'struct config_item_type *' 
but argument is of type 'const struct config_item_type *'
extern void config_group_init_type_name(struct config_group *group,
^~~
   drivers/target/target_core_configfs.c: In function 
'target_core_init_configfs':
   drivers/target/target_core_configfs.c:3231:4: warning: passing argument 3 of 
'config_group_init_type_name' discards 'const' qualifier from pointer target 
type [-Wdiscarded-qualifiers]
   _core_cit);
   ^
   In file included from drivers/target/target_core_configfs.c:37:0:
   include/linux/configfs.h:102:13: note: expected 'struct config_item_type *' 
but argument is of type 'const struct config_item_type *'
extern void config_group_init_type_name(struct config_group *group,
^~~
   drivers/target/target_core_configfs.c:3237:51: warning: passing argument 3 
of 'config_group_init_type_name' discards 'const' qualifier from pointer target 
type [-Wdiscarded-qualifiers]
 config_group_init_type_name(_group, "alua", _core_alua_cit);
  ^
   In file included from drivers/target/target_core_configfs.c:37:0:
   include/linux/configfs.h:102:13: note: expected 'struct config_item_type *' 
but argument is of type 'const struct config_item_type *'
extern void config_group_init_type_name(struct config_group *group,
^~~
   drivers/target/target_core_configfs.c:3245:4: warning: passing argument 3 of 
'config_group_init_type_name' discards 'const' qualifier from pointer target 
type [-Wdiscarded-qualifiers]
   _core_alua_lu_gps_cit);
   ^
   In file included from 

Re: [PATCH] target: make config_item_type const

2017-10-12 Thread kbuild test robot
Hi Bhumika,

[auto build test WARNING on target/master]
[also build test WARNING on v4.14-rc4 next-20171009]
[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/Bhumika-Goyal/target-make-config_item_type-const/20171013-120027
base:   https://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending.git 
master
config: x86_64-randconfig-x012-201741 (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64 

All warnings (new ones prefixed by >>):

>> drivers/target/target_core_configfs.c:320:15: warning: initialization 
>> discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
   .ci_type = _core_fabrics_item,
  ^
   drivers/target/target_core_configfs.c: In function 
'target_core_alua_create_lu_gp':
>> drivers/target/target_core_configfs.c:2405:4: warning: passing argument 3 of 
>> 'config_group_init_type_name' discards 'const' qualifier from pointer target 
>> type [-Wdiscarded-qualifiers]
   _core_alua_lu_gp_cit);
   ^
   In file included from drivers/target/target_core_configfs.c:37:0:
   include/linux/configfs.h:102:13: note: expected 'struct config_item_type *' 
but argument is of type 'const struct config_item_type *'
extern void config_group_init_type_name(struct config_group *group,
^~~
   drivers/target/target_core_configfs.c: In function 
'target_core_alua_create_tg_pt_gp':
   drivers/target/target_core_configfs.c:2844:4: warning: passing argument 3 of 
'config_group_init_type_name' discards 'const' qualifier from pointer target 
type [-Wdiscarded-qualifiers]
   _core_alua_tg_pt_gp_cit);
   ^
   In file included from drivers/target/target_core_configfs.c:37:0:
   include/linux/configfs.h:102:13: note: expected 'struct config_item_type *' 
but argument is of type 'const struct config_item_type *'
extern void config_group_init_type_name(struct config_group *group,
^~~
   drivers/target/target_core_configfs.c: In function 'target_core_make_subdev':
   drivers/target/target_core_configfs.c:2975:24: warning: passing argument 3 
of 'config_group_init_type_name' discards 'const' qualifier from pointer target 
type [-Wdiscarded-qualifiers]
   "default_tg_pt_gp", _core_alua_tg_pt_gp_cit);
   ^
   In file included from drivers/target/target_core_configfs.c:37:0:
   include/linux/configfs.h:102:13: note: expected 'struct config_item_type *' 
but argument is of type 'const struct config_item_type *'
extern void config_group_init_type_name(struct config_group *group,
^~~
   drivers/target/target_core_configfs.c: In function 
'target_core_call_addhbatotarget':
   drivers/target/target_core_configfs.c:3170:4: warning: passing argument 3 of 
'config_group_init_type_name' discards 'const' qualifier from pointer target 
type [-Wdiscarded-qualifiers]
   _core_hba_cit);
   ^
   In file included from drivers/target/target_core_configfs.c:37:0:
   include/linux/configfs.h:102:13: note: expected 'struct config_item_type *' 
but argument is of type 'const struct config_item_type *'
extern void config_group_init_type_name(struct config_group *group,
^~~
   drivers/target/target_core_configfs.c: In function 
'target_core_init_configfs':
   drivers/target/target_core_configfs.c:3231:4: warning: passing argument 3 of 
'config_group_init_type_name' discards 'const' qualifier from pointer target 
type [-Wdiscarded-qualifiers]
   _core_cit);
   ^
   In file included from drivers/target/target_core_configfs.c:37:0:
   include/linux/configfs.h:102:13: note: expected 'struct config_item_type *' 
but argument is of type 'const struct config_item_type *'
extern void config_group_init_type_name(struct config_group *group,
^~~
   drivers/target/target_core_configfs.c:3237:51: warning: passing argument 3 
of 'config_group_init_type_name' discards 'const' qualifier from pointer target 
type [-Wdiscarded-qualifiers]
 config_group_init_type_name(_group, "alua", _core_alua_cit);
  ^
   In file included from drivers/target/target_core_configfs.c:37:0:
   include/linux/configfs.h:102:13: note: expected 'struct config_item_type *' 
but argument is of type 'const struct config_item_type *'
extern void config_group_init_type_name(struct config_group *group,
^~~
   drivers/target/target_core_configfs.c:3245:4: warning: passing argument 3 of 
'config_group_init_type_name' discards 'const' qualifier from pointer target 
type [-Wdiscarded-qualifiers]
   _core_alua_lu_gps_cit);
   ^
   In file included from 

[PATCH] target: make config_item_type const

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

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

Done using Coccinelle.

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

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

[PATCH] target: make config_item_type const

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

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

Done using Coccinelle.

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

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