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

firmware: stratix10-rsu: replace scnprintf() with sysfs_emit() in *_show() functions

Replace scnprintf() with sysfs_emit() in sysfs *_show() functions
in stratix10-rsu.c to follow the kernel's guidelines from
Documentation/filesystems/sysfs.rst.

This improves consistency, safety, and makes the code easier to
maintain and update in the future.

Signed-off-by: Rahul Kumar <rk0006818@gmail.com>
Signed-off-by: Dinh Nguyen <dinguyen@kernel.org>

authored by

Rahul Kumar and committed by
Dinh Nguyen
4f7ffdfb 15847537

+3 -4
+3 -4
drivers/firmware/stratix10-rsu.c
··· 478 478 if (!priv) 479 479 return -ENODEV; 480 480 481 - return scnprintf(buf, sizeof(priv->max_retry), 482 - "0x%08x\n", priv->max_retry); 481 + return sysfs_emit(buf, "0x%08x\n", priv->max_retry); 483 482 } 484 483 485 484 static ssize_t dcmf0_show(struct device *dev, ··· 648 649 if (priv->spt0_address == INVALID_SPT_ADDRESS) 649 650 return -EIO; 650 651 651 - return scnprintf(buf, PAGE_SIZE, "0x%08lx\n", priv->spt0_address); 652 + return sysfs_emit(buf, "0x%08lx\n", priv->spt0_address); 652 653 } 653 654 654 655 static ssize_t spt1_address_show(struct device *dev, ··· 662 663 if (priv->spt1_address == INVALID_SPT_ADDRESS) 663 664 return -EIO; 664 665 665 - return scnprintf(buf, PAGE_SIZE, "0x%08lx\n", priv->spt1_address); 666 + return sysfs_emit(buf, "0x%08lx\n", priv->spt1_address); 666 667 } 667 668 668 669 static DEVICE_ATTR_RO(current_image);