Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: ye xingchen <ye.xingchen@zte.com.cn>
Link: https://lore.kernel.org/r/202212061714501297954@zte.com.cn
Signed-off-by: Vinod Koul <vkoul@kernel.org>

authored by

ye xingchen and committed by
Vinod Koul
faab1234 3dfaa68f

+5 -7
+5 -7
drivers/dma/ppc4xx/adma.c
··· 4299 4299 for (i = 0; i < PPC440SPE_ADMA_ENGINES_NUM; i++) { 4300 4300 if (ppc440spe_adma_devices[i] == -1) 4301 4301 continue; 4302 - size += scnprintf(buf + size, PAGE_SIZE - size, 4303 - "PPC440SP(E)-ADMA.%d: %s\n", i, 4304 - ppc_adma_errors[ppc440spe_adma_devices[i]]); 4302 + size += sysfs_emit_at(buf, size, "PPC440SP(E)-ADMA.%d: %s\n", 4303 + i, ppc_adma_errors[ppc440spe_adma_devices[i]]); 4305 4304 } 4306 4305 return size; 4307 4306 } ··· 4308 4309 4309 4310 static ssize_t enable_show(struct device_driver *dev, char *buf) 4310 4311 { 4311 - return snprintf(buf, PAGE_SIZE, 4312 - "PPC440SP(e) RAID-6 capabilities are %sABLED.\n", 4313 - ppc440spe_r6_enabled ? "EN" : "DIS"); 4312 + return sysfs_emit(buf, "PPC440SP(e) RAID-6 capabilities are %sABLED.\n", 4313 + ppc440spe_r6_enabled ? "EN" : "DIS"); 4314 4314 } 4315 4315 4316 4316 static ssize_t enable_store(struct device_driver *dev, const char *buf, ··· 4360 4362 reg &= 0xFF; 4361 4363 #endif 4362 4364 4363 - size = snprintf(buf, PAGE_SIZE, "PPC440SP(e) RAID-6 driver " 4365 + size = sysfs_emit(buf, "PPC440SP(e) RAID-6 driver " 4364 4366 "uses 0x1%02x polynomial.\n", reg); 4365 4367 return size; 4366 4368 }