diff options
Diffstat (limited to 'drivers/gpu/drm/drm_drv.c')
-rw-r--r-- | drivers/gpu/drm/drm_drv.c | 43 |
1 files changed, 9 insertions, 34 deletions
diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c index 4a66201edaec..90288ec7c284 100644 --- a/drivers/gpu/drm/drm_drv.c +++ b/drivers/gpu/drm/drm_drv.c | |||
@@ -243,47 +243,20 @@ int drm_lastclose(struct drm_device * dev) | |||
243 | * | 243 | * |
244 | * Initializes an array of drm_device structures, and attempts to | 244 | * Initializes an array of drm_device structures, and attempts to |
245 | * initialize all available devices, using consecutive minors, registering the | 245 | * initialize all available devices, using consecutive minors, registering the |
246 | * stubs and initializing the AGP device. | 246 | * stubs and initializing the device. |
247 | * | 247 | * |
248 | * Expands the \c DRIVER_PREINIT and \c DRIVER_POST_INIT macros before and | 248 | * Expands the \c DRIVER_PREINIT and \c DRIVER_POST_INIT macros before and |
249 | * after the initialization for driver customization. | 249 | * after the initialization for driver customization. |
250 | */ | 250 | */ |
251 | int drm_init(struct drm_driver *driver) | 251 | int drm_init(struct drm_driver *driver) |
252 | { | 252 | { |
253 | struct pci_dev *pdev = NULL; | ||
254 | const struct pci_device_id *pid; | ||
255 | int i; | ||
256 | |||
257 | DRM_DEBUG("\n"); | 253 | DRM_DEBUG("\n"); |
258 | |||
259 | INIT_LIST_HEAD(&driver->device_list); | 254 | INIT_LIST_HEAD(&driver->device_list); |
260 | 255 | ||
261 | if (driver->driver_features & DRIVER_MODESET) | 256 | if (driver->driver_features & DRIVER_USE_PLATFORM_DEVICE) |
262 | return pci_register_driver(&driver->pci_driver); | 257 | return drm_platform_init(driver); |
263 | 258 | else | |
264 | /* If not using KMS, fall back to stealth mode manual scanning. */ | 259 | return drm_pci_init(driver); |
265 | for (i = 0; driver->pci_driver.id_table[i].vendor != 0; i++) { | ||
266 | pid = &driver->pci_driver.id_table[i]; | ||
267 | |||
268 | /* Loop around setting up a DRM device for each PCI device | ||
269 | * matching our ID and device class. If we had the internal | ||
270 | * function that pci_get_subsys and pci_get_class used, we'd | ||
271 | * be able to just pass pid in instead of doing a two-stage | ||
272 | * thing. | ||
273 | */ | ||
274 | pdev = NULL; | ||
275 | while ((pdev = | ||
276 | pci_get_subsys(pid->vendor, pid->device, pid->subvendor, | ||
277 | pid->subdevice, pdev)) != NULL) { | ||
278 | if ((pdev->class & pid->class_mask) != pid->class) | ||
279 | continue; | ||
280 | |||
281 | /* stealth mode requires a manual probe */ | ||
282 | pci_dev_get(pdev); | ||
283 | drm_get_dev(pdev, pid, driver); | ||
284 | } | ||
285 | } | ||
286 | return 0; | ||
287 | } | 260 | } |
288 | 261 | ||
289 | EXPORT_SYMBOL(drm_init); | 262 | EXPORT_SYMBOL(drm_init); |
@@ -315,6 +288,7 @@ static int __init drm_core_init(void) | |||
315 | { | 288 | { |
316 | int ret = -ENOMEM; | 289 | int ret = -ENOMEM; |
317 | 290 | ||
291 | drm_global_init(); | ||
318 | idr_init(&drm_minors_idr); | 292 | idr_init(&drm_minors_idr); |
319 | 293 | ||
320 | if (register_chrdev(DRM_MAJOR, "drm", &drm_stub_fops)) | 294 | if (register_chrdev(DRM_MAJOR, "drm", &drm_stub_fops)) |
@@ -362,6 +336,7 @@ static void __exit drm_core_exit(void) | |||
362 | 336 | ||
363 | unregister_chrdev(DRM_MAJOR, "drm"); | 337 | unregister_chrdev(DRM_MAJOR, "drm"); |
364 | 338 | ||
339 | idr_remove_all(&drm_minors_idr); | ||
365 | idr_destroy(&drm_minors_idr); | 340 | idr_destroy(&drm_minors_idr); |
366 | } | 341 | } |
367 | 342 | ||
@@ -506,9 +481,9 @@ long drm_ioctl(struct file *filp, | |||
506 | if (ioctl->flags & DRM_UNLOCKED) | 481 | if (ioctl->flags & DRM_UNLOCKED) |
507 | retcode = func(dev, kdata, file_priv); | 482 | retcode = func(dev, kdata, file_priv); |
508 | else { | 483 | else { |
509 | lock_kernel(); | 484 | mutex_lock(&drm_global_mutex); |
510 | retcode = func(dev, kdata, file_priv); | 485 | retcode = func(dev, kdata, file_priv); |
511 | unlock_kernel(); | 486 | mutex_unlock(&drm_global_mutex); |
512 | } | 487 | } |
513 | 488 | ||
514 | if (cmd & IOC_OUT) { | 489 | if (cmd & IOC_OUT) { |