]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - fs/sysfs/file.c
sysfs: refill attribute buffer when reading from offset 0
[linux-2.6-omap-h63xx.git] / fs / sysfs / file.c
index baa663e69388aeb623aeb667f86ff12540b741e8..ade9a7e6a75763cd11304a638113f86e18f09d01 100644 (file)
@@ -13,6 +13,7 @@
 #include <linux/module.h>
 #include <linux/kobject.h>
 #include <linux/kallsyms.h>
+#include <linux/slab.h>
 #include <linux/namei.h>
 #include <linux/poll.h>
 #include <linux/list.h>
@@ -128,7 +129,7 @@ sysfs_read_file(struct file *file, char __user *buf, size_t count, loff_t *ppos)
        ssize_t retval = 0;
 
        mutex_lock(&buffer->mutex);
-       if (buffer->needs_read_fill) {
+       if (buffer->needs_read_fill || *ppos == 0) {
                retval = fill_read_buffer(file->f_path.dentry,buffer);
                if (retval)
                        goto out;
@@ -409,8 +410,7 @@ static int sysfs_release(struct inode *inode, struct file *filp)
  * return POLLERR|POLLPRI, and select will return the fd whether
  * it is waiting for read, write, or exceptions.
  * Once poll/select indicates that the value has changed, you
- * need to close and re-open the file, as simply seeking and reading
- * again will not get new data, or reset the state of 'poll'.
+ * need to close and re-open the file, or seek to 0 and read again.
  * Reminder: this only works for attributes which actively support
  * it, and it is not possible to test an attribute from userspace
  * to see if it supports poll (Neither 'poll' nor 'select' return