Message ID | 1507812623-12598-1-git-send-email-bhumirks@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Delegated to: | Bjorn Helgaas |
Headers | show |
On Thu, Oct 12, 2017 at 2:50 PM, Bhumika Goyal <bhumirks@gmail.com> wrote: > This is a followup patch for: > https://patchwork.kernel.org/patch/9999649/ 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/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/pci/endpoint/pci-ep-cfs.c | 12 ++++++------ > 1 file changed, 6 insertions(+), 6 deletions(-) > > diff --git a/drivers/pci/endpoint/pci-ep-cfs.c b/drivers/pci/endpoint/pci-ep-cfs.c > index 424fdd6..4f74386 100644 > --- a/drivers/pci/endpoint/pci-ep-cfs.c > +++ b/drivers/pci/endpoint/pci-ep-cfs.c > @@ -150,7 +150,7 @@ static void pci_epc_epf_unlink(struct config_item *epc_item, > .drop_link = pci_epc_epf_unlink, > }; > > -static struct config_item_type pci_epc_type = { > +static const struct config_item_type pci_epc_type = { > .ct_item_ops = &pci_epc_item_ops, > .ct_attrs = pci_epc_attrs, > .ct_owner = THIS_MODULE, > @@ -361,7 +361,7 @@ static void pci_epf_release(struct config_item *item) > .release = pci_epf_release, > }; > > -static struct config_item_type pci_epf_type = { > +static const struct config_item_type pci_epf_type = { > .ct_item_ops = &pci_epf_ops, > .ct_attrs = pci_epf_attrs, > .ct_owner = THIS_MODULE, > @@ -400,7 +400,7 @@ static void pci_epf_drop(struct config_group *group, struct config_item *item) > .drop_item = &pci_epf_drop, > }; > > -static struct config_item_type pci_epf_group_type = { > +static const struct config_item_type pci_epf_group_type = { > .ct_group_ops = &pci_epf_group_ops, > .ct_owner = THIS_MODULE, > }; > @@ -428,15 +428,15 @@ void pci_ep_cfs_remove_epf_group(struct config_group *group) > } > EXPORT_SYMBOL(pci_ep_cfs_remove_epf_group); > > -static struct config_item_type pci_functions_type = { > +static const struct config_item_type pci_functions_type = { > .ct_owner = THIS_MODULE, > }; > > -static struct config_item_type pci_controllers_type = { > +static const struct config_item_type pci_controllers_type = { > .ct_owner = THIS_MODULE, > }; > > -static struct config_item_type pci_ep_type = { > +static const struct config_item_type pci_ep_type = { > .ct_owner = THIS_MODULE, > }; > > -- > 1.9.1 >
Hi Bhumika, [auto build test WARNING on pci/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/PCI-endpoint-make-config_item_type-const/20171015-175843 base: https://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git next config: i386-randconfig-s1-201742+CONFIG_DEBUG_INFO_REDUCED (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/pci/endpoint/pci-ep-cfs.c: In function 'pci_ep_cfs_add_epc_group': >> drivers/pci/endpoint/pci-ep-cfs.c:174:43: 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, &pci_epc_type); ^ In file included from include/linux/pci-ep-cfs.h:15:0, from drivers/pci/endpoint/pci-ep-cfs.c:25: 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/pci/endpoint/pci-ep-cfs.c: In function 'pci_epf_make': drivers/pci/endpoint/pci-ep-cfs.c:380:55: warning: passing argument 3 of 'config_group_init_type_name' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] config_group_init_type_name(&epf_group->group, name, &pci_epf_type); ^ In file included from include/linux/pci-ep-cfs.h:15:0, from drivers/pci/endpoint/pci-ep-cfs.c:25: 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/pci/endpoint/pci-ep-cfs.c: In function 'pci_ep_cfs_add_epf_group': >> drivers/pci/endpoint/pci-ep-cfs.c:413:7: warning: passing argument 3 of 'configfs_register_default_group' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] &pci_epf_group_type); ^ In file included from include/linux/pci-ep-cfs.h:15:0, from drivers/pci/endpoint/pci-ep-cfs.c:25: include/linux/configfs.h:262:1: note: expected 'struct config_item_type *' but argument is of type 'const struct config_item_type *' configfs_register_default_group(struct config_group *parent_group, ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/pci/endpoint/pci-ep-cfs.c: At top level: >> drivers/pci/endpoint/pci-ep-cfs.c:447:15: warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] .ci_type = &pci_ep_type, ^ drivers/pci/endpoint/pci-ep-cfs.c: In function 'pci_ep_cfs_init': drivers/pci/endpoint/pci-ep-cfs.c:468:10: warning: passing argument 3 of 'configfs_register_default_group' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] &pci_functions_type); ^ In file included from include/linux/pci-ep-cfs.h:15:0, from drivers/pci/endpoint/pci-ep-cfs.c:25: include/linux/configfs.h:262:1: note: expected 'struct config_item_type *' but argument is of type 'const struct config_item_type *' configfs_register_default_group(struct config_group *parent_group, ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/pci/endpoint/pci-ep-cfs.c:478:7: warning: passing argument 3 of 'configfs_register_default_group' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] &pci_controllers_type); ^ In file included from include/linux/pci-ep-cfs.h:15:0, from drivers/pci/endpoint/pci-ep-cfs.c:25: include/linux/configfs.h:262:1: note: expected 'struct config_item_type *' but argument is of type 'const struct config_item_type *' configfs_register_default_group(struct config_group *parent_group, ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ vim +174 drivers/pci/endpoint/pci-ep-cfs.c d7467991 Kishon Vijay Abraham I 2017-03-27 158 d7467991 Kishon Vijay Abraham I 2017-03-27 159 struct config_group *pci_ep_cfs_add_epc_group(const char *name) d7467991 Kishon Vijay Abraham I 2017-03-27 160 { d7467991 Kishon Vijay Abraham I 2017-03-27 161 int ret; d7467991 Kishon Vijay Abraham I 2017-03-27 162 struct pci_epc *epc; d7467991 Kishon Vijay Abraham I 2017-03-27 163 struct config_group *group; d7467991 Kishon Vijay Abraham I 2017-03-27 164 struct pci_epc_group *epc_group; d7467991 Kishon Vijay Abraham I 2017-03-27 165 d7467991 Kishon Vijay Abraham I 2017-03-27 166 epc_group = kzalloc(sizeof(*epc_group), GFP_KERNEL); d7467991 Kishon Vijay Abraham I 2017-03-27 167 if (!epc_group) { d7467991 Kishon Vijay Abraham I 2017-03-27 168 ret = -ENOMEM; d7467991 Kishon Vijay Abraham I 2017-03-27 169 goto err; d7467991 Kishon Vijay Abraham I 2017-03-27 170 } d7467991 Kishon Vijay Abraham I 2017-03-27 171 d7467991 Kishon Vijay Abraham I 2017-03-27 172 group = &epc_group->group; d7467991 Kishon Vijay Abraham I 2017-03-27 173 d7467991 Kishon Vijay Abraham I 2017-03-27 @174 config_group_init_type_name(group, name, &pci_epc_type); d7467991 Kishon Vijay Abraham I 2017-03-27 175 ret = configfs_register_group(controllers_group, group); d7467991 Kishon Vijay Abraham I 2017-03-27 176 if (ret) { d7467991 Kishon Vijay Abraham I 2017-03-27 177 pr_err("failed to register configfs group for %s\n", name); d7467991 Kishon Vijay Abraham I 2017-03-27 178 goto err_register_group; d7467991 Kishon Vijay Abraham I 2017-03-27 179 } d7467991 Kishon Vijay Abraham I 2017-03-27 180 d7467991 Kishon Vijay Abraham I 2017-03-27 181 epc = pci_epc_get(name); d7467991 Kishon Vijay Abraham I 2017-03-27 182 if (IS_ERR(epc)) { d7467991 Kishon Vijay Abraham I 2017-03-27 183 ret = PTR_ERR(epc); d7467991 Kishon Vijay Abraham I 2017-03-27 184 goto err_epc_get; d7467991 Kishon Vijay Abraham I 2017-03-27 185 } d7467991 Kishon Vijay Abraham I 2017-03-27 186 d7467991 Kishon Vijay Abraham I 2017-03-27 187 epc_group->epc = epc; d7467991 Kishon Vijay Abraham I 2017-03-27 188 d7467991 Kishon Vijay Abraham I 2017-03-27 189 return group; d7467991 Kishon Vijay Abraham I 2017-03-27 190 d7467991 Kishon Vijay Abraham I 2017-03-27 191 err_epc_get: d7467991 Kishon Vijay Abraham I 2017-03-27 192 configfs_unregister_group(group); d7467991 Kishon Vijay Abraham I 2017-03-27 193 d7467991 Kishon Vijay Abraham I 2017-03-27 194 err_register_group: d7467991 Kishon Vijay Abraham I 2017-03-27 195 kfree(epc_group); d7467991 Kishon Vijay Abraham I 2017-03-27 196 d7467991 Kishon Vijay Abraham I 2017-03-27 197 err: d7467991 Kishon Vijay Abraham I 2017-03-27 198 return ERR_PTR(ret); d7467991 Kishon Vijay Abraham I 2017-03-27 199 } d7467991 Kishon Vijay Abraham I 2017-03-27 200 EXPORT_SYMBOL(pci_ep_cfs_add_epc_group); d7467991 Kishon Vijay Abraham I 2017-03-27 201 :::::: The code at line 174 was first introduced by commit :::::: d746799116103d857be203382b09035bbe225d03 PCI: endpoint: Introduce configfs entry for configuring EP functions :::::: TO: Kishon Vijay Abraham I <kishon@ti.com> :::::: CC: Bjorn Helgaas <bhelgaas@google.com> --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation
diff --git a/drivers/pci/endpoint/pci-ep-cfs.c b/drivers/pci/endpoint/pci-ep-cfs.c index 424fdd6..4f74386 100644 --- a/drivers/pci/endpoint/pci-ep-cfs.c +++ b/drivers/pci/endpoint/pci-ep-cfs.c @@ -150,7 +150,7 @@ static void pci_epc_epf_unlink(struct config_item *epc_item, .drop_link = pci_epc_epf_unlink, }; -static struct config_item_type pci_epc_type = { +static const struct config_item_type pci_epc_type = { .ct_item_ops = &pci_epc_item_ops, .ct_attrs = pci_epc_attrs, .ct_owner = THIS_MODULE, @@ -361,7 +361,7 @@ static void pci_epf_release(struct config_item *item) .release = pci_epf_release, }; -static struct config_item_type pci_epf_type = { +static const struct config_item_type pci_epf_type = { .ct_item_ops = &pci_epf_ops, .ct_attrs = pci_epf_attrs, .ct_owner = THIS_MODULE, @@ -400,7 +400,7 @@ static void pci_epf_drop(struct config_group *group, struct config_item *item) .drop_item = &pci_epf_drop, }; -static struct config_item_type pci_epf_group_type = { +static const struct config_item_type pci_epf_group_type = { .ct_group_ops = &pci_epf_group_ops, .ct_owner = THIS_MODULE, }; @@ -428,15 +428,15 @@ void pci_ep_cfs_remove_epf_group(struct config_group *group) } EXPORT_SYMBOL(pci_ep_cfs_remove_epf_group); -static struct config_item_type pci_functions_type = { +static const struct config_item_type pci_functions_type = { .ct_owner = THIS_MODULE, }; -static struct config_item_type pci_controllers_type = { +static const struct config_item_type pci_controllers_type = { .ct_owner = THIS_MODULE, }; -static struct config_item_type pci_ep_type = { +static const struct config_item_type pci_ep_type = { .ct_owner = THIS_MODULE, };
This is a followup patch for: https://patchwork.kernel.org/patch/9999649/ 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 <bhumirks@gmail.com> --- drivers/pci/endpoint/pci-ep-cfs.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)