]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
kmod: convert two call sites to call_usermodehelper_fns()
authorBoaz Harrosh <bharrosh@panasas.com>
Wed, 4 Apr 2012 00:08:31 +0000 (10:08 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Wed, 4 Apr 2012 03:22:12 +0000 (13:22 +1000)
Both kernel/sys.c && security/keys/request_key.c where inlining the exact
same code as call_usermodehelper_fns(); So simply convert these sites to
directly use call_usermodehelper_fns().

Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
kernel/sys.c
security/keys/request_key.c

index e7006eb6c1e4fdc3fa7967eaa45541609b5d499f..a73d8439208688d6d6b33c420cfc6cc7ccf0225c 100644 (file)
@@ -2022,7 +2022,6 @@ int orderly_poweroff(bool force)
                NULL
        };
        int ret = -ENOMEM;
-       struct subprocess_info *info;
 
        if (argv == NULL) {
                printk(KERN_WARNING "%s failed to allocate memory for \"%s\"\n",
@@ -2030,18 +2029,16 @@ int orderly_poweroff(bool force)
                goto out;
        }
 
-       info = call_usermodehelper_setup(argv[0], argv, envp, GFP_ATOMIC);
-       if (info == NULL) {
-               argv_free(argv);
-               goto out;
-       }
-
-       call_usermodehelper_setfns(info, NULL, argv_cleanup, NULL);
+       ret = call_usermodehelper_fns(argv[0], argv, envp, UMH_NO_WAIT,
+                                     NULL, argv_cleanup, NULL);
+out:
+       if (likely(!ret))
+               return 0;
 
-       ret = call_usermodehelper_exec(info, UMH_NO_WAIT);
+       if (ret == -ENOMEM)
+               argv_free(argv);
 
-  out:
-       if (ret && force) {
+       if (force) {
                printk(KERN_WARNING "Failed to start orderly shutdown: "
                       "forcing the issue\n");
 
index cc3790315d2f15778fcc3c8a3ec7f2434282277d..000e7501752022089b82efeb153115498e55da60 100644 (file)
@@ -93,16 +93,9 @@ static void umh_keys_cleanup(struct subprocess_info *info)
 static int call_usermodehelper_keys(char *path, char **argv, char **envp,
                                        struct key *session_keyring, int wait)
 {
-       gfp_t gfp_mask = (wait == UMH_NO_WAIT) ? GFP_ATOMIC : GFP_KERNEL;
-       struct subprocess_info *info =
-               call_usermodehelper_setup(path, argv, envp, gfp_mask);
-
-       if (!info)
-               return -ENOMEM;
-
-       call_usermodehelper_setfns(info, umh_keys_init, umh_keys_cleanup,
-                                       key_get(session_keyring));
-       return call_usermodehelper_exec(info, wait);
+       return call_usermodehelper_fns(path, argv, envp, wait,
+                                      umh_keys_init, umh_keys_cleanup,
+                                      key_get(session_keyring));
 }
 
 /*