Skip to content

Commit

Permalink
s390/ctcm: Convert sysfs sprintf to sysfs_emit
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Thorsten Winkler authored and Paolo Abeni committed Jun 23, 2023
1 parent 1a079f3 commit d585e4b
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions drivers/s390/net/ctcm_sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ static ssize_t ctcm_buffer_show(struct device *dev,

if (!priv)
return -ENODEV;
return sprintf(buf, "%d\n", priv->buffer_size);
return sysfs_emit(buf, "%d\n", priv->buffer_size);
}

static ssize_t ctcm_buffer_write(struct device *dev,
Expand Down Expand Up @@ -120,7 +120,7 @@ static ssize_t stats_show(struct device *dev,
if (!priv || gdev->state != CCWGROUP_ONLINE)
return -ENODEV;
ctcm_print_statistics(priv);
return sprintf(buf, "0\n");
return sysfs_emit(buf, "0\n");
}

static ssize_t stats_write(struct device *dev, struct device_attribute *attr,
Expand All @@ -142,7 +142,7 @@ static ssize_t ctcm_proto_show(struct device *dev,
if (!priv)
return -ENODEV;

return sprintf(buf, "%d\n", priv->protocol);
return sysfs_emit(buf, "%d\n", priv->protocol);
}

static ssize_t ctcm_proto_store(struct device *dev,
Expand Down Expand Up @@ -184,8 +184,8 @@ static ssize_t ctcm_type_show(struct device *dev,
if (!cgdev)
return -ENODEV;

return sprintf(buf, "%s\n",
ctcm_type[cgdev->cdev[0]->id.driver_info]);
return sysfs_emit(buf, "%s\n",
ctcm_type[cgdev->cdev[0]->id.driver_info]);
}

static DEVICE_ATTR(buffer, 0644, ctcm_buffer_show, ctcm_buffer_write);
Expand Down

0 comments on commit d585e4b

Please sign in to comment.