]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
staging: greybus: arche-platform: Use sysfs_emit instead of sprintf
authorShubham Chakraborty <chakrabortyshubham66@gmail.com>
Thu, 26 Feb 2026 06:52:39 +0000 (12:22 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 9 Mar 2026 16:02:34 +0000 (17:02 +0100)
Refactor sprintf to sysfs_emit in the show function of the arche platform
driver. This follows the standard kernel practice of using sysfs_emit for
sysfs attributes, ensuring consistent output formatting and newline
handling.

Signed-off-by: Shubham Chakraborty <chakrabortyshubham66@gmail.com>
Link: https://patch.msgid.link/20260226065239.11698-1-chakrabortyshubham66@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/greybus/arche-platform.c

index f669a7e2eb11da713dd9d9151e8b599bc9fdbc77..de5de59ea8ab2ab84e846a9702fc71eb991519ee 100644 (file)
@@ -374,15 +374,15 @@ static ssize_t state_show(struct device *dev,
 
        switch (arche_pdata->state) {
        case ARCHE_PLATFORM_STATE_OFF:
-               return sprintf(buf, "off\n");
+               return sysfs_emit(buf, "off\n");
        case ARCHE_PLATFORM_STATE_ACTIVE:
-               return sprintf(buf, "active\n");
+               return sysfs_emit(buf, "active\n");
        case ARCHE_PLATFORM_STATE_STANDBY:
-               return sprintf(buf, "standby\n");
+               return sysfs_emit(buf, "standby\n");
        case ARCHE_PLATFORM_STATE_FW_FLASHING:
-               return sprintf(buf, "fw_flashing\n");
+               return sysfs_emit(buf, "fw_flashing\n");
        default:
-               return sprintf(buf, "unknown state\n");
+               return sysfs_emit(buf, "unknown state\n");
        }
 }