[Bluetooth] Disconnect HID interrupt channel first
[pandora-kernel.git] / crypto / cryptomgr.c
index e0ebe1b..9b5b156 100644 (file)
@@ -17,6 +17,7 @@
 #include <linux/module.h>
 #include <linux/notifier.h>
 #include <linux/rtnetlink.h>
+#include <linux/sched.h>
 #include <linux/string.h>
 #include <linux/workqueue.h>
 
@@ -31,6 +32,8 @@ struct cryptomgr_param {
        } alg;
 
        struct {
+               u32 type;
+               u32 mask;
                char name[CRYPTO_MAX_ALG_NAME];
        } larval;
 
@@ -42,27 +45,32 @@ static void cryptomgr_probe(void *data)
        struct cryptomgr_param *param = data;
        struct crypto_template *tmpl;
        struct crypto_instance *inst;
+       int err;
 
        tmpl = crypto_lookup_template(param->template);
        if (!tmpl)
                goto err;
 
-       inst = tmpl->alloc(&param->alg, sizeof(param->alg));
-       if (IS_ERR(inst))
-               goto err;
-       else if ((err = crypto_register_instance(tmpl, inst))) {
-               tmpl->free(inst);
-               goto err;
-       }
+       do {
+               inst = tmpl->alloc(&param->alg, sizeof(param->alg));
+               if (IS_ERR(inst))
+                       err = PTR_ERR(inst);
+               else if ((err = crypto_register_instance(tmpl, inst)))
+                       tmpl->free(inst);
+       } while (err == -EAGAIN && !signal_pending(current));
 
        crypto_tmpl_put(tmpl);
 
+       if (err)
+               goto err;
+
 out:
        kfree(param);
        return;
 
 err:
-       crypto_larval_error(param->larval.name);
+       crypto_larval_error(param->larval.name, param->larval.type,
+                           param->larval.mask);
        goto out;
 }
 
@@ -101,6 +109,8 @@ static int cryptomgr_schedule_probe(struct crypto_larval *larval)
        param->alg.data.name[len] = 0;
 
        memcpy(param->larval.name, larval->alg.cra_name, CRYPTO_MAX_ALG_NAME);
+       param->larval.type = larval->alg.cra_flags;
+       param->larval.mask = larval->mask;
 
        INIT_WORK(&param->work, cryptomgr_probe, param);
        schedule_work(&param->work);