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
1313
1414 static void tee_shm_release(struct tee_shm *shm)
1515 {
16− struct tee_device *teedev = shm->teedev;
16+ struct tee_device *teedev = shm->ctx->teedev;
1717
1818 if (shm->flags & TEE_SHM_DMA_BUF) {
1919 mutex_lock(&teedev->mutex);
@@ -44,8 +44,7 @@ static void tee_shm_release(struct tee_shm *shm) · 24 unmodified lines
4444 kfree(shm->pages);
4545 }
4646
47− if (shm->ctx)
48− teedev_ctx_put(shm->ctx);
47+ teedev_ctx_put(shm->ctx);
4948
5049 kfree(shm);
5150
@@ -126,7 +125,6 @@ struct tee_shm *tee_shm_alloc(struct tee_context *ctx, size_t size, u32 flags) · 74 unmodified lines
126125 }
127126
128127 shm->flags = flags | TEE_SHM_POOL;
129− shm->teedev = teedev;
130128 shm->ctx = ctx;
131129 if (flags & TEE_SHM_DMA_BUF)
132130 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
215213 }
216214
217215 shm->flags = flags | TEE_SHM_REGISTER;
218− shm->teedev = teedev;
219216 shm->ctx = ctx;
220217 shm->id = -1;
221218 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
167167
168168 /**
169169 * struct tee_shm - shared memory object
170− * @teedev: device used to allocate the object
171− * @ctx: context using the object, if NULL the context is gone
170+ * @ctx: context using the object
172171 * @paddr: physical address of the shared memory
173172 * @kaddr: virtual address of the shared memory
174173 * @size: size of shared memory
@@ -183,7 +182,6 @@ void tee_device_unregister(struct tee_device *teedev); · 8 unmodified lines
183182 * subsystem and from drivers that implements their own shm pool manager.
184183 */
185184 struct tee_shm {
186− struct tee_device *teedev;
187185 struct tee_context *ctx;
188186 phys_addr_t paddr;
189187 void *kaddr;