aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/drm_drv.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-08-05 19:02:01 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-08-05 19:02:01 -0400
commitfc1caf6eafb30ea185720e29f7f5eccca61ecd60 (patch)
tree666dabc25a9b02e5c05f9eba32fa6b0d8027341a /drivers/gpu/drm/drm_drv.c
parent9779714c8af09d57527f18d9aa2207dcc27a8687 (diff)
parent96576a9e1a0cdb8a43d3af5846be0948f52b4460 (diff)
Merge branch 'drm-core-next' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6
* 'drm-core-next' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6: (204 commits) agp: intel-agp: do not use PCI resources before pci_enable_device() agp: efficeon-agp: do not use PCI resources before pci_enable_device() drm: kill BKL from common code drm/kms: Simplify setup of the initial I2C encoder config. drm,io-mapping: Specify slot to use for atomic mappings drm/radeon/kms: only expose underscan on avivo chips drm/radeon: add new pci ids drm: Cleanup after failing to create master->unique and dev->name drm/radeon: tone down overchatty acpi debug messages. drm/radeon/kms: enable underscan option for digital connectors drm/radeon/kms: fix calculation of h/v scaling factors drm/radeon/kms/igp: sideport is AMD only drm/radeon/kms: handle the case of no active displays properly in the bandwidth code drm: move ttm global code to core drm drm/i915: Clear the Ironlake dithering flags when the pipe doesn't want it. drm/radeon/kms: make sure HPD is set to NONE on analog-only connectors drm/radeon/kms: make sure rio_mem is valid before unmapping it drm/agp/i915: trim stolen space to 32M drm/i915: Unset cursor if out-of-bounds upon mode change (v4) drm/i915: Unreference object not handle on creation ...
Diffstat (limited to 'drivers/gpu/drm/drm_drv.c')
-rw-r--r--drivers/gpu/drm/drm_drv.c43
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 */
251int drm_init(struct drm_driver *driver) 251int 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
289EXPORT_SYMBOL(drm_init); 262EXPORT_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) {