summaryrefslogtreecommitdiff
path: root/linux/drivers/media/video/cpia_pp.c
diff options
context:
space:
mode:
Diffstat (limited to 'linux/drivers/media/video/cpia_pp.c')
-rw-r--r--linux/drivers/media/video/cpia_pp.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/linux/drivers/media/video/cpia_pp.c b/linux/drivers/media/video/cpia_pp.c
index 41f4b8d17..26e7e6d5b 100644
--- a/linux/drivers/media/video/cpia_pp.c
+++ b/linux/drivers/media/video/cpia_pp.c
@@ -82,6 +82,10 @@ struct pp_cam_entry {
struct pardevice *pdev;
struct parport *port;
struct work_struct cb_task;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
+ void (*cb_func)(void *cbdata);
+ void *cb_data;
+#endif
int open_count;
wait_queue_head_t wq_stream;
/* image state flags */
@@ -130,6 +134,22 @@ static void cpia_parport_disable_irq( struct parport *port ) {
#define PARPORT_CHUNK_SIZE PAGE_SIZE
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
+static void cpia_pp_run_callback(struct work_struct *work)
+{
+ void (*cb_func)(void *cbdata);
+ void *cb_data;
+ struct pp_cam_entry *cam;
+
+ cam = container_of(work, struct pp_cam_entry, cb_task);
+ cb_func = cam->cb_func;
+ cb_data = cam->cb_data;
+ work_release(work);
+
+ cb_func(cb_data);
+}
+
+#endif
/****************************************************************************
*
* CPiA-specific low-level parport functions for nibble uploads
@@ -664,7 +684,13 @@ static int cpia_pp_registerCallback(void *privdata, void (*cb)(void *cbdata), vo
int retval = 0;
if(cam->port->irq != PARPORT_IRQ_NONE) {
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
INIT_WORK(&cam->cb_task, cb, cbdata);
+#else
+ cam->cb_func = cb;
+ cam->cb_data = cbdata;
+ INIT_WORK_NAR(&cam->cb_task, cpia_pp_run_callback);
+#endif
} else {
retval = -1;
}