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>
This commit is contained in:
Emese Revfy
2010-01-19 02:58:23 +01:00
committed by Greg Kroah-Hartman
parent 6c1733aca0
commit 52cf25d0ab
54 changed files with 69 additions and 70 deletions
+1 -1
View File
@@ -266,7 +266,7 @@ kobj_type:
struct kobj_type {
void (*release)(struct kobject *);
struct sysfs_ops *sysfs_ops;
const struct sysfs_ops *sysfs_ops;
struct attribute **default_attrs;
};
+1 -1
View File
@@ -282,7 +282,7 @@ static ssize_t cache_show(struct kobject * kobj, struct attribute * attr, char *
return ret;
}
static struct sysfs_ops cache_sysfs_ops = {
static const struct sysfs_ops cache_sysfs_ops = {
.show = cache_show
};
+1 -1
View File
@@ -642,7 +642,7 @@ static struct kobj_attribute *cache_index_opt_attrs[] = {
&cache_assoc_attr,
};
static struct sysfs_ops cache_index_ops = {
static const struct sysfs_ops cache_index_ops = {
.show = cache_index_show,
};
+1 -1
View File
@@ -326,7 +326,7 @@ static struct attribute *sq_sysfs_attrs[] = {
NULL,
};
static struct sysfs_ops sq_sysfs_ops = {
static const struct sysfs_ops sq_sysfs_ops = {
.show = sq_sysfs_show,
.store = sq_sysfs_store,
};
+1 -1
View File
@@ -903,7 +903,7 @@ static ssize_t store(struct kobject *kobj, struct attribute *attr,
return ret;
}
static struct sysfs_ops sysfs_ops = {
static const struct sysfs_ops sysfs_ops = {
.show = show,
.store = store,
};
+1 -1
View File
@@ -388,7 +388,7 @@ static ssize_t store(struct kobject *kobj, struct attribute *attr,
return ret;
}
static struct sysfs_ops threshold_ops = {
static const struct sysfs_ops threshold_ops = {
.show = show,
.store = store,
};
+1 -1
View File
@@ -278,7 +278,7 @@ static struct attribute *integrity_attrs[] = {
NULL,
};
static struct sysfs_ops integrity_ops = {
static const struct sysfs_ops integrity_ops = {
.show = &integrity_attr_show,
.store = &integrity_attr_store,
};
+1 -1
View File
@@ -450,7 +450,7 @@ static void blk_release_queue(struct kobject *kobj)
kmem_cache_free(blk_requestq_cachep, q);
}
static struct sysfs_ops queue_sysfs_ops = {
static const struct sysfs_ops queue_sysfs_ops = {
.show = queue_attr_show,
.store = queue_attr_store,
};
+1 -1
View File
@@ -892,7 +892,7 @@ elv_attr_store(struct kobject *kobj, struct attribute *attr,
return error;
}
static struct sysfs_ops elv_sysfs_ops = {
static const struct sysfs_ops elv_sysfs_ops = {
.show = elv_attr_show,
.store = elv_attr_store,
};
+2 -2
View File
@@ -70,7 +70,7 @@ static ssize_t drv_attr_store(struct kobject *kobj, struct attribute *attr,
return ret;
}
static struct sysfs_ops driver_sysfs_ops = {
static const struct sysfs_ops driver_sysfs_ops = {
.show = drv_attr_show,
.store = drv_attr_store,
};
@@ -115,7 +115,7 @@ static ssize_t bus_attr_store(struct kobject *kobj, struct attribute *attr,
return ret;
}
static struct sysfs_ops bus_sysfs_ops = {
static const struct sysfs_ops bus_sysfs_ops = {
.show = bus_attr_show,
.store = bus_attr_store,
};
+1 -1
View File
@@ -63,7 +63,7 @@ static void class_release(struct kobject *kobj)
kfree(cp);
}
static struct sysfs_ops class_sysfs_ops = {
static const struct sysfs_ops class_sysfs_ops = {
.show = class_attr_show,
.store = class_attr_store,
};
+1 -1
View File
@@ -100,7 +100,7 @@ static ssize_t dev_attr_store(struct kobject *kobj, struct attribute *attr,
return ret;
}
static struct sysfs_ops dev_sysfs_ops = {
static const struct sysfs_ops dev_sysfs_ops = {
.show = dev_attr_show,
.store = dev_attr_store,
};
+2 -2
View File
@@ -54,7 +54,7 @@ sysdev_store(struct kobject *kobj, struct attribute *attr,
return -EIO;
}
static struct sysfs_ops sysfs_ops = {
static const struct sysfs_ops sysfs_ops = {
.show = sysdev_show,
.store = sysdev_store,
};
@@ -104,7 +104,7 @@ static ssize_t sysdev_class_store(struct kobject *kobj, struct attribute *attr,
return -EIO;
}
static struct sysfs_ops sysfs_class_ops = {
static const struct sysfs_ops sysfs_class_ops = {
.show = sysdev_class_show,
.store = sysdev_class_store,
};
+1 -1
View File
@@ -284,7 +284,7 @@ static ssize_t kobj_pkt_store(struct kobject *kobj,
return len;
}
static struct sysfs_ops kobj_pkt_ops = {
static const struct sysfs_ops kobj_pkt_ops = {
.show = kobj_pkt_show,
.store = kobj_pkt_store
};
+1 -1
View File
@@ -766,7 +766,7 @@ static void cpufreq_sysfs_release(struct kobject *kobj)
complete(&policy->kobj_unregister);
}
static struct sysfs_ops sysfs_ops = {
static const struct sysfs_ops sysfs_ops = {
.show = show,
.store = store,
};
+2 -2
View File
@@ -195,7 +195,7 @@ static ssize_t cpuidle_store(struct kobject * kobj, struct attribute * attr,
return ret;
}
static struct sysfs_ops cpuidle_sysfs_ops = {
static const struct sysfs_ops cpuidle_sysfs_ops = {
.show = cpuidle_show,
.store = cpuidle_store,
};
@@ -281,7 +281,7 @@ static ssize_t cpuidle_state_show(struct kobject * kobj,
return ret;
}
static struct sysfs_ops cpuidle_state_sysfs_ops = {
static const struct sysfs_ops cpuidle_state_sysfs_ops = {
.show = cpuidle_state_show,
};
+1 -1
View File
@@ -1138,7 +1138,7 @@ ioat_attr_show(struct kobject *kobj, struct attribute *attr, char *page)
return entry->show(&chan->common, page);
}
struct sysfs_ops ioat_sysfs_ops = {
const struct sysfs_ops ioat_sysfs_ops = {
.show = ioat_attr_show,
};
+1 -1
View File
@@ -346,7 +346,7 @@ bool ioat_cleanup_preamble(struct ioat_chan_common *chan,
unsigned long *phys_complete);
void ioat_kobject_add(struct ioatdma_device *device, struct kobj_type *type);
void ioat_kobject_del(struct ioatdma_device *device);
extern struct sysfs_ops ioat_sysfs_ops;
extern const struct sysfs_ops ioat_sysfs_ops;
extern struct ioat_sysfs_entry ioat_version_attr;
extern struct ioat_sysfs_entry ioat_cap_attr;
#endif /* IOATDMA_H */
+3 -3
View File
@@ -137,7 +137,7 @@ static ssize_t edac_dev_ctl_info_store(struct kobject *kobj,
}
/* edac_dev file operations for an 'ctl_info' */
static struct sysfs_ops device_ctl_info_ops = {
static const struct sysfs_ops device_ctl_info_ops = {
.show = edac_dev_ctl_info_show,
.store = edac_dev_ctl_info_store
};
@@ -373,7 +373,7 @@ static ssize_t edac_dev_instance_store(struct kobject *kobj,
}
/* edac_dev file operations for an 'instance' */
static struct sysfs_ops device_instance_ops = {
static const struct sysfs_ops device_instance_ops = {
.show = edac_dev_instance_show,
.store = edac_dev_instance_store
};
@@ -476,7 +476,7 @@ static ssize_t edac_dev_block_store(struct kobject *kobj,
}
/* edac_dev file operations for a 'block' */
static struct sysfs_ops device_block_ops = {
static const struct sysfs_ops device_block_ops = {
.show = edac_dev_block_show,
.store = edac_dev_block_store
};
+2 -2
View File
@@ -245,7 +245,7 @@ static ssize_t csrowdev_store(struct kobject *kobj, struct attribute *attr,
return -EIO;
}
static struct sysfs_ops csrowfs_ops = {
static const struct sysfs_ops csrowfs_ops = {
.show = csrowdev_show,
.store = csrowdev_store
};
@@ -575,7 +575,7 @@ static ssize_t mcidev_store(struct kobject *kobj, struct attribute *attr,
}
/* Intermediate show/store table */
static struct sysfs_ops mci_ops = {
static const struct sysfs_ops mci_ops = {
.show = mcidev_show,
.store = mcidev_store
};

Some files were not shown because too many files have changed in this diff Show More