constify struct sysfs_ops (against -mm)
Subsystems (8)
PATCH 3/3 constify struct sysfs_ops (against -mm)
.. as again all consumers of it don't require it to be modifiable.
As before, the patch doesn't change all instances where 'const' could have been added as a result of the base structure changes, only where either the change has a real effect (the module loader doesn't enforce read-only section attributes at present, so only built-in files matter) or where compiler warnings would result otherwise.
Signed-off-by Jan Beulich <[email protected]>
Cc Tony Luck <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Jens Axboe <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
--- Documentation/kobject.txt | 2 +- arch/ia64/kernel/topology.c | 2 +- arch/x86/kernel/cpu/intel_cacheinfo.c | 2 +- arch/x86/kernel/cpu/mcheck/mce_amd_64.c | 2 +- block/elevator.c | 2 +- block/ll_rw_blk.c | 2 +- drivers/base/bus.c | 4 ++-- drivers/base/class.c | 4 ++-- drivers/base/core.c | 2 +- drivers/base/sys.c | 4 ++-- drivers/cpufreq/cpufreq.c | 2 +- drivers/cpuidle/sysfs.c | 4 ++-- fs/sysfs/file.c | 8 ++++---- include/linux/kobject.h | 2 +- kernel/params.c | 2 +- mm/slub.c | 2 +- 16 files changed, 23 insertions(+), 23 deletions(-)
Documentation/kobject.txt +1 -1
@@ -262,7 +262,7 @@ kobj_type: struct kobj_type { void (*release)(struct kobject *); - struct sysfs_ops *sysfs_ops; + const struct sysfs_ops *sysfs_ops; struct attribute *const *default_attrs; };
arch/ia64/kernel/topology.c +1 -1
@@ -267,7 +267,7 @@ static ssize_t cache_show(struct kobjectreturn ret; } -static struct sysfs_ops cache_sysfs_ops = { +static const struct sysfs_ops cache_sysfs_ops = { .show = cache_show };
arch/x86/kernel/cpu/intel_cacheinfo.c +1 -1
@@ -668,7 +668,7 @@ static ssize_t store(struct kobject * koreturn 0 ; } -static struct sysfs_ops sysfs_ops = { +static const struct sysfs_ops sysfs_ops = { .show = show, .store = store, };
arch/x86/kernel/cpu/mcheck/mce_amd_64.c +1 -1
@@ -377,7 +377,7 @@ static ssize_t store(struct kobject *kobreturn ret; } -static struct sysfs_ops threshold_ops = { +static const struct sysfs_ops threshold_ops = { .show = show, .store = store, };
block/elevator.c +1 -1
@@ -914,7 +914,7 @@ elv_attr_store(struct kobject *kobj, strreturn error; } -static struct sysfs_ops elv_sysfs_ops = { +static const struct sysfs_ops elv_sysfs_ops = { .show = elv_attr_show, .store = elv_attr_store, };
block/ll_rw_blk.c +1 -1
@@ -4184,7 +4184,7 @@ queue_attr_store(struct kobject *kobj, sreturn res; } -static struct sysfs_ops queue_sysfs_ops = { +static const struct sysfs_ops queue_sysfs_ops = { .show = queue_attr_show, .store = queue_attr_store, };
drivers/base/bus.c +2 -2
@@ -71,7 +71,7 @@ drv_attr_store(struct kobject * kobj, streturn ret; } -static struct sysfs_ops driver_sysfs_ops = { +static const struct sysfs_ops driver_sysfs_ops = { .show = drv_attr_show, .store = drv_attr_store, };
@@ -120,7 +120,7 @@ bus_attr_store(struct kobject * kobj, streturn ret; } -static struct sysfs_ops bus_sysfs_ops = { +static const struct sysfs_ops bus_sysfs_ops = { .show = bus_attr_show, .store = bus_attr_store, };
drivers/base/class.c +2 -2
@@ -61,7 +61,7 @@ static void class_release(struct kobject "be careful\n", class->name); } -static struct sysfs_ops class_sysfs_ops = { +static const struct sysfs_ops class_sysfs_ops = { .show = class_attr_show, .store = class_attr_store, };
@@ -307,7 +307,7 @@ class_device_attr_store(struct kobject *return ret; } -static struct sysfs_ops class_dev_sysfs_ops = { +static const struct sysfs_ops class_dev_sysfs_ops = { .show = class_device_attr_show, .store = class_device_attr_store, };
drivers/base/core.c +1 -1
@@ -76,7 +76,7 @@ dev_attr_store(struct kobject * kobj, streturn ret; } -static struct sysfs_ops dev_sysfs_ops = { +static const struct sysfs_ops dev_sysfs_ops = { .show = dev_attr_show, .store = dev_attr_store, };
drivers/base/sys.c +2 -2
@@ -53,7 +53,7 @@ sysdev_store(struct kobject * kobj, strureturn -EIO ; } -static struct sysfs_ops sysfs_ops = { +static const struct sysfs_ops sysfs_ops = { .show = sysdev_show, .store = sysdev_store, };
@@ -103,7 +103,7 @@ static ssize_t sysdev_class_store(structreturn -EIO ; } -static struct sysfs_ops sysfs_class_ops = { +static const struct sysfs_ops sysfs_class_ops = { .show = sysdev_class_show, .store = sysdev_class_store, };
drivers/cpufreq/cpufreq.c +1 -1
@@ -725,7 +725,7 @@ static void cpufreq_sysfs_release(structcomplete (&policy->kobj_unregister); } -static struct sysfs_ops sysfs_ops = { +static const struct sysfs_ops sysfs_ops = { .show = show, .store = store, };
drivers/cpuidle/sysfs.c +2 -2
@@ -186,7 +186,7 @@ static ssize_t cpuidle_store(struct kobjreturn ret; } -static struct sysfs_ops cpuidle_sysfs_ops = { +static const struct sysfs_ops cpuidle_sysfs_ops = { .show = cpuidle_show, .store = cpuidle_store, };
@@ -258,7 +258,7 @@ static ssize_t cpuidle_state_show(structreturn ret; } -static struct sysfs_ops cpuidle_state_sysfs_ops = { +static const struct sysfs_ops cpuidle_state_sysfs_ops = { .show = cpuidle_state_show, };
fs/sysfs/file.c +4 -4
@@ -50,7 +50,7 @@ struct sysfs_buffer {size_t count;loff_t pos;char * page; -struct sysfs_ops * ops; +const struct sysfs_ops * ops;struct mutex mutex;int needs_read_fill;int event;
@@ -72,7 +72,7 @@ static int fill_read_buffer(struct dentr {struct sysfs_dirent *attr_sd = dentry->d_fsdata;struct kobject *kobj = attr_sd->s_parent->s_dir.kobj; -struct sysfs_ops * ops = buffer->ops; +const struct sysfs_ops * ops = buffer->ops;int ret =0 ;ssize_t count;
@@ -191,7 +191,7 @@ flush_write_buffer(struct dentry * dentr {struct sysfs_dirent *attr_sd = dentry->d_fsdata;struct kobject *kobj = attr_sd->s_parent->s_dir.kobj; -struct sysfs_ops * ops = buffer->ops; +const struct sysfs_ops * ops = buffer->ops;int rc;/* need attr_sd for attr and ops, its parent for kobj */
@@ -326,7 +326,7 @@ static int sysfs_open_file(struct inodestruct sysfs_dirent *attr_sd = file->f_path.dentry->d_fsdata;struct kobject *kobj = attr_sd->s_parent->s_dir.kobj;struct sysfs_buffer *buffer; -struct sysfs_ops *ops; +const struct sysfs_ops *ops;int error = -EACCES ;char *p;
include/linux/kobject.h +1 -1
@@ -107,7 +107,7 @@ extern char * kobject_get_path(struct kostruct kobj_type {void (*release)(struct kobject *); -struct sysfs_ops * sysfs_ops; +const struct sysfs_ops *sysfs_ops;struct attribute *const *default_attrs; };
kernel/params.c +1 -1
@@ -672,7 +672,7 @@ static ssize_t module_attr_store(structreturn ret; } -static struct sysfs_ops module_sysfs_ops = { +static const struct sysfs_ops module_sysfs_ops = { .show = module_attr_show, .store = module_attr_store, };
mm/slub.c +1 -1
@@ -4114,7 +4114,7 @@ static ssize_t slab_attr_store(struct koreturn err; } -static struct sysfs_ops slab_sysfs_ops = { +static const struct sysfs_ops slab_sysfs_ops = { .show = slab_attr_show, .store = slab_attr_store, };