sysfs: Make poll behaviour consistent
[pandora-kernel.git] / fs / sysfs / dir.c
index 6cfdc9a..5f3d725 100644 (file)
@@ -43,6 +43,7 @@ static struct sysfs_dirent * sysfs_new_dirent(struct sysfs_dirent * parent_sd,
 
        memset(sd, 0, sizeof(*sd));
        atomic_set(&sd->s_count, 1);
+       atomic_set(&sd->s_event, 1);
        INIT_LIST_HEAD(&sd->s_children);
        list_add(&sd->s_sibling, &parent_sd->s_children);
        sd->s_element = element;
@@ -429,10 +430,9 @@ static int sysfs_readdir(struct file * filp, void * dirent, filldir_t filldir)
                        i++;
                        /* fallthrough */
                default:
-                       if (filp->f_pos == 2) {
-                               list_del(q);
-                               list_add(q, &parent_sd->s_children);
-                       }
+                       if (filp->f_pos == 2)
+                               list_move(q, &parent_sd->s_children);
+
                        for (p=q->next; p!= &parent_sd->s_children; p=p->next) {
                                struct sysfs_dirent *next;
                                const char * name;
@@ -454,8 +454,7 @@ static int sysfs_readdir(struct file * filp, void * dirent, filldir_t filldir)
                                                 dt_type(next)) < 0)
                                        return 0;
 
-                               list_del(q);
-                               list_add(q, p);
+                               list_move(q, p);
                                p = q;
                                filp->f_pos++;
                        }