提交 40e171c2 编写于 作者: A Andy Shevchenko 提交者: Vinod Koul

dmaengine: use sysfs_emit() to instead of scnprintf()

Follow the advice of the Documentation/filesystems/sysfs.rst and show()
should only use sysfs_emit() or sysfs_emit_at() when formatting the
value to be returned to user space.
Signed-off-by: NAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20230130111141.59627-1-andriy.shevchenko@linux.intel.comSigned-off-by: NVinod Koul <vkoul@kernel.org>
上级 8b544310
...@@ -172,7 +172,7 @@ static ssize_t memcpy_count_show(struct device *dev, ...@@ -172,7 +172,7 @@ static ssize_t memcpy_count_show(struct device *dev,
if (chan) { if (chan) {
for_each_possible_cpu(i) for_each_possible_cpu(i)
count += per_cpu_ptr(chan->local, i)->memcpy_count; count += per_cpu_ptr(chan->local, i)->memcpy_count;
err = sprintf(buf, "%lu\n", count); err = sysfs_emit(buf, "%lu\n", count);
} else } else
err = -ENODEV; err = -ENODEV;
mutex_unlock(&dma_list_mutex); mutex_unlock(&dma_list_mutex);
...@@ -194,7 +194,7 @@ static ssize_t bytes_transferred_show(struct device *dev, ...@@ -194,7 +194,7 @@ static ssize_t bytes_transferred_show(struct device *dev,
if (chan) { if (chan) {
for_each_possible_cpu(i) for_each_possible_cpu(i)
count += per_cpu_ptr(chan->local, i)->bytes_transferred; count += per_cpu_ptr(chan->local, i)->bytes_transferred;
err = sprintf(buf, "%lu\n", count); err = sysfs_emit(buf, "%lu\n", count);
} else } else
err = -ENODEV; err = -ENODEV;
mutex_unlock(&dma_list_mutex); mutex_unlock(&dma_list_mutex);
...@@ -212,7 +212,7 @@ static ssize_t in_use_show(struct device *dev, struct device_attribute *attr, ...@@ -212,7 +212,7 @@ static ssize_t in_use_show(struct device *dev, struct device_attribute *attr,
mutex_lock(&dma_list_mutex); mutex_lock(&dma_list_mutex);
chan = dev_to_dma_chan(dev); chan = dev_to_dma_chan(dev);
if (chan) if (chan)
err = sprintf(buf, "%d\n", chan->client_count); err = sysfs_emit(buf, "%d\n", chan->client_count);
else else
err = -ENODEV; err = -ENODEV;
mutex_unlock(&dma_list_mutex); mutex_unlock(&dma_list_mutex);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册