drm: add drm_dev_alloc() helper
Instead of managing device allocation+initialization in each bus-driver, we should do that in a central place. drm_fill_in_dev() already does most of it, but also requires the global drm lock for partial AGP device registration. Split both apart so we have a clean device initialization/allocation phase, and a registration phase. Signed-off-by: David Herrmann <dh.herrmann@gmail.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
This commit is contained in:

committed by
Dave Airlie

parent
16eb5f4379
commit
1bb72532ac
@@ -7,18 +7,15 @@ int drm_get_usb_dev(struct usb_interface *interface,
|
||||
struct drm_driver *driver)
|
||||
{
|
||||
struct drm_device *dev;
|
||||
struct usb_device *usbdev;
|
||||
int ret;
|
||||
|
||||
DRM_DEBUG("\n");
|
||||
|
||||
dev = kzalloc(sizeof(*dev), GFP_KERNEL);
|
||||
dev = drm_dev_alloc(driver, &interface->dev);
|
||||
if (!dev)
|
||||
return -ENOMEM;
|
||||
|
||||
usbdev = interface_to_usbdev(interface);
|
||||
dev->usbdev = usbdev;
|
||||
dev->dev = &interface->dev;
|
||||
dev->usbdev = interface_to_usbdev(interface);
|
||||
|
||||
mutex_lock(&drm_global_mutex);
|
||||
|
||||
|
Reference in New Issue
Block a user