__blk_crypto_cfg_supported() is called only by blk_crypto_config_supported_natively(), so fold it in. Signed-off-by: Eric Biggers --- block/blk-crypto-profile.c | 22 ---------------------- block/blk-crypto.c | 23 +++++++++++++++++++++-- 2 files changed, 21 insertions(+), 24 deletions(-) diff --git a/block/blk-crypto-profile.c b/block/blk-crypto-profile.c index cf447ba4a66e..53126c091b0b 100644 --- a/block/blk-crypto-profile.c +++ b/block/blk-crypto-profile.c @@ -333,32 +333,10 @@ void blk_crypto_put_keyslot(struct blk_crypto_keyslot *slot) spin_unlock_irqrestore(&profile->idle_slots_lock, flags); wake_up(&profile->idle_slots_wait_queue); } } -/** - * __blk_crypto_cfg_supported() - Check whether the given crypto profile - * supports the given crypto configuration. - * @profile: the crypto profile to check - * @cfg: the crypto configuration to check for - * - * Return: %true if @profile supports the given @cfg. - */ -bool __blk_crypto_cfg_supported(struct blk_crypto_profile *profile, - const struct blk_crypto_config *cfg) -{ - if (!profile) - return false; - if (!(profile->modes_supported[cfg->crypto_mode] & cfg->data_unit_size)) - return false; - if (profile->max_dun_bytes_supported < cfg->dun_bytes) - return false; - if (!(profile->key_types_supported & cfg->key_type)) - return false; - return true; -} - /* * This is an internal function that evicts a key from an inline encryption * device that can be either a real device or the blk-crypto-fallback "device". * It is used only by blk_crypto_evict_key(); see that function for details. */ diff --git a/block/blk-crypto.c b/block/blk-crypto.c index 15e25e41b166..dd83fc5af282 100644 --- a/block/blk-crypto.c +++ b/block/blk-crypto.c @@ -349,15 +349,34 @@ int blk_crypto_init_key(struct blk_crypto_key *blk_key, return 0; } EXPORT_SYMBOL_GPL(blk_crypto_init_key); + +/** + * blk_crypto_config_supported_natively() - Check whether a block device + * supports hardware inline encryption + * with the given configuration. + * @bdev: the block device + * @cfg: the crypto configuration to check for + * + * Return: %true if @bdev supports hardware inline encryption with @cfg. + */ bool blk_crypto_config_supported_natively(struct block_device *bdev, const struct blk_crypto_config *cfg) { - return __blk_crypto_cfg_supported(bdev_get_queue(bdev)->crypto_profile, - cfg); + struct blk_crypto_profile *profile = bdev_get_queue(bdev)->crypto_profile; + + if (!profile) + return false; + if (!(profile->modes_supported[cfg->crypto_mode] & cfg->data_unit_size)) + return false; + if (profile->max_dun_bytes_supported < cfg->dun_bytes) + return false; + if (!(profile->key_types_supported & cfg->key_type)) + return false; + return true; } /* * Check if bios with @cfg can be en/decrypted by blk-crypto (i.e. either the * block_device it's submitted to supports inline crypto, or the -- 2.54.0