* [PATCH] netconsole: make config_item_type const
@ 2017-10-12 12:29 Bhumika Goyal
2017-10-12 15:04 ` Bhumika Goyal
2017-10-14 19:26 ` kbuild test robot
0 siblings, 2 replies; 3+ messages in thread
From: Bhumika Goyal @ 2017-10-12 12:29 UTC (permalink / raw)
To: julia.lawall, davem, akpm, nab, linux-kernel, netdev; +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/net/netconsole.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c
index 0e27920..be9aa36 100644
--- a/drivers/net/netconsole.c
+++ b/drivers/net/netconsole.c
@@ -616,7 +616,7 @@ static void netconsole_target_release(struct config_item *item)
.release = netconsole_target_release,
};
-static struct config_item_type netconsole_target_type = {
+static const struct config_item_type netconsole_target_type = {
.ct_attrs = netconsole_target_attrs,
.ct_item_ops = &netconsole_target_item_ops,
.ct_owner = THIS_MODULE,
@@ -682,7 +682,7 @@ static void drop_netconsole_target(struct config_group *group,
.drop_item = drop_netconsole_target,
};
-static struct config_item_type netconsole_subsys_type = {
+static const struct config_item_type netconsole_subsys_type = {
.ct_group_ops = &netconsole_subsys_group_ops,
.ct_owner = THIS_MODULE,
};
--
1.9.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] netconsole: make config_item_type const
2017-10-12 12:29 [PATCH] netconsole: make config_item_type const Bhumika Goyal
@ 2017-10-12 15:04 ` Bhumika Goyal
2017-10-14 19:26 ` kbuild test robot
1 sibling, 0 replies; 3+ messages in thread
From: Bhumika Goyal @ 2017-10-12 15:04 UTC (permalink / raw)
To: Julia Lawall, David Miller, akpm, nab, Linux Kernel Mailing List,
netdev
Cc: Bhumika Goyal
On Thu, Oct 12, 2017 at 2:29 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.
>
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/net/netconsole.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c
> index 0e27920..be9aa36 100644
> --- a/drivers/net/netconsole.c
> +++ b/drivers/net/netconsole.c
> @@ -616,7 +616,7 @@ static void netconsole_target_release(struct config_item *item)
> .release = netconsole_target_release,
> };
>
> -static struct config_item_type netconsole_target_type = {
> +static const struct config_item_type netconsole_target_type = {
> .ct_attrs = netconsole_target_attrs,
> .ct_item_ops = &netconsole_target_item_ops,
> .ct_owner = THIS_MODULE,
> @@ -682,7 +682,7 @@ static void drop_netconsole_target(struct config_group *group,
> .drop_item = drop_netconsole_target,
> };
>
> -static struct config_item_type netconsole_subsys_type = {
> +static const struct config_item_type netconsole_subsys_type = {
> .ct_group_ops = &netconsole_subsys_group_ops,
> .ct_owner = THIS_MODULE,
> };
> --
> 1.9.1
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] netconsole: make config_item_type const
2017-10-12 12:29 [PATCH] netconsole: make config_item_type const Bhumika Goyal
2017-10-12 15:04 ` Bhumika Goyal
@ 2017-10-14 19:26 ` kbuild test robot
1 sibling, 0 replies; 3+ messages in thread
From: kbuild test robot @ 2017-10-14 19:26 UTC (permalink / raw)
To: Bhumika Goyal
Cc: kbuild-all, julia.lawall, davem, akpm, nab, linux-kernel, netdev,
Bhumika Goyal
[-- Attachment #1: Type: text/plain, Size: 6889 bytes --]
Hi Bhumika,
[auto build test WARNING on net-next/master]
[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/netconsole-make-config_item_type-const/20171015-014833
config: x86_64-randconfig-x005-201742 (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/net/netconsole.c: In function 'make_netconsole_target':
>> drivers/net/netconsole.c:650:46: warning: passing argument 3 of 'config_item_init_type_name' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
config_item_init_type_name(&nt->item, name, &netconsole_target_type);
^
In file included from drivers/net/netconsole.c:49:0:
include/linux/configfs.h:73:13: note: expected 'struct config_item_type *' but argument is of type 'const struct config_item_type *'
extern void config_item_init_type_name(struct config_item *item,
^~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/netconsole.c: At top level:
>> drivers/net/netconsole.c:695:15: warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
.ci_type = &netconsole_subsys_type,
^
vim +650 drivers/net/netconsole.c
0bcc1816 Satyam Sharma 2007-08-10 624
0bcc1816 Satyam Sharma 2007-08-10 625 /*
0bcc1816 Satyam Sharma 2007-08-10 626 * Group operations and type for netconsole_subsys.
0bcc1816 Satyam Sharma 2007-08-10 627 */
0bcc1816 Satyam Sharma 2007-08-10 628
f89ab861 Joel Becker 2008-07-17 629 static struct config_item *make_netconsole_target(struct config_group *group,
f89ab861 Joel Becker 2008-07-17 630 const char *name)
0bcc1816 Satyam Sharma 2007-08-10 631 {
0bcc1816 Satyam Sharma 2007-08-10 632 unsigned long flags;
0bcc1816 Satyam Sharma 2007-08-10 633 struct netconsole_target *nt;
0bcc1816 Satyam Sharma 2007-08-10 634
0bcc1816 Satyam Sharma 2007-08-10 635 /*
0bcc1816 Satyam Sharma 2007-08-10 636 * Allocate and initialize with defaults.
698cf1c6 Tejun Heo 2015-06-25 637 * Target is disabled at creation (!enabled).
0bcc1816 Satyam Sharma 2007-08-10 638 */
0bcc1816 Satyam Sharma 2007-08-10 639 nt = kzalloc(sizeof(*nt), GFP_KERNEL);
e404decb Joe Perches 2012-01-29 640 if (!nt)
a6795e9e Joel Becker 2008-07-17 641 return ERR_PTR(-ENOMEM);
0bcc1816 Satyam Sharma 2007-08-10 642
0bcc1816 Satyam Sharma 2007-08-10 643 nt->np.name = "netconsole";
0bcc1816 Satyam Sharma 2007-08-10 644 strlcpy(nt->np.dev_name, "eth0", IFNAMSIZ);
0bcc1816 Satyam Sharma 2007-08-10 645 nt->np.local_port = 6665;
0bcc1816 Satyam Sharma 2007-08-10 646 nt->np.remote_port = 6666;
1667c942 Joe Perches 2015-03-02 647 eth_broadcast_addr(nt->np.remote_mac);
0bcc1816 Satyam Sharma 2007-08-10 648
0bcc1816 Satyam Sharma 2007-08-10 649 /* Initialize the config_item member */
0bcc1816 Satyam Sharma 2007-08-10 @650 config_item_init_type_name(&nt->item, name, &netconsole_target_type);
0bcc1816 Satyam Sharma 2007-08-10 651
0bcc1816 Satyam Sharma 2007-08-10 652 /* Adding, but it is disabled */
0bcc1816 Satyam Sharma 2007-08-10 653 spin_lock_irqsave(&target_list_lock, flags);
0bcc1816 Satyam Sharma 2007-08-10 654 list_add(&nt->list, &target_list);
0bcc1816 Satyam Sharma 2007-08-10 655 spin_unlock_irqrestore(&target_list_lock, flags);
0bcc1816 Satyam Sharma 2007-08-10 656
f89ab861 Joel Becker 2008-07-17 657 return &nt->item;
0bcc1816 Satyam Sharma 2007-08-10 658 }
0bcc1816 Satyam Sharma 2007-08-10 659
0bcc1816 Satyam Sharma 2007-08-10 660 static void drop_netconsole_target(struct config_group *group,
0bcc1816 Satyam Sharma 2007-08-10 661 struct config_item *item)
0bcc1816 Satyam Sharma 2007-08-10 662 {
0bcc1816 Satyam Sharma 2007-08-10 663 unsigned long flags;
0bcc1816 Satyam Sharma 2007-08-10 664 struct netconsole_target *nt = to_target(item);
0bcc1816 Satyam Sharma 2007-08-10 665
0bcc1816 Satyam Sharma 2007-08-10 666 spin_lock_irqsave(&target_list_lock, flags);
0bcc1816 Satyam Sharma 2007-08-10 667 list_del(&nt->list);
0bcc1816 Satyam Sharma 2007-08-10 668 spin_unlock_irqrestore(&target_list_lock, flags);
0bcc1816 Satyam Sharma 2007-08-10 669
0bcc1816 Satyam Sharma 2007-08-10 670 /*
0bcc1816 Satyam Sharma 2007-08-10 671 * The target may have never been enabled, or was manually disabled
0bcc1816 Satyam Sharma 2007-08-10 672 * before being removed so netpoll may have already been cleaned up.
0bcc1816 Satyam Sharma 2007-08-10 673 */
0bcc1816 Satyam Sharma 2007-08-10 674 if (nt->enabled)
0bcc1816 Satyam Sharma 2007-08-10 675 netpoll_cleanup(&nt->np);
0bcc1816 Satyam Sharma 2007-08-10 676
0bcc1816 Satyam Sharma 2007-08-10 677 config_item_put(&nt->item);
0bcc1816 Satyam Sharma 2007-08-10 678 }
0bcc1816 Satyam Sharma 2007-08-10 679
0bcc1816 Satyam Sharma 2007-08-10 680 static struct configfs_group_operations netconsole_subsys_group_ops = {
0bcc1816 Satyam Sharma 2007-08-10 681 .make_item = make_netconsole_target,
0bcc1816 Satyam Sharma 2007-08-10 682 .drop_item = drop_netconsole_target,
0bcc1816 Satyam Sharma 2007-08-10 683 };
0bcc1816 Satyam Sharma 2007-08-10 684
5de3a121 Bhumika Goyal 2017-10-12 685 static const struct config_item_type netconsole_subsys_type = {
0bcc1816 Satyam Sharma 2007-08-10 686 .ct_group_ops = &netconsole_subsys_group_ops,
0bcc1816 Satyam Sharma 2007-08-10 687 .ct_owner = THIS_MODULE,
0bcc1816 Satyam Sharma 2007-08-10 688 };
0bcc1816 Satyam Sharma 2007-08-10 689
0bcc1816 Satyam Sharma 2007-08-10 690 /* The netconsole configfs subsystem */
0bcc1816 Satyam Sharma 2007-08-10 691 static struct configfs_subsystem netconsole_subsys = {
0bcc1816 Satyam Sharma 2007-08-10 692 .su_group = {
0bcc1816 Satyam Sharma 2007-08-10 693 .cg_item = {
0bcc1816 Satyam Sharma 2007-08-10 694 .ci_namebuf = "netconsole",
0bcc1816 Satyam Sharma 2007-08-10 @695 .ci_type = &netconsole_subsys_type,
0bcc1816 Satyam Sharma 2007-08-10 696 },
0bcc1816 Satyam Sharma 2007-08-10 697 },
0bcc1816 Satyam Sharma 2007-08-10 698 };
0bcc1816 Satyam Sharma 2007-08-10 699
:::::: The code at line 650 was first introduced by commit
:::::: 0bcc1816188e570bde1d56a208996660f2633ae0 [NET] netconsole: Support dynamic reconfiguration using configfs
:::::: TO: Satyam Sharma <satyam@infradead.org>
:::::: CC: David S. Miller <davem@sunset.davemloft.net>
---
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: 34777 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-10-14 19:26 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-12 12:29 [PATCH] netconsole: make config_item_type const Bhumika Goyal
2017-10-12 15:04 ` Bhumika Goyal
2017-10-14 19:26 ` kbuild test robot
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).