sysfs_emit outputs in audio_manager_module.c do not include a terminating newline, which is required for proper sysfs formatting.
Add newline characters to all sysfs_emit format strings.
Signed-off-by: Shivam Gupta shivgupta751157@gmail.com --- drivers/staging/greybus/audio_manager_module.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/staging/greybus/audio_manager_module.c b/drivers/staging/greybus/audio_manager_module.c index dc90cc2d2308..5737f2a32f5a 100644 --- a/drivers/staging/greybus/audio_manager_module.c +++ b/drivers/staging/greybus/audio_manager_module.c @@ -75,7 +75,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 sysfs_emit(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 = @@ -84,7 +84,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 sysfs_emit(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 = @@ -93,7 +93,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 sysfs_emit(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 = @@ -103,7 +103,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 sysfs_emit(buf, "%d", module->desc.intf_id); + return sysfs_emit(buf, "%d\n", module->desc.intf_id); }
static struct gb_audio_manager_module_attribute @@ -114,7 +114,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 sysfs_emit(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 @@ -125,7 +125,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 sysfs_emit(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
On Sat, Mar 28, 2026 at 10:15:27AM +0530, Shivam Gupta wrote:
sysfs_emit outputs in audio_manager_module.c do not include a terminating newline, which is required for proper sysfs formatting.
Add newline characters to all sysfs_emit format strings.
Signed-off-by: Shivam Gupta shivgupta751157@gmail.com
You just changed the user/kernel api here, are you _sure_ it is ok to do so? What tools just broke or were used to test this? What tool asked you to make this change?
thanks,
greg k-h
On Sat, Mar 28, 2026 at 10:15:27AM +0530, Shivam Gupta wrote:
sysfs_emit outputs in audio_manager_module.c do not include a terminating newline, which is required for proper sysfs formatting.
Add newline characters to all sysfs_emit format strings.
Signed-off-by: Shivam Gupta shivgupta751157@gmail.com
You just changed the user/kernel api here, are you _sure_ it is ok to do so? What tools just broke or were used to test this? What tool asked you to make this change?
thanks,
greg k-h
I'm not the author, but I've been going through the staging tree, running checkpatch on various files, and reading documentation to get started with kernel development. This particular file (`drivers/staging/greybus/audio_manager_module.c`) triggers checkpatch warnings about missing newlines in `sysfs_emit` calls.
It seems fine to make this change tho, as it reflects the proper kernel API documented in `Documentation/filesystems/sysfs.rst`. One of the examples at line 266 shows the intended behaviour as:
static ssize_t show_name(struct device *dev, struct device_attribute *attr, char *buf) { return sysfs_emit(buf, "%s\n", dev->name); }
So to answer the question: checkpatch flagged it, and the kernel documentation confirms this is the correct usage of the function.
Happy to help.
Hadi Chokr
The "don't break user space" rule is more important than style guidelines.
regards, dan carpenter
On Sat, Mar 28, 2026 at 10:15:27AM +0530, Shivam Gupta wrote:
sysfs_emit outputs in audio_manager_module.c do not include a terminating newline, which is required for proper sysfs formatting.
Add newline characters to all sysfs_emit format strings.
Signed-off-by: Shivam Gupta shivgupta751157@gmail.com
"Proper sysfs format" is all well and good, but this is something which already exists and adding a newline is changing the API. If you were a maintainer of this code, then I would have more confidence that you know all the user space code which uses this API and are able to test it thouroughly.
We merged a similar change recently and, whatever, that's fine, probably it doesn't break anything. But the more we do it, the more likely we are to break something so my instinct is that we should discourage this kind of change.
regards, dan carpenter