Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 84eb8f64 authored by Runmin Wang's avatar Runmin Wang
Browse files

soc: qcom: core,gladiator hang: Change the sysfs print format



Sizeof(uint32) returns 4 as the value. As a result, the string
copied will be limited to 4 characters.
Update the size to the correct value and add "0x" to the front
of the string.

CRs-Fixed: 1047798
Change-Id: If889cd278fea7e13f941635f72047dcb9141ec2e
Signed-off-by: default avatarRunmin Wang <runminw@codeaurora.org>
parent cc915a39
Loading
Loading
Loading
Loading
+5 −6
Original line number Diff line number Diff line
@@ -33,6 +33,7 @@
#define _WRITE(x, y, z)		(((~(_VAL(z))) & y) | _VALUE(x, z))

#define MODULE_NAME	"msm_hang_detect"
#define MAX_SYSFS_LEN 12

struct hang_detect {
	phys_addr_t threshold[NR_CPUS];
@@ -108,8 +109,7 @@ static ssize_t show_threshold(struct kobject *kobj, struct attribute *attr,
{
	struct hang_detect *device =  to_core_hang_dev(kobj);

	return snprintf(buf, sizeof(device->threshold_val),
				"%u\n", device->threshold_val);
	return snprintf(buf, MAX_SYSFS_LEN, "0x%x\n", device->threshold_val);
}

static size_t store_threshold(struct kobject *kobj, struct attribute *attr,
@@ -147,8 +147,8 @@ static ssize_t show_pmu_event_sel(struct kobject *kobj, struct attribute *attr,
{
	struct hang_detect *hang_device = to_core_hang_dev(kobj);

	return snprintf(buf, sizeof(hang_device->pmu_event_sel),
				"%u\n", hang_device->pmu_event_sel);
	return snprintf(buf, MAX_SYSFS_LEN, "0x%x\n",
			hang_device->pmu_event_sel);
}

static size_t store_pmu_event_sel(struct kobject *kobj, struct attribute *attr,
@@ -188,8 +188,7 @@ static ssize_t show_enable(struct kobject *kobj, struct attribute *attr,
{
	struct hang_detect *hang_device = to_core_hang_dev(kobj);

	return snprintf(buf, sizeof(hang_device->enabled),
			"%u\n", hang_device->enabled);
	return snprintf(buf, MAX_SYSFS_LEN, "%u\n", hang_device->enabled);
}

static size_t store_enable(struct kobject *kobj, struct attribute *attr,
+3 −5
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@
#define NR_GLA_REG 6
#define MODULE_NAME	"gladiator_hang_detect"
#define MAX_THRES	0xFFFFFFFF
#define MAX_LEN_SYSFS 12

struct hang_detect {
	phys_addr_t threshold[NR_GLA_REG];
@@ -199,8 +200,7 @@ static inline ssize_t generic_enable_show(struct kobject *kobj,
	uint32_t reg_value;

	get_enable(offset, hang_dev, &reg_value);
	return snprintf(buf, sizeof(hang_dev->ACE_enable),
			"%d\n", reg_value);
	return snprintf(buf, MAX_LEN_SYSFS, "%u\n", reg_value);
}

static inline ssize_t generic_threshold_show(struct kobject *kobj,
@@ -210,9 +210,7 @@ static inline ssize_t generic_threshold_show(struct kobject *kobj,
	uint32_t reg_value;

	get_threshold(offset, hang_dev, &reg_value);
	return snprintf(buf, sizeof(hang_dev->ACE_threshold),
			"%u\n", reg_value);

	return snprintf(buf, MAX_LEN_SYSFS, "0x%x\n", reg_value);
}

static inline size_t generic_threshold_store(struct kobject *kobj,