Re: [PATCH v2 2/2] staging: greybus: switch sysfs show paths to sysfs_emit()
From: Greg KH
Date: Mon Mar 30 2026 - 11:35:00 EST
On Sun, Mar 29, 2026 at 08:41:24PM +0200, Yug Merabtene wrote:
> Signed-off-by: Yug Merabtene <yug.merabtene@xxxxxxxxx>
> ---
> drivers/staging/greybus/arche-apb-ctrl.c | 12 ++++++------
> drivers/staging/greybus/arche-platform.c | 10 +++++-----
> drivers/staging/greybus/audio_manager_module.c | 12 ++++++------
> drivers/staging/greybus/gbphy.c | 2 +-
> drivers/staging/greybus/light.c | 4 ++--
> drivers/staging/greybus/loopback.c | 14 +++++++-------
> 6 files changed, 27 insertions(+), 27 deletions(-)
>
> diff --git a/drivers/staging/greybus/arche-apb-ctrl.c b/drivers/staging/greybus/arche-apb-ctrl.c
> index 33f26a65f0cc..10effbe07a2a 100644
> --- a/drivers/staging/greybus/arche-apb-ctrl.c
> +++ b/drivers/staging/greybus/arche-apb-ctrl.c
> @@ -300,16 +300,16 @@ static ssize_t state_show(struct device *dev,
>
> switch (apb->state) {
> case ARCHE_PLATFORM_STATE_OFF:
> - return sprintf(buf, "off%s\n",
> - apb->init_disabled ? ",disabled" : "");
> + return sysfs_emit(buf, "off%s\n",
> + apb->init_disabled ? ",disabled" : "");
> 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");
> }
> }
>
> diff --git a/drivers/staging/greybus/arche-platform.c b/drivers/staging/greybus/arche-platform.c
> index f669a7e2eb11..de5de59ea8ab 100644
> --- a/drivers/staging/greybus/arche-platform.c
> +++ b/drivers/staging/greybus/arche-platform.c
> @@ -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");
> }
> }
>
> diff --git a/drivers/staging/greybus/audio_manager_module.c b/drivers/staging/greybus/audio_manager_module.c
> index e87b82ca6d8a..f22ee73eb8d2 100644
> --- a/drivers/staging/greybus/audio_manager_module.c
> +++ b/drivers/staging/greybus/audio_manager_module.c
> @@ -76,7 +76,7 @@ static void gb_audio_module_release(struct kobject *kobj)
> static ssize_t gb_audio_module_name_show(struct gb_audio_manager_module *module,
> struct gb_audio_manager_module_attribute *attr, char *buf)
> {
> - return sprintf(buf, "%s", module->desc.name);
> + return sysfs_emit(buf, "%s\n", module->desc.name);
> }
>
> static struct gb_audio_manager_module_attribute gb_audio_module_name_attribute =
> @@ -85,7 +85,7 @@ static struct gb_audio_manager_module_attribute gb_audio_module_name_attribute =
> static ssize_t gb_audio_module_vid_show(struct gb_audio_manager_module *module,
> struct gb_audio_manager_module_attribute *attr, char *buf)
> {
> - return sprintf(buf, "%d", module->desc.vid);
> + return sysfs_emit(buf, "%d\n", module->desc.vid);
> }
>
> static struct gb_audio_manager_module_attribute gb_audio_module_vid_attribute =
> @@ -94,7 +94,7 @@ static struct gb_audio_manager_module_attribute gb_audio_module_vid_attribute =
> static ssize_t gb_audio_module_pid_show(struct gb_audio_manager_module *module,
> struct gb_audio_manager_module_attribute *attr, char *buf)
> {
> - return sprintf(buf, "%d", module->desc.pid);
> + return sysfs_emit(buf, "%d\n", module->desc.pid);
> }
>
> static struct gb_audio_manager_module_attribute gb_audio_module_pid_attribute =
> @@ -104,7 +104,7 @@ static ssize_t gb_audio_module_intf_id_show(struct gb_audio_manager_module *modu
> struct gb_audio_manager_module_attribute *attr,
> char *buf)
> {
> - return sprintf(buf, "%d", module->desc.intf_id);
> + return sysfs_emit(buf, "%d\n", module->desc.intf_id);
> }
>
> static struct gb_audio_manager_module_attribute
> @@ -115,7 +115,7 @@ static ssize_t gb_audio_module_ip_devices_show(struct gb_audio_manager_module *m
> struct gb_audio_manager_module_attribute *attr,
> char *buf)
> {
> - return sprintf(buf, "0x%X", module->desc.ip_devices);
> + return sysfs_emit(buf, "0x%X\n", module->desc.ip_devices);
> }
>
> static struct gb_audio_manager_module_attribute
> @@ -126,7 +126,7 @@ static ssize_t gb_audio_module_op_devices_show(struct gb_audio_manager_module *m
> struct gb_audio_manager_module_attribute *attr,
> char *buf)
> {
> - return sprintf(buf, "0x%X", module->desc.op_devices);
> + return sysfs_emit(buf, "0x%X\n", module->desc.op_devices);
> }
>
> static struct gb_audio_manager_module_attribute
> diff --git a/drivers/staging/greybus/gbphy.c b/drivers/staging/greybus/gbphy.c
> index bdb0f5164a6f..bb9a5b538e6e 100644
> --- a/drivers/staging/greybus/gbphy.c
> +++ b/drivers/staging/greybus/gbphy.c
> @@ -31,7 +31,7 @@ static ssize_t protocol_id_show(struct device *dev,
> {
> struct gbphy_device *gbphy_dev = to_gbphy_dev(dev);
>
> - return sprintf(buf, "0x%02x\n", gbphy_dev->cport_desc->protocol_id);
> + return sysfs_emit(buf, "0x%02x\n", gbphy_dev->cport_desc->protocol_id);
> }
> static DEVICE_ATTR_RO(protocol_id);
>
> diff --git a/drivers/staging/greybus/light.c b/drivers/staging/greybus/light.c
> index cab02b5da867..2689f9a7524a 100644
> --- a/drivers/staging/greybus/light.c
> +++ b/drivers/staging/greybus/light.c
> @@ -173,7 +173,7 @@ static ssize_t fade_##__dir##_show(struct device *dev, \
> struct led_classdev *cdev = dev_get_drvdata(dev); \
> struct gb_channel *channel = get_channel_from_cdev(cdev); \
> \
> - return sprintf(buf, "%u\n", channel->fade_##__dir); \
> + return sysfs_emit(buf, "%u\n", channel->fade_##__dir); \
> } \
> \
> static ssize_t fade_##__dir##_store(struct device *dev, \
> @@ -220,7 +220,7 @@ static ssize_t color_show(struct device *dev, struct device_attribute *attr,
> struct led_classdev *cdev = dev_get_drvdata(dev);
> struct gb_channel *channel = get_channel_from_cdev(cdev);
>
> - return sprintf(buf, "0x%08x\n", channel->color);
> + return sysfs_emit(buf, "0x%08x\n", channel->color);
> }
>
> static ssize_t color_store(struct device *dev, struct device_attribute *attr,
> diff --git a/drivers/staging/greybus/loopback.c b/drivers/staging/greybus/loopback.c
> index aa9c73cb0ae5..3a502d89d19f 100644
> --- a/drivers/staging/greybus/loopback.c
> +++ b/drivers/staging/greybus/loopback.c
> @@ -125,7 +125,7 @@ static ssize_t field##_show(struct device *dev, \
> char *buf) \
> { \
> struct gb_loopback *gb = dev_get_drvdata(dev); \
> - return sprintf(buf, "%u\n", gb->field); \
> + return sysfs_emit(buf, "%u\n", gb->field); \
> } \
> static DEVICE_ATTR_RO(field)
>
> @@ -137,8 +137,8 @@ static ssize_t name##_##field##_show(struct device *dev, \
> struct gb_loopback *gb = dev_get_drvdata(dev); \
> /* Report 0 for min and max if no transfer succeeded */ \
> if (!gb->requests_completed) \
> - return sprintf(buf, "0\n"); \
> - return sprintf(buf, "%" #type "\n", gb->name.field); \
> + return sysfs_emit(buf, "0\n"); \
> + return sysfs_emit(buf, "%" #type "\n", gb->name.field); \
> } \
> static DEVICE_ATTR_RO(name##_##field)
>
> @@ -158,7 +158,7 @@ static ssize_t name##_avg_show(struct device *dev, \
> rem = do_div(avg, count); \
> rem *= 1000000; \
> do_div(rem, count); \
> - return sprintf(buf, "%llu.%06u\n", avg, (u32)rem); \
> + return sysfs_emit(buf, "%llu.%06u\n", avg, (u32)rem); \
> } \
> static DEVICE_ATTR_RO(name##_avg)
>
> @@ -173,7 +173,7 @@ static ssize_t field##_show(struct device *dev, \
> char *buf) \
> { \
> struct gb_loopback *gb = dev_get_drvdata(dev); \
> - return sprintf(buf, "%" #type "\n", gb->field); \
> + return sysfs_emit(buf, "%" #type "\n", gb->field); \
> } \
> static ssize_t field##_store(struct device *dev, \
> struct device_attribute *attr, \
> @@ -199,7 +199,7 @@ static ssize_t field##_show(struct device *dev, \
> char *buf) \
> { \
> struct gb_loopback *gb = dev_get_drvdata(dev); \
> - return sprintf(buf, "%u\n", gb->field); \
> + return sysfs_emit(buf, "%u\n", gb->field); \
> } \
> static DEVICE_ATTR_RO(field)
>
> @@ -209,7 +209,7 @@ static ssize_t field##_show(struct device *dev, \
> char *buf) \
> { \
> struct gb_loopback *gb = dev_get_drvdata(dev); \
> - return sprintf(buf, "%" #type "\n", gb->field); \
> + return sysfs_emit(buf, "%" #type "\n", gb->field); \
> } \
> static ssize_t field##_store(struct device *dev, \
> struct device_attribute *attr, \
> --
> 2.34.1
>
Hi,
This is the friendly patch-bot of Greg Kroah-Hartman. You have sent him
a patch that has triggered this response. He used to manually respond
to these common problems, but in order to save his sanity (he kept
writing the same thing over and over, yet to different people), I was
created. Hopefully you will not take offence and will fix the problem
in your patch and resubmit it so that it can be accepted into the Linux
kernel tree.
You are receiving this message because of the following common error(s)
as indicated below:
- You did not specify a description of why the patch is needed, or
possibly, any description at all, in the email body. Please read the
section entitled "The canonical patch format" in the kernel file,
Documentation/process/submitting-patches.rst for what is needed in
order to properly describe the change.
If you wish to discuss this problem further, or you have questions about
how to resolve this issue, please feel free to respond to this email and
Greg will reply once he has dug out from the pending patches received
from other developers.
thanks,
greg k-h's patch email bot