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

This commit is contained in:
Linux Build Service Account 2016-08-11 12:48:34 -07:00 committed by Gerrit - the friendly Code Review server
commit 744bdc6546
2 changed files with 8 additions and 11 deletions

View file

@ -33,6 +33,7 @@
#define _WRITE(x, y, z) (((~(_VAL(z))) & y) | _VALUE(x, z)) #define _WRITE(x, y, z) (((~(_VAL(z))) & y) | _VALUE(x, z))
#define MODULE_NAME "msm_hang_detect" #define MODULE_NAME "msm_hang_detect"
#define MAX_SYSFS_LEN 12
struct hang_detect { struct hang_detect {
phys_addr_t threshold[NR_CPUS]; 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); struct hang_detect *device = to_core_hang_dev(kobj);
return snprintf(buf, sizeof(device->threshold_val), return snprintf(buf, MAX_SYSFS_LEN, "0x%x\n", device->threshold_val);
"%u\n", device->threshold_val);
} }
static size_t store_threshold(struct kobject *kobj, struct attribute *attr, 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); struct hang_detect *hang_device = to_core_hang_dev(kobj);
return snprintf(buf, sizeof(hang_device->pmu_event_sel), return snprintf(buf, MAX_SYSFS_LEN, "0x%x\n",
"%u\n", hang_device->pmu_event_sel); hang_device->pmu_event_sel);
} }
static size_t store_pmu_event_sel(struct kobject *kobj, struct attribute *attr, 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); struct hang_detect *hang_device = to_core_hang_dev(kobj);
return snprintf(buf, sizeof(hang_device->enabled), return snprintf(buf, MAX_SYSFS_LEN, "%u\n", hang_device->enabled);
"%u\n", hang_device->enabled);
} }
static size_t store_enable(struct kobject *kobj, struct attribute *attr, static size_t store_enable(struct kobject *kobj, struct attribute *attr,

View file

@ -34,6 +34,7 @@
#define NR_GLA_REG 6 #define NR_GLA_REG 6
#define MODULE_NAME "gladiator_hang_detect" #define MODULE_NAME "gladiator_hang_detect"
#define MAX_THRES 0xFFFFFFFF #define MAX_THRES 0xFFFFFFFF
#define MAX_LEN_SYSFS 12
struct hang_detect { struct hang_detect {
phys_addr_t threshold[NR_GLA_REG]; 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; uint32_t reg_value;
get_enable(offset, hang_dev, &reg_value); get_enable(offset, hang_dev, &reg_value);
return snprintf(buf, sizeof(hang_dev->ACE_enable), return snprintf(buf, MAX_LEN_SYSFS, "%u\n", reg_value);
"%d\n", reg_value);
} }
static inline ssize_t generic_threshold_show(struct kobject *kobj, 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; uint32_t reg_value;
get_threshold(offset, hang_dev, &reg_value); get_threshold(offset, hang_dev, &reg_value);
return snprintf(buf, sizeof(hang_dev->ACE_threshold), return snprintf(buf, MAX_LEN_SYSFS, "0x%x\n", reg_value);
"%u\n", reg_value);
} }
static inline size_t generic_threshold_store(struct kobject *kobj, static inline size_t generic_threshold_store(struct kobject *kobj,