mirror of
https://github.com/linux-msm/laptops-kernel.git
synced 2026-08-13 14:19:53 -07:00
EDAC/device: Constify info sysfs attributes
These structures are never modified, mark them read-only. Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> Link: https://patch.msgid.link/20260223-sysfs-const-edac-v1-4-3ff0b87249e7@weissschuh.net
This commit is contained in:
committed by
Borislav Petkov (AMD)
parent
495e77a575
commit
e72e70870a
@@ -109,14 +109,14 @@ struct ctl_info_attribute {
|
||||
};
|
||||
|
||||
#define to_ctl_info(k) container_of(k, struct edac_device_ctl_info, kobj)
|
||||
#define to_ctl_info_attr(a) container_of(a,struct ctl_info_attribute,attr)
|
||||
#define to_ctl_info_attr(a) container_of_const(a, struct ctl_info_attribute, attr)
|
||||
|
||||
/* Function to 'show' fields from the edac_dev 'ctl_info' structure */
|
||||
static ssize_t edac_dev_ctl_info_show(struct kobject *kobj,
|
||||
struct attribute *attr, char *buffer)
|
||||
{
|
||||
struct edac_device_ctl_info *edac_dev = to_ctl_info(kobj);
|
||||
struct ctl_info_attribute *ctl_info_attr = to_ctl_info_attr(attr);
|
||||
const struct ctl_info_attribute *ctl_info_attr = to_ctl_info_attr(attr);
|
||||
|
||||
if (ctl_info_attr->show)
|
||||
return ctl_info_attr->show(edac_dev, buffer);
|
||||
@@ -129,7 +129,7 @@ static ssize_t edac_dev_ctl_info_store(struct kobject *kobj,
|
||||
const char *buffer, size_t count)
|
||||
{
|
||||
struct edac_device_ctl_info *edac_dev = to_ctl_info(kobj);
|
||||
struct ctl_info_attribute *ctl_info_attr = to_ctl_info_attr(attr);
|
||||
const struct ctl_info_attribute *ctl_info_attr = to_ctl_info_attr(attr);
|
||||
|
||||
if (ctl_info_attr->store)
|
||||
return ctl_info_attr->store(edac_dev, buffer, count);
|
||||
@@ -143,7 +143,7 @@ static const struct sysfs_ops device_ctl_info_ops = {
|
||||
};
|
||||
|
||||
#define CTL_INFO_ATTR(_name,_mode,_show,_store) \
|
||||
static struct ctl_info_attribute attr_ctl_info_##_name = { \
|
||||
static const struct ctl_info_attribute attr_ctl_info_##_name = { \
|
||||
.attr = {.name = __stringify(_name), .mode = _mode }, \
|
||||
.show = _show, \
|
||||
.store = _store, \
|
||||
@@ -161,7 +161,7 @@ CTL_INFO_ATTR(poll_msec, S_IRUGO | S_IWUSR,
|
||||
edac_device_ctl_poll_msec_show, edac_device_ctl_poll_msec_store);
|
||||
|
||||
/* Base Attributes of the EDAC_DEVICE ECC object */
|
||||
static struct attribute *device_ctrl_attrs[] = {
|
||||
static const struct attribute *const device_ctrl_attrs[] = {
|
||||
&attr_ctl_info_panic_on_ue.attr,
|
||||
&attr_ctl_info_log_ue.attr,
|
||||
&attr_ctl_info_log_ce.attr,
|
||||
|
||||
Reference in New Issue
Block a user