Merge master.kernel.org:/pub/scm/linux/kernel/git/sfrench/cifs-2.6
[pandora-kernel.git] / drivers / media / video / pvrusb2 / pvrusb2-context.c
index 40dc598..6bbed88 100644 (file)
@@ -45,16 +45,21 @@ static void pvr2_context_trigger_poll(struct pvr2_context *mp)
 }
 
 
-static void pvr2_context_poll(struct pvr2_context *mp)
+static void pvr2_context_poll(struct work_struct *work)
 {
+       struct pvr2_context *mp =
+               container_of(work, struct pvr2_context, workpoll);
        pvr2_context_enter(mp); do {
                pvr2_hdw_poll(mp->hdw);
        } while (0); pvr2_context_exit(mp);
 }
 
 
-static void pvr2_context_setup(struct pvr2_context *mp)
+static void pvr2_context_setup(struct work_struct *work)
 {
+       struct pvr2_context *mp =
+               container_of(work, struct pvr2_context, workinit);
+
        pvr2_context_enter(mp); do {
                if (!pvr2_hdw_dev_ok(mp->hdw)) break;
                pvr2_hdw_setup(mp->hdw);
@@ -77,23 +82,22 @@ struct pvr2_context *pvr2_context_create(
        const struct usb_device_id *devid,
        void (*setup_func)(struct pvr2_context *))
 {
-       struct pvr2_context *mp = 0;
-       mp = kmalloc(sizeof(*mp),GFP_KERNEL);
+       struct pvr2_context *mp = NULL;
+       mp = kzalloc(sizeof(*mp),GFP_KERNEL);
        if (!mp) goto done;
-       memset(mp,0,sizeof(*mp));
        pvr2_trace(PVR2_TRACE_STRUCT,"Creating pvr_main id=%p",mp);
        mp->setup_func = setup_func;
        mutex_init(&mp->mutex);
        mp->hdw = pvr2_hdw_create(intf,devid);
        if (!mp->hdw) {
                pvr2_context_destroy(mp);
-               mp = 0;
+               mp = NULL;
                goto done;
        }
 
        mp->workqueue = create_singlethread_workqueue("pvrusb2");
-       INIT_WORK(&mp->workinit,(void (*)(void*))pvr2_context_setup,mp);
-       INIT_WORK(&mp->workpoll,(void (*)(void*))pvr2_context_poll,mp);
+       INIT_WORK(&mp->workinit, pvr2_context_setup);
+       INIT_WORK(&mp->workpoll, pvr2_context_poll);
        queue_work(mp->workqueue,&mp->workinit);
  done:
        return mp;
@@ -145,7 +149,7 @@ void pvr2_channel_init(struct pvr2_channel *cp,struct pvr2_context *mp)
 {
        cp->hdw = mp->hdw;
        cp->mc_head = mp;
-       cp->mc_next = 0;
+       cp->mc_next = NULL;
        cp->mc_prev = mp->mc_last;
        if (mp->mc_last) {
                mp->mc_last->mc_next = cp;
@@ -160,8 +164,8 @@ static void pvr2_channel_disclaim_stream(struct pvr2_channel *cp)
 {
        if (!cp->stream) return;
        pvr2_stream_kill(cp->stream->stream);
-       cp->stream->user = 0;
-       cp->stream = 0;
+       cp->stream->user = NULL;
+       cp->stream = NULL;
 }
 
 
@@ -179,7 +183,7 @@ void pvr2_channel_done(struct pvr2_channel *cp)
        } else {
                mp->mc_first = cp->mc_next;
        }
-       cp->hdw = 0;
+       cp->hdw = NULL;
 }
 
 
@@ -212,7 +216,7 @@ struct pvr2_ioread *pvr2_channel_create_mpeg_stream(
 {
        struct pvr2_ioread *cp;
        cp = pvr2_ioread_create();
-       if (!cp) return 0;
+       if (!cp) return NULL;
        pvr2_ioread_setup(cp,sp->stream);
        pvr2_ioread_set_sync_key(cp,stream_sync_key,sizeof(stream_sync_key));
        return cp;