sched: Remove double_rq_lock() from __migrate_task()
[linux/fpc-iii.git] / drivers / gpu / drm / drm_usb.c
blobf2fe94aab901a8edbb6cbac827bad1e27a15b242
1 #include <drm/drmP.h>
2 #include <drm/drm_usb.h>
3 #include <linux/usb.h>
4 #include <linux/module.h>
6 int drm_get_usb_dev(struct usb_interface *interface,
7 const struct usb_device_id *id,
8 struct drm_driver *driver)
10 struct drm_device *dev;
11 int ret;
13 DRM_DEBUG("\n");
15 dev = drm_dev_alloc(driver, &interface->dev);
16 if (!dev)
17 return -ENOMEM;
19 dev->usbdev = interface_to_usbdev(interface);
20 usb_set_intfdata(interface, dev);
22 ret = drm_dev_register(dev, 0);
23 if (ret)
24 goto err_free;
26 DRM_INFO("Initialized %s %d.%d.%d %s on minor %d\n",
27 driver->name, driver->major, driver->minor, driver->patchlevel,
28 driver->date, dev->primary->index);
30 return 0;
32 err_free:
33 drm_dev_unref(dev);
34 return ret;
37 EXPORT_SYMBOL(drm_get_usb_dev);
39 static int drm_usb_set_busid(struct drm_device *dev,
40 struct drm_master *master)
42 return 0;
45 static struct drm_bus drm_usb_bus = {
46 .set_busid = drm_usb_set_busid,
49 /**
50 * drm_usb_init - Register matching USB devices with the DRM subsystem
51 * @driver: DRM device driver
52 * @udriver: USB device driver
54 * Registers one or more devices matched by a USB driver with the DRM
55 * subsystem.
57 * Return: 0 on success or a negative error code on failure.
59 int drm_usb_init(struct drm_driver *driver, struct usb_driver *udriver)
61 int res;
62 DRM_DEBUG("\n");
64 driver->bus = &drm_usb_bus;
66 res = usb_register(udriver);
67 return res;
69 EXPORT_SYMBOL(drm_usb_init);
71 /**
72 * drm_usb_exit - Unregister matching USB devices from the DRM subsystem
73 * @driver: DRM device driver
74 * @udriver: USB device driver
76 * Unregisters one or more devices matched by a USB driver from the DRM
77 * subsystem.
79 void drm_usb_exit(struct drm_driver *driver,
80 struct usb_driver *udriver)
82 usb_deregister(udriver);
84 EXPORT_SYMBOL(drm_usb_exit);
86 MODULE_AUTHOR("David Airlie");
87 MODULE_DESCRIPTION("USB DRM support");
88 MODULE_LICENSE("GPL and additional rights");