From: Chelsy Ratnawat Date: Fri, 22 Aug 2025 11:28:04 +0000 (-0700) Subject: accel/qaic: Replace snprintf() with sysfs_emit() in sysfs show functions X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e68c994445e37322eac1f255489eb4564935969a;p=thirdparty%2Fkernel%2Flinux.git 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 Reviewed-by: Jeff Hugo [jhugo: Fix commit text typos] Signed-off-by: Jeff Hugo Link: https://lore.kernel.org/r/20250822112804.1726592-1-chelsyratnawat2001@gmail.com --- diff --git a/drivers/accel/qaic/qaic_ras.c b/drivers/accel/qaic/qaic_ras.c index 914ffc4a9970d..f1d52a710136a 100644 --- a/drivers/accel/qaic/qaic_ras.c +++ b/drivers/accel/qaic/qaic_ras.c @@ -514,21 +514,21 @@ static ssize_t ce_count_show(struct device *dev, struct device_attribute *attr, { struct qaic_device *qdev = pci_get_drvdata(to_pci_dev(dev)); - return snprintf(buf, PAGE_SIZE, "%d\n", qdev->ce_count); + return sysfs_emit(buf, "%d\n", qdev->ce_count); } static ssize_t ue_count_show(struct device *dev, struct device_attribute *attr, char *buf) { struct qaic_device *qdev = pci_get_drvdata(to_pci_dev(dev)); - return snprintf(buf, PAGE_SIZE, "%d\n", qdev->ue_count); + return sysfs_emit(buf, "%d\n", qdev->ue_count); } static ssize_t ue_nonfatal_count_show(struct device *dev, struct device_attribute *attr, char *buf) { struct qaic_device *qdev = pci_get_drvdata(to_pci_dev(dev)); - return snprintf(buf, PAGE_SIZE, "%d\n", qdev->ue_nf_count); + return sysfs_emit(buf, "%d\n", qdev->ue_nf_count); } static DEVICE_ATTR_RO(ce_count);