aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEmese Revfy2010-01-18 19:58:23 -0600
committerGreg Kroah-Hartman2010-03-07 19:04:49 -0600
commit52cf25d0ab7f78eeecc59ac652ed5090f69b619e (patch)
tree031d1ffb3890bd69c0260c864c512e0be62ac05c
parent6c1733aca0b48db4d0e660d54976a1cca25b5eaf (diff)
downloadkernel-common-52cf25d0ab7f78eeecc59ac652ed5090f69b619e.tar.gz
kernel-common-52cf25d0ab7f78eeecc59ac652ed5090f69b619e.tar.xz
kernel-common-52cf25d0ab7f78eeecc59ac652ed5090f69b619e.zip
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>
-rw-r--r--Documentation/kobject.txt2
-rw-r--r--arch/ia64/kernel/topology.c2
-rw-r--r--arch/powerpc/kernel/cacheinfo.c2
-rw-r--r--arch/sh/kernel/cpu/sh4/sq.c2
-rw-r--r--arch/x86/kernel/cpu/intel_cacheinfo.c2
-rw-r--r--arch/x86/kernel/cpu/mcheck/mce_amd.c2
-rw-r--r--block/blk-integrity.c2
-rw-r--r--block/blk-sysfs.c2
-rw-r--r--block/elevator.c2
-rw-r--r--drivers/base/bus.c4
-rw-r--r--drivers/base/class.c2
-rw-r--r--drivers/base/core.c2
-rw-r--r--drivers/base/sys.c4
-rw-r--r--drivers/block/pktcdvd.c2
-rw-r--r--drivers/cpufreq/cpufreq.c2
-rw-r--r--drivers/cpuidle/sysfs.c4
-rw-r--r--drivers/dma/ioat/dma.c2
-rw-r--r--drivers/dma/ioat/dma.h2
-rw-r--r--drivers/edac/edac_device_sysfs.c6
-rw-r--r--drivers/edac/edac_mc_sysfs.c4
-rw-r--r--drivers/edac/edac_pci_sysfs.c4
-rw-r--r--drivers/firmware/edd.c2
-rw-r--r--drivers/firmware/efivars.c2
-rw-r--r--drivers/firmware/iscsi_ibft.c2
-rw-r--r--drivers/firmware/memmap.c2
-rw-r--r--drivers/gpu/drm/ttm/ttm_bo.c2
-rw-r--r--drivers/gpu/drm/ttm/ttm_memory.c2
-rw-r--r--drivers/infiniband/core/cm.c2
-rw-r--r--drivers/infiniband/core/sysfs.c2
-rw-r--r--drivers/md/dm-sysfs.c2
-rw-r--r--drivers/md/md.c4
-rw-r--r--drivers/net/ibmveth.c2
-rw-r--r--drivers/net/iseries_veth.c4
-rw-r--r--drivers/parisc/pdc_stable.c2
-rw-r--r--drivers/pci/hotplug/fakephp.c2
-rw-r--r--drivers/pci/slot.c2
-rw-r--r--drivers/uio/uio.c4
-rw-r--r--drivers/uwb/wlp/sysfs.c3
-rw-r--r--drivers/video/omap2/dss/manager.c2
-rw-r--r--drivers/video/omap2/dss/overlay.c2
-rw-r--r--drivers/xen/sys-hypervisor.c2
-rw-r--r--fs/btrfs/sysfs.c4
-rw-r--r--fs/dlm/lockspace.c2
-rw-r--r--fs/ext4/super.c2
-rw-r--r--fs/gfs2/sys.c2
-rw-r--r--fs/ocfs2/cluster/masklog.c2
-rw-r--r--fs/sysfs/file.c8
-rw-r--r--include/linux/kobject.h4
-rw-r--r--kernel/params.c2
-rw-r--r--lib/kobject.c2
-rw-r--r--mm/slub.c2
-rw-r--r--net/bridge/br_private.h2
-rw-r--r--net/bridge/br_sysfs_if.c2
-rw-r--r--samples/kobject/kset-example.c2
54 files changed, 69 insertions, 70 deletions
diff --git a/Documentation/kobject.txt b/Documentation/kobject.txt
index c79ab996dad..bdb13817e1e 100644
--- a/Documentation/kobject.txt
+++ b/Documentation/kobject.txt
@@ -266,7 +266,7 @@ kobj_type:
266 266
267 struct kobj_type { 267 struct kobj_type {
268 void (*release)(struct kobject *); 268 void (*release)(struct kobject *);
269 struct sysfs_ops *sysfs_ops; 269 const struct sysfs_ops *sysfs_ops;
270 struct attribute **default_attrs; 270 struct attribute **default_attrs;
271 }; 271 };
272 272
diff --git a/arch/ia64/kernel/topology.c b/arch/ia64/kernel/topology.c
index 8f060352e12..b3a5818088d 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
285static struct sysfs_ops cache_sysfs_ops = { 285static 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 bb37b1d19a5..01fe9ce2837 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
645static struct sysfs_ops cache_index_ops = { 645static 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 fc065f9da6e..14726eef1ce 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
329static struct sysfs_ops sq_sysfs_ops = { 329static 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 eddb1bdd1b8..b3eeb66c0a5 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
906static struct sysfs_ops sysfs_ops = { 906static 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 83a3d1f4efc..cda932ca3ad 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
391static struct sysfs_ops threshold_ops = { 391static const struct sysfs_ops threshold_ops = {
392 .show = show, 392 .show = show,
393 .store = store, 393 .store = store,
394}; 394};
diff --git a/block/blk-integrity.c b/block/blk-integrity.c
index 15c630813b1..96e83c2bdb9 100644
--- a/block/blk-integrity.c
+++ b/block/blk-integrity.c
@@ -278,7 +278,7 @@ static struct attribute *integrity_attrs[] = {
278 NULL, 278 NULL,
279}; 279};
280 280
281static struct sysfs_ops integrity_ops = { 281static const struct sysfs_ops integrity_ops = {
282 .show = &integrity_attr_show, 282 .show = &integrity_attr_show,
283 .store = &integrity_attr_store, 283 .store = &integrity_attr_store,
284}; 284};
diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c
index e85442415db..2ae2cb3f362 100644
--- a/block/blk-sysfs.c
+++ b/block/blk-sysfs.c
@@ -450,7 +450,7 @@ static void blk_release_queue(struct kobject *kobj)
450 kmem_cache_free(blk_requestq_cachep, q); 450 kmem_cache_free(blk_requestq_cachep, q);
451} 451}
452 452
453static struct sysfs_ops queue_sysfs_ops = { 453static const struct sysfs_ops queue_sysfs_ops = {
454 .show = queue_attr_show, 454 .show = queue_attr_show,
455 .store = queue_attr_store, 455 .store = queue_attr_store,
456}; 456};
diff --git a/block/elevator.c b/block/elevator.c
index ee3a883840f..df75676f667 100644
--- a/block/elevator.c
+++ b/block/elevator.c
@@ -892,7 +892,7 @@ elv_attr_store(struct kobject *kobj, struct attribute *attr,
892 return error; 892 return error;
893} 893}
894 894
895static struct sysfs_ops elv_sysfs_ops = { 895static const struct sysfs_ops elv_sysfs_ops = {
896 .show = elv_attr_show, 896 .show = elv_attr_show,
897 .store = elv_attr_store, 897 .store = elv_attr_store,
898}; 898};
diff --git a/drivers/base/bus.c b/drivers/base/bus.c
index 2afe599eb35..cca1aa10054 100644
--- a/drivers/base/bus.c
+++ b/drivers/base/bus.c
@@ -70,7 +70,7 @@ static ssize_t drv_attr_store(struct kobject *kobj, struct attribute *attr,
70 return ret; 70 return ret;
71} 71}
72 72
73static struct sysfs_ops driver_sysfs_ops = { 73static const struct sysfs_ops driver_sysfs_ops = {
74 .show = drv_attr_show, 74 .show = drv_attr_show,
75 .store = drv_attr_store, 75 .store = drv_attr_store,
76}; 76};
@@ -115,7 +115,7 @@ static ssize_t bus_attr_store(struct kobject *kobj, struct attribute *attr,
115 return ret; 115 return ret;
116} 116}
117 117
118static struct sysfs_ops bus_sysfs_ops = { 118static const struct sysfs_ops bus_sysfs_ops = {
119 .show = bus_attr_show, 119 .show = bus_attr_show,
120 .store = bus_attr_store, 120 .store = bus_attr_store,
121}; 121};
diff --git a/drivers/base/class.c b/drivers/base/class.c
index 2e297cc4cd3..0147f476b8a 100644
--- a/drivers/base/class.c
+++ b/drivers/base/class.c
@@ -63,7 +63,7 @@ static void class_release(struct kobject *kobj)
63 kfree(cp); 63 kfree(cp);
64} 64}
65 65
66static struct sysfs_ops class_sysfs_ops = { 66static const struct sysfs_ops class_sysfs_ops = {
67 .show = class_attr_show, 67 .show = class_attr_show,
68 .store = class_attr_store, 68 .store = class_attr_store,
69}; 69};
diff --git a/drivers/base/core.c b/drivers/base/core.c
index 58ec1069f4b..b0d6646a281 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -100,7 +100,7 @@ static ssize_t dev_attr_store(struct kobject *kobj, struct attribute *attr,
100 return ret; 100 return ret;
101} 101}
102 102
103static struct sysfs_ops dev_sysfs_ops = { 103static const struct sysfs_ops dev_sysfs_ops = {
104 .show = dev_attr_show, 104 .show = dev_attr_show,
105 .store = dev_attr_store, 105 .store = dev_attr_store,
106}; 106};
diff --git a/drivers/base/sys.c b/drivers/base/sys.c
index 747c99e0568..8980feec5d1 100644
--- a/drivers/base/sys.c
+++ b/drivers/base/sys.c
@@ -54,7 +54,7 @@ sysdev_store(struct kobject *kobj, struct attribute *attr,
54 return -EIO; 54 return -EIO;
55} 55}
56 56
57static struct sysfs_ops sysfs_ops = { 57static const struct sysfs_ops sysfs_ops = {
58 .show = sysdev_show, 58 .show = sysdev_show,
59 .store = sysdev_store, 59 .store = sysdev_store,
60}; 60};
@@ -104,7 +104,7 @@ static ssize_t sysdev_class_store(struct kobject *kobj, struct attribute *attr,
104 return -EIO; 104 return -EIO;
105} 105}
106 106
107static struct sysfs_ops sysfs_class_ops = { 107static const struct sysfs_ops sysfs_class_ops = {
108 .show = sysdev_class_show, 108 .show = sysdev_class_show,
109 .store = sysdev_class_store, 109 .store = sysdev_class_store,
110}; 110};
diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c
index 73d815d3f1b..39c8514442e 100644
--- a/drivers/block/pktcdvd.c
+++ b/drivers/block/pktcdvd.c
@@ -284,7 +284,7 @@ static ssize_t kobj_pkt_store(struct kobject *kobj,
284 return len; 284 return len;
285} 285}
286 286
287static struct sysfs_ops kobj_pkt_ops = { 287static const struct sysfs_ops kobj_pkt_ops = {
288 .show = kobj_pkt_show, 288 .show = kobj_pkt_show,
289 .store = kobj_pkt_store 289 .store = kobj_pkt_store
290}; 290};
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 67bc2ece7b4..2d5d575e889 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -766,7 +766,7 @@ static void cpufreq_sysfs_release(struct kobject *kobj)
766 complete(&policy->kobj_unregister); 766 complete(&policy->kobj_unregister);
767} 767}
768 768
769static struct sysfs_ops sysfs_ops = { 769static const struct sysfs_ops sysfs_ops = {
770 .show = show, 770 .show = show,
771 .store = store, 771 .store = store,
772}; 772};
diff --git a/drivers/cpuidle/sysfs.c b/drivers/cpuidle/sysfs.c
index c9cefacabf3..8719b36e1a4 100644
--- a/drivers/cpuidle/sysfs.c
+++ b/drivers/cpuidle/sysfs.c
@@ -195,7 +195,7 @@ static ssize_t cpuidle_store(struct kobject * kobj, struct attribute * attr,
195 return ret; 195 return ret;
196} 196}
197 197
198static struct sysfs_ops cpuidle_sysfs_ops = { 198static const struct sysfs_ops cpuidle_sysfs_ops = {
199 .show = cpuidle_show, 199 .show = cpuidle_show,
200 .store = cpuidle_store, 200 .store = cpuidle_store,
201}; 201};
@@ -281,7 +281,7 @@ static ssize_t cpuidle_state_show(struct kobject * kobj,
281 return ret; 281 return ret;
282} 282}
283 283
284static struct sysfs_ops cpuidle_state_sysfs_ops = { 284static const struct sysfs_ops cpuidle_state_sysfs_ops = {
285 .show = cpuidle_state_show, 285 .show = cpuidle_state_show,
286}; 286};
287 287
diff --git a/drivers/dma/ioat/dma.c b/drivers/dma/ioat/dma.c
index af14c9a5b8d..0099340b961 100644
--- a/drivers/dma/ioat/dma.c
+++ b/drivers/dma/ioat/dma.c
@@ -1138,7 +1138,7 @@ ioat_attr_show(struct kobject *kobj, struct attribute *attr, char *page)
1138 return entry->show(&chan->common, page); 1138 return entry->show(&chan->common, page);
1139} 1139}
1140 1140
1141struct sysfs_ops ioat_sysfs_ops = { 1141const struct sysfs_ops ioat_sysfs_ops = {
1142 .show = ioat_attr_show, 1142 .show = ioat_attr_show,
1143}; 1143};
1144 1144
diff --git a/drivers/dma/ioat/dma.h b/drivers/dma/ioat/dma.h
index 4f747a25407..86b97ac8774 100644
--- a/drivers/dma/ioat/dma.h
+++ b/drivers/dma/ioat/dma.h
@@ -346,7 +346,7 @@ bool ioat_cleanup_preamble(struct ioat_chan_common *chan,
346 unsigned long *phys_complete); 346 unsigned long *phys_complete);
347void ioat_kobject_add(struct ioatdma_device *device, struct kobj_type *type); 347void ioat_kobject_add(struct ioatdma_device *device, struct kobj_type *type);
348void ioat_kobject_del(struct ioatdma_device *device); 348void ioat_kobject_del(struct ioatdma_device *device);
349extern struct sysfs_ops ioat_sysfs_ops; 349extern const struct sysfs_ops ioat_sysfs_ops;
350extern struct ioat_sysfs_entry ioat_version_attr; 350extern struct ioat_sysfs_entry ioat_version_attr;
351extern struct ioat_sysfs_entry ioat_cap_attr; 351extern struct ioat_sysfs_entry ioat_cap_attr;
352#endif /* IOATDMA_H */ 352#endif /* IOATDMA_H */
diff --git a/drivers/edac/edac_device_sysfs.c b/drivers/edac/edac_device_sysfs.c
index 53764577035..5fdedbc0f54 100644
--- a/drivers/edac/edac_device_sysfs.c
+++ b/drivers/edac/edac_device_sysfs.c
@@ -137,7 +137,7 @@ static ssize_t edac_dev_ctl_info_store(struct kobject *kobj,
137} 137}
138 138
139/* edac_dev file operations for an 'ctl_info' */ 139/* edac_dev file operations for an 'ctl_info' */
140static struct sysfs_ops device_ctl_info_ops = { 140static const struct sysfs_ops device_ctl_info_ops = {
141 .show = edac_dev_ctl_info_show, 141 .show = edac_dev_ctl_info_show,
142 .store = edac_dev_ctl_info_store 142 .store = edac_dev_ctl_info_store
143}; 143};
@@ -373,7 +373,7 @@ static ssize_t edac_dev_instance_store(struct kobject *kobj,
373} 373}
374 374
375/* edac_dev file operations for an 'instance' */ 375/* edac_dev file operations for an 'instance' */
376static struct sysfs_ops device_instance_ops = { 376static const struct sysfs_ops device_instance_ops = {
377 .show = edac_dev_instance_show, 377 .show = edac_dev_instance_show,
378 .store = edac_dev_instance_store 378 .store = edac_dev_instance_store
379}; 379};
@@ -476,7 +476,7 @@ static ssize_t edac_dev_block_store(struct kobject *kobj,
476} 476}
477 477
478/* edac_dev file operations for a 'block' */ 478/* edac_dev file operations for a 'block' */
479static struct sysfs_ops device_block_ops = { 479static const struct sysfs_ops device_block_ops = {
480 .show = edac_dev_block_show, 480 .show = edac_dev_block_show,
481 .store = edac_dev_block_store 481 .store = edac_dev_block_store
482}; 482};
diff --git a/drivers/edac/edac_mc_sysfs.c b/drivers/edac/edac_mc_sysfs.c
index e1d4ce08348..88840e9fa3e 100644
--- a/drivers/edac/edac_mc_sysfs.c
+++ b/drivers/edac/edac_mc_sysfs.c
@@ -245,7 +245,7 @@ static ssize_t csrowdev_store(struct kobject *kobj, struct attribute *attr,
245 return -EIO; 245 return -EIO;
246} 246}
247 247
248static struct sysfs_ops csrowfs_ops = { 248static const struct sysfs_ops csrowfs_ops = {
249 .show = csrowdev_show, 249 .show = csrowdev_show,
250 .store = csrowdev_store 250 .store = csrowdev_store
251}; 251};
@@ -575,7 +575,7 @@ static ssize_t mcidev_store(struct kobject *kobj, struct attribute *attr,
575} 575}
576 576
577/* Intermediate show/store table */ 577/* Intermediate show/store table */
578static struct sysfs_ops mci_ops = { 578static const struct sysfs_ops mci_ops = {
579 .show = mcidev_show, 579 .show = mcidev_show,
580 .store = mcidev_store 580 .store = mcidev_store
581}; 581};
diff --git a/drivers/edac/edac_pci_sysfs.c b/drivers/edac/edac_pci_sysfs.c
index fb60a877d76..bef94e3d994 100644
--- a/drivers/edac/edac_pci_sysfs.c
+++ b/drivers/edac/edac_pci_sysfs.c
@@ -121,7 +121,7 @@ static ssize_t edac_pci_instance_store(struct kobject *kobj,
121} 121}
122 122
123/* fs_ops table */ 123/* fs_ops table */
124static struct sysfs_ops pci_instance_ops = { 124static const struct sysfs_ops pci_instance_ops = {
125 .show = edac_pci_instance_show, 125 .show = edac_pci_instance_show,
126 .store = edac_pci_instance_store 126 .store = edac_pci_instance_store
127}; 127};
@@ -261,7 +261,7 @@ static ssize_t edac_pci_dev_store(struct kobject *kobj,
261 return -EIO; 261 return -EIO;
262} 262}
263 263
264static struct sysfs_ops edac_pci_sysfs_ops = { 264static const struct sysfs_ops edac_pci_sysfs_ops = {
265 .show = edac_pci_dev_show, 265 .show = edac_pci_dev_show,
266 .store = edac_pci_dev_store 266 .store = edac_pci_dev_store
267}; 267};
diff --git a/drivers/firmware/edd.c b/drivers/firmware/edd.c
index 9e4f59dc7f1..110e24e5088 100644
--- a/drivers/firmware/edd.c
+++ b/drivers/firmware/edd.c
@@ -122,7 +122,7 @@ edd_attr_show(struct kobject * kobj, struct attribute *attr, char *buf)
122 return ret; 122 return ret;
123} 123}
124 124
125static struct sysfs_ops edd_attr_ops = { 125static const struct sysfs_ops edd_attr_ops = {
126 .show = edd_attr_show, 126 .show = edd_attr_show,
127}; 127};
128 128
diff --git a/drivers/firmware/efivars.c b/drivers/firmware/efivars.c
index f4f709d1370..082f06ecd32 100644
--- a/drivers/firmware/efivars.c
+++ b/drivers/firmware/efivars.c
@@ -362,7 +362,7 @@ static ssize_t efivar_attr_store(struct kobject *kobj, struct attribute *attr,
362 return ret; 362 return ret;
363} 363}
364 364
365static struct sysfs_ops efivar_attr_ops = { 365static const struct sysfs_ops efivar_attr_ops = {
366 .show = efivar_attr_show, 366 .show = efivar_attr_show,
367 .store = efivar_attr_store, 367 .store = efivar_attr_store,
368}; 368};
diff --git a/drivers/firmware/iscsi_ibft.c b/drivers/firmware/iscsi_ibft.c
index a3600e3ed0f..ed2801c378d 100644
--- a/drivers/firmware/iscsi_ibft.c
+++ b/drivers/firmware/iscsi_ibft.c
@@ -519,7 +519,7 @@ static ssize_t ibft_show_attribute(struct kobject *kobj,
519 return ret; 519 return ret;
520} 520}
521 521
522static struct sysfs_ops ibft_attr_ops = { 522static const struct sysfs_ops ibft_attr_ops = {
523 .show = ibft_show_attribute, 523 .show = ibft_show_attribute,
524}; 524};
525 525
diff --git a/drivers/firmware/memmap.c b/drivers/firmware/memmap.c
index 20f645743ea..d59f7cad226 100644
--- a/drivers/firmware/memmap.c
+++ b/drivers/firmware/memmap.c
@@ -74,7 +74,7 @@ static struct attribute *def_attrs[] = {
74 NULL 74 NULL
75}; 75};
76 76
77static struct sysfs_ops memmap_attr_ops = { 77static const struct sysfs_ops memmap_attr_ops = {
78 .show = memmap_attr_show, 78 .show = memmap_attr_show,
79}; 79};
80 80
diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
index c7320ce4567..89c38c49066 100644
--- a/drivers/gpu/drm/ttm/ttm_bo.c
+++ b/drivers/gpu/drm/ttm/ttm_bo.c
@@ -128,7 +128,7 @@ static struct attribute *ttm_bo_global_attrs[] = {
128 NULL 128 NULL
129}; 129};
130 130
131static struct sysfs_ops ttm_bo_global_ops = { 131static const struct sysfs_ops ttm_bo_global_ops = {
132 .show = &ttm_bo_global_show 132 .show = &ttm_bo_global_show
133}; 133};
134 134
diff --git a/drivers/gpu/drm/ttm/ttm_memory.c b/drivers/gpu/drm/ttm/ttm_memory.c
index f5245c02b8f..eb143e04d40 100644
--- a/drivers/gpu/drm/ttm/ttm_memory.c
+++ b/drivers/gpu/drm/ttm/ttm_memory.c
@@ -152,7 +152,7 @@ static struct attribute *ttm_mem_zone_attrs[] = {
152 NULL 152 NULL
153}; 153};
154 154
155static struct sysfs_ops ttm_mem_zone_ops = { 155static const struct sysfs_ops ttm_mem_zone_ops = {
156 .show = &ttm_mem_zone_show, 156 .show = &ttm_mem_zone_show,
157 .store = &ttm_mem_zone_store 157 .store = &ttm_mem_zone_store
158}; 158};
diff --git a/drivers/infiniband/core/cm.c b/drivers/infiniband/core/cm.c
index 5130fc55b8e..764787ebe8d 100644
--- a/drivers/infiniband/core/cm.c
+++ b/drivers/infiniband/core/cm.c
@@ -3597,7 +3597,7 @@ static ssize_t cm_show_counter(struct kobject *obj, struct attribute *attr,
3597 atomic_long_read(&group->counter[cm_attr->index])); 3597 atomic_long_read(&group->counter[cm_attr->index]));
3598} 3598}
3599 3599
3600static struct sysfs_ops cm_counter_ops = { 3600static const struct sysfs_ops cm_counter_ops = {
3601 .show = cm_show_counter 3601 .show = cm_show_counter
3602}; 3602};
3603 3603
diff --git a/drivers/infiniband/core/sysfs.c b/drivers/infiniband/core/sysfs.c
index 158a214da2f..1558bb7fc74 100644
--- a/drivers/infiniband/core/sysfs.c
+++ b/drivers/infiniband/core/sysfs.c
@@ -79,7 +79,7 @@ static ssize_t port_attr_show(struct kobject *kobj,
79 return port_attr->show(p, port_attr, buf); 79 return port_attr->show(p, port_attr, buf);
80} 80}
81 81
82static struct sysfs_ops port_sysfs_ops = { 82static const struct sysfs_ops port_sysfs_ops = {
83 .show = port_attr_show 83 .show = port_attr_show
84}; 84};
85 85
diff --git a/drivers/md/dm-sysfs.c b/drivers/md/dm-sysfs.c
index f91b40942e0..84d2b91e4ef 100644
--- a/drivers/md/dm-sysfs.c
+++ b/drivers/md/dm-sysfs.c
@@ -75,7 +75,7 @@ static struct attribute *dm_attrs[] = {
75 NULL, 75 NULL,
76}; 76};
77 77
78static struct sysfs_ops dm_sysfs_ops = { 78static const struct sysfs_ops dm_sysfs_ops = {
79 .show = dm_attr_show, 79 .show = dm_attr_show,
80}; 80};
81 81
diff --git a/drivers/md/md.c b/drivers/md/md.c
index a20a71e5efd..fdc1890b6ac 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -2642,7 +2642,7 @@ static void rdev_free(struct kobject *ko)
2642 mdk_rdev_t *rdev = container_of(ko, mdk_rdev_t, kobj); 2642 mdk_rdev_t *rdev = container_of(ko, mdk_rdev_t, kobj);
2643 kfree(rdev); 2643 kfree(rdev);
2644} 2644}
2645static struct sysfs_ops rdev_sysfs_ops = { 2645static const struct sysfs_ops rdev_sysfs_ops = {
2646 .show = rdev_attr_show, 2646 .show = rdev_attr_show,
2647 .store = rdev_attr_store, 2647 .store = rdev_attr_store,
2648}; 2648};
@@ -4059,7 +4059,7 @@ static void md_free(struct kobject *ko)
4059 kfree(mddev); 4059 kfree(mddev);
4060} 4060}
4061 4061
4062static struct sysfs_ops md_sysfs_ops = { 4062static const struct sysfs_ops md_sysfs_ops = {
4063 .show = md_attr_show, 4063 .show = md_attr_show,
4064 .store = md_attr_store, 4064 .store = md_attr_store,
4065}; 4065};
diff --git a/drivers/net/ibmveth.c b/drivers/net/ibmveth.c
index f2b93796695..0bc777bac9b 100644
--- a/drivers/net/ibmveth.c
+++ b/drivers/net/ibmveth.c
@@ -1577,7 +1577,7 @@ static struct attribute * veth_pool_attrs[] = {
1577 NULL, 1577 NULL,
1578}; 1578};
1579 1579
1580static struct sysfs_ops veth_pool_ops = { 1580static const struct sysfs_ops veth_pool_ops = {
1581 .show = veth_pool_show, 1581 .show = veth_pool_show,
1582 .store = veth_pool_store, 1582 .store = veth_pool_store,
1583}; 1583};
diff --git a/drivers/net/iseries_veth.c b/drivers/net/iseries_veth.c
index 966de5d6952..e6e972d9b7c 100644
--- a/drivers/net/iseries_veth.c
+++ b/drivers/net/iseries_veth.c
@@ -384,7 +384,7 @@ static struct attribute *veth_cnx_default_attrs[] = {
384 NULL 384 NULL
385}; 385};
386 386
387static struct sysfs_ops veth_cnx_sysfs_ops = { 387static const struct sysfs_ops veth_cnx_sysfs_ops = {
388 .show = veth_cnx_attribute_show 388 .show = veth_cnx_attribute_show
389}; 389};
390 390
@@ -441,7 +441,7 @@ static struct attribute *veth_port_default_attrs[] = {
441 NULL 441 NULL
442}; 442};
443 443
444static struct sysfs_ops veth_port_sysfs_ops = { 444static const struct sysfs_ops veth_port_sysfs_ops = {
445 .show = veth_port_attribute_show 445 .show = veth_port_attribute_show
446}; 446};
447 447
diff --git a/drivers/parisc/pdc_stable.c b/drivers/parisc/pdc_stable.c
index 0bc5d474b16..1062b8ffe24 100644
--- a/drivers/parisc/pdc_stable.c
+++ b/drivers/parisc/pdc_stable.c
@@ -481,7 +481,7 @@ pdcspath_attr_store(struct kobject *kobj, struct attribute *attr,
481 return ret; 481 return ret;
482} 482}
483 483
484static struct sysfs_ops pdcspath_attr_ops = { 484static const struct sysfs_ops pdcspath_attr_ops = {
485 .show = pdcspath_attr_show, 485 .show = pdcspath_attr_show,
486 .store = pdcspath_attr_store, 486 .store = pdcspath_attr_store,
487}; 487};
diff --git a/drivers/pci/hotplug/fakephp.c b/drivers/pci/hotplug/fakephp.c
index 6151389fd90..0a894efd4b9 100644
--- a/drivers/pci/hotplug/fakephp.c
+++ b/drivers/pci/hotplug/fakephp.c
@@ -73,7 +73,7 @@ static void legacy_release(struct kobject *kobj)
73} 73}
74 74
75static struct kobj_type legacy_ktype = { 75static struct kobj_type legacy_ktype = {
76 .sysfs_ops = &(struct sysfs_ops){ 76 .sysfs_ops = &(const struct sysfs_ops){
77 .store = legacy_store, .show = legacy_show 77 .store = legacy_store, .show = legacy_show
78 }, 78 },
79 .release = &legacy_release, 79 .release = &legacy_release,
diff --git a/drivers/pci/slot.c b/drivers/pci/slot.c
index 49c9e6c9779..f75a44d37fb 100644
--- a/drivers/pci/slot.c
+++ b/drivers/pci/slot.c
@@ -29,7 +29,7 @@ static ssize_t pci_slot_attr_store(struct kobject *kobj,
29 return attribute->store ? attribute->store(slot, buf, len) : -EIO; 29 return attribute->store ? attribute->store(slot, buf, len) : -EIO;
30} 30}
31 31
32static struct sysfs_ops pci_slot_sysfs_ops = { 32static const struct sysfs_ops pci_slot_sysfs_ops = {
33 .show = pci_slot_attr_show, 33 .show = pci_slot_attr_show,
34 .store = pci_slot_attr_store, 34 .store = pci_slot_attr_store,
35}; 35};
diff --git a/drivers/uio/uio.c b/drivers/uio/uio.c
index e941367dd28..4de382acd8f 100644
--- a/drivers/uio/uio.c
+++ b/drivers/uio/uio.c
@@ -129,7 +129,7 @@ static ssize_t map_type_show(struct kobject *kobj, struct attribute *attr,
129 return entry->show(mem, buf); 129 return entry->show(mem, buf);
130} 130}
131 131
132static struct sysfs_ops map_sysfs_ops = { 132static const struct sysfs_ops map_sysfs_ops = {
133 .show = map_type_show, 133 .show = map_type_show,
134}; 134};
135 135
@@ -217,7 +217,7 @@ static ssize_t portio_type_show(struct kobject *kobj, struct attribute *attr,
217 return entry->show(port, buf); 217 return entry->show(port, buf);
218} 218}
219 219
220static struct sysfs_ops portio_sysfs_ops = { 220static const struct sysfs_ops portio_sysfs_ops = {
221 .show = portio_type_show, 221 .show = portio_type_show,
222}; 222};
223 223
diff --git a/drivers/uwb/wlp/sysfs.c b/drivers/uwb/wlp/sysfs.c
index 0370399ff4b..6627c94cc85 100644
--- a/drivers/uwb/wlp/sysfs.c
+++ b/drivers/uwb/wlp/sysfs.c
@@ -615,8 +615,7 @@ ssize_t wlp_wss_attr_store(struct kobject *kobj, struct attribute *attr,
615 return ret; 615 return ret;
616} 616}
617 617
618static 618static const struct sysfs_ops wss_sysfs_ops = {
619struct sysfs_ops wss_sysfs_ops = {
620 .show = wlp_wss_attr_show, 619 .show = wlp_wss_attr_show,
621 .store = wlp_wss_attr_store, 620 .store = wlp_wss_attr_store,
622}; 621};
diff --git a/drivers/video/omap2/dss/manager.c b/drivers/video/omap2/dss/manager.c
index 913142d4cab..9acef00c47e 100644
--- a/drivers/video/omap2/dss/manager.c
+++ b/drivers/video/omap2/dss/manager.c
@@ -341,7 +341,7 @@ static ssize_t manager_attr_store(struct kobject *kobj, struct attribute *attr,
341 return manager_attr->store(manager, buf, size); 341 return manager_attr->store(manager, buf, size);
342} 342}
343 343
344static struct sysfs_ops manager_sysfs_ops = { 344static const struct sysfs_ops manager_sysfs_ops = {
345 .show = manager_attr_show, 345 .show = manager_attr_show,
346 .store = manager_attr_store, 346 .store = manager_attr_store,
347}; 347};
diff --git a/drivers/video/omap2/dss/overlay.c b/drivers/video/omap2/dss/overlay.c
index 0c5bea263ac..aed3f319434 100644
--- a/drivers/video/omap2/dss/overlay.c
+++ b/drivers/video/omap2/dss/overlay.c
@@ -320,7 +320,7 @@ static ssize_t overlay_attr_store(struct kobject *kobj, struct attribute *attr,
320 return overlay_attr->store(overlay, buf, size); 320 return overlay_attr->store(overlay, buf, size);
321} 321}
322 322
323static struct sysfs_ops overlay_sysfs_ops = { 323static const struct sysfs_ops overlay_sysfs_ops = {
324 .show = overlay_attr_show, 324 .show = overlay_attr_show,
325 .store = overlay_attr_store, 325 .store = overlay_attr_store,
326}; 326};
diff --git a/drivers/xen/sys-hypervisor.c b/drivers/xen/sys-hypervisor.c
index ae5cb05a1a1..bb71ab2336c 100644
--- a/drivers/xen/sys-hypervisor.c
+++ b/drivers/xen/sys-hypervisor.c
@@ -426,7 +426,7 @@ static ssize_t hyp_sysfs_store(struct kobject *kobj,
426 return 0; 426 return 0;
427} 427}
428 428
429static struct sysfs_ops hyp_sysfs_ops = { 429static const struct sysfs_ops hyp_sysfs_ops = {
430 .show = hyp_sysfs_show, 430 .show = hyp_sysfs_show,
431 .store = hyp_sysfs_store, 431 .store = hyp_sysfs_store,
432}; 432};
diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c
index a240b6fa81d..4ce16ef702a 100644
--- a/fs/btrfs/sysfs.c
+++ b/fs/btrfs/sysfs.c
@@ -164,12 +164,12 @@ static void btrfs_root_release(struct kobject *kobj)
164 complete(&root->kobj_unregister); 164 complete(&root->kobj_unregister);
165} 165}
166 166
167static struct sysfs_ops btrfs_super_attr_ops = { 167static const struct sysfs_ops btrfs_super_attr_ops = {
168 .show = btrfs_super_attr_show, 168 .show = btrfs_super_attr_show,
169 .store = btrfs_super_attr_store, 169 .store = btrfs_super_attr_store,
170}; 170};
171 171
172static struct sysfs_ops btrfs_root_attr_ops = { 172static const struct sysfs_ops btrfs_root_attr_ops = {
173 .show = btrfs_root_attr_show, 173 .show = btrfs_root_attr_show,
174 .store = btrfs_root_attr_store, 174 .store = btrfs_root_attr_store,
175}; 175};
diff --git a/fs/dlm/lockspace.c b/fs/dlm/lockspace.c
index 26a8bd40400..f994a7dfda8 100644
--- a/fs/dlm/lockspace.c
+++ b/fs/dlm/lockspace.c
@@ -148,7 +148,7 @@ static void lockspace_kobj_release(struct kobject *k)
148 kfree(ls); 148 kfree(ls);
149} 149}
150 150
151static struct sysfs_ops dlm_attr_ops = { 151static const struct sysfs_ops dlm_attr_ops = {
152 .show = dlm_attr_show, 152 .show = dlm_attr_show,
153 .store = dlm_attr_store, 153 .store = dlm_attr_store,
154}; 154};
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 2b83b96cb2e..ce84a6ed4a4 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -2358,7 +2358,7 @@ static void ext4_sb_release(struct kobject *kobj)
2358} 2358}
2359 2359
2360 2360
2361static struct sysfs_ops ext4_attr_ops = { 2361static const struct sysfs_ops ext4_attr_ops = {
2362 .show = ext4_attr_show, 2362 .show = ext4_attr_show,
2363 .store = ext4_attr_store, 2363 .store = ext4_attr_store,
2364}; 2364};
diff --git a/fs/gfs2/sys.c b/fs/gfs2/sys.c
index 543503010ed..419042f7f0b 100644
--- a/fs/gfs2/sys.c
+++ b/fs/gfs2/sys.c
@@ -49,7 +49,7 @@ static ssize_t gfs2_attr_store(struct kobject *kobj, struct attribute *attr,
49 return a->store ? a->store(sdp, buf, len) : len; 49 return a->store ? a->store(sdp, buf, len) : len;
50} 50}
51 51
52static struct sysfs_ops gfs2_attr_ops = { 52static const struct sysfs_ops gfs2_attr_ops = {
53 .show = gfs2_attr_show, 53 .show = gfs2_attr_show,
54 .store = gfs2_attr_store, 54 .store = gfs2_attr_store,
55}; 55};
diff --git a/fs/ocfs2/cluster/masklog.c b/fs/ocfs2/cluster/masklog.c
index b39da877b12..3bb928a2bf7 100644
--- a/fs/ocfs2/cluster/masklog.c
+++ b/fs/ocfs2/cluster/masklog.c
@@ -136,7 +136,7 @@ static ssize_t mlog_store(struct kobject *obj, struct attribute *attr,
136 return mlog_mask_store(mlog_attr->mask, buf, count); 136 return mlog_mask_store(mlog_attr->mask, buf, count);
137} 137}
138 138
139static struct sysfs_ops mlog_attr_ops = { 139static const struct sysfs_ops mlog_attr_ops = {
140 .show = mlog_show, 140 .show = mlog_show,
141 .store = mlog_store, 141 .store = mlog_store,
142}; 142};
diff --git a/fs/sysfs/file.c b/fs/sysfs/file.c
index 50b725bcc3f..ced2299f1c9 100644
--- a/fs/sysfs/file.c
+++ b/fs/sysfs/file.c
@@ -53,7 +53,7 @@ struct sysfs_buffer {
53 size_t count; 53 size_t count;
54 loff_t pos; 54 loff_t pos;
55 char * page; 55 char * page;
56 struct sysfs_ops * ops; 56 const struct sysfs_ops * ops;
57 struct mutex mutex; 57 struct mutex mutex;
58 int needs_read_fill; 58 int needs_read_fill;
59 int event; 59 int event;
@@ -75,7 +75,7 @@ static int fill_read_buffer(struct dentry * dentry, struct sysfs_buffer * buffer
75{ 75{
76 struct sysfs_dirent *attr_sd = dentry->d_fsdata; 76 struct sysfs_dirent *attr_sd = dentry->d_fsdata;
77 struct kobject *kobj = attr_sd->s_parent->s_dir.kobj; 77 struct kobject *kobj = attr_sd->s_parent->s_dir.kobj;
78 struct sysfs_ops * ops = buffer->ops; 78 const struct sysfs_ops * ops = buffer->ops;
79 int ret = 0; 79 int ret = 0;
80 ssize_t count; 80 ssize_t count;
81 81
@@ -199,7 +199,7 @@ flush_write_buffer(struct dentry * dentry, struct sysfs_buffer * buffer, size_t
199{ 199{
200 struct sysfs_dirent *attr_sd = dentry->d_fsdata; 200 struct sysfs_dirent *attr_sd = dentry->d_fsdata;
201 struct kobject *kobj = attr_sd->s_parent->s_dir.kobj; 201 struct kobject *kobj = attr_sd->s_parent->s_dir.kobj;
202 struct sysfs_ops * ops = buffer->ops; 202 const struct sysfs_ops * ops = buffer->ops;
203 int rc; 203 int rc;
204 204
205 /* need attr_sd for attr and ops, its parent for kobj */ 205 /* need attr_sd for attr and ops, its parent for kobj */
@@ -335,7 +335,7 @@ static int sysfs_open_file(struct inode *inode, struct file *file)
335 struct sysfs_dirent *attr_sd = file->f_path.dentry->d_fsdata; 335 struct sysfs_dirent *attr_sd = file->f_path.dentry->d_fsdata;
336 struct kobject *kobj = attr_sd->s_parent->s_dir.kobj; 336 struct kobject *kobj = attr_sd->s_parent->s_dir.kobj;
337 struct sysfs_buffer *buffer; 337 struct sysfs_buffer *buffer;
338 struct sysfs_ops *ops; 338 const struct sysfs_ops *ops;
339 int error = -EACCES; 339 int error = -EACCES;
340 char *p; 340 char *p;
341 341
diff --git a/include/linux/kobject.h b/include/linux/kobject.h
index 57a1eaae909..3950d3c2850 100644
--- a/include/linux/kobject.h
+++ b/include/linux/kobject.h
@@ -106,7 +106,7 @@ extern char *kobject_get_path(struct kobject *kobj, gfp_t flag);
106 106
107struct kobj_type { 107struct kobj_type {
108 void (*release)(struct kobject *kobj); 108 void (*release)(struct kobject *kobj);
109 struct sysfs_ops *sysfs_ops; 109 const struct sysfs_ops *sysfs_ops;
110 struct attribute **default_attrs; 110 struct attribute **default_attrs;
111}; 111};
112 112
@@ -132,7 +132,7 @@ struct kobj_attribute {
132 const char *buf, size_t count); 132 const char *buf, size_t count);
133}; 133};
134 134
135extern struct sysfs_ops kobj_sysfs_ops; 135extern const struct sysfs_ops kobj_sysfs_ops;
136 136
137/** 137/**
138 * struct kset - a set of kobjects of a specific type, belonging to a specific subsystem. 138 * struct kset - a set of kobjects of a specific type, belonging to a specific subsystem.
diff --git a/kernel/params.c b/kernel/params.c
index 48370be3c0a..68396d73c83 100644
--- a/kernel/params.c
+++ b/kernel/params.c
@@ -722,7 +722,7 @@ static ssize_t module_attr_store(struct kobject *kobj,
722 return ret; 722 return ret;
723} 723}
724 724
725static struct sysfs_ops module_sysfs_ops = { 725static const struct sysfs_ops module_sysfs_ops = {
726 .show = module_attr_show, 726 .show = module_attr_show,
727 .store = module_attr_store, 727 .store = module_attr_store,
728}; 728};
diff --git a/lib/kobject.c b/lib/kobject.c
index cecf5a0ef6e..8115eb1bbf4 100644
--- a/lib/kobject.c
+++ b/lib/kobject.c
@@ -700,7 +700,7 @@ static ssize_t kobj_attr_store(struct kobject *kobj, struct attribute *attr,
700 return ret; 700 return ret;
701} 701}
702 702
703struct sysfs_ops kobj_sysfs_ops = { 703const struct sysfs_ops kobj_sysfs_ops = {
704 .show = kobj_attr_show, 704 .show = kobj_attr_show,
705 .store = kobj_attr_store, 705 .store = kobj_attr_store,
706}; 706};
diff --git a/mm/slub.c b/mm/slub.c
index a26753c12dc..a2b8969ba6d 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -4390,7 +4390,7 @@ static void kmem_cache_release(struct kobject *kobj)
4390 kfree(s); 4390 kfree(s);
4391} 4391}
4392 4392
4393static struct sysfs_ops slab_sysfs_ops = { 4393static const struct sysfs_ops slab_sysfs_ops = {
4394 .show = slab_attr_show, 4394 .show = slab_attr_show,
4395 .store = slab_attr_store, 4395 .store = slab_attr_store,
4396}; 4396};
diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h
index 1cf2cef7858..fef0384e3c0 100644
--- a/net/bridge/br_private.h
+++ b/net/bridge/br_private.h
@@ -423,7 +423,7 @@ extern void br_ifinfo_notify(int event, struct net_bridge_port *port);
423 423
424#ifdef CONFIG_SYSFS 424#ifdef CONFIG_SYSFS
425/* br_sysfs_if.c */ 425/* br_sysfs_if.c */
426extern struct sysfs_ops brport_sysfs_ops; 426extern const struct sysfs_ops brport_sysfs_ops;
427extern int br_sysfs_addif(struct net_bridge_port *p); 427extern int br_sysfs_addif(struct net_bridge_port *p);
428 428
429/* br_sysfs_br.c */ 429/* br_sysfs_br.c */
diff --git a/net/bridge/br_sysfs_if.c b/net/bridge/br_sysfs_if.c
index 696596cd338..0b9916489d6 100644
--- a/net/bridge/br_sysfs_if.c
+++ b/net/bridge/br_sysfs_if.c
@@ -238,7 +238,7 @@ static ssize_t brport_store(struct kobject * kobj,
238 return ret; 238 return ret;
239} 239}
240 240
241struct sysfs_ops brport_sysfs_ops = { 241const struct sysfs_ops brport_sysfs_ops = {
242 .show = brport_show, 242 .show = brport_show,
243 .store = brport_store, 243 .store = brport_store,
244}; 244};
diff --git a/samples/kobject/kset-example.c b/samples/kobject/kset-example.c
index 7c608814052..3b126d1f859 100644
--- a/samples/kobject/kset-example.c
+++ b/samples/kobject/kset-example.c
@@ -87,7 +87,7 @@ static ssize_t foo_attr_store(struct kobject *kobj,
87} 87}
88 88
89/* Our custom sysfs_ops that we will associate with our ktype later on */ 89/* Our custom sysfs_ops that we will associate with our ktype later on */
90static struct sysfs_ops foo_sysfs_ops = { 90static const struct sysfs_ops foo_sysfs_ops = {
91 .show = foo_attr_show, 91 .show = foo_attr_show,
92 .store = foo_attr_store, 92 .store = foo_attr_store,
93}; 93};