[PATCH] configfs: make function arguments const
From: Bhumika Goyal
Date: Wed Oct 11 2017 - 09:46:37 EST
This is a followup patch for: https://lkml.org/lkml/2017/10/11/375
Make the struct config_item_type *type function argument of functions
config_{item/group}_init_type_name const as the argument in both the
functions is only stored in the ci_type field of a config_item structure
which is const.
Make the argument of configfs_register_default_group const as it is
only passed to the argument of the function config_group_init_type_name
which is now const.
Signed-off-by: Bhumika Goyal <bhumirks@xxxxxxxxx>
---
This change allows lots of config_item_type structure to be const.
fs/configfs/dir.c | 2 +-
fs/configfs/item.c | 4 ++--
include/linux/configfs.h | 6 +++---
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/fs/configfs/dir.c b/fs/configfs/dir.c
index 56fb261..46935fe 100644
--- a/fs/configfs/dir.c
+++ b/fs/configfs/dir.c
@@ -1810,7 +1810,7 @@ void configfs_unregister_group(struct config_group *group)
struct config_group *
configfs_register_default_group(struct config_group *parent_group,
const char *name,
- struct config_item_type *item_type)
+ const struct config_item_type *item_type)
{
int ret;
struct config_group *group;
diff --git a/fs/configfs/item.c b/fs/configfs/item.c
index a66f662..b375b5e 100644
--- a/fs/configfs/item.c
+++ b/fs/configfs/item.c
@@ -113,7 +113,7 @@ int config_item_set_name(struct config_item *item, const char *fmt, ...)
void config_item_init_type_name(struct config_item *item,
const char *name,
- struct config_item_type *type)
+ const struct config_item_type *type)
{
config_item_set_name(item, "%s", name);
item->ci_type = type;
@@ -122,7 +122,7 @@ void config_item_init_type_name(struct config_item *item,
EXPORT_SYMBOL(config_item_init_type_name);
void config_group_init_type_name(struct config_group *group, const char *name,
- struct config_item_type *type)
+ const struct config_item_type *type)
{
config_item_set_name(&group->cg_item, "%s", name);
group->cg_item.ci_type = type;
diff --git a/include/linux/configfs.h b/include/linux/configfs.h
index c967090..acfc96f 100644
--- a/include/linux/configfs.h
+++ b/include/linux/configfs.h
@@ -72,7 +72,7 @@ static inline char *config_item_name(struct config_item * item)
extern void config_item_init_type_name(struct config_item *item,
const char *name,
- struct config_item_type *type);
+ const struct config_item_type *type);
extern struct config_item *config_item_get(struct config_item *);
extern struct config_item *config_item_get_unless_zero(struct config_item *);
@@ -101,7 +101,7 @@ struct config_group {
extern void config_group_init(struct config_group *group);
extern void config_group_init_type_name(struct config_group *group,
const char *name,
- struct config_item_type *type);
+ const struct config_item_type *type);
static inline struct config_group *to_config_group(struct config_item *item)
{
@@ -261,7 +261,7 @@ int configfs_register_group(struct config_group *parent_group,
struct config_group *
configfs_register_default_group(struct config_group *parent_group,
const char *name,
- struct config_item_type *item_type);
+ const struct config_item_type *item_type);
void configfs_unregister_default_group(struct config_group *group);
/* These functions can sleep and can alloc with GFP_KERNEL */
--
1.9.1