History

tee: remove redundant teedev in struct tee_shm

The ctx element in struct tee_shm is always valid. So remove the now redundant teedev element.

Jens Wiklander committed 7 years ago

Commit 5271b201 parent f1bbace2 files · +3 −8Browse files

Unified · Split

2 files
  1. drivers/tee/tee_shm.c +2 −5
  2. include/linux/tee_drv.h +1 −3
drivers/tee/tee_shm.c+2−5
@@ -13,7 +13,7 @@ · 12 unmodified lines
13 13
14static void tee_shm_release(struct tee_shm *shm)14static void tee_shm_release(struct tee_shm *shm)
15{15{
16 struct tee_device *teedev = shm->teedev;16 struct tee_device *teedev = shm->ctx->teedev;
17 17
18 if (shm->flags & TEE_SHM_DMA_BUF) {18 if (shm->flags & TEE_SHM_DMA_BUF) {
19 mutex_lock(&teedev->mutex);19 mutex_lock(&teedev->mutex);
@@ -44,8 +44,7 @@ static void tee_shm_release(struct tee_shm *shm) · 24 unmodified lines
44 kfree(shm->pages);44 kfree(shm->pages);
45 }45 }
46 46
47 if (shm->ctx)47 teedev_ctx_put(shm->ctx);
48 teedev_ctx_put(shm->ctx);
49 48
50 kfree(shm);49 kfree(shm);
51 50
@@ -126,7 +125,6 @@ struct tee_shm *tee_shm_alloc(struct tee_context *ctx, size_t size, u32 flags) · 74 unmodified lines
126 }125 }
127 126
128 shm->flags = flags | TEE_SHM_POOL;127 shm->flags = flags | TEE_SHM_POOL;
129 shm->teedev = teedev;
130 shm->ctx = ctx;128 shm->ctx = ctx;
131 if (flags & TEE_SHM_DMA_BUF)129 if (flags & TEE_SHM_DMA_BUF)
132 poolm = teedev->pool->dma_buf_mgr;130 poolm = teedev->pool->dma_buf_mgr;
@@ -215,7 +213,6 @@ struct tee_shm *tee_shm_register(struct tee_context *ctx, unsigned long addr, · 82 unmodified lines
215 }213 }
216 214
217 shm->flags = flags | TEE_SHM_REGISTER;215 shm->flags = flags | TEE_SHM_REGISTER;
218 shm->teedev = teedev;
219 shm->ctx = ctx;216 shm->ctx = ctx;
220 shm->id = -1;217 shm->id = -1;
221 addr = untagged_addr(addr);218 addr = untagged_addr(addr);
include/linux/tee_drv.h+1−3
@@ -167,8 +167,7 @@ void tee_device_unregister(struct tee_device *teedev); · 166 unmodified lines
167 167
168/**168/**
169 * struct tee_shm - shared memory object169 * struct tee_shm - shared memory object
170 * @teedev: device used to allocate the object170 * @ctx: context using the object
171 * @ctx: context using the object, if NULL the context is gone
172 * @paddr: physical address of the shared memory171 * @paddr: physical address of the shared memory
173 * @kaddr: virtual address of the shared memory172 * @kaddr: virtual address of the shared memory
174 * @size: size of shared memory173 * @size: size of shared memory
@@ -183,7 +182,6 @@ void tee_device_unregister(struct tee_device *teedev); · 8 unmodified lines
183 * subsystem and from drivers that implements their own shm pool manager.182 * subsystem and from drivers that implements their own shm pool manager.
184 */183 */
185struct tee_shm {184struct tee_shm {
186 struct tee_device *teedev;
187 struct tee_context *ctx;185 struct tee_context *ctx;
188 phys_addr_t paddr;186 phys_addr_t paddr;
189 void *kaddr;187 void *kaddr;