提交 abe19b7b 编写于 作者: A Akinobu Mita 提交者: Linus Torvalds

dcdbas: use memory_read_from_buffer()

Signed-off-by: NAkinobu Mita <akinobu.mita@gmail.com>
Cc: Doug Warzecha <Douglas_Warzecha@dell.com>
Cc: Zhang Rui <rui.zhang@intel.com>
Cc: Matt Domsch <Matt_Domsch@dell.com>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 f37e6617
......@@ -152,20 +152,11 @@ static ssize_t smi_data_read(struct kobject *kobj,
struct bin_attribute *bin_attr,
char *buf, loff_t pos, size_t count)
{
size_t max_read;
ssize_t ret;
mutex_lock(&smi_data_lock);
if (pos >= smi_data_buf_size) {
ret = 0;
goto out;
}
max_read = smi_data_buf_size - pos;
ret = min(max_read, count);
memcpy(buf, smi_data_buf + pos, ret);
out:
ret = memory_read_from_buffer(buf, count, &pos, smi_data_buf,
smi_data_buf_size);
mutex_unlock(&smi_data_lock);
return ret;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册