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>
This commit is contained in:

committed by
Greg Kroah-Hartman

parent
aa838896d8
commit
973c39115c
@@ -404,17 +404,23 @@ static ssize_t type_show(struct device *dev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
struct cacheinfo *this_leaf = dev_get_drvdata(dev);
|
||||
const char *output;
|
||||
|
||||
switch (this_leaf->type) {
|
||||
case CACHE_TYPE_DATA:
|
||||
return sysfs_emit(buf, "Data\n");
|
||||
output = "Data";
|
||||
break;
|
||||
case CACHE_TYPE_INST:
|
||||
return sysfs_emit(buf, "Instruction\n");
|
||||
output = "Instruction";
|
||||
break;
|
||||
case CACHE_TYPE_UNIFIED:
|
||||
return sysfs_emit(buf, "Unified\n");
|
||||
output = "Unified";
|
||||
break;
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
return sysfs_emit(buf, "%s\n", output);
|
||||
}
|
||||
|
||||
static ssize_t allocation_policy_show(struct device *dev,
|
||||
@@ -422,15 +428,18 @@ static ssize_t allocation_policy_show(struct device *dev,
|
||||
{
|
||||
struct cacheinfo *this_leaf = dev_get_drvdata(dev);
|
||||
unsigned int ci_attr = this_leaf->attributes;
|
||||
int n = 0;
|
||||
const char *output;
|
||||
|
||||
if ((ci_attr & CACHE_READ_ALLOCATE) && (ci_attr & CACHE_WRITE_ALLOCATE))
|
||||
n = sysfs_emit(buf, "ReadWriteAllocate\n");
|
||||
output = "ReadWriteAllocate";
|
||||
else if (ci_attr & CACHE_READ_ALLOCATE)
|
||||
n = sysfs_emit(buf, "ReadAllocate\n");
|
||||
output = "ReadAllocate";
|
||||
else if (ci_attr & CACHE_WRITE_ALLOCATE)
|
||||
n = sysfs_emit(buf, "WriteAllocate\n");
|
||||
return n;
|
||||
output = "WriteAllocate";
|
||||
else
|
||||
return 0;
|
||||
|
||||
return sysfs_emit(buf, "%s\n", output);
|
||||
}
|
||||
|
||||
static ssize_t write_policy_show(struct device *dev,
|
||||
|
Reference in New Issue
Block a user