drm/ttm: add ttm_resource_fini v2

Make sure we call the common cleanup function in all
implementations of the resource manager.

v2: fix missing case in i915, rudimentary kerneldoc, should be
    filled in more when we add more functionality

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20220124122514.1832-2-christian.koenig@amd.com
This commit is contained in:
Christian König
2021-07-09 15:18:39 +02:00
parent 2343bcdb47
commit de3688e469
13 changed files with 48 additions and 6 deletions

View File

@ -29,6 +29,14 @@
#include <drm/ttm/ttm_resource.h>
#include <drm/ttm/ttm_bo_driver.h>
/**
* ttm_resource_init - resource object constructure
* @bo: buffer object this resources is allocated for
* @place: placement of the resource
* @res: the resource object to inistilize
*
* Initialize a new resource object. Counterpart of &ttm_resource_fini.
*/
void ttm_resource_init(struct ttm_buffer_object *bo,
const struct ttm_place *place,
struct ttm_resource *res)
@ -44,6 +52,21 @@ void ttm_resource_init(struct ttm_buffer_object *bo,
}
EXPORT_SYMBOL(ttm_resource_init);
/**
* ttm_resource_fini - resource destructor
* @man: the resource manager this resource belongs to
* @res: the resource to clean up
*
* Should be used by resource manager backends to clean up the TTM resource
* objects before freeing the underlying structure. Counterpart of
* &ttm_resource_init
*/
void ttm_resource_fini(struct ttm_resource_manager *man,
struct ttm_resource *res)
{
}
EXPORT_SYMBOL(ttm_resource_fini);
int ttm_resource_alloc(struct ttm_buffer_object *bo,
const struct ttm_place *place,
struct ttm_resource **res_ptr)