diff options
author | Joe Perches <joe@perches.com> | 2020-09-16 22:40:40 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2020-10-02 13:09:10 +0200 |
commit | 973c39115cb308b6b1fe64b4f342996f3eef06d0 (patch) | |
tree | ea2fbd252ceebb4299ea0c03b42929464232adc0 /drivers/base/power | |
parent | drivers core: Use sysfs_emit and sysfs_emit_at for show(device *...) functions (diff) | |
download | linux-973c39115cb308b6b1fe64b4f342996f3eef06d0.tar.xz linux-973c39115cb308b6b1fe64b4f342996f3eef06d0.zip |
drivers core: Remove strcat uses around sysfs_emit and neaten
strcat is no longer necessary for sysfs_emit and sysfs_emit_at uses.
Convert the strcat uses to sysfs_emit calls and neaten other block
uses of direct returns to use an intermediate const char *.
Signed-off-by: Joe Perches <joe@perches.com>
Link: https://lore.kernel.org/r/5d606519698ce4c8f1203a2b35797d8254c6050a.1600285923.git.joe@perches.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/base/power')
-rw-r--r-- | drivers/base/power/sysfs.c | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/drivers/base/power/sysfs.c b/drivers/base/power/sysfs.c index 4276b792d0aa..61e16786f6c5 100644 --- a/drivers/base/power/sysfs.c +++ b/drivers/base/power/sysfs.c @@ -255,9 +255,9 @@ static ssize_t pm_qos_latency_tolerance_us_show(struct device *dev, s32 value = dev_pm_qos_get_user_latency_tolerance(dev); if (value < 0) - return sysfs_emit(buf, "auto\n"); + return sysfs_emit(buf, "%s\n", "auto"); if (value == PM_QOS_LATENCY_ANY) - return sysfs_emit(buf, "any\n"); + return sysfs_emit(buf, "%s\n", "any"); return sysfs_emit(buf, "%d\n", value); } @@ -538,13 +538,18 @@ static DEVICE_ATTR_RO(runtime_active_kids); static ssize_t runtime_enabled_show(struct device *dev, struct device_attribute *attr, char *buf) { - if (dev->power.disable_depth && (dev->power.runtime_auto == false)) - return sysfs_emit(buf, "disabled & forbidden\n"); - if (dev->power.disable_depth) - return sysfs_emit(buf, "disabled\n"); - if (dev->power.runtime_auto == false) - return sysfs_emit(buf, "forbidden\n"); - return sysfs_emit(buf, "enabled\n"); + const char *output; + + if (dev->power.disable_depth && !dev->power.runtime_auto) + output = "disabled & forbidden"; + else if (dev->power.disable_depth) + output = "disabled"; + else if (!dev->power.runtime_auto) + output = "forbidden"; + else + output = "enabled"; + + return sysfs_emit(buf, "%s\n", output); } static DEVICE_ATTR_RO(runtime_enabled); |