aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/include/linux/keyslot-manager.h
diff options
context:
space:
mode:
authorEric Biggers <ebiggers@google.com>2021-01-21 00:21:54 -0800
committerUlf Hansson <ulf.hansson@linaro.org>2021-02-01 11:56:18 +0100
commit5851d3b042b694839d2241fbb3200ce958135cdf (patch)
treec399d0eeeca923f0e72458fa24d929f3fd751edd /include/linux/keyslot-manager.h
parentmmc: sdhci-of-aspeed: Fix kunit-related build error (diff)
downloadwireguard-linux-5851d3b042b694839d2241fbb3200ce958135cdf.tar.xz
wireguard-linux-5851d3b042b694839d2241fbb3200ce958135cdf.zip
block/keyslot-manager: introduce devm_blk_ksm_init()
Add a resource-managed variant of blk_ksm_init() so that drivers don't have to worry about calling blk_ksm_destroy(). Note that the implementation uses a custom devres action to call blk_ksm_destroy() rather than switching the two allocations to be directly devres-managed, e.g. with devm_kmalloc(). This is because we need to keep zeroing the memory containing the keyslots when it is freed, and also because we want to continue using kvmalloc() (and there is no devm_kvmalloc()). Signed-off-by: Eric Biggers <ebiggers@google.com> Reviewed-by: Satya Tangirala <satyat@google.com> Acked-by: Jens Axboe <axboe@kernel.dk> Link: https://lore.kernel.org/r/20210121082155.111333-2-ebiggers@kernel.org Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Diffstat (limited to 'include/linux/keyslot-manager.h')
-rw-r--r--include/linux/keyslot-manager.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/include/linux/keyslot-manager.h b/include/linux/keyslot-manager.h
index 18f3f5346843..443ad817c6c5 100644
--- a/include/linux/keyslot-manager.h
+++ b/include/linux/keyslot-manager.h
@@ -85,6 +85,9 @@ struct blk_keyslot_manager {
int blk_ksm_init(struct blk_keyslot_manager *ksm, unsigned int num_slots);
+int devm_blk_ksm_init(struct device *dev, struct blk_keyslot_manager *ksm,
+ unsigned int num_slots);
+
blk_status_t blk_ksm_get_slot_for_key(struct blk_keyslot_manager *ksm,
const struct blk_crypto_key *key,
struct blk_ksm_keyslot **slot_ptr);