- unsigned int pos;
- unsigned int size;
-
- pos = *ppos;
- size = up->size;
- if (pos >= size)
- return 0;
- if (nbytes > size - pos)
- nbytes = size - pos;
-
- if (copy_to_user(buf, up->data + pos, nbytes))
- return -EFAULT;
-
- *ppos += nbytes;
-
- return nbytes;
+ return simple_read_from_buffer(buf, nbytes, ppos, up->data, up->size);