Skip to content

Commit d4db89c

Browse files
zhijianli88takaswie
authored andcommitted
firewire: Convert snprintf/sprintf to sysfs_emit
Per filesystems/sysfs.rst, show() should only use sysfs_emit() or sysfs_emit_at() when formatting the value to be returned to user space. coccinelle complains that there are still a couple of functions that use snprintf(). Convert them to sysfs_emit(). > drivers/firewire/core-device.c:326:8-16: WARNING: please use sysfs_emit or sysfs_emit_at No functional change intended Signed-off-by: Li Zhijian <lizhijian@fujitsu.com> Link: https://lore.kernel.org/r/20240122053942.80648-2-lizhijian@fujitsu.com Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
1 parent 4a2b06c commit d4db89c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/firewire/core-device.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ static ssize_t show_immediate(struct device *dev,
322322
if (value < 0)
323323
return -ENOENT;
324324

325-
return snprintf(buf, PAGE_SIZE, "0x%06x\n", value);
325+
return sysfs_emit(buf, "0x%06x\n", value);
326326
}
327327

328328
#define IMMEDIATE_ATTR(name, key) \
@@ -482,7 +482,7 @@ static ssize_t is_local_show(struct device *dev,
482482
{
483483
struct fw_device *device = fw_device(dev);
484484

485-
return sprintf(buf, "%u\n", device->is_local);
485+
return sysfs_emit(buf, "%u\n", device->is_local);
486486
}
487487

488488
static int units_sprintf(char *buf, const u32 *directory)

0 commit comments

Comments
 (0)