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

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

[auto build test WARNING on balbi-usb/next]
[also build test WARNING on v4.14-rc4 next-20171013]
[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/usb-gadget-configfs-make-config_item_type-const/20171014-133441
base:   https://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git next
config: i386-randconfig-x014-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=i386 

All warnings (new ones prefixed by >>):

   drivers/usb/gadget/configfs.c: In function 'config_desc_make':
>> drivers/usb/gadget/configfs.c:668:5: warning: passing argument 3 of 
>> 'config_group_init_type_name' discards 'const' qualifier from pointer target 
>> type [-Wdiscarded-qualifiers]
_config_type);
^
   In file included from drivers/usb/gadget/configfs.c:1: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/usb/gadget/configfs.c: In function 'gadgets_make':
   drivers/usb/gadget/configfs.c:1421:48: 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, name, _root_type);
   ^
   In file included from drivers/usb/gadget/configfs.c:1: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/usb/gadget/configfs.c:1424:4: warning: passing argument 3 of 
'config_group_init_type_name' discards 'const' qualifier from pointer target 
type [-Wdiscarded-qualifiers]
   _type);
   ^
   In file included from drivers/usb/gadget/configfs.c:1: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/usb/gadget/configfs.c:1428:4: warning: passing argument 3 of 
'config_group_init_type_name' discards 'const' qualifier from pointer target 
type [-Wdiscarded-qualifiers]
   _desc_type);
   ^
   In file included from drivers/usb/gadget/configfs.c:1: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/usb/gadget/configfs.c: At top level:
>> drivers/usb/gadget/configfs.c:1487:15: warning: initialization discards 
>> 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
   .ci_type = _type,
  ^

vim +668 drivers/usb/gadget/configfs.c

88af8bbe Sebastian Andrzej Siewior 2012-12-23  620  
88af8bbe Sebastian Andrzej Siewior 2012-12-23  621  static struct config_group 
*config_desc_make(
88af8bbe Sebastian Andrzej Siewior 2012-12-23  622  struct 
config_group *group,
88af8bbe Sebastian Andrzej Siewior 2012-12-23  623  const char 
*name)
88af8bbe Sebastian Andrzej Siewior 2012-12-23  624  {
88af8bbe Sebastian Andrzej Siewior 2012-12-23  625  struct gadget_info *gi;
88af8bbe Sebastian Andrzej Siewior 2012-12-23  626  struct config_usb_cfg 
*cfg;
88af8bbe Sebastian Andrzej Siewior 2012-12-23  627  char buf[MAX_NAME_LEN];
88af8bbe Sebastian Andrzej Siewior 2012-12-23  628  char *num_str;
88af8bbe Sebastian Andrzej Siewior 2012-12-23  629  u8 num;
88af8bbe Sebastian Andrzej Siewior 2012-12-23  630  int ret;
88af8bbe Sebastian Andrzej Siewior 2012-12-23  631  
88af8bbe Sebastian Andrzej Siewior 2012-12-23  632  gi = 
container_of(group, struct gadget_info, configs_group);
88af8bbe Sebastian Andrzej Siewior 2012-12-23  633  ret = snprintf(buf, 
MAX_NAME_LEN, "%s", name);
88af8bbe Sebastian Andrzej Siewior 2012-12-23  634  if (ret >= MAX_NAME_LEN)
88af8bbe Sebastian Andrzej Siewior 2012-12-23  635  return 
ERR_PTR(-ENAMETOOLONG);
88af8bbe Sebastian Andrzej Siewior 2012-12-23  636  
88af8bbe Sebastian Andrzej Siewior 2012-12-23  637  num_str = strchr(buf, 
'.');
88af8bbe Sebastian Andrzej Siewior 2012-12-23  638  if (!num_str) {
88af8bbe Sebastian Andrzej Siewior 2012-12-23  639  pr_err("Unable 
to locate . in name.bConfigurationValue\n");
88af8bbe Sebastian Andrzej Siewior 2012-12-23  640  return 
ERR_PTR(-EINVAL);
88af8bbe Sebastian Andrzej Siewior 2012-12-23  

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

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

[auto build test WARNING on balbi-usb/next]
[also build test WARNING on v4.14-rc4 next-20171013]
[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/usb-gadget-configfs-make-config_item_type-const/20171014-133441
base:   https://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git next
config: i386-randconfig-x014-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=i386 

All warnings (new ones prefixed by >>):

   drivers/usb/gadget/configfs.c: In function 'config_desc_make':
>> drivers/usb/gadget/configfs.c:668:5: warning: passing argument 3 of 
>> 'config_group_init_type_name' discards 'const' qualifier from pointer target 
>> type [-Wdiscarded-qualifiers]
_config_type);
^
   In file included from drivers/usb/gadget/configfs.c:1: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/usb/gadget/configfs.c: In function 'gadgets_make':
   drivers/usb/gadget/configfs.c:1421:48: 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, name, _root_type);
   ^
   In file included from drivers/usb/gadget/configfs.c:1: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/usb/gadget/configfs.c:1424:4: warning: passing argument 3 of 
'config_group_init_type_name' discards 'const' qualifier from pointer target 
type [-Wdiscarded-qualifiers]
   _type);
   ^
   In file included from drivers/usb/gadget/configfs.c:1: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/usb/gadget/configfs.c:1428:4: warning: passing argument 3 of 
'config_group_init_type_name' discards 'const' qualifier from pointer target 
type [-Wdiscarded-qualifiers]
   _desc_type);
   ^
   In file included from drivers/usb/gadget/configfs.c:1: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/usb/gadget/configfs.c: At top level:
>> drivers/usb/gadget/configfs.c:1487:15: warning: initialization discards 
>> 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
   .ci_type = _type,
  ^

vim +668 drivers/usb/gadget/configfs.c

88af8bbe Sebastian Andrzej Siewior 2012-12-23  620  
88af8bbe Sebastian Andrzej Siewior 2012-12-23  621  static struct config_group 
*config_desc_make(
88af8bbe Sebastian Andrzej Siewior 2012-12-23  622  struct 
config_group *group,
88af8bbe Sebastian Andrzej Siewior 2012-12-23  623  const char 
*name)
88af8bbe Sebastian Andrzej Siewior 2012-12-23  624  {
88af8bbe Sebastian Andrzej Siewior 2012-12-23  625  struct gadget_info *gi;
88af8bbe Sebastian Andrzej Siewior 2012-12-23  626  struct config_usb_cfg 
*cfg;
88af8bbe Sebastian Andrzej Siewior 2012-12-23  627  char buf[MAX_NAME_LEN];
88af8bbe Sebastian Andrzej Siewior 2012-12-23  628  char *num_str;
88af8bbe Sebastian Andrzej Siewior 2012-12-23  629  u8 num;
88af8bbe Sebastian Andrzej Siewior 2012-12-23  630  int ret;
88af8bbe Sebastian Andrzej Siewior 2012-12-23  631  
88af8bbe Sebastian Andrzej Siewior 2012-12-23  632  gi = 
container_of(group, struct gadget_info, configs_group);
88af8bbe Sebastian Andrzej Siewior 2012-12-23  633  ret = snprintf(buf, 
MAX_NAME_LEN, "%s", name);
88af8bbe Sebastian Andrzej Siewior 2012-12-23  634  if (ret >= MAX_NAME_LEN)
88af8bbe Sebastian Andrzej Siewior 2012-12-23  635  return 
ERR_PTR(-ENAMETOOLONG);
88af8bbe Sebastian Andrzej Siewior 2012-12-23  636  
88af8bbe Sebastian Andrzej Siewior 2012-12-23  637  num_str = strchr(buf, 
'.');
88af8bbe Sebastian Andrzej Siewior 2012-12-23  638  if (!num_str) {
88af8bbe Sebastian Andrzej Siewior 2012-12-23  639  pr_err("Unable 
to locate . in name.bConfigurationValue\n");
88af8bbe Sebastian Andrzej Siewior 2012-12-23  640  return 
ERR_PTR(-EINVAL);
88af8bbe Sebastian Andrzej Siewior 2012-12-23  

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

2017-10-12 Thread Bhumika Goyal
On Thu, Oct 12, 2017 at 3:03 PM, Bhumika Goyal  wrote:
> This is a followup patch for:
> https://patchwork.kernel.org/patch/649/ and
> https://lkml.org/lkml/2017/10/11/375
>
> Make config_item_type structures const as they are either passed to a
> function having the argument as const or stored in the const "ci_type"
> field of a config_item structure.
>
> Done using Coccinelle.
>

Actually, this patch is dependent on the patches in the links
https://lkml.org/lkml/2017/10/11/375 and
https://patchwork.kernel.org/patch/649/. Therefore, this patch
won't be correct unless the patches in these links gets applied.

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


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

2017-10-12 Thread Bhumika Goyal
On Thu, Oct 12, 2017 at 3:03 PM, Bhumika Goyal  wrote:
> This is a followup patch for:
> https://patchwork.kernel.org/patch/649/ and
> https://lkml.org/lkml/2017/10/11/375
>
> Make config_item_type structures const as they are either passed to a
> function having the argument as const or stored in the const "ci_type"
> field of a config_item structure.
>
> Done using Coccinelle.
>

Actually, this patch is dependent on the patches in the links
https://lkml.org/lkml/2017/10/11/375 and
https://patchwork.kernel.org/patch/649/. Therefore, this patch
won't be correct unless the patches in these links gets applied.

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


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

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

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

Done using Coccinelle.

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

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



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

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

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

Done using Coccinelle.

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

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