]> Pileus Git - ~andy/linux/commitdiff
drm: inline drm_agp_destroy
authorDaniel Vetter <daniel.vetter@ffwll.ch>
Wed, 11 Dec 2013 10:34:37 +0000 (11:34 +0100)
committerDave Airlie <airlied@redhat.com>
Wed, 18 Dec 2013 01:23:46 +0000 (11:23 +1000)
Wrapping a kfree is pointless.

v2: Add a comment to the kerneldoc for drm_agp_init to explain where
the kfree happens as requested by David. Note that for modeset drivers
agp cleanup is fairly complicated anyway: The drm_agp_clear is a noop
and drivers must call drm_agp_release on their own. Which they all
seem to do properly.

Cc: David Herrmann <dh.herrmann@gmail.com>
Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Dave Airlie <airlied@redhat.com>
drivers/gpu/drm/drm_agpsupport.c
drivers/gpu/drm/drm_pci.c
include/drm/drm_agpsupport.h

index 084a674e4b561e216e795190dcd5cc923d7ecea2..1f544af43617f6060a497c8ef790311d9172c1fd 100644 (file)
@@ -393,6 +393,9 @@ int drm_agp_free_ioctl(struct drm_device *dev, void *data,
  * Gets the drm_agp_t structure which is made available by the agpgart module
  * via the inter_module_* functions. Creates and initializes a drm_agp_head
  * structure.
+ *
+ * Note that final cleanup of the kmalloced structure is directly done in
+ * drm_pci_agp_destroy.
  */
 struct drm_agp_head *drm_agp_init(struct drm_device *dev)
 {
@@ -459,21 +462,6 @@ void drm_agp_clear(struct drm_device *dev)
        dev->agp->enabled = 0;
 }
 
-/**
- * drm_agp_destroy - Destroy AGP head
- * @dev: DRM device
- *
- * Destroy resources that were previously allocated via drm_agp_initp. Caller
- * must ensure to clean up all AGP resources before calling this. See
- * drm_agp_clear().
- *
- * Call this to destroy AGP heads allocated via drm_agp_init().
- */
-void drm_agp_destroy(struct drm_agp_head *agp)
-{
-       kfree(agp);
-}
-
 /**
  * Binds a collection of pages into AGP memory at the given offset, returning
  * the AGP memory structure containing them.
index 2211c4d70c2d8e9e5d866f88f138f3cc1d456557..f710e3d9d847298408048ad589e8ec4f8b238f5c 100644 (file)
@@ -281,7 +281,7 @@ static void drm_pci_agp_destroy(struct drm_device *dev)
        if (dev->agp) {
                arch_phys_wc_del(dev->agp->agp_mtrr);
                drm_agp_clear(dev);
-               drm_agp_destroy(dev->agp);
+               kfree(dev->agp);
                dev->agp = NULL;
        }
 }
index a12b0e011e444c91eec4a071b3686962e4adb4ad..56a861b2ceaa7f01e303a7e79218b46dd91f5321 100644 (file)
@@ -20,7 +20,6 @@ DRM_AGP_MEM *drm_agp_bind_pages(struct drm_device *dev,
                                uint32_t type);
 
 struct drm_agp_head *drm_agp_init(struct drm_device *dev);
-void drm_agp_destroy(struct drm_agp_head *agp);
 void drm_agp_clear(struct drm_device *dev);
 int drm_agp_acquire(struct drm_device *dev);
 int drm_agp_acquire_ioctl(struct drm_device *dev, void *data,
@@ -76,10 +75,6 @@ static inline struct drm_agp_head *drm_agp_init(struct drm_device *dev)
        return NULL;
 }
 
-static inline void drm_agp_destroy(struct drm_agp_head *agp)
-{
-}
-
 static inline void drm_agp_clear(struct drm_device *dev)
 {
 }