dcdbas: use memory_read_from_buffer()
Signed-off-by: Akinobu 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: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
f37e66173e
commit
abe19b7b82
1 changed files with 2 additions and 11 deletions
|
@ -152,20 +152,11 @@ static ssize_t smi_data_read(struct kobject *kobj,
|
||||||
struct bin_attribute *bin_attr,
|
struct bin_attribute *bin_attr,
|
||||||
char *buf, loff_t pos, size_t count)
|
char *buf, loff_t pos, size_t count)
|
||||||
{
|
{
|
||||||
size_t max_read;
|
|
||||||
ssize_t ret;
|
ssize_t ret;
|
||||||
|
|
||||||
mutex_lock(&smi_data_lock);
|
mutex_lock(&smi_data_lock);
|
||||||
|
ret = memory_read_from_buffer(buf, count, &pos, smi_data_buf,
|
||||||
if (pos >= smi_data_buf_size) {
|
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:
|
|
||||||
mutex_unlock(&smi_data_lock);
|
mutex_unlock(&smi_data_lock);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue