mirror of
git://git.yoctoproject.org/linux-yocto.git
synced 2025-10-23 07:23:12 +02: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)
|
char *buf)
|
||||||
{
|
{
|
||||||
struct gio_device *gio_dev = to_gio_device(dev);
|
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);
|
static DEVICE_ATTR_RO(modalias);
|
||||||
|
|
||||||
|
@ -177,7 +176,7 @@ static ssize_t name_show(struct device *dev,
|
||||||
struct gio_device *giodev;
|
struct gio_device *giodev;
|
||||||
|
|
||||||
giodev = to_gio_device(dev);
|
giodev = to_gio_device(dev);
|
||||||
return sprintf(buf, "%s", giodev->name);
|
return sysfs_emit(buf, "%s\n", giodev->name);
|
||||||
}
|
}
|
||||||
static DEVICE_ATTR_RO(name);
|
static DEVICE_ATTR_RO(name);
|
||||||
|
|
||||||
|
@ -187,7 +186,7 @@ static ssize_t id_show(struct device *dev,
|
||||||
struct gio_device *giodev;
|
struct gio_device *giodev;
|
||||||
|
|
||||||
giodev = to_gio_device(dev);
|
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);
|
static DEVICE_ATTR_RO(id);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user