diff options
author | Jason Gunthorpe <jgg@nvidia.com> | 2021-10-19 19:09:25 +0200 |
---|---|---|
committer | Jason Gunthorpe <jgg@nvidia.com> | 2021-10-19 19:09:25 +0200 |
commit | 71ee1f1275432421307d27dd4df43f33e60456de (patch) | |
tree | a69e771c98ca332d0872612b61413b7fbd9e2765 /drivers/tee/optee/device.c | |
parent | RDMA/core: Set sgtable nents when using ib_dma_virt_map_sg() (diff) | |
parent | RDMA/mlx5: Attach ndescs to mlx5_ib_mkey (diff) | |
download | linux-71ee1f1275432421307d27dd4df43f33e60456de.tar.xz linux-71ee1f1275432421307d27dd4df43f33e60456de.zip |
Merge brank 'mlx5_mkey' into rdma.git for-next
A small series to clean up the mlx5 mkey code across the mlx5_core and
InfiniBand.
* branch 'mlx5_mkey':
RDMA/mlx5: Attach ndescs to mlx5_ib_mkey
RDMA/mlx5: Move struct mlx5_core_mkey to mlx5_ib
RDMA/mlx5: Replace struct mlx5_core_mkey by u32 key
RDMA/mlx5: Remove pd from struct mlx5_core_mkey
RDMA/mlx5: Remove size from struct mlx5_core_mkey
RDMA/mlx5: Remove iova from struct mlx5_core_mkey
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Diffstat (limited to 'drivers/tee/optee/device.c')
-rw-r--r-- | drivers/tee/optee/device.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/drivers/tee/optee/device.c b/drivers/tee/optee/device.c index ec1d24693eba..128a2d2a50a1 100644 --- a/drivers/tee/optee/device.c +++ b/drivers/tee/optee/device.c @@ -53,6 +53,13 @@ static int get_devices(struct tee_context *ctx, u32 session, return 0; } +static void optee_release_device(struct device *dev) +{ + struct tee_client_device *optee_device = to_tee_client_device(dev); + + kfree(optee_device); +} + static int optee_register_device(const uuid_t *device_uuid) { struct tee_client_device *optee_device = NULL; @@ -63,6 +70,7 @@ static int optee_register_device(const uuid_t *device_uuid) return -ENOMEM; optee_device->dev.bus = &tee_bus_type; + optee_device->dev.release = optee_release_device; if (dev_set_name(&optee_device->dev, "optee-ta-%pUb", device_uuid)) { kfree(optee_device); return -ENOMEM; @@ -154,3 +162,17 @@ int optee_enumerate_devices(u32 func) { return __optee_enumerate_devices(func); } + +static int __optee_unregister_device(struct device *dev, void *data) +{ + if (!strncmp(dev_name(dev), "optee-ta", strlen("optee-ta"))) + device_unregister(dev); + + return 0; +} + +void optee_unregister_devices(void) +{ + bus_for_each_dev(&tee_bus_type, NULL, NULL, + __optee_unregister_device); +} |