s390/lcs: Convert sysfs sprintf to sysfs_emit
authorThorsten Winkler <twinkler@linux.ibm.com>
Wed, 21 Jun 2023 13:49:18 +0000 (15:49 +0200)
committerPaolo Abeni <pabeni@redhat.com>
Fri, 23 Jun 2023 09:55:54 +0000 (11:55 +0200)
Following the advice of the Documentation/filesystems/sysfs.rst.
All sysfs related show()-functions should only use sysfs_emit() or
sysfs_emit_at() when formatting the value to be returned to user space.

While at it, follow Linux kernel coding style and unify indentation

Reported-by: Jules Irenge <jbi.octave@gmail.com>
Reported-by: Joe Perches <joe@perches.com>
Reviewed-by: Alexandra Winter <wintera@linux.ibm.com>
Reviewed-by: Simon Horman <simon.horman@corigine.com>
Signed-off-by: Thorsten Winkler <twinkler@linux.ibm.com>
Signed-off-by: Alexandra Winter <wintera@linux.ibm.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
drivers/s390/net/lcs.c

index bb1092775dccc15f88d761d20d37876bdb21d3e7..a473d46ad6686266505b9b6403d982f18e13c7b1 100644 (file)
@@ -1899,14 +1899,14 @@ lcs_open_device(struct net_device *dev)
 static ssize_t
 lcs_portno_show (struct device *dev, struct device_attribute *attr, char *buf)
 {
-        struct lcs_card *card;
+       struct lcs_card *card;
 
        card = dev_get_drvdata(dev);
 
-        if (!card)
-                return 0;
+       if (!card)
+               return 0;
 
-        return sprintf(buf, "%d\n", card->portno);
+       return sysfs_emit(buf, "%d\n", card->portno);
 }
 
 /*
@@ -1956,7 +1956,8 @@ lcs_type_show(struct device *dev, struct device_attribute *attr, char *buf)
        if (!cgdev)
                return -ENODEV;
 
-       return sprintf(buf, "%s\n", lcs_type[cgdev->cdev[0]->id.driver_info]);
+       return sysfs_emit(buf, "%s\n",
+                         lcs_type[cgdev->cdev[0]->id.driver_info]);
 }
 
 static DEVICE_ATTR(type, 0444, lcs_type_show, NULL);
@@ -1968,7 +1969,7 @@ lcs_timeout_show(struct device *dev, struct device_attribute *attr, char *buf)
 
        card = dev_get_drvdata(dev);
 
-       return card ? sprintf(buf, "%u\n", card->lancmd_timeout) : 0;
+       return card ? sysfs_emit(buf, "%u\n", card->lancmd_timeout) : 0;
 }
 
 static ssize_t