llseek: automatically add .llseek fop
[sfrench/cifs-2.6.git] / drivers / media / IR / imon.c
index 4bbd45f4284c37b53c1169b95f250a1eaf44d01b..faed5a332c718f0720bd87b44dbb8f09f0d5b5fb 100644 (file)
@@ -87,7 +87,6 @@ static ssize_t lcd_write(struct file *file, const char *buf,
 struct imon_context {
        struct device *dev;
        struct ir_dev_props *props;
-       struct ir_input_dev *ir;
        /* Newer devices have two interfaces */
        struct usb_device *usbdev_intf0;
        struct usb_device *usbdev_intf1;
@@ -152,7 +151,8 @@ static const struct file_operations vfd_fops = {
        .owner          = THIS_MODULE,
        .open           = &display_open,
        .write          = &vfd_write,
-       .release        = &display_close
+       .release        = &display_close,
+       .llseek         = noop_llseek,
 };
 
 /* lcd character device file operations */
@@ -160,7 +160,8 @@ static const struct file_operations lcd_fops = {
        .owner          = THIS_MODULE,
        .open           = &display_open,
        .write          = &lcd_write,
-       .release        = &display_close
+       .release        = &display_close,
+       .llseek         = noop_llseek,
 };
 
 enum {
@@ -407,7 +408,7 @@ static int display_close(struct inode *inode, struct file *file)
        struct imon_context *ictx = NULL;
        int retval = 0;
 
-       ictx = (struct imon_context *)file->private_data;
+       ictx = file->private_data;
 
        if (!ictx) {
                err("%s: no context for device", __func__);
@@ -812,7 +813,7 @@ static ssize_t vfd_write(struct file *file, const char *buf,
        const unsigned char vfd_packet6[] = {
                0x01, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF };
 
-       ictx = (struct imon_context *)file->private_data;
+       ictx = file->private_data;
        if (!ictx) {
                err("%s: no context for device", __func__);
                return -ENODEV;
@@ -896,7 +897,7 @@ static ssize_t lcd_write(struct file *file, const char *buf,
        int retval = 0;
        struct imon_context *ictx;
 
-       ictx = (struct imon_context *)file->private_data;
+       ictx = file->private_data;
        if (!ictx) {
                err("%s: no context for device", __func__);
                return -ENODEV;
@@ -1656,7 +1657,6 @@ static struct input_dev *imon_init_idev(struct imon_context *ictx)
 {
        struct input_dev *idev;
        struct ir_dev_props *props;
-       struct ir_input_dev *ir;
        int ret, i;
 
        idev = input_allocate_device();
@@ -1671,12 +1671,6 @@ static struct input_dev *imon_init_idev(struct imon_context *ictx)
                goto props_alloc_failed;
        }
 
-       ir = kzalloc(sizeof(struct ir_input_dev), GFP_KERNEL);
-       if (!ir) {
-               dev_err(ictx->dev, "remote ir input dev allocation failed\n");
-               goto ir_dev_alloc_failed;
-       }
-
        snprintf(ictx->name_idev, sizeof(ictx->name_idev),
                 "iMON Remote (%04x:%04x)", ictx->vendor, ictx->product);
        idev->name = ictx->name_idev;
@@ -1706,14 +1700,9 @@ static struct input_dev *imon_init_idev(struct imon_context *ictx)
        props->change_protocol = imon_ir_change_protocol;
        ictx->props = props;
 
-       ictx->ir = ir;
-       memcpy(&ir->dev, ictx->dev, sizeof(struct device));
-
        usb_to_input_id(ictx->usbdev_intf0, &idev->id);
        idev->dev.parent = ictx->dev;
 
-       input_set_drvdata(idev, ir);
-
        ret = ir_input_register(idev, RC_MAP_IMON_PAD, props, MOD_NAME);
        if (ret < 0) {
                dev_err(ictx->dev, "remote input dev register failed\n");
@@ -1723,8 +1712,6 @@ static struct input_dev *imon_init_idev(struct imon_context *ictx)
        return idev;
 
 idev_register_failed:
-       kfree(ir);
-ir_dev_alloc_failed:
        kfree(props);
 props_alloc_failed:
        input_free_device(idev);
@@ -1943,8 +1930,7 @@ static struct imon_context *imon_init_intf0(struct usb_interface *intf)
        return ictx;
 
 urb_submit_failed:
-       input_unregister_device(ictx->idev);
-       input_free_device(ictx->idev);
+       ir_input_unregister(ictx->idev);
 idev_setup_failed:
 find_endpoint_failed:
        mutex_unlock(&ictx->lock);
@@ -2014,10 +2000,8 @@ static struct imon_context *imon_init_intf1(struct usb_interface *intf,
        return ictx;
 
 urb_submit_failed:
-       if (ictx->touch) {
+       if (ictx->touch)
                input_unregister_device(ictx->touch);
-               input_free_device(ictx->touch);
-       }
 touch_setup_failed:
 find_endpoint_failed:
        mutex_unlock(&ictx->lock);
@@ -2067,6 +2051,7 @@ static void imon_get_ffdc_type(struct imon_context *ictx)
                detected_display_type = IMON_DISPLAY_TYPE_VFD;
                break;
        /* iMON LCD, MCE IR */
+       case 0x9e:
        case 0x9f:
                dev_info(ictx->dev, "0xffdc iMON LCD, MCE IR");
                detected_display_type = IMON_DISPLAY_TYPE_LCD;
@@ -2306,7 +2291,7 @@ static void __devexit imon_disconnect(struct usb_interface *interface)
        if (ifnum == 0) {
                ictx->dev_present_intf0 = false;
                usb_kill_urb(ictx->rx_urb_intf0);
-               input_unregister_device(ictx->idev);
+               ir_input_unregister(ictx->idev);
                if (ictx->display_supported) {
                        if (ictx->display_type == IMON_DISPLAY_TYPE_LCD)
                                usb_deregister_dev(interface, &imon_lcd_class);