aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/drm_stub.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/drm_stub.c')
-rw-r--r--drivers/gpu/drm/drm_stub.c92
1 files changed, 5 insertions, 87 deletions
diff --git a/drivers/gpu/drm/drm_stub.c b/drivers/gpu/drm/drm_stub.c
index a0c365f2e521..d1ad57450df1 100644
--- a/drivers/gpu/drm/drm_stub.c
+++ b/drivers/gpu/drm/drm_stub.c
@@ -156,6 +156,9 @@ static void drm_master_destroy(struct kref *kref)
156 master->unique_len = 0; 156 master->unique_len = 0;
157 } 157 }
158 158
159 kfree(dev->devname);
160 dev->devname = NULL;
161
159 list_for_each_entry_safe(pt, next, &master->magicfree, head) { 162 list_for_each_entry_safe(pt, next, &master->magicfree, head) {
160 list_del(&pt->head); 163 list_del(&pt->head);
161 drm_ht_remove_item(&master->magiclist, &pt->hash_item); 164 drm_ht_remove_item(&master->magiclist, &pt->hash_item);
@@ -224,7 +227,7 @@ int drm_dropmaster_ioctl(struct drm_device *dev, void *data,
224 return 0; 227 return 0;
225} 228}
226 229
227static int drm_fill_in_dev(struct drm_device * dev, struct pci_dev *pdev, 230int drm_fill_in_dev(struct drm_device *dev,
228 const struct pci_device_id *ent, 231 const struct pci_device_id *ent,
229 struct drm_driver *driver) 232 struct drm_driver *driver)
230{ 233{
@@ -245,14 +248,6 @@ static int drm_fill_in_dev(struct drm_device * dev, struct pci_dev *pdev,
245 248
246 idr_init(&dev->drw_idr); 249 idr_init(&dev->drw_idr);
247 250
248 dev->pdev = pdev;
249 dev->pci_device = pdev->device;
250 dev->pci_vendor = pdev->vendor;
251
252#ifdef __alpha__
253 dev->hose = pdev->sysdata;
254#endif
255
256 if (drm_ht_create(&dev->map_hash, 12)) { 251 if (drm_ht_create(&dev->map_hash, 12)) {
257 return -ENOMEM; 252 return -ENOMEM;
258 } 253 }
@@ -321,7 +316,7 @@ static int drm_fill_in_dev(struct drm_device * dev, struct pci_dev *pdev,
321 * create the proc init entry via proc_init(). This routines assigns 316 * create the proc init entry via proc_init(). This routines assigns
322 * minor numbers to secondary heads of multi-headed cards 317 * minor numbers to secondary heads of multi-headed cards
323 */ 318 */
324static int drm_get_minor(struct drm_device *dev, struct drm_minor **minor, int type) 319int drm_get_minor(struct drm_device *dev, struct drm_minor **minor, int type)
325{ 320{
326 struct drm_minor *new_minor; 321 struct drm_minor *new_minor;
327 int ret; 322 int ret;
@@ -388,83 +383,6 @@ err_idr:
388} 383}
389 384
390/** 385/**
391 * Register.
392 *
393 * \param pdev - PCI device structure
394 * \param ent entry from the PCI ID table with device type flags
395 * \return zero on success or a negative number on failure.
396 *
397 * Attempt to gets inter module "drm" information. If we are first
398 * then register the character device and inter module information.
399 * Try and register, if we fail to register, backout previous work.
400 */
401int drm_get_dev(struct pci_dev *pdev, const struct pci_device_id *ent,
402 struct drm_driver *driver)
403{
404 struct drm_device *dev;
405 int ret;
406
407 DRM_DEBUG("\n");
408
409 dev = kzalloc(sizeof(*dev), GFP_KERNEL);
410 if (!dev)
411 return -ENOMEM;
412
413 ret = pci_enable_device(pdev);
414 if (ret)
415 goto err_g1;
416
417 pci_set_master(pdev);
418 if ((ret = drm_fill_in_dev(dev, pdev, ent, driver))) {
419 printk(KERN_ERR "DRM: Fill_in_dev failed.\n");
420 goto err_g2;
421 }
422
423 if (drm_core_check_feature(dev, DRIVER_MODESET)) {
424 pci_set_drvdata(pdev, dev);
425 ret = drm_get_minor(dev, &dev->control, DRM_MINOR_CONTROL);
426 if (ret)
427 goto err_g2;
428 }
429
430 if ((ret = drm_get_minor(dev, &dev->primary, DRM_MINOR_LEGACY)))
431 goto err_g3;
432
433 if (dev->driver->load) {
434 ret = dev->driver->load(dev, ent->driver_data);
435 if (ret)
436 goto err_g4;
437 }
438
439 /* setup the grouping for the legacy output */
440 if (drm_core_check_feature(dev, DRIVER_MODESET)) {
441 ret = drm_mode_group_init_legacy_group(dev, &dev->primary->mode_group);
442 if (ret)
443 goto err_g4;
444 }
445
446 list_add_tail(&dev->driver_item, &driver->device_list);
447
448 DRM_INFO("Initialized %s %d.%d.%d %s for %s on minor %d\n",
449 driver->name, driver->major, driver->minor, driver->patchlevel,
450 driver->date, pci_name(pdev), dev->primary->index);
451
452 return 0;
453
454err_g4:
455 drm_put_minor(&dev->primary);
456err_g3:
457 if (drm_core_check_feature(dev, DRIVER_MODESET))
458 drm_put_minor(&dev->control);
459err_g2:
460 pci_disable_device(pdev);
461err_g1:
462 kfree(dev);
463 return ret;
464}
465EXPORT_SYMBOL(drm_get_dev);
466
467/**
468 * Put a secondary minor number. 386 * Put a secondary minor number.
469 * 387 *
470 * \param sec_minor - structure to be released 388 * \param sec_minor - structure to be released