diff options
author | Jordan Crouse <jcrouse@codeaurora.org> | 2018-11-07 15:35:46 -0700 |
---|---|---|
committer | Rob Clark <robdclark@gmail.com> | 2018-12-11 13:05:30 -0500 |
commit | 1e29dff00400d40fdd3d52f2a76c188f5126f033 (patch) | |
tree | 12cec23c147affe371047c8d64153e3fcbadfd7f /drivers/gpu/drm/msm/msm_gem.c | |
parent | d6852b4b2d0140b0fbfe112edf4fe66c1857b561 (diff) | |
download | linux-1e29dff00400d40fdd3d52f2a76c188f5126f033.tar.bz2 |
drm/msm: Add a common function to free kernel buffer objects
Buffer objects allocated with msm_gem_kernel_new() are mostly
freed the same way so we can save a few lines of code with a
common function.
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
Diffstat (limited to 'drivers/gpu/drm/msm/msm_gem.c')
-rw-r--r-- | drivers/gpu/drm/msm/msm_gem.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/drivers/gpu/drm/msm/msm_gem.c b/drivers/gpu/drm/msm/msm_gem.c index 4646e9e45fc2..f32cf75e1b3f 100644 --- a/drivers/gpu/drm/msm/msm_gem.c +++ b/drivers/gpu/drm/msm/msm_gem.c @@ -1079,3 +1079,18 @@ void *msm_gem_kernel_new_locked(struct drm_device *dev, uint32_t size, { return _msm_gem_kernel_new(dev, size, flags, aspace, bo, iova, true); } + +void msm_gem_kernel_put(struct drm_gem_object *bo, + struct msm_gem_address_space *aspace, bool locked) +{ + if (IS_ERR_OR_NULL(bo)) + return; + + msm_gem_put_vaddr(bo); + msm_gem_put_iova(bo, aspace); + + if (locked) + drm_gem_object_put(bo); + else + drm_gem_object_put_unlocked(bo); +} |