diff options
author | Emese Revfy <re.emese@gmail.com> | 2010-01-18 20:58:23 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-03-07 20:04:49 -0500 |
commit | 52cf25d0ab7f78eeecc59ac652ed5090f69b619e (patch) | |
tree | 031d1ffb3890bd69c0260c864c512e0be62ac05c /arch | |
parent | 6c1733aca0b48db4d0e660d54976a1cca25b5eaf (diff) |
Driver core: Constify struct sysfs_ops in struct kobj_type
Constify struct sysfs_ops.
This is part of the ops structure constification
effort started by Arjan van de Ven et al.
Benefits of this constification:
* prevents modification of data that is shared
(referenced) by many other structure instances
at runtime
* detects/prevents accidental (but not intentional)
modification attempts on archs that enforce
read-only kernel data at runtime
* potentially better optimized code as the compiler
can assume that the const data cannot be changed
* the compiler/linker move const data into .rodata
and therefore exclude them from false sharing
Signed-off-by: Emese Revfy <re.emese@gmail.com>
Acked-by: David Teigland <teigland@redhat.com>
Acked-by: Matt Domsch <Matt_Domsch@dell.com>
Acked-by: Maciej Sosnowski <maciej.sosnowski@intel.com>
Acked-by: Hans J. Koch <hjk@linutronix.de>
Acked-by: Pekka Enberg <penberg@cs.helsinki.fi>
Acked-by: Jens Axboe <jens.axboe@oracle.com>
Acked-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/ia64/kernel/topology.c | 2 | ||||
-rw-r--r-- | arch/powerpc/kernel/cacheinfo.c | 2 | ||||
-rw-r--r-- | arch/sh/kernel/cpu/sh4/sq.c | 2 | ||||
-rw-r--r-- | arch/x86/kernel/cpu/intel_cacheinfo.c | 2 | ||||
-rw-r--r-- | arch/x86/kernel/cpu/mcheck/mce_amd.c | 2 |
5 files changed, 5 insertions, 5 deletions
diff --git a/arch/ia64/kernel/topology.c b/arch/ia64/kernel/topology.c index 8f060352e129..b3a5818088d9 100644 --- a/arch/ia64/kernel/topology.c +++ b/arch/ia64/kernel/topology.c | |||
@@ -282,7 +282,7 @@ static ssize_t cache_show(struct kobject * kobj, struct attribute * attr, char * | |||
282 | return ret; | 282 | return ret; |
283 | } | 283 | } |
284 | 284 | ||
285 | static struct sysfs_ops cache_sysfs_ops = { | 285 | static const struct sysfs_ops cache_sysfs_ops = { |
286 | .show = cache_show | 286 | .show = cache_show |
287 | }; | 287 | }; |
288 | 288 | ||
diff --git a/arch/powerpc/kernel/cacheinfo.c b/arch/powerpc/kernel/cacheinfo.c index bb37b1d19a58..01fe9ce28379 100644 --- a/arch/powerpc/kernel/cacheinfo.c +++ b/arch/powerpc/kernel/cacheinfo.c | |||
@@ -642,7 +642,7 @@ static struct kobj_attribute *cache_index_opt_attrs[] = { | |||
642 | &cache_assoc_attr, | 642 | &cache_assoc_attr, |
643 | }; | 643 | }; |
644 | 644 | ||
645 | static struct sysfs_ops cache_index_ops = { | 645 | static const struct sysfs_ops cache_index_ops = { |
646 | .show = cache_index_show, | 646 | .show = cache_index_show, |
647 | }; | 647 | }; |
648 | 648 | ||
diff --git a/arch/sh/kernel/cpu/sh4/sq.c b/arch/sh/kernel/cpu/sh4/sq.c index fc065f9da6e5..14726eef1ce0 100644 --- a/arch/sh/kernel/cpu/sh4/sq.c +++ b/arch/sh/kernel/cpu/sh4/sq.c | |||
@@ -326,7 +326,7 @@ static struct attribute *sq_sysfs_attrs[] = { | |||
326 | NULL, | 326 | NULL, |
327 | }; | 327 | }; |
328 | 328 | ||
329 | static struct sysfs_ops sq_sysfs_ops = { | 329 | static const struct sysfs_ops sq_sysfs_ops = { |
330 | .show = sq_sysfs_show, | 330 | .show = sq_sysfs_show, |
331 | .store = sq_sysfs_store, | 331 | .store = sq_sysfs_store, |
332 | }; | 332 | }; |
diff --git a/arch/x86/kernel/cpu/intel_cacheinfo.c b/arch/x86/kernel/cpu/intel_cacheinfo.c index eddb1bdd1b8f..b3eeb66c0a51 100644 --- a/arch/x86/kernel/cpu/intel_cacheinfo.c +++ b/arch/x86/kernel/cpu/intel_cacheinfo.c | |||
@@ -903,7 +903,7 @@ static ssize_t store(struct kobject *kobj, struct attribute *attr, | |||
903 | return ret; | 903 | return ret; |
904 | } | 904 | } |
905 | 905 | ||
906 | static struct sysfs_ops sysfs_ops = { | 906 | static const struct sysfs_ops sysfs_ops = { |
907 | .show = show, | 907 | .show = show, |
908 | .store = store, | 908 | .store = store, |
909 | }; | 909 | }; |
diff --git a/arch/x86/kernel/cpu/mcheck/mce_amd.c b/arch/x86/kernel/cpu/mcheck/mce_amd.c index 83a3d1f4efca..cda932ca3ade 100644 --- a/arch/x86/kernel/cpu/mcheck/mce_amd.c +++ b/arch/x86/kernel/cpu/mcheck/mce_amd.c | |||
@@ -388,7 +388,7 @@ static ssize_t store(struct kobject *kobj, struct attribute *attr, | |||
388 | return ret; | 388 | return ret; |
389 | } | 389 | } |
390 | 390 | ||
391 | static struct sysfs_ops threshold_ops = { | 391 | static const struct sysfs_ops threshold_ops = { |
392 | .show = show, | 392 | .show = show, |
393 | .store = store, | 393 | .store = store, |
394 | }; | 394 | }; |