diff mbox

iio: make config_item_type const

Message ID 1507801276-1716-1-git-send-email-bhumirks@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Bhumika Goyal Oct. 12, 2017, 9:41 a.m. UTC
This is a followup patch for:
https://lkml.org/lkml/2017/10/11/375
https://patchwork.kernel.org/patch/9999649/
https://lkml.org/lkml/2017/10/11/469 and
https://lkml.org/lkml/2017/10/11/661

Make the config_item_type structures const as they are either passed to
the functions having the argument as const (link 2,3,4) or they are
stored in the const "ci_type" field of a config_item structure (link 1).

Done using Coccinelle.

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
---
 drivers/iio/dummy/iio_simple_dummy.c   | 2 +-
 drivers/iio/industrialio-configfs.c    | 2 +-
 drivers/iio/industrialio-sw-device.c   | 6 +++---
 drivers/iio/industrialio-sw-trigger.c  | 6 +++---
 drivers/iio/trigger/iio-trig-hrtimer.c | 2 +-
 drivers/iio/trigger/iio-trig-loop.c    | 2 +-
 6 files changed, 10 insertions(+), 10 deletions(-)

Comments

Bhumika Goyal Oct. 12, 2017, 3:05 p.m. UTC | #1
On Thu, Oct 12, 2017 at 11:41 AM, Bhumika Goyal <bhumirks@gmail.com> wrote:
> This is a followup patch for:
> https://lkml.org/lkml/2017/10/11/375
> https://patchwork.kernel.org/patch/9999649/
> https://lkml.org/lkml/2017/10/11/469 and
> https://lkml.org/lkml/2017/10/11/661
>
> Make the config_item_type structures const as they are either passed to
> the functions having the argument as const (link 2,3,4) or they are
> stored in the const "ci_type" field of a config_item structure (link 1).
>
> Done using Coccinelle.
>

Actually, this patch is dependent on the links given in the patch.
Therefore, this patch
won't be correct unless the patches in these links gets applied.

> Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
> ---
>  drivers/iio/dummy/iio_simple_dummy.c   | 2 +-
>  drivers/iio/industrialio-configfs.c    | 2 +-
>  drivers/iio/industrialio-sw-device.c   | 6 +++---
>  drivers/iio/industrialio-sw-trigger.c  | 6 +++---
>  drivers/iio/trigger/iio-trig-hrtimer.c | 2 +-
>  drivers/iio/trigger/iio-trig-loop.c    | 2 +-
>  6 files changed, 10 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/iio/dummy/iio_simple_dummy.c b/drivers/iio/dummy/iio_simple_dummy.c
> index a45d01e..6205247 100644
> --- a/drivers/iio/dummy/iio_simple_dummy.c
> +++ b/drivers/iio/dummy/iio_simple_dummy.c
> @@ -26,7 +26,7 @@
>  #include <linux/iio/sw_device.h>
>  #include "iio_simple_dummy.h"
>
> -static struct config_item_type iio_dummy_type = {
> +static const struct config_item_type iio_dummy_type = {
>         .ct_owner = THIS_MODULE,
>  };
>
> diff --git a/drivers/iio/industrialio-configfs.c b/drivers/iio/industrialio-configfs.c
> index 45ce2bc..5a0aae1 100644
> --- a/drivers/iio/industrialio-configfs.c
> +++ b/drivers/iio/industrialio-configfs.c
> @@ -17,7 +17,7 @@
>  #include <linux/iio/iio.h>
>  #include <linux/iio/configfs.h>
>
> -static struct config_item_type iio_root_group_type = {
> +static const struct config_item_type iio_root_group_type = {
>         .ct_owner       = THIS_MODULE,
>  };
>
> diff --git a/drivers/iio/industrialio-sw-device.c b/drivers/iio/industrialio-sw-device.c
> index 81b49cf..90df97c 100644
> --- a/drivers/iio/industrialio-sw-device.c
> +++ b/drivers/iio/industrialio-sw-device.c
> @@ -19,9 +19,9 @@
>  #include <linux/configfs.h>
>
>  static struct config_group *iio_devices_group;
> -static struct config_item_type iio_device_type_group_type;
> +static const struct config_item_type iio_device_type_group_type;
>
> -static struct config_item_type iio_devices_group_type = {
> +static const struct config_item_type iio_devices_group_type = {
>         .ct_owner = THIS_MODULE,
>  };
>
> @@ -156,7 +156,7 @@ static void device_drop_group(struct config_group *group,
>         .drop_item      = &device_drop_group,
>  };
>
> -static struct config_item_type iio_device_type_group_type = {
> +static const struct config_item_type iio_device_type_group_type = {
>         .ct_group_ops = &device_ops,
>         .ct_owner       = THIS_MODULE,
>  };
> diff --git a/drivers/iio/industrialio-sw-trigger.c b/drivers/iio/industrialio-sw-trigger.c
> index 8d24fb1..bc6b7fb 100644
> --- a/drivers/iio/industrialio-sw-trigger.c
> +++ b/drivers/iio/industrialio-sw-trigger.c
> @@ -19,9 +19,9 @@
>  #include <linux/configfs.h>
>
>  static struct config_group *iio_triggers_group;
> -static struct config_item_type iio_trigger_type_group_type;
> +static const struct config_item_type iio_trigger_type_group_type;
>
> -static struct config_item_type iio_triggers_group_type = {
> +static const struct config_item_type iio_triggers_group_type = {
>         .ct_owner = THIS_MODULE,
>  };
>
> @@ -156,7 +156,7 @@ static void trigger_drop_group(struct config_group *group,
>         .drop_item      = &trigger_drop_group,
>  };
>
> -static struct config_item_type iio_trigger_type_group_type = {
> +static const struct config_item_type iio_trigger_type_group_type = {
>         .ct_group_ops = &trigger_ops,
>         .ct_owner       = THIS_MODULE,
>  };
> diff --git a/drivers/iio/trigger/iio-trig-hrtimer.c b/drivers/iio/trigger/iio-trig-hrtimer.c
> index 3ee9216..7accd01 100644
> --- a/drivers/iio/trigger/iio-trig-hrtimer.c
> +++ b/drivers/iio/trigger/iio-trig-hrtimer.c
> @@ -30,7 +30,7 @@ struct iio_hrtimer_info {
>         ktime_t period;
>  };
>
> -static struct config_item_type iio_hrtimer_type = {
> +static const struct config_item_type iio_hrtimer_type = {
>         .ct_owner = THIS_MODULE,
>  };
>
> diff --git a/drivers/iio/trigger/iio-trig-loop.c b/drivers/iio/trigger/iio-trig-loop.c
> index b4b02db..94a90e0 100644
> --- a/drivers/iio/trigger/iio-trig-loop.c
> +++ b/drivers/iio/trigger/iio-trig-loop.c
> @@ -36,7 +36,7 @@ struct iio_loop_info {
>         struct task_struct *task;
>  };
>
> -static struct config_item_type iio_loop_type = {
> +static const struct config_item_type iio_loop_type = {
>         .ct_owner = THIS_MODULE,
>  };
>
> --
> 1.9.1
>
--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
kernel test robot Oct. 14, 2017, 3:15 p.m. UTC | #2
Hi Bhumika,

[auto build test WARNING on iio/togreg]
[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/iio-make-config_item_type-const/20171014-213401
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git togreg
config: x86_64-randconfig-x018-201741 (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//iio/trigger/iio-trig-hrtimer.c: In function 'iio_trig_hrtimer_probe':
>> drivers//iio/trigger/iio-trig-hrtimer.c:149:54: warning: passing argument 3 of 'iio_swt_group_init_type_name' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
     iio_swt_group_init_type_name(&trig_info->swt, name, &iio_hrtimer_type);
                                                         ^
   In file included from drivers//iio/trigger/iio-trig-hrtimer.c:21:0:
   include/linux/iio/sw_trigger.h:61:6: note: expected 'struct config_item_type *' but argument is of type 'const struct config_item_type *'
    void iio_swt_group_init_type_name(struct iio_sw_trigger *t,
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   Cyclomatic Complexity 1 arch/x86/include/asm/bitops.h:fls64
   Cyclomatic Complexity 1 include/linux/log2.h:__ilog2_u64
   Cyclomatic Complexity 1 include/linux/kernel.h:kstrtoul
   Cyclomatic Complexity 1 include/asm-generic/getorder.h:__get_order
   Cyclomatic Complexity 1 include/linux/err.h:ERR_PTR
   Cyclomatic Complexity 28 include/linux/slab.h:kmalloc_index
   Cyclomatic Complexity 68 include/linux/slab.h:kmalloc_large
   Cyclomatic Complexity 5 include/linux/slab.h:kmalloc
   Cyclomatic Complexity 1 include/linux/slab.h:kzalloc
   Cyclomatic Complexity 1 include/linux/hrtimer.h:hrtimer_start
   Cyclomatic Complexity 1 include/linux/hrtimer.h:hrtimer_forward_now
   Cyclomatic Complexity 1 include/linux/device.h:dev_get_drvdata
   Cyclomatic Complexity 1 include/linux/device.h:dev_set_drvdata
   Cyclomatic Complexity 2 include/linux/iio/trigger.h:to_iio_trigger
   Cyclomatic Complexity 1 include/linux/iio/trigger.h:iio_trigger_set_drvdata
   Cyclomatic Complexity 1 include/linux/iio/trigger.h:iio_trigger_get_drvdata
   Cyclomatic Complexity 1 include/linux/iio/sw_trigger.h:iio_swt_group_init_type_name
   Cyclomatic Complexity 3 drivers//iio/trigger/iio-trig-hrtimer.c:iio_hrtimer_store_sampling_frequency
   Cyclomatic Complexity 1 drivers//iio/trigger/iio-trig-hrtimer.c:iio_trig_hrtimer_init
   Cyclomatic Complexity 2 drivers//iio/trigger/iio-trig-hrtimer.c:iio_trig_hrtimer_set_state
   Cyclomatic Complexity 1 drivers//iio/trigger/iio-trig-hrtimer.c:iio_trig_hrtimer_remove
   Cyclomatic Complexity 4 drivers//iio/trigger/iio-trig-hrtimer.c:iio_trig_hrtimer_probe
   Cyclomatic Complexity 2 drivers//iio/trigger/iio-trig-hrtimer.c:iio_hrtimer_trig_handler
   Cyclomatic Complexity 1 drivers//iio/trigger/iio-trig-hrtimer.c:iio_hrtimer_show_sampling_frequency
   Cyclomatic Complexity 1 drivers//iio/trigger/iio-trig-hrtimer.c:iio_trig_hrtimer_exit
--
   drivers//iio/trigger/iio-trig-loop.c: In function 'iio_trig_loop_probe':
>> drivers//iio/trigger/iio-trig-loop.c:101:54: warning: passing argument 3 of 'iio_swt_group_init_type_name' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
     iio_swt_group_init_type_name(&trig_info->swt, name, &iio_loop_type);
                                                         ^
   In file included from drivers//iio/trigger/iio-trig-loop.c:32:0:
   include/linux/iio/sw_trigger.h:61:6: note: expected 'struct config_item_type *' but argument is of type 'const struct config_item_type *'
    void iio_swt_group_init_type_name(struct iio_sw_trigger *t,
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   Cyclomatic Complexity 1 arch/x86/include/asm/bitops.h:fls64
   Cyclomatic Complexity 1 include/linux/log2.h:__ilog2_u64
   Cyclomatic Complexity 1 include/asm-generic/getorder.h:__get_order
   Cyclomatic Complexity 1 include/linux/err.h:ERR_PTR
   Cyclomatic Complexity 1 include/linux/err.h:PTR_ERR
   Cyclomatic Complexity 1 include/linux/err.h:IS_ERR
   Cyclomatic Complexity 1 include/linux/device.h:dev_get_drvdata
   Cyclomatic Complexity 1 include/linux/device.h:dev_set_drvdata
   Cyclomatic Complexity 28 include/linux/slab.h:kmalloc_index
   Cyclomatic Complexity 68 include/linux/slab.h:kmalloc_large
   Cyclomatic Complexity 5 include/linux/slab.h:kmalloc
   Cyclomatic Complexity 1 include/linux/slab.h:kzalloc
   Cyclomatic Complexity 1 include/linux/iio/trigger.h:iio_trigger_set_drvdata
   Cyclomatic Complexity 1 include/linux/iio/trigger.h:iio_trigger_get_drvdata
   Cyclomatic Complexity 1 include/linux/iio/sw_trigger.h:iio_swt_group_init_type_name
   Cyclomatic Complexity 1 drivers//iio/trigger/iio-trig-loop.c:iio_trig_loop_init
   Cyclomatic Complexity 1 drivers//iio/trigger/iio-trig-loop.c:iio_trig_loop_remove
   Cyclomatic Complexity 4 drivers//iio/trigger/iio-trig-loop.c:iio_trig_loop_probe
   Cyclomatic Complexity 4 drivers//iio/trigger/iio-trig-loop.c:iio_loop_trigger_set_state
   Cyclomatic Complexity 2 drivers//iio/trigger/iio-trig-loop.c:iio_loop_thread
   Cyclomatic Complexity 1 drivers//iio/trigger/iio-trig-loop.c:iio_trig_loop_exit
--
>> drivers/iio/industrialio-configfs.c:28:15: warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
       .ci_type = &iio_root_group_type,
                  ^
   Cyclomatic Complexity 1 drivers/iio/industrialio-configfs.c:iio_configfs_init
   Cyclomatic Complexity 1 drivers/iio/industrialio-configfs.c:iio_configfs_exit
--
   drivers/iio/industrialio-sw-device.c: In function 'iio_register_sw_device_type':
>> drivers/iio/industrialio-sw-device.c:63:7: warning: passing argument 3 of 'configfs_register_default_group' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
          &iio_device_type_group_type);
          ^
   In file included from include/linux/iio/sw_device.h:17:0,
                    from drivers/iio/industrialio-sw-device.c:17:
   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/iio/industrialio-sw-device.c: In function 'iio_sw_device_init':
   drivers/iio/industrialio-sw-device.c:169:7: warning: passing argument 3 of 'configfs_register_default_group' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
          &iio_devices_group_type);
          ^
   In file included from include/linux/iio/sw_device.h:17:0,
                    from drivers/iio/industrialio-sw-device.c:17:
   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,
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   Cyclomatic Complexity 5 include/linux/compiler.h:__write_once_size
   Cyclomatic Complexity 1 include/linux/list.h:__list_add_valid
   Cyclomatic Complexity 1 include/linux/list.h:__list_del_entry_valid
   Cyclomatic Complexity 2 include/linux/list.h:__list_add
   Cyclomatic Complexity 1 include/linux/list.h:list_add_tail
   Cyclomatic Complexity 1 include/linux/list.h:__list_del
   Cyclomatic Complexity 2 include/linux/list.h:__list_del_entry
   Cyclomatic Complexity 1 include/linux/list.h:list_del
   Cyclomatic Complexity 1 include/linux/err.h:ERR_PTR
   Cyclomatic Complexity 1 include/linux/err.h:PTR_ERR
   Cyclomatic Complexity 1 include/linux/err.h:IS_ERR
   Cyclomatic Complexity 1 include/linux/err.h:ERR_CAST
   Cyclomatic Complexity 2 include/linux/err.h:PTR_ERR_OR_ZERO
   Cyclomatic Complexity 1 include/linux/module.h:try_module_get
   Cyclomatic Complexity 1 include/linux/module.h:module_put
   Cyclomatic Complexity 3 include/linux/configfs.h:to_config_group
   Cyclomatic Complexity 2 include/linux/iio/sw_device.h:to_iio_sw_device
   Cyclomatic Complexity 1 drivers/iio/industrialio-sw-device.c:iio_sw_device_init
   Cyclomatic Complexity 5 drivers/iio/industrialio-sw-device.c:__iio_find_sw_device_type
   Cyclomatic Complexity 3 drivers/iio/industrialio-sw-device.c:iio_get_sw_device_type
   Cyclomatic Complexity 1 drivers/iio/industrialio-sw-device.c:iio_sw_device_exit
   Cyclomatic Complexity 4 drivers/iio/industrialio-sw-device.c:iio_register_sw_device_type
   Cyclomatic Complexity 2 drivers/iio/industrialio-sw-device.c:iio_unregister_sw_device_type
   Cyclomatic Complexity 3 drivers/iio/industrialio-sw-device.c:iio_sw_device_create
   Cyclomatic Complexity 2 drivers/iio/industrialio-sw-device.c:device_make_group
   Cyclomatic Complexity 1 drivers/iio/industrialio-sw-device.c:iio_sw_device_destroy
   Cyclomatic Complexity 1 drivers/iio/industrialio-sw-device.c:device_drop_group
--
   drivers/iio/industrialio-sw-trigger.c: In function 'iio_register_sw_trigger_type':
>> drivers/iio/industrialio-sw-trigger.c:63:7: warning: passing argument 3 of 'configfs_register_default_group' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
          &iio_trigger_type_group_type);
          ^
   In file included from include/linux/iio/sw_trigger.h:17:0,
                    from drivers/iio/industrialio-sw-trigger.c:17:
   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/iio/industrialio-sw-trigger.c: In function 'iio_sw_trigger_init':
   drivers/iio/industrialio-sw-trigger.c:169:7: warning: passing argument 3 of 'configfs_register_default_group' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
          &iio_triggers_group_type);
          ^
   In file included from include/linux/iio/sw_trigger.h:17:0,
                    from drivers/iio/industrialio-sw-trigger.c:17:
   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,
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   Cyclomatic Complexity 5 include/linux/compiler.h:__write_once_size
   Cyclomatic Complexity 1 include/linux/list.h:__list_add_valid
   Cyclomatic Complexity 1 include/linux/list.h:__list_del_entry_valid
   Cyclomatic Complexity 2 include/linux/list.h:__list_add
   Cyclomatic Complexity 1 include/linux/list.h:list_add_tail
   Cyclomatic Complexity 1 include/linux/list.h:__list_del
   Cyclomatic Complexity 2 include/linux/list.h:__list_del_entry
   Cyclomatic Complexity 1 include/linux/list.h:list_del
   Cyclomatic Complexity 1 include/linux/err.h:ERR_PTR
   Cyclomatic Complexity 1 include/linux/err.h:PTR_ERR
   Cyclomatic Complexity 1 include/linux/err.h:IS_ERR
   Cyclomatic Complexity 1 include/linux/err.h:ERR_CAST
   Cyclomatic Complexity 2 include/linux/err.h:PTR_ERR_OR_ZERO
   Cyclomatic Complexity 1 include/linux/module.h:try_module_get
   Cyclomatic Complexity 1 include/linux/module.h:module_put
   Cyclomatic Complexity 3 include/linux/configfs.h:to_config_group
   Cyclomatic Complexity 2 include/linux/iio/sw_trigger.h:to_iio_sw_trigger
   Cyclomatic Complexity 1 drivers/iio/industrialio-sw-trigger.c:iio_sw_trigger_init
   Cyclomatic Complexity 5 drivers/iio/industrialio-sw-trigger.c:__iio_find_sw_trigger_type
   Cyclomatic Complexity 3 drivers/iio/industrialio-sw-trigger.c:iio_get_sw_trigger_type
   Cyclomatic Complexity 1 drivers/iio/industrialio-sw-trigger.c:iio_sw_trigger_exit
   Cyclomatic Complexity 4 drivers/iio/industrialio-sw-trigger.c:iio_register_sw_trigger_type
   Cyclomatic Complexity 2 drivers/iio/industrialio-sw-trigger.c:iio_unregister_sw_trigger_type
   Cyclomatic Complexity 3 drivers/iio/industrialio-sw-trigger.c:iio_sw_trigger_create
   Cyclomatic Complexity 2 drivers/iio/industrialio-sw-trigger.c:trigger_make_group
   Cyclomatic Complexity 1 drivers/iio/industrialio-sw-trigger.c:iio_sw_trigger_destroy
   Cyclomatic Complexity 1 drivers/iio/industrialio-sw-trigger.c:trigger_drop_group

vim +/const +28 drivers/iio/industrialio-configfs.c

8261d961 Daniel Baluta 2015-11-09  23  
8261d961 Daniel Baluta 2015-11-09  24  struct configfs_subsystem iio_configfs_subsys = {
8261d961 Daniel Baluta 2015-11-09  25  	.su_group = {
8261d961 Daniel Baluta 2015-11-09  26  		.cg_item = {
8261d961 Daniel Baluta 2015-11-09  27  			.ci_namebuf = "iio",
8261d961 Daniel Baluta 2015-11-09 @28  			.ci_type = &iio_root_group_type,
8261d961 Daniel Baluta 2015-11-09  29  		},
8261d961 Daniel Baluta 2015-11-09  30  	},
8261d961 Daniel Baluta 2015-11-09  31  	.su_mutex = __MUTEX_INITIALIZER(iio_configfs_subsys.su_mutex),
8261d961 Daniel Baluta 2015-11-09  32  };
8261d961 Daniel Baluta 2015-11-09  33  EXPORT_SYMBOL(iio_configfs_subsys);
8261d961 Daniel Baluta 2015-11-09  34  

:::::: The code at line 28 was first introduced by commit
:::::: 8261d961d1f397925d7a470864c14663d01ed714 iio: core: Introduce IIO configfs support

:::::: TO: Daniel Baluta <daniel.baluta@intel.com>
:::::: CC: Jonathan Cameron <jic23@kernel.org>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
Jonathan Cameron Oct. 14, 2017, 6:19 p.m. UTC | #3
On Thu, 12 Oct 2017 17:05:55 +0200
Bhumika Goyal <bhumirks@gmail.com> wrote:

> On Thu, Oct 12, 2017 at 11:41 AM, Bhumika Goyal <bhumirks@gmail.com> wrote:
> > This is a followup patch for:
> > https://lkml.org/lkml/2017/10/11/375

One quick suggestion - don't use lkml as an archive - it's frequently
down from at least some places (is for me now).

> > https://patchwork.kernel.org/patch/9999649/
> > https://lkml.org/lkml/2017/10/11/469 and
> > https://lkml.org/lkml/2017/10/11/661
> >
> > Make the config_item_type structures const as they are either passed to
> > the functions having the argument as const (link 2,3,4) or they are
> > stored in the const "ci_type" field of a config_item structure (link 1).
> >
> > Done using Coccinelle.
> >  
> 
> Actually, this patch is dependent on the links given in the patch.
> Therefore, this patch
> won't be correct unless the patches in these links gets applied.

Hmm.. This is going to take a while to apply then as we'll have
to wait for those changes to get into my upstream tree, or we
have to agree this goes through the same tree as those.

Best bet may be to resend after the next merge window - or
put together a single patch set with all the dependencies and
the patches using them then someone appropriate can make
an immutable branch from them for the various trees to pull in.

Which route you take is up to you.  Good work in general
though these large cross tree tidy ups can take a while
to get in place!

Jonathan

> 
> > Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
> > ---
> >  drivers/iio/dummy/iio_simple_dummy.c   | 2 +-
> >  drivers/iio/industrialio-configfs.c    | 2 +-
> >  drivers/iio/industrialio-sw-device.c   | 6 +++---
> >  drivers/iio/industrialio-sw-trigger.c  | 6 +++---
> >  drivers/iio/trigger/iio-trig-hrtimer.c | 2 +-
> >  drivers/iio/trigger/iio-trig-loop.c    | 2 +-
> >  6 files changed, 10 insertions(+), 10 deletions(-)
> >
> > diff --git a/drivers/iio/dummy/iio_simple_dummy.c b/drivers/iio/dummy/iio_simple_dummy.c
> > index a45d01e..6205247 100644
> > --- a/drivers/iio/dummy/iio_simple_dummy.c
> > +++ b/drivers/iio/dummy/iio_simple_dummy.c
> > @@ -26,7 +26,7 @@
> >  #include <linux/iio/sw_device.h>
> >  #include "iio_simple_dummy.h"
> >
> > -static struct config_item_type iio_dummy_type = {
> > +static const struct config_item_type iio_dummy_type = {
> >         .ct_owner = THIS_MODULE,
> >  };
> >
> > diff --git a/drivers/iio/industrialio-configfs.c b/drivers/iio/industrialio-configfs.c
> > index 45ce2bc..5a0aae1 100644
> > --- a/drivers/iio/industrialio-configfs.c
> > +++ b/drivers/iio/industrialio-configfs.c
> > @@ -17,7 +17,7 @@
> >  #include <linux/iio/iio.h>
> >  #include <linux/iio/configfs.h>
> >
> > -static struct config_item_type iio_root_group_type = {
> > +static const struct config_item_type iio_root_group_type = {
> >         .ct_owner       = THIS_MODULE,
> >  };
> >
> > diff --git a/drivers/iio/industrialio-sw-device.c b/drivers/iio/industrialio-sw-device.c
> > index 81b49cf..90df97c 100644
> > --- a/drivers/iio/industrialio-sw-device.c
> > +++ b/drivers/iio/industrialio-sw-device.c
> > @@ -19,9 +19,9 @@
> >  #include <linux/configfs.h>
> >
> >  static struct config_group *iio_devices_group;
> > -static struct config_item_type iio_device_type_group_type;
> > +static const struct config_item_type iio_device_type_group_type;
> >
> > -static struct config_item_type iio_devices_group_type = {
> > +static const struct config_item_type iio_devices_group_type = {
> >         .ct_owner = THIS_MODULE,
> >  };
> >
> > @@ -156,7 +156,7 @@ static void device_drop_group(struct config_group *group,
> >         .drop_item      = &device_drop_group,
> >  };
> >
> > -static struct config_item_type iio_device_type_group_type = {
> > +static const struct config_item_type iio_device_type_group_type = {
> >         .ct_group_ops = &device_ops,
> >         .ct_owner       = THIS_MODULE,
> >  };
> > diff --git a/drivers/iio/industrialio-sw-trigger.c b/drivers/iio/industrialio-sw-trigger.c
> > index 8d24fb1..bc6b7fb 100644
> > --- a/drivers/iio/industrialio-sw-trigger.c
> > +++ b/drivers/iio/industrialio-sw-trigger.c
> > @@ -19,9 +19,9 @@
> >  #include <linux/configfs.h>
> >
> >  static struct config_group *iio_triggers_group;
> > -static struct config_item_type iio_trigger_type_group_type;
> > +static const struct config_item_type iio_trigger_type_group_type;
> >
> > -static struct config_item_type iio_triggers_group_type = {
> > +static const struct config_item_type iio_triggers_group_type = {
> >         .ct_owner = THIS_MODULE,
> >  };
> >
> > @@ -156,7 +156,7 @@ static void trigger_drop_group(struct config_group *group,
> >         .drop_item      = &trigger_drop_group,
> >  };
> >
> > -static struct config_item_type iio_trigger_type_group_type = {
> > +static const struct config_item_type iio_trigger_type_group_type = {
> >         .ct_group_ops = &trigger_ops,
> >         .ct_owner       = THIS_MODULE,
> >  };
> > diff --git a/drivers/iio/trigger/iio-trig-hrtimer.c b/drivers/iio/trigger/iio-trig-hrtimer.c
> > index 3ee9216..7accd01 100644
> > --- a/drivers/iio/trigger/iio-trig-hrtimer.c
> > +++ b/drivers/iio/trigger/iio-trig-hrtimer.c
> > @@ -30,7 +30,7 @@ struct iio_hrtimer_info {
> >         ktime_t period;
> >  };
> >
> > -static struct config_item_type iio_hrtimer_type = {
> > +static const struct config_item_type iio_hrtimer_type = {
> >         .ct_owner = THIS_MODULE,
> >  };
> >
> > diff --git a/drivers/iio/trigger/iio-trig-loop.c b/drivers/iio/trigger/iio-trig-loop.c
> > index b4b02db..94a90e0 100644
> > --- a/drivers/iio/trigger/iio-trig-loop.c
> > +++ b/drivers/iio/trigger/iio-trig-loop.c
> > @@ -36,7 +36,7 @@ struct iio_loop_info {
> >         struct task_struct *task;
> >  };
> >
> > -static struct config_item_type iio_loop_type = {
> > +static const struct config_item_type iio_loop_type = {
> >         .ct_owner = THIS_MODULE,
> >  };
> >
> > --
> > 1.9.1
> >  

--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/iio/dummy/iio_simple_dummy.c b/drivers/iio/dummy/iio_simple_dummy.c
index a45d01e..6205247 100644
--- a/drivers/iio/dummy/iio_simple_dummy.c
+++ b/drivers/iio/dummy/iio_simple_dummy.c
@@ -26,7 +26,7 @@ 
 #include <linux/iio/sw_device.h>
 #include "iio_simple_dummy.h"
 
-static struct config_item_type iio_dummy_type = {
+static const struct config_item_type iio_dummy_type = {
 	.ct_owner = THIS_MODULE,
 };
 
diff --git a/drivers/iio/industrialio-configfs.c b/drivers/iio/industrialio-configfs.c
index 45ce2bc..5a0aae1 100644
--- a/drivers/iio/industrialio-configfs.c
+++ b/drivers/iio/industrialio-configfs.c
@@ -17,7 +17,7 @@ 
 #include <linux/iio/iio.h>
 #include <linux/iio/configfs.h>
 
-static struct config_item_type iio_root_group_type = {
+static const struct config_item_type iio_root_group_type = {
 	.ct_owner       = THIS_MODULE,
 };
 
diff --git a/drivers/iio/industrialio-sw-device.c b/drivers/iio/industrialio-sw-device.c
index 81b49cf..90df97c 100644
--- a/drivers/iio/industrialio-sw-device.c
+++ b/drivers/iio/industrialio-sw-device.c
@@ -19,9 +19,9 @@ 
 #include <linux/configfs.h>
 
 static struct config_group *iio_devices_group;
-static struct config_item_type iio_device_type_group_type;
+static const struct config_item_type iio_device_type_group_type;
 
-static struct config_item_type iio_devices_group_type = {
+static const struct config_item_type iio_devices_group_type = {
 	.ct_owner = THIS_MODULE,
 };
 
@@ -156,7 +156,7 @@  static void device_drop_group(struct config_group *group,
 	.drop_item	= &device_drop_group,
 };
 
-static struct config_item_type iio_device_type_group_type = {
+static const struct config_item_type iio_device_type_group_type = {
 	.ct_group_ops = &device_ops,
 	.ct_owner       = THIS_MODULE,
 };
diff --git a/drivers/iio/industrialio-sw-trigger.c b/drivers/iio/industrialio-sw-trigger.c
index 8d24fb1..bc6b7fb 100644
--- a/drivers/iio/industrialio-sw-trigger.c
+++ b/drivers/iio/industrialio-sw-trigger.c
@@ -19,9 +19,9 @@ 
 #include <linux/configfs.h>
 
 static struct config_group *iio_triggers_group;
-static struct config_item_type iio_trigger_type_group_type;
+static const struct config_item_type iio_trigger_type_group_type;
 
-static struct config_item_type iio_triggers_group_type = {
+static const struct config_item_type iio_triggers_group_type = {
 	.ct_owner = THIS_MODULE,
 };
 
@@ -156,7 +156,7 @@  static void trigger_drop_group(struct config_group *group,
 	.drop_item	= &trigger_drop_group,
 };
 
-static struct config_item_type iio_trigger_type_group_type = {
+static const struct config_item_type iio_trigger_type_group_type = {
 	.ct_group_ops = &trigger_ops,
 	.ct_owner       = THIS_MODULE,
 };
diff --git a/drivers/iio/trigger/iio-trig-hrtimer.c b/drivers/iio/trigger/iio-trig-hrtimer.c
index 3ee9216..7accd01 100644
--- a/drivers/iio/trigger/iio-trig-hrtimer.c
+++ b/drivers/iio/trigger/iio-trig-hrtimer.c
@@ -30,7 +30,7 @@  struct iio_hrtimer_info {
 	ktime_t period;
 };
 
-static struct config_item_type iio_hrtimer_type = {
+static const struct config_item_type iio_hrtimer_type = {
 	.ct_owner = THIS_MODULE,
 };
 
diff --git a/drivers/iio/trigger/iio-trig-loop.c b/drivers/iio/trigger/iio-trig-loop.c
index b4b02db..94a90e0 100644
--- a/drivers/iio/trigger/iio-trig-loop.c
+++ b/drivers/iio/trigger/iio-trig-loop.c
@@ -36,7 +36,7 @@  struct iio_loop_info {
 	struct task_struct *task;
 };
 
-static struct config_item_type iio_loop_type = {
+static const struct config_item_type iio_loop_type = {
 	.ct_owner = THIS_MODULE,
 };