Skip to content

Commit b2d5ca9

Browse files
PauloMigAlmeidatsbogend
authored andcommitted
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 <[email protected]> Reviewed-by: Maciej W. Rozycki <[email protected]> Signed-off-by: Thomas Bogendoerfer <[email protected]>
1 parent 8198375 commit b2d5ca9

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

arch/mips/sgi-ip22/ip22-gio.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -165,9 +165,8 @@ static ssize_t modalias_show(struct device *dev, struct device_attribute *a,
165165
char *buf)
166166
{
167167
struct gio_device *gio_dev = to_gio_device(dev);
168-
int len = snprintf(buf, PAGE_SIZE, "gio:%x\n", gio_dev->id.id);
169168

170-
return (len >= PAGE_SIZE) ? (PAGE_SIZE - 1) : len;
169+
return sysfs_emit(buf, "gio:%x\n", gio_dev->id.id);
171170
}
172171
static DEVICE_ATTR_RO(modalias);
173172

@@ -177,7 +176,7 @@ static ssize_t name_show(struct device *dev,
177176
struct gio_device *giodev;
178177

179178
giodev = to_gio_device(dev);
180-
return sprintf(buf, "%s", giodev->name);
179+
return sysfs_emit(buf, "%s\n", giodev->name);
181180
}
182181
static DEVICE_ATTR_RO(name);
183182

@@ -187,7 +186,7 @@ static ssize_t id_show(struct device *dev,
187186
struct gio_device *giodev;
188187

189188
giodev = to_gio_device(dev);
190-
return sprintf(buf, "%x", giodev->id.id);
189+
return sysfs_emit(buf, "%x\n", giodev->id.id);
191190
}
192191
static DEVICE_ATTR_RO(id);
193192

0 commit comments

Comments
 (0)