drm: remove agp_init() bus callback
authorDaniel Vetter <daniel.vetter@ffwll.ch>
Wed, 11 Dec 2013 10:34:36 +0000 (11:34 +0100)
committerDave Airlie <airlied@redhat.com>
Wed, 18 Dec 2013 01:22:30 +0000 (11:22 +1000)
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>
drivers/gpu/drm/drm_pci.c
drivers/gpu/drm/drm_stub.c
include/drm/drmP.h

index 626e9cfd8aa5ac355041d6fe8f81fd628de2b264..2211c4d70c2d8e9e5d866f88f138f3cc1d456557 100644 (file)
@@ -293,7 +293,6 @@ static struct drm_bus drm_pci_bus = {
        .set_busid = drm_pci_set_busid,
        .set_unique = drm_pci_set_unique,
        .irq_by_busid = drm_pci_irq_by_busid,
-       .agp_init = drm_pci_agp_init,
        .agp_destroy = drm_pci_agp_destroy,
 };
 
@@ -332,9 +331,13 @@ int drm_get_pci_dev(struct pci_dev *pdev, const struct pci_device_id *ent,
        if (drm_core_check_feature(dev, DRIVER_MODESET))
                pci_set_drvdata(pdev, dev);
 
+       mutex_lock(&drm_global_mutex);
+       drm_pci_agp_init(dev);
+       mutex_unlock(&drm_global_mutex);
+
        ret = drm_dev_register(dev, ent->driver_data);
        if (ret)
-               goto err_pci;
+               goto err_agp;
 
        DRM_INFO("Initialized %s %d.%d.%d %s for %s on minor %d\n",
                 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,
 
        return 0;
 
-err_pci:
+err_agp:
+       mutex_lock(&drm_global_mutex);
+       drm_pci_agp_destroy(dev);
+       mutex_unlock(&drm_global_mutex);
        pci_disable_device(pdev);
 err_free:
        drm_dev_free(dev);
index 82141e6e8ac842fb73d8501ee2dac5eab9bdb053..128a2b7a1f661bc6424994c86311164b19f88940 100644 (file)
@@ -527,13 +527,10 @@ int drm_dev_register(struct drm_device *dev, unsigned long flags)
 
        mutex_lock(&drm_global_mutex);
 
-       if (dev->driver->bus->agp_init)
-               dev->driver->bus->agp_init(dev);
-
        if (drm_core_check_feature(dev, DRIVER_MODESET)) {
                ret = drm_get_minor(dev, &dev->control, DRM_MINOR_CONTROL);
                if (ret)
-                       goto err_agp;
+                       goto out_unlock;
        }
 
        if (drm_core_check_feature(dev, DRIVER_RENDER) && drm_rnodes) {
@@ -572,9 +569,6 @@ err_render_node:
        drm_put_minor(dev->render);
 err_control_node:
        drm_put_minor(dev->control);
-err_agp:
-       if (dev->driver->bus->agp_destroy)
-               dev->driver->bus->agp_destroy(dev);
 out_unlock:
        mutex_unlock(&drm_global_mutex);
        return ret;
index 04909a80735dd992a53ecb153bda0ae8ba0ccad1..50a54c0695188bcf16f02d2ee415c6e2a5ebd9f9 100644 (file)
@@ -767,7 +767,6 @@ struct drm_bus {
                          struct drm_unique *unique);
        int (*irq_by_busid)(struct drm_device *dev, struct drm_irq_busid *p);
        /* hooks that are for PCI */
-       void (*agp_init)(struct drm_device *dev);
        void (*agp_destroy)(struct drm_device *dev);
 
 };