Fix occurrences of "the the "
[sfrench/cifs-2.6.git] / drivers / media / dvb / dvb-usb / dvb-usb-remote.c
index 0a3a0b6c23509f8e80c95dae37d595bbd516d50e..9200a30dd1b906ffad037d3351d441f56a668c2c 100644 (file)
@@ -3,7 +3,7 @@
  * Copyright (C) 2004-6 Patrick Boettcher (patrick.boettcher@desy.de)
  * see dvb-usb-init.c for copyright information.
  *
- * This file contains functions for initializing the the input-device and for handling remote-control-queries.
+ * This file contains functions for initializing the input-device and for handling remote-control-queries.
  */
 #include "dvb-usb-common.h"
 #include <linux/usb/input.h>
  *
  * TODO: Fix the repeat rate of the input device.
  */
-static void dvb_usb_read_remote_control(void *data)
+static void dvb_usb_read_remote_control(struct work_struct *work)
 {
-       struct dvb_usb_device *d = data;
+       struct dvb_usb_device *d =
+               container_of(work, struct dvb_usb_device, rc_query_work.work);
        u32 event;
        int state;
 
@@ -89,7 +90,9 @@ schedule:
 
 int dvb_usb_remote_init(struct dvb_usb_device *d)
 {
+       struct input_dev *input_dev;
        int i;
+       int err;
 
        if (d->props.rc_key_map == NULL ||
                d->props.rc_query == NULL ||
@@ -99,23 +102,22 @@ int dvb_usb_remote_init(struct dvb_usb_device *d)
        usb_make_path(d->udev, d->rc_phys, sizeof(d->rc_phys));
        strlcat(d->rc_phys, "/ir0", sizeof(d->rc_phys));
 
-       d->rc_input_dev = input_allocate_device();
-       if (!d->rc_input_dev)
+       input_dev = input_allocate_device();
+       if (!input_dev)
                return -ENOMEM;
 
-       d->rc_input_dev->evbit[0] = BIT(EV_KEY);
-       d->rc_input_dev->keycodesize = sizeof(unsigned char);
-       d->rc_input_dev->keycodemax = KEY_MAX;
-       d->rc_input_dev->name = "IR-receiver inside an USB DVB receiver";
-       d->rc_input_dev->phys = d->rc_phys;
-       usb_to_input_id(d->udev, &d->rc_input_dev->id);
-       d->rc_input_dev->cdev.dev = &d->udev->dev;
+       input_dev->evbit[0] = BIT(EV_KEY);
+       input_dev->name = "IR-receiver inside an USB DVB receiver";
+       input_dev->phys = d->rc_phys;
+       usb_to_input_id(d->udev, &input_dev->id);
+       input_dev->cdev.dev = &d->udev->dev;
 
        /* set the bits for the keys */
        deb_rc("key map size: %d\n", d->props.rc_key_map_size);
        for (i = 0; i < d->props.rc_key_map_size; i++) {
-               deb_rc("setting bit for event %d item %d\n",d->props.rc_key_map[i].event, i);
-               set_bit(d->props.rc_key_map[i].event, d->rc_input_dev->keybit);
+               deb_rc("setting bit for event %d item %d\n",
+                       d->props.rc_key_map[i].event, i);
+               set_bit(d->props.rc_key_map[i].event, input_dev->keybit);
        }
 
        /* Start the remote-control polling. */
@@ -123,12 +125,18 @@ int dvb_usb_remote_init(struct dvb_usb_device *d)
                d->props.rc_interval = 100; /* default */
 
        /* setting these two values to non-zero, we have to manage key repeats */
-       d->rc_input_dev->rep[REP_PERIOD] = d->props.rc_interval;
-       d->rc_input_dev->rep[REP_DELAY]  = d->props.rc_interval + 150;
+       input_dev->rep[REP_PERIOD] = d->props.rc_interval;
+       input_dev->rep[REP_DELAY]  = d->props.rc_interval + 150;
 
-       input_register_device(d->rc_input_dev);
+       err = input_register_device(input_dev);
+       if (err) {
+               input_free_device(input_dev);
+               return err;
+       }
+
+       d->rc_input_dev = input_dev;
 
-       INIT_WORK(&d->rc_query_work, dvb_usb_read_remote_control, d);
+       INIT_DELAYED_WORK(&d->rc_query_work, dvb_usb_read_remote_control);
 
        info("schedule remote query interval to %d msecs.", d->props.rc_interval);
        schedule_delayed_work(&d->rc_query_work,msecs_to_jiffies(d->props.rc_interval));
@@ -141,7 +149,7 @@ int dvb_usb_remote_init(struct dvb_usb_device *d)
 int dvb_usb_remote_exit(struct dvb_usb_device *d)
 {
        if (d->state & DVB_USB_STATE_REMOTE) {
-               cancel_delayed_work(&d->rc_query_work);
+               cancel_rearming_delayed_work(&d->rc_query_work);
                flush_scheduled_work();
                input_unregister_device(d->rc_input_dev);
        }