aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Vetter <daniel.vetter@ffwll.ch>2013-12-11 05:34:36 -0500
committerDave Airlie <airlied@redhat.com>2013-12-17 20:22:30 -0500
commit2c695fa0444273c7139a3ca4c324c95498a0bfed (patch)
tree3612a56b876fd3773dc6a07083ec6120a08ad0fd
parentd9906753bb997d651beaba0e4026a873bd0e8340 (diff)
drm: remove agp_init() bus callback
The PCI bus helper is the only user of it. Call it directly before device-registration to get rid of the callback. Note that all drm_agp_*() calls are locked with the drm-global-mutex so we need to explicitly lock it during initialization. It's not really clear why it's needed, but lets be safe. v2: Rebase on top of the agp_init interface change. v3: Remove the rebase-fail where I've accidentally killed the ->irq_by_busid callback a bit too early. Cc: David Herrmann <dh.herrmann@gmail.com> Signed-off-by: David Herrmann <dh.herrmann@gmail.com> (v1) Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Signed-off-by: Dave Airlie <airlied@redhat.com>
-rw-r--r--drivers/gpu/drm/drm_pci.c12
-rw-r--r--drivers/gpu/drm/drm_stub.c8
-rw-r--r--include/drm/drmP.h1
3 files changed, 10 insertions, 11 deletions
diff --git a/drivers/gpu/drm/drm_pci.c b/drivers/gpu/drm/drm_pci.c
index 626e9cfd8aa5..2211c4d70c2d 100644
--- a/drivers/gpu/drm/drm_pci.c
+++ b/drivers/gpu/drm/drm_pci.c
@@ -293,7 +293,6 @@ static struct drm_bus drm_pci_bus = {
293 .set_busid = drm_pci_set_busid, 293 .set_busid = drm_pci_set_busid,
294 .set_unique = drm_pci_set_unique, 294 .set_unique = drm_pci_set_unique,
295 .irq_by_busid = drm_pci_irq_by_busid, 295 .irq_by_busid = drm_pci_irq_by_busid,
296 .agp_init = drm_pci_agp_init,
297 .agp_destroy = drm_pci_agp_destroy, 296 .agp_destroy = drm_pci_agp_destroy,
298}; 297};
299 298
@@ -332,9 +331,13 @@ int drm_get_pci_dev(struct pci_dev *pdev, const struct pci_device_id *ent,
332 if (drm_core_check_feature(dev, DRIVER_MODESET)) 331 if (drm_core_check_feature(dev, DRIVER_MODESET))
333 pci_set_drvdata(pdev, dev); 332 pci_set_drvdata(pdev, dev);
334 333
334 mutex_lock(&drm_global_mutex);
335 drm_pci_agp_init(dev);
336 mutex_unlock(&drm_global_mutex);
337
335 ret = drm_dev_register(dev, ent->driver_data); 338 ret = drm_dev_register(dev, ent->driver_data);
336 if (ret) 339 if (ret)
337 goto err_pci; 340 goto err_agp;
338 341
339 DRM_INFO("Initialized %s %d.%d.%d %s for %s on minor %d\n", 342 DRM_INFO("Initialized %s %d.%d.%d %s for %s on minor %d\n",
340 driver->name, driver->major, driver->minor, driver->patchlevel, 343 driver->name, driver->major, driver->minor, driver->patchlevel,
@@ -347,7 +350,10 @@ int drm_get_pci_dev(struct pci_dev *pdev, const struct pci_device_id *ent,
347 350
348 return 0; 351 return 0;
349 352
350err_pci: 353err_agp:
354 mutex_lock(&drm_global_mutex);
355 drm_pci_agp_destroy(dev);
356 mutex_unlock(&drm_global_mutex);
351 pci_disable_device(pdev); 357 pci_disable_device(pdev);
352err_free: 358err_free:
353 drm_dev_free(dev); 359 drm_dev_free(dev);
diff --git a/drivers/gpu/drm/drm_stub.c b/drivers/gpu/drm/drm_stub.c
index 82141e6e8ac8..128a2b7a1f66 100644
--- a/drivers/gpu/drm/drm_stub.c
+++ b/drivers/gpu/drm/drm_stub.c
@@ -527,13 +527,10 @@ int drm_dev_register(struct drm_device *dev, unsigned long flags)
527 527
528 mutex_lock(&drm_global_mutex); 528 mutex_lock(&drm_global_mutex);
529 529
530 if (dev->driver->bus->agp_init)
531 dev->driver->bus->agp_init(dev);
532
533 if (drm_core_check_feature(dev, DRIVER_MODESET)) { 530 if (drm_core_check_feature(dev, DRIVER_MODESET)) {
534 ret = drm_get_minor(dev, &dev->control, DRM_MINOR_CONTROL); 531 ret = drm_get_minor(dev, &dev->control, DRM_MINOR_CONTROL);
535 if (ret) 532 if (ret)
536 goto err_agp; 533 goto out_unlock;
537 } 534 }
538 535
539 if (drm_core_check_feature(dev, DRIVER_RENDER) && drm_rnodes) { 536 if (drm_core_check_feature(dev, DRIVER_RENDER) && drm_rnodes) {
@@ -572,9 +569,6 @@ err_render_node:
572 drm_put_minor(dev->render); 569 drm_put_minor(dev->render);
573err_control_node: 570err_control_node:
574 drm_put_minor(dev->control); 571 drm_put_minor(dev->control);
575err_agp:
576 if (dev->driver->bus->agp_destroy)
577 dev->driver->bus->agp_destroy(dev);
578out_unlock: 572out_unlock:
579 mutex_unlock(&drm_global_mutex); 573 mutex_unlock(&drm_global_mutex);
580 return ret; 574 return ret;
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index 04909a80735d..50a54c069518 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -767,7 +767,6 @@ struct drm_bus {
767 struct drm_unique *unique); 767 struct drm_unique *unique);
768 int (*irq_by_busid)(struct drm_device *dev, struct drm_irq_busid *p); 768 int (*irq_by_busid)(struct drm_device *dev, struct drm_irq_busid *p);
769 /* hooks that are for PCI */ 769 /* hooks that are for PCI */
770 void (*agp_init)(struct drm_device *dev);
771 void (*agp_destroy)(struct drm_device *dev); 770 void (*agp_destroy)(struct drm_device *dev);
772 771
773}; 772};