]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - drivers/media/dvb/cinergyT2/cinergyT2.c
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
[karo-tx-linux.git] / drivers / media / dvb / cinergyT2 / cinergyT2.c
index 9325d039ea652c622071b04d8c31ed7e6ff473ef..8458ff3f351e265b15affc9f71541b9f7802503c 100644 (file)
@@ -22,7 +22,6 @@
  *
  */
 
-#include <linux/config.h>
 #include <linux/init.h>
 #include <linux/module.h>
 #include <linux/slab.h>
@@ -128,7 +127,7 @@ struct cinergyt2 {
 
        struct dvbt_set_parameters_msg param;
        struct dvbt_get_status_msg status;
-       struct work_struct query_work;
+       struct delayed_work query_work;
 
        wait_queue_head_t poll_wq;
        int pending_fe_events;
@@ -142,7 +141,7 @@ struct cinergyt2 {
 #ifdef ENABLE_RC
        struct input_dev *rc_input_dev;
        char phys[64];
-       struct work_struct rc_query_work;
+       struct delayed_work rc_query_work;
        int rc_input_event;
        u32 rc_last_code;
        unsigned long last_event_jiffies;
@@ -239,7 +238,7 @@ static void cinergyt2_sleep (struct cinergyt2 *cinergyt2, int sleep)
        cinergyt2->sleeping = sleep;
 }
 
-static void cinergyt2_stream_irq (struct urb *urb, struct pt_regs *regs);
+static void cinergyt2_stream_irq (struct urb *urb);
 
 static int cinergyt2_submit_stream_urb (struct cinergyt2 *cinergyt2, struct urb *urb)
 {
@@ -259,7 +258,7 @@ static int cinergyt2_submit_stream_urb (struct cinergyt2 *cinergyt2, struct urb
        return err;
 }
 
-static void cinergyt2_stream_irq (struct urb *urb, struct pt_regs *regs)
+static void cinergyt2_stream_irq (struct urb *urb)
 {
        struct cinergyt2 *cinergyt2 = urb->context;
 
@@ -276,8 +275,7 @@ static void cinergyt2_free_stream_urbs (struct cinergyt2 *cinergyt2)
        int i;
 
        for (i=0; i<STREAM_URB_COUNT; i++)
-               if (cinergyt2->stream_urb[i])
-                       usb_free_urb(cinergyt2->stream_urb[i]);
+               usb_free_urb(cinergyt2->stream_urb[i]);
 
        usb_buffer_free(cinergyt2->udev, STREAM_URB_COUNT*STREAM_BUF_SIZE,
                            cinergyt2->streambuf, cinergyt2->streambuf_dmahandle);
@@ -321,8 +319,7 @@ static void cinergyt2_stop_stream_xfer (struct cinergyt2 *cinergyt2)
        cinergyt2_control_stream_transfer(cinergyt2, 0);
 
        for (i=0; i<STREAM_URB_COUNT; i++)
-               if (cinergyt2->stream_urb[i])
-                       usb_kill_urb(cinergyt2->stream_urb[i]);
+               usb_kill_urb(cinergyt2->stream_urb[i]);
 }
 
 static int cinergyt2_start_stream_xfer (struct cinergyt2 *cinergyt2)
@@ -544,15 +541,19 @@ static unsigned int cinergyt2_poll (struct file *file, struct poll_table_struct
 {
        struct dvb_device *dvbdev = file->private_data;
        struct cinergyt2 *cinergyt2 = dvbdev->priv;
+       unsigned int mask = 0;
 
        if (cinergyt2->disconnect_pending || mutex_lock_interruptible(&cinergyt2->sem))
                return -ERESTARTSYS;
 
        poll_wait(file, &cinergyt2->poll_wq, wait);
 
+       if (cinergyt2->pending_fe_events != 0)
+               mask |= (POLLIN | POLLRDNORM | POLLPRI);
+
        mutex_unlock(&cinergyt2->sem);
 
-       return (POLLIN | POLLRDNORM | POLLPRI);
+       return mask;
 }
 
 
@@ -721,9 +722,10 @@ static struct dvb_device cinergyt2_fe_template = {
 
 #ifdef ENABLE_RC
 
-static void cinergyt2_query_rc (void *data)
+static void cinergyt2_query_rc (struct work_struct *work)
 {
-       struct cinergyt2 *cinergyt2 = data;
+       struct cinergyt2 *cinergyt2 =
+               container_of(work, struct cinergyt2, rc_query_work.work);
        char buf[1] = { CINERGYT2_EP1_GET_RC_EVENTS };
        struct cinergyt2_rc_event rc_events[12];
        int n, len, i;
@@ -804,7 +806,7 @@ static int cinergyt2_register_rc(struct cinergyt2 *cinergyt2)
        strlcat(cinergyt2->phys, "/input0", sizeof(cinergyt2->phys));
        cinergyt2->rc_input_event = KEY_MAX;
        cinergyt2->rc_last_code = ~0;
-       INIT_WORK(&cinergyt2->rc_query_work, cinergyt2_query_rc, cinergyt2);
+       INIT_DELAYED_WORK(&cinergyt2->rc_query_work, cinergyt2_query_rc);
 
        input_dev->name = DRIVER_NAME " remote control";
        input_dev->phys = cinergyt2->phys;
@@ -845,9 +847,10 @@ static inline void cinergyt2_resume_rc(struct cinergyt2 *cinergyt2) { }
 
 #endif /* ENABLE_RC */
 
-static void cinergyt2_query (void *data)
+static void cinergyt2_query (struct work_struct *work)
 {
-       struct cinergyt2 *cinergyt2 = (struct cinergyt2 *) data;
+       struct cinergyt2 *cinergyt2 =
+               container_of(work, struct cinergyt2, query_work.work);
        char cmd [] = { CINERGYT2_EP1_GET_TUNER_STATUS };
        struct dvbt_get_status_msg *s = &cinergyt2->status;
        uint8_t lock_bits;
@@ -891,7 +894,7 @@ static int cinergyt2_probe (struct usb_interface *intf,
 
        mutex_init(&cinergyt2->sem);
        init_waitqueue_head (&cinergyt2->poll_wq);
-       INIT_WORK(&cinergyt2->query_work, cinergyt2_query, cinergyt2);
+       INIT_DELAYED_WORK(&cinergyt2->query_work, cinergyt2_query);
 
        cinergyt2->udev = interface_to_usbdev(intf);
        cinergyt2->param.cmd = CINERGYT2_EP1_SET_TUNER_PARAMETERS;
@@ -902,7 +905,7 @@ static int cinergyt2_probe (struct usb_interface *intf,
                return -ENOMEM;
        }
 
-       if ((err = dvb_register_adapter(&cinergyt2->adapter, DRIVER_NAME, THIS_MODULE)) < 0) {
+       if ((err = dvb_register_adapter(&cinergyt2->adapter, DRIVER_NAME, THIS_MODULE, &cinergyt2->udev->dev)) < 0) {
                kfree(cinergyt2);
                return err;
        }
@@ -978,7 +981,7 @@ static int cinergyt2_suspend (struct usb_interface *intf, pm_message_t state)
        if (cinergyt2->disconnect_pending || mutex_lock_interruptible(&cinergyt2->sem))
                return -ERESTARTSYS;
 
-       if (state.event > PM_EVENT_ON) {
+       if (1) {
                struct cinergyt2 *cinergyt2 = usb_get_intfdata (intf);
 
                cinergyt2_suspend_rc(cinergyt2);