[PATCH 16/19] drm: remove agp_init() bus callback
David Herrmann
dh.herrmann at gmail.com
Sun Nov 3 06:14:39 PST 2013
Hi Daniel
On Sun, Nov 3, 2013 at 2:31 PM, Daniel Vetter <daniel.vetter at ffwll.ch> wrote:
> From: David Herrmann <dh.herrmann at gmail.com>
>
> 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.
>
> Signed-off-by: David Herrmann <dh.herrmann at gmail.com> (v1)
> Signed-off-by: Daniel Vetter <daniel.vetter at ffwll.ch>
> ---
> drivers/gpu/drm/drm_pci.c | 13 +++++++++----
> drivers/gpu/drm/drm_stub.c | 8 +-------
> include/drm/drmP.h | 1 -
> 3 files changed, 10 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_pci.c b/drivers/gpu/drm/drm_pci.c
> index 4ec43b8d42f5..54eae6d83e5d 100644
> --- a/drivers/gpu/drm/drm_pci.c
> +++ b/drivers/gpu/drm/drm_pci.c
> @@ -292,8 +292,6 @@ static struct drm_bus drm_pci_bus = {
> .get_name = drm_pci_get_name,
> .set_busid = drm_pci_set_busid,
> .set_unique = drm_pci_set_unique,
> - .irq_by_busid = drm_pci_irq_by_busid,
Err, where does that come from?
Cheers
David
> - .agp_init = drm_pci_agp_init,
> .agp_destroy = drm_pci_agp_destroy,
> };
>
> @@ -332,9 +330,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 +349,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);
> diff --git a/drivers/gpu/drm/drm_stub.c b/drivers/gpu/drm/drm_stub.c
> index dea432b2dfcf..4b25f693ae89 100644
> --- a/drivers/gpu/drm/drm_stub.c
> +++ b/drivers/gpu/drm/drm_stub.c
> @@ -502,13 +502,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) {
> @@ -549,9 +546,6 @@ err_render_node:
> err_control_node:
> if (dev->control)
> 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;
> diff --git a/include/drm/drmP.h b/include/drm/drmP.h
> index df502c292ef8..8cf8cfef8c56 100644
> --- a/include/drm/drmP.h
> +++ b/include/drm/drmP.h
> @@ -749,7 +749,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);
>
> };
> --
> 1.8.4.rc3
>
More information about the dri-devel
mailing list