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

mips: sgi-ip22: Replace "s[n]?printf" with sysfs_emit in sysfs callbacks

Replace open-coded pieces with sysfs_emit() helper in sysfs .show()
callbacks.

Signed-off-by: Paulo Miguel Almeida <paulo.miguel.almeida.rodenas@gmail.com>
Reviewed-by: Maciej W. Rozycki <macro@orcam.me.uk>
Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>

authored by

Paulo Miguel Almeida and committed by
Thomas Bogendoerfer
b2d5ca95 81983758

+3 -4
+3 -4
arch/mips/sgi-ip22/ip22-gio.c
··· 165 165 char *buf) 166 166 { 167 167 struct gio_device *gio_dev = to_gio_device(dev); 168 - int len = snprintf(buf, PAGE_SIZE, "gio:%x\n", gio_dev->id.id); 169 168 170 - return (len >= PAGE_SIZE) ? (PAGE_SIZE - 1) : len; 169 + return sysfs_emit(buf, "gio:%x\n", gio_dev->id.id); 171 170 } 172 171 static DEVICE_ATTR_RO(modalias); 173 172 ··· 176 177 struct gio_device *giodev; 177 178 178 179 giodev = to_gio_device(dev); 179 - return sprintf(buf, "%s", giodev->name); 180 + return sysfs_emit(buf, "%s\n", giodev->name); 180 181 } 181 182 static DEVICE_ATTR_RO(name); 182 183 ··· 186 187 struct gio_device *giodev; 187 188 188 189 giodev = to_gio_device(dev); 189 - return sprintf(buf, "%x", giodev->id.id); 190 + return sysfs_emit(buf, "%x\n", giodev->id.id); 190 191 } 191 192 static DEVICE_ATTR_RO(id); 192 193