PM / Sleep: Add wakeup_source_activate and wakeup_source_deactivate tracepoints
[linux-2.6.git] / drivers / base / devtmpfs.c
index a49897d..8493536 100644 (file)
@@ -40,7 +40,7 @@ static struct req {
        struct completion done;
        int err;
        const char *name;
-       mode_t mode;    /* 0 => delete */
+       umode_t mode;   /* 0 => delete */
        struct device *dev;
 } *requests;
 
@@ -142,7 +142,7 @@ int devtmpfs_delete_node(struct device *dev)
        return req.err;
 }
 
-static int dev_mkdir(const char *name, mode_t mode)
+static int dev_mkdir(const char *name, umode_t mode)
 {
        struct dentry *dentry;
        struct path path;
@@ -164,38 +164,32 @@ static int dev_mkdir(const char *name, mode_t mode)
 
 static int create_path(const char *nodepath)
 {
-       int err;
+       char *path;
+       char *s;
+       int err = 0;
 
-       err = dev_mkdir(nodepath, 0755);
-       if (err == -ENOENT) {
-               char *path;
-               char *s;
+       /* parent directories do not exist, create them */
+       path = kstrdup(nodepath, GFP_KERNEL);
+       if (!path)
+               return -ENOMEM;
 
-               /* parent directories do not exist, create them */
-               path = kstrdup(nodepath, GFP_KERNEL);
-               if (!path) {
-                       err = -ENOMEM;
-                       goto out;
-               }
-               s = path;
-               for (;;) {
-                       s = strchr(s, '/');
-                       if (!s)
-                               break;
-                       s[0] = '\0';
-                       err = dev_mkdir(path, 0755);
-                       if (err && err != -EEXIST)
-                               break;
-                       s[0] = '/';
-                       s++;
-               }
-               kfree(path);
+       s = path;
+       for (;;) {
+               s = strchr(s, '/');
+               if (!s)
+                       break;
+               s[0] = '\0';
+               err = dev_mkdir(path, 0755);
+               if (err && err != -EEXIST)
+                       break;
+               s[0] = '/';
+               s++;
        }
-out:
+       kfree(path);
        return err;
 }
 
-static int handle_create(const char *nodename, mode_t mode, struct device *dev)
+static int handle_create(const char *nodename, umode_t mode, struct device *dev)
 {
        struct dentry *dentry;
        struct path path;
@@ -382,9 +376,9 @@ int devtmpfs_mount(const char *mntdir)
        return err;
 }
 
-static __initdata DECLARE_COMPLETION(setup_done);
+static DECLARE_COMPLETION(setup_done);
 
-static int handle(const char *name, mode_t mode, struct device *dev)
+static int handle(const char *name, umode_t mode, struct device *dev)
 {
        if (mode)
                return handle_create(name, mode, dev);
@@ -412,16 +406,16 @@ static int devtmpfsd(void *p)
                        requests = NULL;
                        spin_unlock(&req_lock);
                        while (req) {
+                               struct req *next = req->next;
                                req->err = handle(req->name, req->mode, req->dev);
                                complete(&req->done);
-                               req = req->next;
+                               req = next;
                        }
                        spin_lock(&req_lock);
                }
-               set_current_state(TASK_INTERRUPTIBLE);
+               __set_current_state(TASK_INTERRUPTIBLE);
                spin_unlock(&req_lock);
                schedule();
-               __set_current_state(TASK_RUNNING);
        }
        return 0;
 out: