Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/tegra: Extract tegra_gem_lookup()

The static function host1x_bo_lookup() in drm.c is also useful
elsewhere. Extract it as tegra_gem_lookup() in gem.c.

Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>

authored by

Mikko Perttunen and committed by
Thierry Reding
f51632cc 0fddaa85

+18 -17
+3 -17
drivers/gpu/drm/tegra/drm.c
··· 107 107 kfree(context); 108 108 } 109 109 110 - static struct host1x_bo * 111 - host1x_bo_lookup(struct drm_file *file, u32 handle) 112 - { 113 - struct drm_gem_object *gem; 114 - struct tegra_bo *bo; 115 - 116 - gem = drm_gem_object_lookup(file, handle); 117 - if (!gem) 118 - return NULL; 119 - 120 - bo = to_tegra_bo(gem); 121 - return &bo->base; 122 - } 123 - 124 110 static int host1x_reloc_copy_from_user(struct host1x_reloc *dest, 125 111 struct drm_tegra_reloc __user *src, 126 112 struct drm_device *drm, ··· 137 151 138 152 dest->flags = HOST1X_RELOC_READ | HOST1X_RELOC_WRITE; 139 153 140 - dest->cmdbuf.bo = host1x_bo_lookup(file, cmdbuf); 154 + dest->cmdbuf.bo = tegra_gem_lookup(file, cmdbuf); 141 155 if (!dest->cmdbuf.bo) 142 156 return -ENOENT; 143 157 144 - dest->target.bo = host1x_bo_lookup(file, target); 158 + dest->target.bo = tegra_gem_lookup(file, target); 145 159 if (!dest->target.bo) 146 160 return -ENOENT; 147 161 ··· 224 238 goto fail; 225 239 } 226 240 227 - bo = host1x_bo_lookup(file, cmdbuf.handle); 241 + bo = tegra_gem_lookup(file, cmdbuf.handle); 228 242 if (!bo) { 229 243 err = -ENOENT; 230 244 goto fail;
+13
drivers/gpu/drm/tegra/gem.c
··· 707 707 708 708 return &bo->gem; 709 709 } 710 + 711 + struct host1x_bo *tegra_gem_lookup(struct drm_file *file, u32 handle) 712 + { 713 + struct drm_gem_object *gem; 714 + struct tegra_bo *bo; 715 + 716 + gem = drm_gem_object_lookup(file, handle); 717 + if (!gem) 718 + return NULL; 719 + 720 + bo = to_tegra_bo(gem); 721 + return &bo->base; 722 + }
+2
drivers/gpu/drm/tegra/gem.h
··· 80 80 struct drm_gem_object *tegra_gem_prime_import(struct drm_device *drm, 81 81 struct dma_buf *buf); 82 82 83 + struct host1x_bo *tegra_gem_lookup(struct drm_file *file, u32 handle); 84 + 83 85 #endif