static int bthid_release(struct inode *inode, struct file *file)
{
    struct bthid_device *p_dev = file->private_data;

    printk("######## bthid_release: ########\n");
    
    if (p_dev->hid) 
    {
        if (p_dev->hid->status == (HID_STAT_ADDED | HID_STAT_PARSED))
        {
            hidinput_disconnect(p_dev->hid);
        }

        if (p_dev->hid->driver_data != NULL)
        {
            kfree(p_dev->hid->driver_data);
        }

        hid_destroy_device(p_dev->hid);
        p_dev->hid = NULL;
    }

    kfree(p_dev);
    file->private_data = NULL;

    printk("######## bthid_release: done ########\n");
    return 0;
}
示例#2
0
static int bthid_release(struct inode *inode, struct file *file)
{
    struct bthid_device *p_dev = file->private_data;

#ifdef CONFIG_DEBUG_PRINTK
    printk(KERN_INFO "######## bthid_release: ########\n");
#else
    ;
#endif
    
    if (p_dev->hid) 
    {
        if (p_dev->hid->status == (HID_STAT_ADDED | HID_STAT_PARSED))
        {
            hidinput_disconnect(p_dev->hid);
        }

        if (p_dev->hid->driver_data != NULL)
        {
            kfree(p_dev->hid->driver_data);
        }

        hid_destroy_device(p_dev->hid);
        p_dev->hid = NULL;
    }

    kfree(p_dev);
    file->private_data = NULL;

#ifdef CONFIG_DEBUG_PRINTK
    printk(KERN_INFO "######## bthid_release: done ########\n");
#else
    ;
#endif
    return 0;
}