You need to sign in or sign up before continuing.
未验证 提交 04378630 编写于 作者: H Heiner Kallweit 提交者: Mark Brown

spi: use sysfs_emit() for printing statistics and add trailing newline

Use dedicated function sysfs_emit() that does some extra checking,
e.g. to ensure that no more than PAGESIZE bytes are written.
In addition add a trailing newline to the output, that makes it
better readable from the console.
Signed-off-by: NHeiner Kallweit <hkallweit1@gmail.com>
Link: https://lore.kernel.org/r/56e1588d-d53b-73e9-fdc8-7fe30bf91f11@gmail.comSigned-off-by: NMark Brown <broonie@kernel.org>
上级 07025cea
...@@ -143,7 +143,7 @@ static ssize_t spi_statistics_##name##_show(struct spi_statistics *stat, \ ...@@ -143,7 +143,7 @@ static ssize_t spi_statistics_##name##_show(struct spi_statistics *stat, \
unsigned long flags; \ unsigned long flags; \
ssize_t len; \ ssize_t len; \
spin_lock_irqsave(&stat->lock, flags); \ spin_lock_irqsave(&stat->lock, flags); \
len = sprintf(buf, format_string, stat->field); \ len = sysfs_emit(buf, format_string "\n", stat->field); \
spin_unlock_irqrestore(&stat->lock, flags); \ spin_unlock_irqrestore(&stat->lock, flags); \
return len; \ return len; \
} \ } \
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册