The ctx element in struct tee_shm is always valid. So remove the now redundant teedev element.
Unified · Split
| @@ -13,7 +13,7 @@ · 12 unmodified lines | ||
| 13 | 13 | |
| 14 | 14 | static 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 | 18 | if (shm->flags & TEE_SHM_DMA_BUF) { |
| 19 | 19 | mutex_lock(&teedev->mutex); |
| @@ -44,8 +44,7 @@ static void tee_shm_release(struct tee_shm *shm) · 24 unmodified lines | ||
| 44 | 44 | kfree(shm->pages); |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | − if (shm->ctx) | |
| 48 | − teedev_ctx_put(shm->ctx); | |
| 47 | + teedev_ctx_put(shm->ctx); | |
| 49 | 48 | |
| 50 | 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 | 127 | shm->flags = flags | TEE_SHM_POOL; |
| 129 | − shm->teedev = teedev; | |
| 130 | 128 | shm->ctx = ctx; |
| 131 | 129 | if (flags & TEE_SHM_DMA_BUF) |
| 132 | 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 | 215 | shm->flags = flags | TEE_SHM_REGISTER; |
| 218 | − shm->teedev = teedev; | |
| 219 | 216 | shm->ctx = ctx; |
| 220 | 217 | shm->id = -1; |
| 221 | 218 | addr = untagged_addr(addr); |
| @@ -167,8 +167,7 @@ void tee_device_unregister(struct tee_device *teedev); · 166 unmodified lines | ||
| 167 | 167 | |
| 168 | 168 | /** |
| 169 | 169 | * 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 | |
| 172 | 171 | * @paddr: physical address of the shared memory |
| 173 | 172 | * @kaddr: virtual address of the shared memory |
| 174 | 173 | * @size: size of shared memory |
| @@ -183,7 +182,6 @@ void tee_device_unregister(struct tee_device *teedev); · 8 unmodified lines | ||
| 183 | 182 | * subsystem and from drivers that implements their own shm pool manager. |
| 184 | 183 | */ |
| 185 | 184 | struct tee_shm { |
| 186 | − struct tee_device *teedev; | |
| 187 | 185 | struct tee_context *ctx; |
| 188 | 186 | phys_addr_t paddr; |
| 189 | 187 | void *kaddr; |