aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Vetter <daniel.vetter@ffwll.ch>2013-12-11 05:34:37 -0500
committerDave Airlie <airlied@redhat.com>2013-12-17 20:23:46 -0500
commitd6e4b28b60c5dae660aebe5cd731b21d02ca285e (patch)
tree8dbd4ad61de18f5d2f0354d9b82f1c9c3dc713e0
parent2c695fa0444273c7139a3ca4c324c95498a0bfed (diff)
drm: inline drm_agp_destroy
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>
-rw-r--r--drivers/gpu/drm/drm_agpsupport.c18
-rw-r--r--drivers/gpu/drm/drm_pci.c2
-rw-r--r--include/drm/drm_agpsupport.h5
3 files changed, 4 insertions, 21 deletions
diff --git a/drivers/gpu/drm/drm_agpsupport.c b/drivers/gpu/drm/drm_agpsupport.c
index 084a674e4b56..1f544af43617 100644
--- a/drivers/gpu/drm/drm_agpsupport.c
+++ b/drivers/gpu/drm/drm_agpsupport.c
@@ -393,6 +393,9 @@ int drm_agp_free_ioctl(struct drm_device *dev, void *data,
393 * Gets the drm_agp_t structure which is made available by the agpgart module 393 * Gets the drm_agp_t structure which is made available by the agpgart module
394 * via the inter_module_* functions. Creates and initializes a drm_agp_head 394 * via the inter_module_* functions. Creates and initializes a drm_agp_head
395 * structure. 395 * structure.
396 *
397 * Note that final cleanup of the kmalloced structure is directly done in
398 * drm_pci_agp_destroy.
396 */ 399 */
397struct drm_agp_head *drm_agp_init(struct drm_device *dev) 400struct drm_agp_head *drm_agp_init(struct drm_device *dev)
398{ 401{
@@ -460,21 +463,6 @@ void drm_agp_clear(struct drm_device *dev)
460} 463}
461 464
462/** 465/**
463 * drm_agp_destroy - Destroy AGP head
464 * @dev: DRM device
465 *
466 * Destroy resources that were previously allocated via drm_agp_initp. Caller
467 * must ensure to clean up all AGP resources before calling this. See
468 * drm_agp_clear().
469 *
470 * Call this to destroy AGP heads allocated via drm_agp_init().
471 */
472void drm_agp_destroy(struct drm_agp_head *agp)
473{
474 kfree(agp);
475}
476
477/**
478 * Binds a collection of pages into AGP memory at the given offset, returning 466 * Binds a collection of pages into AGP memory at the given offset, returning
479 * the AGP memory structure containing them. 467 * the AGP memory structure containing them.
480 * 468 *
diff --git a/drivers/gpu/drm/drm_pci.c b/drivers/gpu/drm/drm_pci.c
index 2211c4d70c2d..f710e3d9d847 100644
--- a/drivers/gpu/drm/drm_pci.c
+++ b/drivers/gpu/drm/drm_pci.c
@@ -281,7 +281,7 @@ static void drm_pci_agp_destroy(struct drm_device *dev)
281 if (dev->agp) { 281 if (dev->agp) {
282 arch_phys_wc_del(dev->agp->agp_mtrr); 282 arch_phys_wc_del(dev->agp->agp_mtrr);
283 drm_agp_clear(dev); 283 drm_agp_clear(dev);
284 drm_agp_destroy(dev->agp); 284 kfree(dev->agp);
285 dev->agp = NULL; 285 dev->agp = NULL;
286 } 286 }
287} 287}
diff --git a/include/drm/drm_agpsupport.h b/include/drm/drm_agpsupport.h
index a12b0e011e44..56a861b2ceaa 100644
--- a/include/drm/drm_agpsupport.h
+++ b/include/drm/drm_agpsupport.h
@@ -20,7 +20,6 @@ DRM_AGP_MEM *drm_agp_bind_pages(struct drm_device *dev,
20 uint32_t type); 20 uint32_t type);
21 21
22struct drm_agp_head *drm_agp_init(struct drm_device *dev); 22struct drm_agp_head *drm_agp_init(struct drm_device *dev);
23void drm_agp_destroy(struct drm_agp_head *agp);
24void drm_agp_clear(struct drm_device *dev); 23void drm_agp_clear(struct drm_device *dev);
25int drm_agp_acquire(struct drm_device *dev); 24int drm_agp_acquire(struct drm_device *dev);
26int drm_agp_acquire_ioctl(struct drm_device *dev, void *data, 25int 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)
76 return NULL; 75 return NULL;
77} 76}
78 77
79static inline void drm_agp_destroy(struct drm_agp_head *agp)
80{
81}
82
83static inline void drm_agp_clear(struct drm_device *dev) 78static inline void drm_agp_clear(struct drm_device *dev)
84{ 79{
85} 80}