On 1/25/21 1:25 PM, Eric Biggers wrote: > On Mon, Jan 25, 2021 at 12:14:00PM -0800, Satya Tangirala wrote: >> On Thu, Jan 21, 2021 at 12:23 AM Eric Biggers <ebiggers@xxxxxxxxxx> wrote: >>> >>> From: Eric Biggers <ebiggers@xxxxxxxxxx> >>> >>> 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@xxxxxxxxxx> > [..] >>> diff --git a/include/linux/keyslot-manager.h b/include/linux/keyslot-manager.h >>> index 18f3f5346843f..443ad817c6c57 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); >>> -- >> >> Looks good to me. Please feel free to add >> Reviewed-by: Satya Tangirala <satyat@xxxxxxxxxx> > > Thanks Satya. Jens, any objection to this patch going in through the MMC tree? No objections from me, doesn't look like we have any real worries of conflicts. -- Jens Axboe