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

s390/ctcm: Convert sysfs sprintf to sysfs_emit

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.

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>

authored by

Thorsten Winkler and committed by
Paolo Abeni
d585e4b7 1a079f3e

+5 -5
+5 -5
drivers/s390/net/ctcm_sysfs.c
··· 28 28 29 29 if (!priv) 30 30 return -ENODEV; 31 - return sprintf(buf, "%d\n", priv->buffer_size); 31 + return sysfs_emit(buf, "%d\n", priv->buffer_size); 32 32 } 33 33 34 34 static ssize_t ctcm_buffer_write(struct device *dev, ··· 120 120 if (!priv || gdev->state != CCWGROUP_ONLINE) 121 121 return -ENODEV; 122 122 ctcm_print_statistics(priv); 123 - return sprintf(buf, "0\n"); 123 + return sysfs_emit(buf, "0\n"); 124 124 } 125 125 126 126 static ssize_t stats_write(struct device *dev, struct device_attribute *attr, ··· 142 142 if (!priv) 143 143 return -ENODEV; 144 144 145 - return sprintf(buf, "%d\n", priv->protocol); 145 + return sysfs_emit(buf, "%d\n", priv->protocol); 146 146 } 147 147 148 148 static ssize_t ctcm_proto_store(struct device *dev, ··· 184 184 if (!cgdev) 185 185 return -ENODEV; 186 186 187 - return sprintf(buf, "%s\n", 188 - ctcm_type[cgdev->cdev[0]->id.driver_info]); 187 + return sysfs_emit(buf, "%s\n", 188 + ctcm_type[cgdev->cdev[0]->id.driver_info]); 189 189 } 190 190 191 191 static DEVICE_ATTR(buffer, 0644, ctcm_buffer_show, ctcm_buffer_write);