/* the usage count for the device is incremented on open() and decremented on release()  */
static int ftdi_elan_open(struct inode *inode, struct file *file)
/* the usage count for the device is incremented on open() and decremented on release()  */
static int ftdi_elan_open(struct inode *inode, struct file *file)
{
        int subminor = iminor(inode);
        struct usb_interface *interface = usb_find_interface(&ftdi_elan_driver,
                subminor);
        if (!interface) {
                printk(KERN_ERR "can't find device for minor %d\n", subminor);
                return -ENODEV;
        } else {
                struct usb_ftdi *ftdi = usb_get_intfdata(interface);
                if (!ftdi) {
                        return -ENODEV;
                } else {
                        if (down_interruptible(&ftdi->sw_lock)) {
                                return -EINTR;
                        } else {
                                ftdi_elan_get_kref(ftdi);
                                file->private_data = ftdi;
                                return 0;
                        }
                }
        }
}