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

accel/qaic: Replace snprintf() with sysfs_emit() in sysfs show functions

Documentation/filesystems/sysfs.rst mentions that show() should only
use sysfs_emit() or sysfs_emit_at() when formatting the value to be
returned to user space. So replace snprintf() with sysfs_emit().

Signed-off-by: Chelsy Ratnawat <chelsyratnawat2001@gmail.com>
Reviewed-by: Jeff Hugo <jeff.hugo@oss.qualcomm.com>
[jhugo: Fix commit text typos]
Signed-off-by: Jeff Hugo <jeff.hugo@oss.qualcomm.com>
Link: https://lore.kernel.org/r/20250822112804.1726592-1-chelsyratnawat2001@gmail.com

authored by

Chelsy Ratnawat and committed by
Jeff Hugo
e68c9944 bed12912

+3 -3
+3 -3
drivers/accel/qaic/qaic_ras.c
··· 514 514 { 515 515 struct qaic_device *qdev = pci_get_drvdata(to_pci_dev(dev)); 516 516 517 - return snprintf(buf, PAGE_SIZE, "%d\n", qdev->ce_count); 517 + return sysfs_emit(buf, "%d\n", qdev->ce_count); 518 518 } 519 519 520 520 static ssize_t ue_count_show(struct device *dev, struct device_attribute *attr, char *buf) 521 521 { 522 522 struct qaic_device *qdev = pci_get_drvdata(to_pci_dev(dev)); 523 523 524 - return snprintf(buf, PAGE_SIZE, "%d\n", qdev->ue_count); 524 + return sysfs_emit(buf, "%d\n", qdev->ue_count); 525 525 } 526 526 527 527 static ssize_t ue_nonfatal_count_show(struct device *dev, struct device_attribute *attr, char *buf) 528 528 { 529 529 struct qaic_device *qdev = pci_get_drvdata(to_pci_dev(dev)); 530 530 531 - return snprintf(buf, PAGE_SIZE, "%d\n", qdev->ue_nf_count); 531 + return sysfs_emit(buf, "%d\n", qdev->ue_nf_count); 532 532 } 533 533 534 534 static DEVICE_ATTR_RO(ce_count);