3 #include <linux/export.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 struct usb_device
*usbdev
;
16 dev
= kzalloc(sizeof(*dev
), GFP_KERNEL
);
20 usbdev
= interface_to_usbdev(interface
);
22 dev
->dev
= &usbdev
->dev
;
24 mutex_lock(&drm_global_mutex
);
26 ret
= drm_fill_in_dev(dev
, NULL
, driver
);
28 printk(KERN_ERR
"DRM: Fill_in_dev failed.\n");
32 usb_set_intfdata(interface
, dev
);
33 ret
= drm_get_minor(dev
, &dev
->control
, DRM_MINOR_CONTROL
);
37 ret
= drm_get_minor(dev
, &dev
->primary
, DRM_MINOR_LEGACY
);
41 if (dev
->driver
->load
) {
42 ret
= dev
->driver
->load(dev
, 0);
47 /* setup the grouping for the legacy output */
48 ret
= drm_mode_group_init_legacy_group(dev
,
49 &dev
->primary
->mode_group
);
53 list_add_tail(&dev
->driver_item
, &driver
->device_list
);
55 mutex_unlock(&drm_global_mutex
);
57 DRM_INFO("Initialized %s %d.%d.%d %s on minor %d\n",
58 driver
->name
, driver
->major
, driver
->minor
, driver
->patchlevel
,
59 driver
->date
, dev
->primary
->index
);
64 drm_put_minor(&dev
->primary
);
66 drm_put_minor(&dev
->control
);
69 mutex_unlock(&drm_global_mutex
);
73 EXPORT_SYMBOL(drm_get_usb_dev
);
75 static int drm_usb_get_irq(struct drm_device
*dev
)
80 static const char *drm_usb_get_name(struct drm_device
*dev
)
85 static int drm_usb_set_busid(struct drm_device
*dev
,
86 struct drm_master
*master
)
91 static struct drm_bus drm_usb_bus
= {
92 .bus_type
= DRIVER_BUS_USB
,
93 .get_irq
= drm_usb_get_irq
,
94 .get_name
= drm_usb_get_name
,
95 .set_busid
= drm_usb_set_busid
,
98 int drm_usb_init(struct drm_driver
*driver
, struct usb_driver
*udriver
)
103 INIT_LIST_HEAD(&driver
->device_list
);
104 driver
->kdriver
.usb
= udriver
;
105 driver
->bus
= &drm_usb_bus
;
107 res
= usb_register(udriver
);
110 EXPORT_SYMBOL(drm_usb_init
);
112 void drm_usb_exit(struct drm_driver
*driver
,
113 struct usb_driver
*udriver
)
115 usb_deregister(udriver
);
117 EXPORT_SYMBOL(drm_usb_exit
);