~ubuntu-branches/ubuntu/saucy/linux-ti-omap4/saucy-proposed

« back to all changes in this revision

Viewing changes to drivers/usb/core/devio.c

  • Committer: Package Import Robot
  • Author(s): Paolo Pisati, Paolo Pisati, Stefan Bader, Upstream Kernel Changes
  • Date: 2012-08-15 17:17:43 UTC
  • Revision ID: package-import@ubuntu.com-20120815171743-h5wnuf51xe7pvdid
Tags: 3.5.0-207.13
[ Paolo Pisati ]

* Start new release

[ Stefan Bader ]

* (config) Enable getabis to use local package copies

[ Upstream Kernel Changes ]

* fixup: gargabe collect iva_seq[0|1] init
* [Config] enable all SND_OMAP_SOC_*s
* fixup: cm2xxx_3xxx.o is needed for omap2_cm_read|write_reg
* fixup: add some snd_soc_dai* helper functions
* fixup: s/snd_soc_dpcm_params/snd_soc_dpcm/g
* fixup: typo, no_host_mode and useless SDP4430 init
* fixup: enable again aess hwmod

Show diffs side-by-side

added added

removed removed

Lines of Context:
732
732
        if (imajor(inode) == USB_DEVICE_MAJOR)
733
733
                dev = usbdev_lookup_by_devt(inode->i_rdev);
734
734
 
735
 
#ifdef CONFIG_USB_DEVICEFS
736
 
        /* procfs file */
737
 
        if (!dev) {
738
 
                dev = inode->i_private;
739
 
                if (dev && dev->usbfs_dentry &&
740
 
                                        dev->usbfs_dentry->d_inode == inode)
741
 
                        usb_get_dev(dev);
742
 
                else
743
 
                        dev = NULL;
744
 
        }
745
 
#endif
746
735
        mutex_unlock(&usbfs_mutex);
747
736
 
748
737
        if (!dev)
2079
2068
        }
2080
2069
}
2081
2070
 
2082
 
#ifdef CONFIG_USB_DEVICE_CLASS
2083
 
static struct class *usb_classdev_class;
2084
 
 
2085
 
static int usb_classdev_add(struct usb_device *dev)
2086
 
{
2087
 
        struct device *cldev;
2088
 
 
2089
 
        cldev = device_create(usb_classdev_class, &dev->dev, dev->dev.devt,
2090
 
                              NULL, "usbdev%d.%d", dev->bus->busnum,
2091
 
                              dev->devnum);
2092
 
        if (IS_ERR(cldev))
2093
 
                return PTR_ERR(cldev);
2094
 
        dev->usb_classdev = cldev;
2095
 
        return 0;
2096
 
}
2097
 
 
2098
 
static void usb_classdev_remove(struct usb_device *dev)
2099
 
{
2100
 
        if (dev->usb_classdev)
2101
 
                device_unregister(dev->usb_classdev);
2102
 
}
2103
 
 
2104
 
#else
2105
 
#define usb_classdev_add(dev)           0
2106
 
#define usb_classdev_remove(dev)        do {} while (0)
2107
 
 
2108
 
#endif
2109
 
 
2110
2071
static int usbdev_notify(struct notifier_block *self,
2111
2072
                               unsigned long action, void *dev)
2112
2073
{
2113
2074
        switch (action) {
2114
2075
        case USB_DEVICE_ADD:
2115
 
                if (usb_classdev_add(dev))
2116
 
                        return NOTIFY_BAD;
2117
2076
                break;
2118
2077
        case USB_DEVICE_REMOVE:
2119
 
                usb_classdev_remove(dev);
2120
2078
                usbdev_remove(dev);
2121
2079
                break;
2122
2080
        }
2146
2104
                       USB_DEVICE_MAJOR);
2147
2105
                goto error_cdev;
2148
2106
        }
2149
 
#ifdef CONFIG_USB_DEVICE_CLASS
2150
 
        usb_classdev_class = class_create(THIS_MODULE, "usb_device");
2151
 
        if (IS_ERR(usb_classdev_class)) {
2152
 
                printk(KERN_ERR "Unable to register usb_device class\n");
2153
 
                retval = PTR_ERR(usb_classdev_class);
2154
 
                cdev_del(&usb_device_cdev);
2155
 
                usb_classdev_class = NULL;
2156
 
                goto out;
2157
 
        }
2158
 
        /* devices of this class shadow the major:minor of their parent
2159
 
         * device, so clear ->dev_kobj to prevent adding duplicate entries
2160
 
         * to /sys/dev
2161
 
         */
2162
 
        usb_classdev_class->dev_kobj = NULL;
2163
 
#endif
2164
2107
        usb_register_notify(&usbdev_nb);
2165
2108
out:
2166
2109
        return retval;
2173
2116
void usb_devio_cleanup(void)
2174
2117
{
2175
2118
        usb_unregister_notify(&usbdev_nb);
2176
 
#ifdef CONFIG_USB_DEVICE_CLASS
2177
 
        class_destroy(usb_classdev_class);
2178
 
#endif
2179
2119
        cdev_del(&usb_device_cdev);
2180
2120
        unregister_chrdev_region(USB_DEVICE_DEV, USB_DEVICE_MAX);
2181
2121
}