diff options
Diffstat (limited to 'drivers/gpu/drm/drm_stub.c')
-rw-r--r-- | drivers/gpu/drm/drm_stub.c | 101 |
1 files changed, 82 insertions, 19 deletions
diff --git a/drivers/gpu/drm/drm_stub.c b/drivers/gpu/drm/drm_stub.c index 64bd52f13199..432994aafc3b 100644 --- a/drivers/gpu/drm/drm_stub.c +++ b/drivers/gpu/drm/drm_stub.c | |||
@@ -254,25 +254,6 @@ int drm_dropmaster_ioctl(struct drm_device *dev, void *data, | |||
254 | return 0; | 254 | return 0; |
255 | } | 255 | } |
256 | 256 | ||
257 | int drm_fill_in_dev(struct drm_device *dev, | ||
258 | const struct pci_device_id *ent, | ||
259 | struct drm_driver *driver) | ||
260 | { | ||
261 | int retcode; | ||
262 | |||
263 | if (dev->driver->bus->agp_init) { | ||
264 | retcode = dev->driver->bus->agp_init(dev); | ||
265 | if (retcode) { | ||
266 | drm_lastclose(dev); | ||
267 | return retcode; | ||
268 | } | ||
269 | } | ||
270 | |||
271 | return 0; | ||
272 | } | ||
273 | EXPORT_SYMBOL(drm_fill_in_dev); | ||
274 | |||
275 | |||
276 | /** | 257 | /** |
277 | * Get a secondary minor number. | 258 | * Get a secondary minor number. |
278 | * | 259 | * |
@@ -452,6 +433,8 @@ EXPORT_SYMBOL(drm_unplug_dev); | |||
452 | * @parent: Parent device object | 433 | * @parent: Parent device object |
453 | * | 434 | * |
454 | * Allocate and initialize a new DRM device. No device registration is done. | 435 | * Allocate and initialize a new DRM device. No device registration is done. |
436 | * Call drm_dev_register() to advertice the device to user space and register it | ||
437 | * with other core subsystems. | ||
455 | * | 438 | * |
456 | * RETURNS: | 439 | * RETURNS: |
457 | * Pointer to new DRM device, or NULL if out of memory. | 440 | * Pointer to new DRM device, or NULL if out of memory. |
@@ -517,3 +500,83 @@ err_free: | |||
517 | return NULL; | 500 | return NULL; |
518 | } | 501 | } |
519 | EXPORT_SYMBOL(drm_dev_alloc); | 502 | EXPORT_SYMBOL(drm_dev_alloc); |
503 | |||
504 | /** | ||
505 | * drm_dev_register - Register DRM device | ||
506 | * @dev: Device to register | ||
507 | * | ||
508 | * Register the DRM device @dev with the system, advertise device to user-space | ||
509 | * and start normal device operation. @dev must be allocated via drm_dev_alloc() | ||
510 | * previously. | ||
511 | * | ||
512 | * Never call this twice on any device! | ||
513 | * | ||
514 | * RETURNS: | ||
515 | * 0 on success, negative error code on failure. | ||
516 | */ | ||
517 | int drm_dev_register(struct drm_device *dev, unsigned long flags) | ||
518 | { | ||
519 | int ret; | ||
520 | |||
521 | mutex_lock(&drm_global_mutex); | ||
522 | |||
523 | if (dev->driver->bus->agp_init) { | ||
524 | ret = dev->driver->bus->agp_init(dev); | ||
525 | if (ret) | ||
526 | goto out_unlock; | ||
527 | } | ||
528 | |||
529 | if (drm_core_check_feature(dev, DRIVER_MODESET)) { | ||
530 | ret = drm_get_minor(dev, &dev->control, DRM_MINOR_CONTROL); | ||
531 | if (ret) | ||
532 | goto err_agp; | ||
533 | } | ||
534 | |||
535 | if (drm_core_check_feature(dev, DRIVER_RENDER) && drm_rnodes) { | ||
536 | ret = drm_get_minor(dev, &dev->render, DRM_MINOR_RENDER); | ||
537 | if (ret) | ||
538 | goto err_control_node; | ||
539 | } | ||
540 | |||
541 | ret = drm_get_minor(dev, &dev->primary, DRM_MINOR_LEGACY); | ||
542 | if (ret) | ||
543 | goto err_render_node; | ||
544 | |||
545 | if (dev->driver->load) { | ||
546 | ret = dev->driver->load(dev, flags); | ||
547 | if (ret) | ||
548 | goto err_primary_node; | ||
549 | } | ||
550 | |||
551 | /* setup grouping for legacy outputs */ | ||
552 | if (drm_core_check_feature(dev, DRIVER_MODESET)) { | ||
553 | ret = drm_mode_group_init_legacy_group(dev, | ||
554 | &dev->primary->mode_group); | ||
555 | if (ret) | ||
556 | goto err_unload; | ||
557 | } | ||
558 | |||
559 | list_add_tail(&dev->driver_item, &dev->driver->device_list); | ||
560 | |||
561 | ret = 0; | ||
562 | goto out_unlock; | ||
563 | |||
564 | err_unload: | ||
565 | if (dev->driver->unload) | ||
566 | dev->driver->unload(dev); | ||
567 | err_primary_node: | ||
568 | drm_put_minor(&dev->primary); | ||
569 | err_render_node: | ||
570 | if (dev->render) | ||
571 | drm_put_minor(&dev->render); | ||
572 | err_control_node: | ||
573 | if (dev->control) | ||
574 | drm_put_minor(&dev->control); | ||
575 | err_agp: | ||
576 | if (dev->driver->bus->agp_destroy) | ||
577 | dev->driver->bus->agp_destroy(dev); | ||
578 | out_unlock: | ||
579 | mutex_unlock(&drm_global_mutex); | ||
580 | return ret; | ||
581 | } | ||
582 | EXPORT_SYMBOL(drm_dev_register); | ||