diff mbox

[18/19] drm: kill the ->agp_destroy callback

Message ID 1383485485-8210-19-git-send-email-daniel.vetter@ffwll.ch (mailing list archive)
State New, archived
Headers show

Commit Message

Daniel Vetter Nov. 3, 2013, 1:31 p.m. UTC
Call drm_pci_agp_destroy directly, there's no point in the
indirection. Long term we want to shuffle this into each driver's
unload logic, but that needs cleared-up drm lifetime rules first.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
 drivers/gpu/drm/drm_pci.c  | 3 +--
 drivers/gpu/drm/drm_stub.c | 4 ++--
 include/drm/drmP.h         | 4 +---
 3 files changed, 4 insertions(+), 7 deletions(-)

Comments

David Herrmann Nov. 3, 2013, 1:49 p.m. UTC | #1
Hi Daniel

On Sun, Nov 3, 2013 at 2:31 PM, Daniel Vetter <daniel.vetter@ffwll.ch> wrote:
> Call drm_pci_agp_destroy directly, there's no point in the
> indirection. Long term we want to shuffle this into each driver's
> unload logic, but that needs cleared-up drm lifetime rules first.
>
> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> ---
>  drivers/gpu/drm/drm_pci.c  | 3 +--
>  drivers/gpu/drm/drm_stub.c | 4 ++--
>  include/drm/drmP.h         | 4 +---
>  3 files changed, 4 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_pci.c b/drivers/gpu/drm/drm_pci.c
> index d0937dd62899..36e7f8e74027 100644
> --- a/drivers/gpu/drm/drm_pci.c
> +++ b/drivers/gpu/drm/drm_pci.c
> @@ -276,7 +276,7 @@ static void drm_pci_agp_init(struct drm_device *dev)
>         }
>  }
>
> -static void drm_pci_agp_destroy(struct drm_device *dev)
> +void drm_pci_agp_destroy(struct drm_device *dev)

That one is #ifdef CONFIG_PCI
So please provide a dummy below, same as for drm_pci_init().

If that's fixed:

Reviewed-by: David Herrmann <dh.herrmann@gmail.com>

Thanks
David

>  {
>         if (dev->agp) {
>                 arch_phys_wc_del(dev->agp->agp_mtrr);
> @@ -292,7 +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,
> -       .agp_destroy = drm_pci_agp_destroy,
>  };
>
>  /**
> diff --git a/drivers/gpu/drm/drm_stub.c b/drivers/gpu/drm/drm_stub.c
> index 4b25f693ae89..3ec8d4f9f09a 100644
> --- a/drivers/gpu/drm/drm_stub.c
> +++ b/drivers/gpu/drm/drm_stub.c
> @@ -569,8 +569,8 @@ void drm_dev_unregister(struct drm_device *dev)
>         if (dev->driver->unload)
>                 dev->driver->unload(dev);
>
> -       if (dev->driver->bus->agp_destroy)
> -               dev->driver->bus->agp_destroy(dev);
> +       if (dev->agp)
> +               drm_pci_agp_destroy(dev);
>
>         drm_vblank_cleanup(dev);
>
> diff --git a/include/drm/drmP.h b/include/drm/drmP.h
> index 8cf8cfef8c56..f67104aa7b51 100644
> --- a/include/drm/drmP.h
> +++ b/include/drm/drmP.h
> @@ -748,9 +748,6 @@ struct drm_bus {
>         int (*set_unique)(struct drm_device *dev, struct drm_master *master,
>                           struct drm_unique *unique);
>         int (*irq_by_busid)(struct drm_device *dev, struct drm_irq_busid *p);
> -       /* hooks that are for PCI */
> -       void (*agp_destroy)(struct drm_device *dev);
> -
>  };
>
>  /**
> @@ -1658,6 +1655,7 @@ static __inline__ int drm_pci_device_is_agp(struct drm_device *dev)
>
>         return pci_find_capability(dev->pdev, PCI_CAP_ID_AGP);
>  }
> +void drm_pci_agp_destroy(struct drm_device *dev);
>
>  extern int drm_pci_init(struct drm_driver *driver, struct pci_driver *pdriver);
>  extern void drm_pci_exit(struct drm_driver *driver, struct pci_driver *pdriver);
> --
> 1.8.4.rc3
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
diff mbox

Patch

diff --git a/drivers/gpu/drm/drm_pci.c b/drivers/gpu/drm/drm_pci.c
index d0937dd62899..36e7f8e74027 100644
--- a/drivers/gpu/drm/drm_pci.c
+++ b/drivers/gpu/drm/drm_pci.c
@@ -276,7 +276,7 @@  static void drm_pci_agp_init(struct drm_device *dev)
 	}
 }
 
-static void drm_pci_agp_destroy(struct drm_device *dev)
+void drm_pci_agp_destroy(struct drm_device *dev)
 {
 	if (dev->agp) {
 		arch_phys_wc_del(dev->agp->agp_mtrr);
@@ -292,7 +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,
-	.agp_destroy = drm_pci_agp_destroy,
 };
 
 /**
diff --git a/drivers/gpu/drm/drm_stub.c b/drivers/gpu/drm/drm_stub.c
index 4b25f693ae89..3ec8d4f9f09a 100644
--- a/drivers/gpu/drm/drm_stub.c
+++ b/drivers/gpu/drm/drm_stub.c
@@ -569,8 +569,8 @@  void drm_dev_unregister(struct drm_device *dev)
 	if (dev->driver->unload)
 		dev->driver->unload(dev);
 
-	if (dev->driver->bus->agp_destroy)
-		dev->driver->bus->agp_destroy(dev);
+	if (dev->agp)
+		drm_pci_agp_destroy(dev);
 
 	drm_vblank_cleanup(dev);
 
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index 8cf8cfef8c56..f67104aa7b51 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -748,9 +748,6 @@  struct drm_bus {
 	int (*set_unique)(struct drm_device *dev, struct drm_master *master,
 			  struct drm_unique *unique);
 	int (*irq_by_busid)(struct drm_device *dev, struct drm_irq_busid *p);
-	/* hooks that are for PCI */
-	void (*agp_destroy)(struct drm_device *dev);
-
 };
 
 /**
@@ -1658,6 +1655,7 @@  static __inline__ int drm_pci_device_is_agp(struct drm_device *dev)
 
 	return pci_find_capability(dev->pdev, PCI_CAP_ID_AGP);
 }
+void drm_pci_agp_destroy(struct drm_device *dev);
 
 extern int drm_pci_init(struct drm_driver *driver, struct pci_driver *pdriver);
 extern void drm_pci_exit(struct drm_driver *driver, struct pci_driver *pdriver);