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

Configure Feed

Select the types of activity you want to include in your feed.

clockevents: Convert s[n]printf() 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().

Signed-off-by: Li Zhijian <lizhijian@fujitsu.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/r/20240314100402.1326582-2-lizhijian@fujitsu.com

authored by

Li Zhijian and committed by
Thomas Gleixner
98fe0fcb 8f0acb7f

+1 -1
+1 -1
kernel/time/clockevents.c
··· 677 677 raw_spin_lock_irq(&clockevents_lock); 678 678 td = tick_get_tick_dev(dev); 679 679 if (td && td->evtdev) 680 - count = snprintf(buf, PAGE_SIZE, "%s\n", td->evtdev->name); 680 + count = sysfs_emit(buf, "%s\n", td->evtdev->name); 681 681 raw_spin_unlock_irq(&clockevents_lock); 682 682 return count; 683 683 }