iio: make function argument and some structures const
authorBhumika Goyal <bhumirks@gmail.com>
Mon, 16 Oct 2017 15:18:43 +0000 (17:18 +0200)
committerChristoph Hellwig <hch@lst.de>
Thu, 19 Oct 2017 14:15:24 +0000 (16:15 +0200)
Make the argument of the functions iio_sw{d/t}_group_init_type_name const
as they are only passed to the function config_group_init_type_name having
the argument as const.

Make the config_item_type structures const as they are either passed to
the functions having the argument as const or they are
stored in the const "ci_type" field of a config_item structure.

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Acked-by: Jonathan Cameron <Jonathan.Cameron@Huawei.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
drivers/iio/dummy/iio_simple_dummy.c
drivers/iio/industrialio-configfs.c
drivers/iio/industrialio-sw-device.c
drivers/iio/industrialio-sw-trigger.c
drivers/iio/trigger/iio-trig-hrtimer.c
drivers/iio/trigger/iio-trig-loop.c
include/linux/iio/sw_device.h
include/linux/iio/sw_trigger.h

index ad3410e528b68fbc2cc281983da4a19921fa401b..e177a0862b2b70178bb0e4adde53d34d177d9293 100644 (file)
@@ -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,
 };
 
index 45ce2bc47180286c7c3b6ef9f50fb0c72ff7631e..5a0aae119369b301062d4a7419f86a5be2e9fe00 100644 (file)
@@ -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,
 };
 
index 81b49cfca452eaf27bf26959e9d10f4b81a807fb..90df97c542f6cb690b81ab46e1f3d2a4093f0be6 100644 (file)
@@ -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 struct configfs_group_operations device_ops = {
        .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,
 };
index 8d24fb159cc92504c16938529542c117bd38000d..bc6b7fb43e3a1987db513b1ecad456b4fa9edd04 100644 (file)
@@ -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 struct configfs_group_operations trigger_ops = {
        .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,
 };
index a1cad6cc2e0ff1bc70ca99d8d315eccdd5acb7d3..ce7d120b348e456e31279bd24034254cd4812843 100644 (file)
@@ -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,
 };
 
index dc6be28f96fe62ef6374404ac633c578a848b0eb..745a01f04a278b489c4576fdb19212e223b349e4 100644 (file)
@@ -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,
 };
 
index fa7931933067982b2bac57f4c73aac039db8f692..8642b91a7577e3c444aaadda9cf85acd7b391a69 100644 (file)
@@ -60,7 +60,7 @@ void iio_sw_device_type_configfs_unregister(struct iio_sw_device_type *dt);
 static inline
 void iio_swd_group_init_type_name(struct iio_sw_device *d,
                                  const char *name,
-                                 struct config_item_type *type)
+                                 const struct config_item_type *type)
 {
 #if IS_ENABLED(CONFIG_CONFIGFS_FS)
        config_group_init_type_name(&d->group, name, type);
index c97eab67558f6c33877217d7f0a22df6e2bbdcca..0c43738a9e24fea62cf4f9eccfb5dbf2790c6a76 100644 (file)
@@ -60,7 +60,7 @@ void iio_sw_trigger_type_configfs_unregister(struct iio_sw_trigger_type *tt);
 static inline
 void iio_swt_group_init_type_name(struct iio_sw_trigger *t,
                                  const char *name,
-                                 struct config_item_type *type)
+                                 const struct config_item_type *type)
 {
 #if IS_ENABLED(CONFIG_CONFIGFS_FS)
        config_group_init_type_name(&t->group, name, type);