mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-12-29 09:16:33 +00:00
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>
This commit is contained in:
parent
8198375843
commit
b2d5ca95ec
@ -165,9 +165,8 @@ static ssize_t modalias_show(struct device *dev, struct device_attribute *a,
|
||||
char *buf)
|
||||
{
|
||||
struct gio_device *gio_dev = to_gio_device(dev);
|
||||
int len = snprintf(buf, PAGE_SIZE, "gio:%x\n", gio_dev->id.id);
|
||||
|
||||
return (len >= PAGE_SIZE) ? (PAGE_SIZE - 1) : len;
|
||||
return sysfs_emit(buf, "gio:%x\n", gio_dev->id.id);
|
||||
}
|
||||
static DEVICE_ATTR_RO(modalias);
|
||||
|
||||
@ -177,7 +176,7 @@ static ssize_t name_show(struct device *dev,
|
||||
struct gio_device *giodev;
|
||||
|
||||
giodev = to_gio_device(dev);
|
||||
return sprintf(buf, "%s", giodev->name);
|
||||
return sysfs_emit(buf, "%s\n", giodev->name);
|
||||
}
|
||||
static DEVICE_ATTR_RO(name);
|
||||
|
||||
@ -187,7 +186,7 @@ static ssize_t id_show(struct device *dev,
|
||||
struct gio_device *giodev;
|
||||
|
||||
giodev = to_gio_device(dev);
|
||||
return sprintf(buf, "%x", giodev->id.id);
|
||||
return sysfs_emit(buf, "%x\n", giodev->id.id);
|
||||
}
|
||||
static DEVICE_ATTR_RO(id);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user