Commit faab1234 authored by ye xingchen's avatar ye xingchen Committed by Vinod Koul

dmaengine: ppc4xx: Convert to use sysfs_emit()/sysfs_emit_at() APIs

Follow the advice of the Documentation/filesystems/sysfs.rst and show()
should only use sysfs_emit() or sysfs_emit_at() when formatting the
value to be returned to user space.
Signed-off-by: default avatarye xingchen <ye.xingchen@zte.com.cn>
Link: https://lore.kernel.org/r/202212061714501297954@zte.com.cnSigned-off-by: default avatarVinod Koul <vkoul@kernel.org>
parent 3dfaa68f
...@@ -4299,9 +4299,8 @@ static ssize_t devices_show(struct device_driver *dev, char *buf) ...@@ -4299,9 +4299,8 @@ static ssize_t devices_show(struct device_driver *dev, char *buf)
for (i = 0; i < PPC440SPE_ADMA_ENGINES_NUM; i++) { for (i = 0; i < PPC440SPE_ADMA_ENGINES_NUM; i++) {
if (ppc440spe_adma_devices[i] == -1) if (ppc440spe_adma_devices[i] == -1)
continue; continue;
size += scnprintf(buf + size, PAGE_SIZE - size, size += sysfs_emit_at(buf, size, "PPC440SP(E)-ADMA.%d: %s\n",
"PPC440SP(E)-ADMA.%d: %s\n", i, i, ppc_adma_errors[ppc440spe_adma_devices[i]]);
ppc_adma_errors[ppc440spe_adma_devices[i]]);
} }
return size; return size;
} }
...@@ -4309,8 +4308,7 @@ static DRIVER_ATTR_RO(devices); ...@@ -4309,8 +4308,7 @@ static DRIVER_ATTR_RO(devices);
static ssize_t enable_show(struct device_driver *dev, char *buf) static ssize_t enable_show(struct device_driver *dev, char *buf)
{ {
return snprintf(buf, PAGE_SIZE, return sysfs_emit(buf, "PPC440SP(e) RAID-6 capabilities are %sABLED.\n",
"PPC440SP(e) RAID-6 capabilities are %sABLED.\n",
ppc440spe_r6_enabled ? "EN" : "DIS"); ppc440spe_r6_enabled ? "EN" : "DIS");
} }
...@@ -4362,7 +4360,7 @@ static ssize_t poly_show(struct device_driver *dev, char *buf) ...@@ -4362,7 +4360,7 @@ static ssize_t poly_show(struct device_driver *dev, char *buf)
reg &= 0xFF; reg &= 0xFF;
#endif #endif
size = snprintf(buf, PAGE_SIZE, "PPC440SP(e) RAID-6 driver " size = sysfs_emit(buf, "PPC440SP(e) RAID-6 driver "
"uses 0x1%02x polynomial.\n", reg); "uses 0x1%02x polynomial.\n", reg);
return size; return size;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment