[PATCH 1/2] edac: Modify sysfs enabled values log_ue, log_ce to bool

From: Kamati Srinivas
Date: Fri Mar 03 2023 - 07:54:57 EST


Use kstrtobool() since simple_strtoul() is deprecated.
Also change edac_device_get_log_ue/ce return type from int to bool.

Signed-off-by: Kamati Srinivas <quic_kamasrin@xxxxxxxxxxx>
---
drivers/edac/edac_device.c | 4 ++--
drivers/edac/edac_device.h | 4 ++--
drivers/edac/edac_device_sysfs.c | 12 ++++++------
3 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/edac/edac_device.c b/drivers/edac/edac_device.c
index 8c4d947fb848..ddfa094d0f3a 100644
--- a/drivers/edac/edac_device.c
+++ b/drivers/edac/edac_device.c
@@ -539,12 +539,12 @@ struct edac_device_ctl_info *edac_device_del_device(struct device *dev)
}
EXPORT_SYMBOL_GPL(edac_device_del_device);

-static inline int edac_device_get_log_ce(struct edac_device_ctl_info *edac_dev)
+static inline bool edac_device_get_log_ce(struct edac_device_ctl_info *edac_dev)
{
return edac_dev->log_ce;
}

-static inline int edac_device_get_log_ue(struct edac_device_ctl_info *edac_dev)
+static inline bool edac_device_get_log_ue(struct edac_device_ctl_info *edac_dev)
{
return edac_dev->log_ue;
}
diff --git a/drivers/edac/edac_device.h b/drivers/edac/edac_device.h
index c4c0e0bdce14..e1645332eaa2 100644
--- a/drivers/edac/edac_device.h
+++ b/drivers/edac/edac_device.h
@@ -157,8 +157,8 @@ struct edac_device_ctl_info {
int dev_idx;

/* Per instance controls for this edac_device */
- int log_ue; /* boolean for logging UEs */
- int log_ce; /* boolean for logging CEs */
+ bool log_ue; /* boolean for logging UEs */
+ bool log_ce; /* boolean for logging CEs */
int panic_on_ue; /* boolean for panic'ing on an UE */
unsigned poll_msec; /* number of milliseconds to poll interval */
unsigned long delay; /* number of jiffies for poll_msec */
diff --git a/drivers/edac/edac_device_sysfs.c b/drivers/edac/edac_device_sysfs.c
index 5e7593753799..51a3a90d7404 100644
--- a/drivers/edac/edac_device_sysfs.c
+++ b/drivers/edac/edac_device_sysfs.c
@@ -39,10 +39,10 @@ static ssize_t edac_device_ctl_log_ue_store(struct edac_device_ctl_info
*ctl_info, const char *data,
size_t count)
{
- /* if parameter is zero, turn off flag, if non-zero turn on flag */
- ctl_info->log_ue = (simple_strtoul(data, NULL, 0) != 0);
+ int ret;

- return count;
+ ret = kstrtobool(data, &ctl_info->log_ue);
+ return ret ? ret : count;
}

/* 'log_ce' */
@@ -56,10 +56,10 @@ static ssize_t edac_device_ctl_log_ce_store(struct edac_device_ctl_info
*ctl_info, const char *data,
size_t count)
{
- /* if parameter is zero, turn off flag, if non-zero turn on flag */
- ctl_info->log_ce = (simple_strtoul(data, NULL, 0) != 0);
+ int ret;

- return count;
+ ret = kstrtobool(data, &ctl_info->log_ce);
+ return ret ? ret : count;
}

/* 'panic_on_ue' */
--
2.17.1