PM / sleep: Asynchronous threads for suspend_noirq
[linux/fpc-iii.git] / drivers / gpu / drm / drm_usb.c
blob0f8cb1ae76074d2bf21d75d678585222019f2cdd
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_free(dev);
34 return ret;
37 EXPORT_SYMBOL(drm_get_usb_dev);
39 static int drm_usb_get_irq(struct drm_device *dev)
41 return 0;
44 static const char *drm_usb_get_name(struct drm_device *dev)
46 return "USB";
49 static int drm_usb_set_busid(struct drm_device *dev,
50 struct drm_master *master)
52 return 0;
55 static struct drm_bus drm_usb_bus = {
56 .bus_type = DRIVER_BUS_USB,
57 .get_irq = drm_usb_get_irq,
58 .get_name = drm_usb_get_name,
59 .set_busid = drm_usb_set_busid,
62 int drm_usb_init(struct drm_driver *driver, struct usb_driver *udriver)
64 int res;
65 DRM_DEBUG("\n");
67 driver->kdriver.usb = udriver;
68 driver->bus = &drm_usb_bus;
70 res = usb_register(udriver);
71 return res;
73 EXPORT_SYMBOL(drm_usb_init);
75 void drm_usb_exit(struct drm_driver *driver,
76 struct usb_driver *udriver)
78 usb_deregister(udriver);
80 EXPORT_SYMBOL(drm_usb_exit);
82 MODULE_AUTHOR("David Airlie");
83 MODULE_DESCRIPTION("USB DRM support");
84 MODULE_LICENSE("GPL and additional rights");