[PATCH 1/2] drm: remove agp_init() bus callback
David Herrmann
dh.herrmann at gmail.com
Sun Nov 3 03:06:05 PST 2013
Hi Dave
This one can also go into 3.13. This and 2/2 provide the agp_init()
cleanup that Daniel suggested for the drm_dev_*() patches. 2/2 is not
required, but I thought it was a nice addition.
Thanks
David
On Sat, Oct 19, 2013 at 1:58 PM, David Herrmann <dh.herrmann at gmail.com> wrote:
> 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.
>
> Signed-off-by: David Herrmann <dh.herrmann at gmail.com>
> ---
> Hi
>
> If someone wants to review drm_agpsupport.c and tell me why _all_ calls to
> drm_agp_*() functions currently hold the global mutex, I'd be happy to hear it.
> Otherwise, I will just not care for that old stuff and keep the semantics with
> the kind of ugly locks around drm_pci_agp_*().
>
> Thanks
> David
>
> drivers/gpu/drm/drm_pci.c | 13 +++++++++++--
> drivers/gpu/drm/drm_stub.c | 11 +----------
> include/drm/drmP.h | 1 -
> 3 files changed, 12 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_pci.c b/drivers/gpu/drm/drm_pci.c
> index f00d7a9..7d3435c 100644
> --- a/drivers/gpu/drm/drm_pci.c
> +++ b/drivers/gpu/drm/drm_pci.c
> @@ -299,7 +299,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,
> };
>
> @@ -338,16 +337,26 @@ 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);
>
> - ret = drm_dev_register(dev, ent->driver_data);
> + mutex_lock(&drm_global_mutex);
> + ret = drm_pci_agp_init(dev);
> + mutex_unlock(&drm_global_mutex);
> if (ret)
> goto err_pci;
>
> + ret = drm_dev_register(dev, ent->driver_data);
> + if (ret)
> + 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,
> driver->date, pci_name(pdev), dev->primary->index);
>
> return 0;
>
> +err_agp:
> + mutex_lock(&drm_global_mutex);
> + drm_pci_agp_destroy(dev);
> + mutex_unlock(&drm_global_mutex);
> err_pci:
> pci_disable_device(pdev);
> err_free:
> diff --git a/drivers/gpu/drm/drm_stub.c b/drivers/gpu/drm/drm_stub.c
> index 26055ab..ac211c3 100644
> --- a/drivers/gpu/drm/drm_stub.c
> +++ b/drivers/gpu/drm/drm_stub.c
> @@ -502,16 +502,10 @@ int drm_dev_register(struct drm_device *dev, unsigned long flags)
>
> mutex_lock(&drm_global_mutex);
>
> - if (dev->driver->bus->agp_init) {
> - ret = dev->driver->bus->agp_init(dev);
> - if (ret)
> - goto out_unlock;
> - }
> -
> 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) {
> @@ -554,9 +548,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 2b954ad..dfc44ae 100644
> --- a/include/drm/drmP.h
> +++ b/include/drm/drmP.h
> @@ -750,7 +750,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 */
> - int (*agp_init)(struct drm_device *dev);
> void (*agp_destroy)(struct drm_device *dev);
>
> };
> --
> 1.8.4.1
>
More information about the dri-devel
mailing list