Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1742860 > unrolled thread

[PATCH] nvme: make config_item_type __ro_after_init

Started byBhumika Goyal <bhumirks@gmail.com>
First post2017-10-01 21:20 +0200
Last post2017-10-02 10:20 +0200
Articles 2 — 1 participant

Back to article view | Back to linux.kernel


Contents

  [PATCH] nvme: make config_item_type __ro_after_init Bhumika Goyal <bhumirks@gmail.com> - 2017-10-01 21:20 +0200
    Re: [PATCH] nvme: make config_item_type __ro_after_init Bhumika Goyal <bhumirks@gmail.com> - 2017-10-02 10:20 +0200

#1742860 — [PATCH] nvme: make config_item_type __ro_after_init

FromBhumika Goyal <bhumirks@gmail.com>
Date2017-10-01 21:20 +0200
Subject[PATCH] nvme: make config_item_type __ro_after_init
Message-ID<uvRWq-60J-3@gated-at.bofh.it>
Make these __ro_after_init as they are only stored as a reference in the
ci_type field of a config_item structure during the init phase in the
function config_group_init_type_name. None of the fields of these
structures are modified after the init phase, so they can be
__ro_after_init.

Structures found using Coccinelle and changes done by hand.

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
---
 drivers/nvme/target/configfs.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/nvme/target/configfs.c b/drivers/nvme/target/configfs.c
index b6aeb1d..075d9b5 100644
--- a/drivers/nvme/target/configfs.c
+++ b/drivers/nvme/target/configfs.c
@@ -767,7 +767,7 @@ static struct config_group *nvmet_subsys_make(struct config_group *group,
 	.make_group		= nvmet_subsys_make,
 };
 
-static struct config_item_type nvmet_subsystems_type = {
+static struct config_item_type nvmet_subsystems_type __ro_after_init = {
 	.ct_group_ops		= &nvmet_subsystems_group_ops,
 	.ct_owner		= THIS_MODULE,
 };
@@ -921,7 +921,7 @@ static struct config_group *nvmet_ports_make(struct config_group *group,
 	.make_group		= nvmet_ports_make,
 };
 
-static struct config_item_type nvmet_ports_type = {
+static struct config_item_type nvmet_ports_type __ro_after_init = {
 	.ct_group_ops		= &nvmet_ports_group_ops,
 	.ct_owner		= THIS_MODULE,
 };
@@ -963,7 +963,7 @@ static struct config_group *nvmet_hosts_make_group(struct config_group *group,
 	.make_group		= nvmet_hosts_make_group,
 };
 
-static struct config_item_type nvmet_hosts_type = {
+static struct config_item_type nvmet_hosts_type __ro_after_init = {
 	.ct_group_ops		= &nvmet_hosts_group_ops,
 	.ct_owner		= THIS_MODULE,
 };
-- 
1.9.1

[toc] | [next] | [standalone]


#1743008

FromBhumika Goyal <bhumirks@gmail.com>
Date2017-10-02 10:20 +0200
Message-ID<uw47f-4VO-1@gated-at.bofh.it>
In reply to#1742860
On Mon, Oct 2, 2017 at 12:44 AM, Bhumika Goyal <bhumirks@gmail.com> wrote:
> Make these __ro_after_init as they are only stored as a reference in the
> ci_type field of a config_item structure during the init phase in the
> function config_group_init_type_name. None of the fields of these
> structures are modified after the init phase, so they can be
> __ro_after_init.
>
> Structures found using Coccinelle and changes done by hand.
>

Hello all,

This patch should be dropped as the structures can also be made const
instead of __ro_after_init. I will send a patch making them const.

Thanks,
Bhumika

> Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
> ---
>  drivers/nvme/target/configfs.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/nvme/target/configfs.c b/drivers/nvme/target/configfs.c
> index b6aeb1d..075d9b5 100644
> --- a/drivers/nvme/target/configfs.c
> +++ b/drivers/nvme/target/configfs.c
> @@ -767,7 +767,7 @@ static struct config_group *nvmet_subsys_make(struct config_group *group,
>         .make_group             = nvmet_subsys_make,
>  };
>
> -static struct config_item_type nvmet_subsystems_type = {
> +static struct config_item_type nvmet_subsystems_type __ro_after_init = {
>         .ct_group_ops           = &nvmet_subsystems_group_ops,
>         .ct_owner               = THIS_MODULE,
>  };
> @@ -921,7 +921,7 @@ static struct config_group *nvmet_ports_make(struct config_group *group,
>         .make_group             = nvmet_ports_make,
>  };
>
> -static struct config_item_type nvmet_ports_type = {
> +static struct config_item_type nvmet_ports_type __ro_after_init = {
>         .ct_group_ops           = &nvmet_ports_group_ops,
>         .ct_owner               = THIS_MODULE,
>  };
> @@ -963,7 +963,7 @@ static struct config_group *nvmet_hosts_make_group(struct config_group *group,
>         .make_group             = nvmet_hosts_make_group,
>  };
>
> -static struct config_item_type nvmet_hosts_type = {
> +static struct config_item_type nvmet_hosts_type __ro_after_init = {
>         .ct_group_ops           = &nvmet_hosts_group_ops,
>         .ct_owner               = THIS_MODULE,
>  };
> --
> 1.9.1
>

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web