mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-24 05:04:00 +08:00
md: Constify attribute_group structs
The attribute_group structs are never modified, they're only passed to sysfs_create_group() and sysfs_remove_group(). Make them const to allow the compiler to put them in read-only memory. Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com> Signed-off-by: Song Liu <song@kernel.org>
This commit is contained in:
parent
608f52e30a
commit
c32dc04059
@ -2616,7 +2616,7 @@ static struct attribute *md_bitmap_attrs[] = {
|
|||||||
&max_backlog_used.attr,
|
&max_backlog_used.attr,
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
struct attribute_group md_bitmap_group = {
|
const struct attribute_group md_bitmap_group = {
|
||||||
.name = "bitmap",
|
.name = "bitmap",
|
||||||
.attrs = md_bitmap_attrs,
|
.attrs = md_bitmap_attrs,
|
||||||
};
|
};
|
||||||
|
@ -785,7 +785,7 @@ out_free_new:
|
|||||||
return ERR_PTR(error);
|
return ERR_PTR(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct attribute_group md_redundancy_group;
|
static const struct attribute_group md_redundancy_group;
|
||||||
|
|
||||||
void mddev_unlock(struct mddev *mddev)
|
void mddev_unlock(struct mddev *mddev)
|
||||||
{
|
{
|
||||||
@ -802,7 +802,7 @@ void mddev_unlock(struct mddev *mddev)
|
|||||||
* test it under the same mutex to ensure its correct value
|
* test it under the same mutex to ensure its correct value
|
||||||
* is seen.
|
* is seen.
|
||||||
*/
|
*/
|
||||||
struct attribute_group *to_remove = mddev->to_remove;
|
const struct attribute_group *to_remove = mddev->to_remove;
|
||||||
mddev->to_remove = NULL;
|
mddev->to_remove = NULL;
|
||||||
mddev->sysfs_active = 1;
|
mddev->sysfs_active = 1;
|
||||||
mutex_unlock(&mddev->reconfig_mutex);
|
mutex_unlock(&mddev->reconfig_mutex);
|
||||||
@ -5500,7 +5500,7 @@ static struct attribute *md_redundancy_attrs[] = {
|
|||||||
&md_degraded.attr,
|
&md_degraded.attr,
|
||||||
NULL,
|
NULL,
|
||||||
};
|
};
|
||||||
static struct attribute_group md_redundancy_group = {
|
static const struct attribute_group md_redundancy_group = {
|
||||||
.name = NULL,
|
.name = NULL,
|
||||||
.attrs = md_redundancy_attrs,
|
.attrs = md_redundancy_attrs,
|
||||||
};
|
};
|
||||||
|
@ -481,7 +481,7 @@ struct mddev {
|
|||||||
atomic_t max_corr_read_errors; /* max read retries */
|
atomic_t max_corr_read_errors; /* max read retries */
|
||||||
struct list_head all_mddevs;
|
struct list_head all_mddevs;
|
||||||
|
|
||||||
struct attribute_group *to_remove;
|
const struct attribute_group *to_remove;
|
||||||
|
|
||||||
struct bio_set bio_set;
|
struct bio_set bio_set;
|
||||||
struct bio_set sync_set; /* for sync operations like
|
struct bio_set sync_set; /* for sync operations like
|
||||||
@ -613,7 +613,7 @@ struct md_sysfs_entry {
|
|||||||
ssize_t (*show)(struct mddev *, char *);
|
ssize_t (*show)(struct mddev *, char *);
|
||||||
ssize_t (*store)(struct mddev *, const char *, size_t);
|
ssize_t (*store)(struct mddev *, const char *, size_t);
|
||||||
};
|
};
|
||||||
extern struct attribute_group md_bitmap_group;
|
extern const struct attribute_group md_bitmap_group;
|
||||||
|
|
||||||
static inline struct kernfs_node *sysfs_get_dirent_safe(struct kernfs_node *sd, char *name)
|
static inline struct kernfs_node *sysfs_get_dirent_safe(struct kernfs_node *sd, char *name)
|
||||||
{
|
{
|
||||||
|
@ -6940,7 +6940,7 @@ static struct attribute *raid5_attrs[] = {
|
|||||||
&ppl_write_hint.attr,
|
&ppl_write_hint.attr,
|
||||||
NULL,
|
NULL,
|
||||||
};
|
};
|
||||||
static struct attribute_group raid5_attrs_group = {
|
static const struct attribute_group raid5_attrs_group = {
|
||||||
.name = NULL,
|
.name = NULL,
|
||||||
.attrs = raid5_attrs,
|
.attrs = raid5_attrs,
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user