CRED: Separate task security context from task_struct
[linux-2.6.git] / drivers / connector / cn_queue.c
index 05f8ce2..b6fe7e7 100644 (file)
 #include <linux/connector.h>
 #include <linux/delay.h>
 
-void cn_queue_wrapper(void *data)
+void cn_queue_wrapper(struct work_struct *work)
 {
-       struct cn_callback_data *d = data;
+       struct cn_callback_entry *cbq =
+               container_of(work, struct cn_callback_entry, work);
+       struct cn_callback_data *d = &cbq->data;
 
        d->callback(d->callback_priv);
 
@@ -57,13 +59,12 @@ static struct cn_callback_entry *cn_queue_alloc_callback_entry(char *name, struc
        memcpy(&cbq->id.id, id, sizeof(struct cb_id));
        cbq->data.callback = callback;
        
-       INIT_WORK(&cbq->work, &cn_queue_wrapper, &cbq->data);
+       INIT_WORK(&cbq->work, &cn_queue_wrapper);
        return cbq;
 }
 
 static void cn_queue_free_callback(struct cn_callback_entry *cbq)
 {
-       cancel_delayed_work(&cbq->work);
        flush_workqueue(cbq->pdev->cn_queue);
 
        kfree(cbq);
@@ -98,12 +99,11 @@ int cn_queue_add_callback(struct cn_queue_dev *dev, char *name, struct cb_id *id
        spin_unlock_bh(&dev->queue_lock);
 
        if (found) {
-               atomic_dec(&dev->refcnt);
                cn_queue_free_callback(cbq);
+               atomic_dec(&dev->refcnt);
                return -EINVAL;
        }
 
-       cbq->nls = dev->nls;
        cbq->seq = 0;
        cbq->group = cbq->id.id.idx;
 
@@ -145,9 +145,8 @@ struct cn_queue_dev *cn_queue_alloc_dev(char *name, struct sock *nls)
        spin_lock_init(&dev->queue_lock);
 
        dev->nls = nls;
-       dev->netlink_groups = 0;
 
-       dev->cn_queue = create_workqueue(dev->name);
+       dev->cn_queue = create_singlethread_workqueue(dev->name);
        if (!dev->cn_queue) {
                kfree(dev);
                return NULL;