Re: [PATCH] configfs: make config_item_type const

From: Bhumika Goyal
Date: Thu Oct 12 2017 - 11:02:50 EST


On Thu, Oct 12, 2017 at 3:29 PM, Bhumika Goyal <bhumirks@xxxxxxxxx> 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@xxxxxxxxx>
> ---
> samples/configfs/configfs_sample.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/samples/configfs/configfs_sample.c b/samples/configfs/configfs_sample.c
> index 1ea3311..004a4e2 100644
> --- a/samples/configfs/configfs_sample.c
> +++ b/samples/configfs/configfs_sample.c
> @@ -115,7 +115,7 @@ static ssize_t childless_description_show(struct config_item *item, char *page)
> NULL,
> };
>
> -static struct config_item_type childless_type = {
> +static const struct config_item_type childless_type = {
> .ct_attrs = childless_attrs,
> .ct_owner = THIS_MODULE,
> };
> @@ -193,7 +193,7 @@ static void simple_child_release(struct config_item *item)
> .release = simple_child_release,
> };
>
> -static struct config_item_type simple_child_type = {
> +static const struct config_item_type simple_child_type = {
> .ct_item_ops = &simple_child_item_ops,
> .ct_attrs = simple_child_attrs,
> .ct_owner = THIS_MODULE,
> @@ -261,7 +261,7 @@ static void simple_children_release(struct config_item *item)
> .make_item = simple_children_make_item,
> };
>
> -static struct config_item_type simple_children_type = {
> +static const struct config_item_type simple_children_type = {
> .ct_item_ops = &simple_children_item_ops,
> .ct_group_ops = &simple_children_group_ops,
> .ct_attrs = simple_children_attrs,
> @@ -331,7 +331,7 @@ static ssize_t group_children_description_show(struct config_item *item,
> .make_group = group_children_make_group,
> };
>
> -static struct config_item_type group_children_type = {
> +static const struct config_item_type group_children_type = {
> .ct_group_ops = &group_children_group_ops,
> .ct_attrs = group_children_attrs,
> .ct_owner = THIS_MODULE,
> --
> 1.9.1
>