* [PATCH] IB/cma: make config_item_type const
@ 2017-10-12 12:20 ` Bhumika Goyal
0 siblings, 0 replies; 6+ messages in thread
From: Bhumika Goyal @ 2017-10-12 12:20 UTC (permalink / raw)
To: julia.lawall-L2FTfq7BK8M, dledford-H+wXaHxf7aLQT0dZR+AlfA,
sean.hefty-ral2JQCrhuEAvxtiuMwx3w,
hal.rosenstock-Re5JQEeQqe8AvxtiuMwx3w,
linux-rdma-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA
Cc: Bhumika Goyal
This is a followup patch for: https://lkml.org/lkml/2017/10/11/375 and
https://patchwork.kernel.org/patch/9999649/
Make these structures const as they are either passed to the functions
having the argument as const or stored as a reference in the "ci_type"
const field of a config_item structure.
Done using Coccienlle.
Signed-off-by: Bhumika Goyal <bhumirks-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
drivers/infiniband/core/cma_configfs.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/infiniband/core/cma_configfs.c b/drivers/infiniband/core/cma_configfs.c
index 54076a3..31dfee0 100644
--- a/drivers/infiniband/core/cma_configfs.c
+++ b/drivers/infiniband/core/cma_configfs.c
@@ -186,7 +186,7 @@ static ssize_t default_roce_tos_store(struct config_item *item,
NULL,
};
-static struct config_item_type cma_port_group_type = {
+static const struct config_item_type cma_port_group_type = {
.ct_attrs = cma_configfs_attributes,
.ct_owner = THIS_MODULE
};
@@ -263,7 +263,7 @@ static void release_cma_ports_group(struct config_item *item)
.release = release_cma_ports_group
};
-static struct config_item_type cma_ports_group_type = {
+static const struct config_item_type cma_ports_group_type = {
.ct_item_ops = &cma_ports_item_ops,
.ct_owner = THIS_MODULE
};
@@ -272,7 +272,7 @@ static void release_cma_ports_group(struct config_item *item)
.release = release_cma_dev
};
-static struct config_item_type cma_device_group_type = {
+static const struct config_item_type cma_device_group_type = {
.ct_item_ops = &cma_device_item_ops,
.ct_owner = THIS_MODULE
};
@@ -323,7 +323,7 @@ static struct config_group *make_cma_dev(struct config_group *group,
.make_group = make_cma_dev,
};
-static struct config_item_type cma_subsys_type = {
+static const struct config_item_type cma_subsys_type = {
.ct_group_ops = &cma_subsys_group_ops,
.ct_owner = THIS_MODULE,
};
--
1.9.1
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH] IB/cma: make config_item_type const
@ 2017-10-12 12:20 ` Bhumika Goyal
0 siblings, 0 replies; 6+ messages in thread
From: Bhumika Goyal @ 2017-10-12 12:20 UTC (permalink / raw)
To: julia.lawall, dledford, sean.hefty, hal.rosenstock, linux-rdma,
linux-kernel
Cc: Bhumika Goyal
This is a followup patch for: https://lkml.org/lkml/2017/10/11/375 and
https://patchwork.kernel.org/patch/9999649/
Make these structures const as they are either passed to the functions
having the argument as const or stored as a reference in the "ci_type"
const field of a config_item structure.
Done using Coccienlle.
Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
---
drivers/infiniband/core/cma_configfs.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/infiniband/core/cma_configfs.c b/drivers/infiniband/core/cma_configfs.c
index 54076a3..31dfee0 100644
--- a/drivers/infiniband/core/cma_configfs.c
+++ b/drivers/infiniband/core/cma_configfs.c
@@ -186,7 +186,7 @@ static ssize_t default_roce_tos_store(struct config_item *item,
NULL,
};
-static struct config_item_type cma_port_group_type = {
+static const struct config_item_type cma_port_group_type = {
.ct_attrs = cma_configfs_attributes,
.ct_owner = THIS_MODULE
};
@@ -263,7 +263,7 @@ static void release_cma_ports_group(struct config_item *item)
.release = release_cma_ports_group
};
-static struct config_item_type cma_ports_group_type = {
+static const struct config_item_type cma_ports_group_type = {
.ct_item_ops = &cma_ports_item_ops,
.ct_owner = THIS_MODULE
};
@@ -272,7 +272,7 @@ static void release_cma_ports_group(struct config_item *item)
.release = release_cma_dev
};
-static struct config_item_type cma_device_group_type = {
+static const struct config_item_type cma_device_group_type = {
.ct_item_ops = &cma_device_item_ops,
.ct_owner = THIS_MODULE
};
@@ -323,7 +323,7 @@ static struct config_group *make_cma_dev(struct config_group *group,
.make_group = make_cma_dev,
};
-static struct config_item_type cma_subsys_type = {
+static const struct config_item_type cma_subsys_type = {
.ct_group_ops = &cma_subsys_group_ops,
.ct_owner = THIS_MODULE,
};
--
1.9.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] IB/cma: make config_item_type const
2017-10-12 12:20 ` Bhumika Goyal
(?)
@ 2017-10-12 15:04 ` Bhumika Goyal
2017-10-12 21:24 ` Parav Pandit
-1 siblings, 1 reply; 6+ messages in thread
From: Bhumika Goyal @ 2017-10-12 15:04 UTC (permalink / raw)
To: Julia Lawall, dledford, sean.hefty, Hal Rosenstock, linux-rdma,
Linux Kernel Mailing List
Cc: Bhumika Goyal
On Thu, Oct 12, 2017 at 2:20 PM, Bhumika Goyal <bhumirks@gmail.com> wrote:
> This is a followup patch for: https://lkml.org/lkml/2017/10/11/375 and
> https://patchwork.kernel.org/patch/9999649/
>
> Make these structures const as they are either passed to the functions
> having the argument as const or stored as a reference in the "ci_type"
> const field of a config_item structure.
>
> Done using Coccienlle.
>
This patch is dependent on the patches in the links
https://lkml.org/lkml/2017/10/11/375 and
https://patchwork.kernel.org/patch/9999649/. Therefore, this patch
won't be correct unless the patches in these links gets applied.
> Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
> ---
> drivers/infiniband/core/cma_configfs.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/infiniband/core/cma_configfs.c b/drivers/infiniband/core/cma_configfs.c
> index 54076a3..31dfee0 100644
> --- a/drivers/infiniband/core/cma_configfs.c
> +++ b/drivers/infiniband/core/cma_configfs.c
> @@ -186,7 +186,7 @@ static ssize_t default_roce_tos_store(struct config_item *item,
> NULL,
> };
>
> -static struct config_item_type cma_port_group_type = {
> +static const struct config_item_type cma_port_group_type = {
> .ct_attrs = cma_configfs_attributes,
> .ct_owner = THIS_MODULE
> };
> @@ -263,7 +263,7 @@ static void release_cma_ports_group(struct config_item *item)
> .release = release_cma_ports_group
> };
>
> -static struct config_item_type cma_ports_group_type = {
> +static const struct config_item_type cma_ports_group_type = {
> .ct_item_ops = &cma_ports_item_ops,
> .ct_owner = THIS_MODULE
> };
> @@ -272,7 +272,7 @@ static void release_cma_ports_group(struct config_item *item)
> .release = release_cma_dev
> };
>
> -static struct config_item_type cma_device_group_type = {
> +static const struct config_item_type cma_device_group_type = {
> .ct_item_ops = &cma_device_item_ops,
> .ct_owner = THIS_MODULE
> };
> @@ -323,7 +323,7 @@ static struct config_group *make_cma_dev(struct config_group *group,
> .make_group = make_cma_dev,
> };
>
> -static struct config_item_type cma_subsys_type = {
> +static const struct config_item_type cma_subsys_type = {
> .ct_group_ops = &cma_subsys_group_ops,
> .ct_owner = THIS_MODULE,
> };
> --
> 1.9.1
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] IB/cma: make config_item_type const
2017-10-12 15:04 ` Bhumika Goyal
@ 2017-10-12 21:24 ` Parav Pandit
0 siblings, 0 replies; 6+ messages in thread
From: Parav Pandit @ 2017-10-12 21:24 UTC (permalink / raw)
To: Bhumika Goyal
Cc: Julia Lawall, Doug Ledford, Hefty, Sean, Hal Rosenstock,
linux-rdma, Linux Kernel Mailing List
On Thu, Oct 12, 2017 at 10:04 AM, Bhumika Goyal <bhumirks@gmail.com> wrote:
> On Thu, Oct 12, 2017 at 2:20 PM, Bhumika Goyal <bhumirks@gmail.com> wrote:
>> This is a followup patch for: https://lkml.org/lkml/2017/10/11/375 and
>> https://patchwork.kernel.org/patch/9999649/
>>
>> Make these structures const as they are either passed to the functions
>> having the argument as const or stored as a reference in the "ci_type"
>> const field of a config_item structure.
>>
>> Done using Coccienlle.
>>
>
> This patch is dependent on the patches in the links
> https://lkml.org/lkml/2017/10/11/375 and
> https://patchwork.kernel.org/patch/9999649/. Therefore, this patch
> won't be correct unless the patches in these links gets applied.
>
>> Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
>> ---
>> drivers/infiniband/core/cma_configfs.c | 8 ++++----
>> 1 file changed, 4 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/infiniband/core/cma_configfs.c b/drivers/infiniband/core/cma_configfs.c
>> index 54076a3..31dfee0 100644
>> --- a/drivers/infiniband/core/cma_configfs.c
>> +++ b/drivers/infiniband/core/cma_configfs.c
>> @@ -186,7 +186,7 @@ static ssize_t default_roce_tos_store(struct config_item *item,
>> NULL,
>> };
>>
>> -static struct config_item_type cma_port_group_type = {
>> +static const struct config_item_type cma_port_group_type = {
>> .ct_attrs = cma_configfs_attributes,
>> .ct_owner = THIS_MODULE
>> };
>> @@ -263,7 +263,7 @@ static void release_cma_ports_group(struct config_item *item)
>> .release = release_cma_ports_group
>> };
>>
>> -static struct config_item_type cma_ports_group_type = {
>> +static const struct config_item_type cma_ports_group_type = {
>> .ct_item_ops = &cma_ports_item_ops,
>> .ct_owner = THIS_MODULE
>> };
>> @@ -272,7 +272,7 @@ static void release_cma_ports_group(struct config_item *item)
>> .release = release_cma_dev
>> };
>>
>> -static struct config_item_type cma_device_group_type = {
>> +static const struct config_item_type cma_device_group_type = {
>> .ct_item_ops = &cma_device_item_ops,
>> .ct_owner = THIS_MODULE
>> };
>> @@ -323,7 +323,7 @@ static struct config_group *make_cma_dev(struct config_group *group,
>> .make_group = make_cma_dev,
>> };
>>
>> -static struct config_item_type cma_subsys_type = {
>> +static const struct config_item_type cma_subsys_type = {
>> .ct_group_ops = &cma_subsys_group_ops,
>> .ct_owner = THIS_MODULE,
>> };
>> --
>> 1.9.1
>>
> --
Patch subject should be RDMA/cma even though in past we have mix of
IB/cma and RDMA/cma patches.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] IB/cma: make config_item_type const
2017-10-12 12:20 ` Bhumika Goyal
@ 2017-10-13 6:41 ` kbuild test robot
-1 siblings, 0 replies; 6+ messages in thread
From: kbuild test robot @ 2017-10-13 6:41 UTC (permalink / raw)
Cc: kbuild-all-JC7UmRfGjtg, julia.lawall-L2FTfq7BK8M,
dledford-H+wXaHxf7aLQT0dZR+AlfA,
sean.hefty-ral2JQCrhuEAvxtiuMwx3w,
hal.rosenstock-Re5JQEeQqe8AvxtiuMwx3w,
linux-rdma-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA, Bhumika Goyal
[-- Attachment #1: Type: text/plain, Size: 15207 bytes --]
Hi Bhumika,
[auto build test WARNING on rdma/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/IB-cma-make-config_item_type-const/20171013-134956
base: https://git.kernel.org/pub/scm/linux/kernel/git/dledford/rdma.git master
config: x86_64-randconfig-x018-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/infiniband/core/cma_configfs.c: In function 'make_cma_ports':
>> drivers/infiniband/core/cma_configfs.c:225:10: warning: passing argument 3 of 'config_group_init_type_name' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
&cma_port_group_type);
^
In file included from drivers/infiniband/core/cma_configfs.c:34: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/infiniband/core/cma_configfs.c: In function 'make_cma_dev':
drivers/infiniband/core/cma_configfs.c:301:9: warning: passing argument 3 of 'config_group_init_type_name' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
&cma_ports_group_type);
^
In file included from drivers/infiniband/core/cma_configfs.c:34: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/infiniband/core/cma_configfs.c:308:9: warning: passing argument 3 of 'config_group_init_type_name' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
&cma_device_group_type);
^
In file included from drivers/infiniband/core/cma_configfs.c:34: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/infiniband/core/cma_configfs.c: At top level:
>> drivers/infiniband/core/cma_configfs.c:335:15: warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
.ci_type = &cma_subsys_type,
^
Cyclomatic Complexity 5 include/linux/compiler.h:__write_once_size
Cyclomatic Complexity 1 arch/x86/include/asm/bitops.h:fls64
Cyclomatic Complexity 1 include/linux/log2.h:__ilog2_u64
Cyclomatic Complexity 1 include/linux/list.h:__list_add_valid
Cyclomatic Complexity 2 include/linux/list.h:__list_add
Cyclomatic Complexity 1 include/linux/list.h:list_add_tail
Cyclomatic Complexity 1 include/asm-generic/getorder.h:__get_order
Cyclomatic Complexity 1 include/linux/err.h:ERR_PTR
Cyclomatic Complexity 1 include/linux/configfs.h:configfs_add_default_group
Cyclomatic Complexity 28 include/linux/slab.h:kmalloc_index
Cyclomatic Complexity 68 include/linux/slab.h:kmalloc_large
Cyclomatic Complexity 5 include/linux/slab.h:kmalloc
Cyclomatic Complexity 5 include/linux/slab.h:kmalloc_array
Cyclomatic Complexity 1 include/linux/slab.h:kcalloc
Cyclomatic Complexity 1 include/linux/slab.h:kzalloc
Cyclomatic Complexity 1 drivers/infiniband/core/cma_configfs.c:cma_configfs_params_put
Cyclomatic Complexity 3 drivers/infiniband/core/cma_configfs.c:release_cma_dev
Cyclomatic Complexity 3 drivers/infiniband/core/cma_configfs.c:release_cma_ports_group
Cyclomatic Complexity 1 drivers/infiniband/core/cma_configfs.c:filter_by_name
Cyclomatic Complexity 4 drivers/infiniband/core/cma_configfs.c:make_cma_ports
Cyclomatic Complexity 5 drivers/infiniband/core/cma_configfs.c:make_cma_dev
Cyclomatic Complexity 4 drivers/infiniband/core/cma_configfs.c:to_dev_port_group
Cyclomatic Complexity 3 drivers/infiniband/core/cma_configfs.c:cma_configfs_params_get
Cyclomatic Complexity 4 drivers/infiniband/core/cma_configfs.c:default_roce_tos_store
Cyclomatic Complexity 2 drivers/infiniband/core/cma_configfs.c:default_roce_tos_show
Cyclomatic Complexity 4 drivers/infiniband/core/cma_configfs.c:default_roce_mode_store
Cyclomatic Complexity 3 drivers/infiniband/core/cma_configfs.c:default_roce_mode_show
Cyclomatic Complexity 1 drivers/infiniband/core/cma_configfs.c:cma_configfs_init
Cyclomatic Complexity 1 drivers/infiniband/core/cma_configfs.c:cma_configfs_exit
vim +225 drivers/infiniband/core/cma_configfs.c
045959db Matan Barak 2015-12-23 193
045959db Matan Barak 2015-12-23 194 static int make_cma_ports(struct cma_dev_group *cma_dev_group,
045959db Matan Barak 2015-12-23 195 struct cma_device *cma_dev)
045959db Matan Barak 2015-12-23 196 {
045959db Matan Barak 2015-12-23 197 struct ib_device *ibdev;
045959db Matan Barak 2015-12-23 198 unsigned int i;
045959db Matan Barak 2015-12-23 199 unsigned int ports_num;
045959db Matan Barak 2015-12-23 200 struct cma_dev_port_group *ports;
045959db Matan Barak 2015-12-23 201 int err;
045959db Matan Barak 2015-12-23 202
045959db Matan Barak 2015-12-23 203 ibdev = cma_get_ib_dev(cma_dev);
045959db Matan Barak 2015-12-23 204
045959db Matan Barak 2015-12-23 205 if (!ibdev)
045959db Matan Barak 2015-12-23 206 return -ENODEV;
045959db Matan Barak 2015-12-23 207
045959db Matan Barak 2015-12-23 208 ports_num = ibdev->phys_port_cnt;
045959db Matan Barak 2015-12-23 209 ports = kcalloc(ports_num, sizeof(*cma_dev_group->ports),
045959db Matan Barak 2015-12-23 210 GFP_KERNEL);
045959db Matan Barak 2015-12-23 211
1ae1602d Christoph Hellwig 2016-02-26 212 if (!ports) {
045959db Matan Barak 2015-12-23 213 err = -ENOMEM;
045959db Matan Barak 2015-12-23 214 goto free;
045959db Matan Barak 2015-12-23 215 }
045959db Matan Barak 2015-12-23 216
045959db Matan Barak 2015-12-23 217 for (i = 0; i < ports_num; i++) {
045959db Matan Barak 2015-12-23 218 char port_str[10];
045959db Matan Barak 2015-12-23 219
045959db Matan Barak 2015-12-23 220 ports[i].port_num = i + 1;
045959db Matan Barak 2015-12-23 221 snprintf(port_str, sizeof(port_str), "%u", i + 1);
045959db Matan Barak 2015-12-23 222 ports[i].cma_dev_group = cma_dev_group;
045959db Matan Barak 2015-12-23 223 config_group_init_type_name(&ports[i].group,
045959db Matan Barak 2015-12-23 224 port_str,
045959db Matan Barak 2015-12-23 @225 &cma_port_group_type);
1ae1602d Christoph Hellwig 2016-02-26 226 configfs_add_default_group(&ports[i].group,
1ae1602d Christoph Hellwig 2016-02-26 227 &cma_dev_group->ports_group);
1ae1602d Christoph Hellwig 2016-02-26 228
045959db Matan Barak 2015-12-23 229 }
045959db Matan Barak 2015-12-23 230 cma_dev_group->ports = ports;
045959db Matan Barak 2015-12-23 231
045959db Matan Barak 2015-12-23 232 return 0;
045959db Matan Barak 2015-12-23 233 free:
045959db Matan Barak 2015-12-23 234 kfree(ports);
045959db Matan Barak 2015-12-23 235 cma_dev_group->ports = NULL;
045959db Matan Barak 2015-12-23 236 return err;
045959db Matan Barak 2015-12-23 237 }
045959db Matan Barak 2015-12-23 238
045959db Matan Barak 2015-12-23 239 static void release_cma_dev(struct config_item *item)
045959db Matan Barak 2015-12-23 240 {
045959db Matan Barak 2015-12-23 241 struct config_group *group = container_of(item, struct config_group,
045959db Matan Barak 2015-12-23 242 cg_item);
045959db Matan Barak 2015-12-23 243 struct cma_dev_group *cma_dev_group = container_of(group,
045959db Matan Barak 2015-12-23 244 struct cma_dev_group,
045959db Matan Barak 2015-12-23 245 device_group);
045959db Matan Barak 2015-12-23 246
045959db Matan Barak 2015-12-23 247 kfree(cma_dev_group);
045959db Matan Barak 2015-12-23 248 };
045959db Matan Barak 2015-12-23 249
045959db Matan Barak 2015-12-23 250 static void release_cma_ports_group(struct config_item *item)
045959db Matan Barak 2015-12-23 251 {
045959db Matan Barak 2015-12-23 252 struct config_group *group = container_of(item, struct config_group,
045959db Matan Barak 2015-12-23 253 cg_item);
045959db Matan Barak 2015-12-23 254 struct cma_dev_group *cma_dev_group = container_of(group,
045959db Matan Barak 2015-12-23 255 struct cma_dev_group,
045959db Matan Barak 2015-12-23 256 ports_group);
045959db Matan Barak 2015-12-23 257
045959db Matan Barak 2015-12-23 258 kfree(cma_dev_group->ports);
045959db Matan Barak 2015-12-23 259 cma_dev_group->ports = NULL;
045959db Matan Barak 2015-12-23 260 };
045959db Matan Barak 2015-12-23 261
045959db Matan Barak 2015-12-23 262 static struct configfs_item_operations cma_ports_item_ops = {
045959db Matan Barak 2015-12-23 263 .release = release_cma_ports_group
045959db Matan Barak 2015-12-23 264 };
045959db Matan Barak 2015-12-23 265
157120c0 Bhumika Goyal 2017-10-12 266 static const struct config_item_type cma_ports_group_type = {
045959db Matan Barak 2015-12-23 267 .ct_item_ops = &cma_ports_item_ops,
045959db Matan Barak 2015-12-23 268 .ct_owner = THIS_MODULE
045959db Matan Barak 2015-12-23 269 };
045959db Matan Barak 2015-12-23 270
045959db Matan Barak 2015-12-23 271 static struct configfs_item_operations cma_device_item_ops = {
045959db Matan Barak 2015-12-23 272 .release = release_cma_dev
045959db Matan Barak 2015-12-23 273 };
045959db Matan Barak 2015-12-23 274
157120c0 Bhumika Goyal 2017-10-12 275 static const struct config_item_type cma_device_group_type = {
045959db Matan Barak 2015-12-23 276 .ct_item_ops = &cma_device_item_ops,
045959db Matan Barak 2015-12-23 277 .ct_owner = THIS_MODULE
045959db Matan Barak 2015-12-23 278 };
045959db Matan Barak 2015-12-23 279
045959db Matan Barak 2015-12-23 280 static struct config_group *make_cma_dev(struct config_group *group,
045959db Matan Barak 2015-12-23 281 const char *name)
045959db Matan Barak 2015-12-23 282 {
045959db Matan Barak 2015-12-23 283 int err = -ENODEV;
045959db Matan Barak 2015-12-23 284 struct cma_device *cma_dev = cma_enum_devices_by_ibdev(filter_by_name,
045959db Matan Barak 2015-12-23 285 (void *)name);
045959db Matan Barak 2015-12-23 286 struct cma_dev_group *cma_dev_group = NULL;
045959db Matan Barak 2015-12-23 287
045959db Matan Barak 2015-12-23 288 if (!cma_dev)
045959db Matan Barak 2015-12-23 289 goto fail;
045959db Matan Barak 2015-12-23 290
045959db Matan Barak 2015-12-23 291 cma_dev_group = kzalloc(sizeof(*cma_dev_group), GFP_KERNEL);
045959db Matan Barak 2015-12-23 292
045959db Matan Barak 2015-12-23 293 if (!cma_dev_group) {
045959db Matan Barak 2015-12-23 294 err = -ENOMEM;
045959db Matan Barak 2015-12-23 295 goto fail;
045959db Matan Barak 2015-12-23 296 }
045959db Matan Barak 2015-12-23 297
045959db Matan Barak 2015-12-23 298 strncpy(cma_dev_group->name, name, sizeof(cma_dev_group->name));
045959db Matan Barak 2015-12-23 299
045959db Matan Barak 2015-12-23 300 config_group_init_type_name(&cma_dev_group->ports_group, "ports",
045959db Matan Barak 2015-12-23 301 &cma_ports_group_type);
045959db Matan Barak 2015-12-23 302
1ae1602d Christoph Hellwig 2016-02-26 303 err = make_cma_ports(cma_dev_group, cma_dev);
1ae1602d Christoph Hellwig 2016-02-26 304 if (err)
1ae1602d Christoph Hellwig 2016-02-26 305 goto fail;
045959db Matan Barak 2015-12-23 306
045959db Matan Barak 2015-12-23 307 config_group_init_type_name(&cma_dev_group->device_group, name,
045959db Matan Barak 2015-12-23 @308 &cma_device_group_type);
1ae1602d Christoph Hellwig 2016-02-26 309 configfs_add_default_group(&cma_dev_group->ports_group,
1ae1602d Christoph Hellwig 2016-02-26 310 &cma_dev_group->device_group);
045959db Matan Barak 2015-12-23 311
045959db Matan Barak 2015-12-23 312 cma_deref_dev(cma_dev);
045959db Matan Barak 2015-12-23 313 return &cma_dev_group->device_group;
045959db Matan Barak 2015-12-23 314
045959db Matan Barak 2015-12-23 315 fail:
045959db Matan Barak 2015-12-23 316 if (cma_dev)
045959db Matan Barak 2015-12-23 317 cma_deref_dev(cma_dev);
045959db Matan Barak 2015-12-23 318 kfree(cma_dev_group);
045959db Matan Barak 2015-12-23 319 return ERR_PTR(err);
045959db Matan Barak 2015-12-23 320 }
045959db Matan Barak 2015-12-23 321
045959db Matan Barak 2015-12-23 322 static struct configfs_group_operations cma_subsys_group_ops = {
045959db Matan Barak 2015-12-23 323 .make_group = make_cma_dev,
045959db Matan Barak 2015-12-23 324 };
045959db Matan Barak 2015-12-23 325
157120c0 Bhumika Goyal 2017-10-12 326 static const struct config_item_type cma_subsys_type = {
045959db Matan Barak 2015-12-23 327 .ct_group_ops = &cma_subsys_group_ops,
045959db Matan Barak 2015-12-23 328 .ct_owner = THIS_MODULE,
045959db Matan Barak 2015-12-23 329 };
045959db Matan Barak 2015-12-23 330
045959db Matan Barak 2015-12-23 331 static struct configfs_subsystem cma_subsys = {
045959db Matan Barak 2015-12-23 332 .su_group = {
045959db Matan Barak 2015-12-23 333 .cg_item = {
045959db Matan Barak 2015-12-23 334 .ci_namebuf = "rdma_cm",
045959db Matan Barak 2015-12-23 @335 .ci_type = &cma_subsys_type,
045959db Matan Barak 2015-12-23 336 },
045959db Matan Barak 2015-12-23 337 },
045959db Matan Barak 2015-12-23 338 };
045959db Matan Barak 2015-12-23 339
:::::: The code at line 225 was first introduced by commit
:::::: 045959db65c67d7189dc89ecddb5fa10aafa449d IB/cma: Add configfs for rdma_cm
:::::: TO: Matan Barak <matanb-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
:::::: CC: Doug Ledford <dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.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: 32016 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] IB/cma: make config_item_type const
@ 2017-10-13 6:41 ` kbuild test robot
0 siblings, 0 replies; 6+ messages in thread
From: kbuild test robot @ 2017-10-13 6:41 UTC (permalink / raw)
To: Bhumika Goyal
Cc: kbuild-all, julia.lawall, dledford, sean.hefty, hal.rosenstock,
linux-rdma, linux-kernel, Bhumika Goyal
[-- Attachment #1: Type: text/plain, Size: 15151 bytes --]
Hi Bhumika,
[auto build test WARNING on rdma/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/IB-cma-make-config_item_type-const/20171013-134956
base: https://git.kernel.org/pub/scm/linux/kernel/git/dledford/rdma.git master
config: x86_64-randconfig-x018-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/infiniband/core/cma_configfs.c: In function 'make_cma_ports':
>> drivers/infiniband/core/cma_configfs.c:225:10: warning: passing argument 3 of 'config_group_init_type_name' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
&cma_port_group_type);
^
In file included from drivers/infiniband/core/cma_configfs.c:34: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/infiniband/core/cma_configfs.c: In function 'make_cma_dev':
drivers/infiniband/core/cma_configfs.c:301:9: warning: passing argument 3 of 'config_group_init_type_name' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
&cma_ports_group_type);
^
In file included from drivers/infiniband/core/cma_configfs.c:34: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/infiniband/core/cma_configfs.c:308:9: warning: passing argument 3 of 'config_group_init_type_name' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
&cma_device_group_type);
^
In file included from drivers/infiniband/core/cma_configfs.c:34: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/infiniband/core/cma_configfs.c: At top level:
>> drivers/infiniband/core/cma_configfs.c:335:15: warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
.ci_type = &cma_subsys_type,
^
Cyclomatic Complexity 5 include/linux/compiler.h:__write_once_size
Cyclomatic Complexity 1 arch/x86/include/asm/bitops.h:fls64
Cyclomatic Complexity 1 include/linux/log2.h:__ilog2_u64
Cyclomatic Complexity 1 include/linux/list.h:__list_add_valid
Cyclomatic Complexity 2 include/linux/list.h:__list_add
Cyclomatic Complexity 1 include/linux/list.h:list_add_tail
Cyclomatic Complexity 1 include/asm-generic/getorder.h:__get_order
Cyclomatic Complexity 1 include/linux/err.h:ERR_PTR
Cyclomatic Complexity 1 include/linux/configfs.h:configfs_add_default_group
Cyclomatic Complexity 28 include/linux/slab.h:kmalloc_index
Cyclomatic Complexity 68 include/linux/slab.h:kmalloc_large
Cyclomatic Complexity 5 include/linux/slab.h:kmalloc
Cyclomatic Complexity 5 include/linux/slab.h:kmalloc_array
Cyclomatic Complexity 1 include/linux/slab.h:kcalloc
Cyclomatic Complexity 1 include/linux/slab.h:kzalloc
Cyclomatic Complexity 1 drivers/infiniband/core/cma_configfs.c:cma_configfs_params_put
Cyclomatic Complexity 3 drivers/infiniband/core/cma_configfs.c:release_cma_dev
Cyclomatic Complexity 3 drivers/infiniband/core/cma_configfs.c:release_cma_ports_group
Cyclomatic Complexity 1 drivers/infiniband/core/cma_configfs.c:filter_by_name
Cyclomatic Complexity 4 drivers/infiniband/core/cma_configfs.c:make_cma_ports
Cyclomatic Complexity 5 drivers/infiniband/core/cma_configfs.c:make_cma_dev
Cyclomatic Complexity 4 drivers/infiniband/core/cma_configfs.c:to_dev_port_group
Cyclomatic Complexity 3 drivers/infiniband/core/cma_configfs.c:cma_configfs_params_get
Cyclomatic Complexity 4 drivers/infiniband/core/cma_configfs.c:default_roce_tos_store
Cyclomatic Complexity 2 drivers/infiniband/core/cma_configfs.c:default_roce_tos_show
Cyclomatic Complexity 4 drivers/infiniband/core/cma_configfs.c:default_roce_mode_store
Cyclomatic Complexity 3 drivers/infiniband/core/cma_configfs.c:default_roce_mode_show
Cyclomatic Complexity 1 drivers/infiniband/core/cma_configfs.c:cma_configfs_init
Cyclomatic Complexity 1 drivers/infiniband/core/cma_configfs.c:cma_configfs_exit
vim +225 drivers/infiniband/core/cma_configfs.c
045959db Matan Barak 2015-12-23 193
045959db Matan Barak 2015-12-23 194 static int make_cma_ports(struct cma_dev_group *cma_dev_group,
045959db Matan Barak 2015-12-23 195 struct cma_device *cma_dev)
045959db Matan Barak 2015-12-23 196 {
045959db Matan Barak 2015-12-23 197 struct ib_device *ibdev;
045959db Matan Barak 2015-12-23 198 unsigned int i;
045959db Matan Barak 2015-12-23 199 unsigned int ports_num;
045959db Matan Barak 2015-12-23 200 struct cma_dev_port_group *ports;
045959db Matan Barak 2015-12-23 201 int err;
045959db Matan Barak 2015-12-23 202
045959db Matan Barak 2015-12-23 203 ibdev = cma_get_ib_dev(cma_dev);
045959db Matan Barak 2015-12-23 204
045959db Matan Barak 2015-12-23 205 if (!ibdev)
045959db Matan Barak 2015-12-23 206 return -ENODEV;
045959db Matan Barak 2015-12-23 207
045959db Matan Barak 2015-12-23 208 ports_num = ibdev->phys_port_cnt;
045959db Matan Barak 2015-12-23 209 ports = kcalloc(ports_num, sizeof(*cma_dev_group->ports),
045959db Matan Barak 2015-12-23 210 GFP_KERNEL);
045959db Matan Barak 2015-12-23 211
1ae1602d Christoph Hellwig 2016-02-26 212 if (!ports) {
045959db Matan Barak 2015-12-23 213 err = -ENOMEM;
045959db Matan Barak 2015-12-23 214 goto free;
045959db Matan Barak 2015-12-23 215 }
045959db Matan Barak 2015-12-23 216
045959db Matan Barak 2015-12-23 217 for (i = 0; i < ports_num; i++) {
045959db Matan Barak 2015-12-23 218 char port_str[10];
045959db Matan Barak 2015-12-23 219
045959db Matan Barak 2015-12-23 220 ports[i].port_num = i + 1;
045959db Matan Barak 2015-12-23 221 snprintf(port_str, sizeof(port_str), "%u", i + 1);
045959db Matan Barak 2015-12-23 222 ports[i].cma_dev_group = cma_dev_group;
045959db Matan Barak 2015-12-23 223 config_group_init_type_name(&ports[i].group,
045959db Matan Barak 2015-12-23 224 port_str,
045959db Matan Barak 2015-12-23 @225 &cma_port_group_type);
1ae1602d Christoph Hellwig 2016-02-26 226 configfs_add_default_group(&ports[i].group,
1ae1602d Christoph Hellwig 2016-02-26 227 &cma_dev_group->ports_group);
1ae1602d Christoph Hellwig 2016-02-26 228
045959db Matan Barak 2015-12-23 229 }
045959db Matan Barak 2015-12-23 230 cma_dev_group->ports = ports;
045959db Matan Barak 2015-12-23 231
045959db Matan Barak 2015-12-23 232 return 0;
045959db Matan Barak 2015-12-23 233 free:
045959db Matan Barak 2015-12-23 234 kfree(ports);
045959db Matan Barak 2015-12-23 235 cma_dev_group->ports = NULL;
045959db Matan Barak 2015-12-23 236 return err;
045959db Matan Barak 2015-12-23 237 }
045959db Matan Barak 2015-12-23 238
045959db Matan Barak 2015-12-23 239 static void release_cma_dev(struct config_item *item)
045959db Matan Barak 2015-12-23 240 {
045959db Matan Barak 2015-12-23 241 struct config_group *group = container_of(item, struct config_group,
045959db Matan Barak 2015-12-23 242 cg_item);
045959db Matan Barak 2015-12-23 243 struct cma_dev_group *cma_dev_group = container_of(group,
045959db Matan Barak 2015-12-23 244 struct cma_dev_group,
045959db Matan Barak 2015-12-23 245 device_group);
045959db Matan Barak 2015-12-23 246
045959db Matan Barak 2015-12-23 247 kfree(cma_dev_group);
045959db Matan Barak 2015-12-23 248 };
045959db Matan Barak 2015-12-23 249
045959db Matan Barak 2015-12-23 250 static void release_cma_ports_group(struct config_item *item)
045959db Matan Barak 2015-12-23 251 {
045959db Matan Barak 2015-12-23 252 struct config_group *group = container_of(item, struct config_group,
045959db Matan Barak 2015-12-23 253 cg_item);
045959db Matan Barak 2015-12-23 254 struct cma_dev_group *cma_dev_group = container_of(group,
045959db Matan Barak 2015-12-23 255 struct cma_dev_group,
045959db Matan Barak 2015-12-23 256 ports_group);
045959db Matan Barak 2015-12-23 257
045959db Matan Barak 2015-12-23 258 kfree(cma_dev_group->ports);
045959db Matan Barak 2015-12-23 259 cma_dev_group->ports = NULL;
045959db Matan Barak 2015-12-23 260 };
045959db Matan Barak 2015-12-23 261
045959db Matan Barak 2015-12-23 262 static struct configfs_item_operations cma_ports_item_ops = {
045959db Matan Barak 2015-12-23 263 .release = release_cma_ports_group
045959db Matan Barak 2015-12-23 264 };
045959db Matan Barak 2015-12-23 265
157120c0 Bhumika Goyal 2017-10-12 266 static const struct config_item_type cma_ports_group_type = {
045959db Matan Barak 2015-12-23 267 .ct_item_ops = &cma_ports_item_ops,
045959db Matan Barak 2015-12-23 268 .ct_owner = THIS_MODULE
045959db Matan Barak 2015-12-23 269 };
045959db Matan Barak 2015-12-23 270
045959db Matan Barak 2015-12-23 271 static struct configfs_item_operations cma_device_item_ops = {
045959db Matan Barak 2015-12-23 272 .release = release_cma_dev
045959db Matan Barak 2015-12-23 273 };
045959db Matan Barak 2015-12-23 274
157120c0 Bhumika Goyal 2017-10-12 275 static const struct config_item_type cma_device_group_type = {
045959db Matan Barak 2015-12-23 276 .ct_item_ops = &cma_device_item_ops,
045959db Matan Barak 2015-12-23 277 .ct_owner = THIS_MODULE
045959db Matan Barak 2015-12-23 278 };
045959db Matan Barak 2015-12-23 279
045959db Matan Barak 2015-12-23 280 static struct config_group *make_cma_dev(struct config_group *group,
045959db Matan Barak 2015-12-23 281 const char *name)
045959db Matan Barak 2015-12-23 282 {
045959db Matan Barak 2015-12-23 283 int err = -ENODEV;
045959db Matan Barak 2015-12-23 284 struct cma_device *cma_dev = cma_enum_devices_by_ibdev(filter_by_name,
045959db Matan Barak 2015-12-23 285 (void *)name);
045959db Matan Barak 2015-12-23 286 struct cma_dev_group *cma_dev_group = NULL;
045959db Matan Barak 2015-12-23 287
045959db Matan Barak 2015-12-23 288 if (!cma_dev)
045959db Matan Barak 2015-12-23 289 goto fail;
045959db Matan Barak 2015-12-23 290
045959db Matan Barak 2015-12-23 291 cma_dev_group = kzalloc(sizeof(*cma_dev_group), GFP_KERNEL);
045959db Matan Barak 2015-12-23 292
045959db Matan Barak 2015-12-23 293 if (!cma_dev_group) {
045959db Matan Barak 2015-12-23 294 err = -ENOMEM;
045959db Matan Barak 2015-12-23 295 goto fail;
045959db Matan Barak 2015-12-23 296 }
045959db Matan Barak 2015-12-23 297
045959db Matan Barak 2015-12-23 298 strncpy(cma_dev_group->name, name, sizeof(cma_dev_group->name));
045959db Matan Barak 2015-12-23 299
045959db Matan Barak 2015-12-23 300 config_group_init_type_name(&cma_dev_group->ports_group, "ports",
045959db Matan Barak 2015-12-23 301 &cma_ports_group_type);
045959db Matan Barak 2015-12-23 302
1ae1602d Christoph Hellwig 2016-02-26 303 err = make_cma_ports(cma_dev_group, cma_dev);
1ae1602d Christoph Hellwig 2016-02-26 304 if (err)
1ae1602d Christoph Hellwig 2016-02-26 305 goto fail;
045959db Matan Barak 2015-12-23 306
045959db Matan Barak 2015-12-23 307 config_group_init_type_name(&cma_dev_group->device_group, name,
045959db Matan Barak 2015-12-23 @308 &cma_device_group_type);
1ae1602d Christoph Hellwig 2016-02-26 309 configfs_add_default_group(&cma_dev_group->ports_group,
1ae1602d Christoph Hellwig 2016-02-26 310 &cma_dev_group->device_group);
045959db Matan Barak 2015-12-23 311
045959db Matan Barak 2015-12-23 312 cma_deref_dev(cma_dev);
045959db Matan Barak 2015-12-23 313 return &cma_dev_group->device_group;
045959db Matan Barak 2015-12-23 314
045959db Matan Barak 2015-12-23 315 fail:
045959db Matan Barak 2015-12-23 316 if (cma_dev)
045959db Matan Barak 2015-12-23 317 cma_deref_dev(cma_dev);
045959db Matan Barak 2015-12-23 318 kfree(cma_dev_group);
045959db Matan Barak 2015-12-23 319 return ERR_PTR(err);
045959db Matan Barak 2015-12-23 320 }
045959db Matan Barak 2015-12-23 321
045959db Matan Barak 2015-12-23 322 static struct configfs_group_operations cma_subsys_group_ops = {
045959db Matan Barak 2015-12-23 323 .make_group = make_cma_dev,
045959db Matan Barak 2015-12-23 324 };
045959db Matan Barak 2015-12-23 325
157120c0 Bhumika Goyal 2017-10-12 326 static const struct config_item_type cma_subsys_type = {
045959db Matan Barak 2015-12-23 327 .ct_group_ops = &cma_subsys_group_ops,
045959db Matan Barak 2015-12-23 328 .ct_owner = THIS_MODULE,
045959db Matan Barak 2015-12-23 329 };
045959db Matan Barak 2015-12-23 330
045959db Matan Barak 2015-12-23 331 static struct configfs_subsystem cma_subsys = {
045959db Matan Barak 2015-12-23 332 .su_group = {
045959db Matan Barak 2015-12-23 333 .cg_item = {
045959db Matan Barak 2015-12-23 334 .ci_namebuf = "rdma_cm",
045959db Matan Barak 2015-12-23 @335 .ci_type = &cma_subsys_type,
045959db Matan Barak 2015-12-23 336 },
045959db Matan Barak 2015-12-23 337 },
045959db Matan Barak 2015-12-23 338 };
045959db Matan Barak 2015-12-23 339
:::::: The code at line 225 was first introduced by commit
:::::: 045959db65c67d7189dc89ecddb5fa10aafa449d IB/cma: Add configfs for rdma_cm
:::::: TO: Matan Barak <matanb@mellanox.com>
:::::: CC: Doug Ledford <dledford@redhat.com>
---
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: 32016 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2017-10-13 6:41 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-12 12:20 [PATCH] IB/cma: make config_item_type const Bhumika Goyal
2017-10-12 12:20 ` Bhumika Goyal
2017-10-12 15:04 ` Bhumika Goyal
2017-10-12 21:24 ` Parav Pandit
[not found] ` <1507810800-8972-1-git-send-email-bhumirks-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-10-13 6:41 ` kbuild test robot
2017-10-13 6:41 ` kbuild test robot
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.