scsi: ufs: use devm_blk_ksm_init()
authorEric Biggers <ebiggers@google.com>
Thu, 21 Jan 2021 08:21:55 +0000 (00:21 -0800)
committerUlf Hansson <ulf.hansson@linaro.org>
Mon, 1 Feb 2021 11:01:56 +0000 (12:01 +0100)
Use the new resource-managed variant of blk_ksm_init() so that the UFS
driver doesn't have to manually call blk_ksm_destroy().

Signed-off-by: Eric Biggers <ebiggers@google.com>
Reviewed-by: Satya Tangirala <satyat@google.com>
Link: https://lore.kernel.org/r/20210121082155.111333-3-ebiggers@kernel.org
Acked-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
drivers/scsi/ufs/ufshcd-crypto.c
drivers/scsi/ufs/ufshcd-crypto.h
drivers/scsi/ufs/ufshcd.c

index 07310b1..153dd57 100644 (file)
@@ -179,8 +179,8 @@ int ufshcd_hba_init_crypto_capabilities(struct ufs_hba *hba)
        }
 
        /* The actual number of configurations supported is (CFGC+1) */
-       err = blk_ksm_init(&hba->ksm,
-                          hba->crypto_capabilities.config_count + 1);
+       err = devm_blk_ksm_init(hba->dev, &hba->ksm,
+                               hba->crypto_capabilities.config_count + 1);
        if (err)
                goto out_free_caps;
 
@@ -238,8 +238,3 @@ void ufshcd_crypto_setup_rq_keyslot_manager(struct ufs_hba *hba,
        if (hba->caps & UFSHCD_CAP_CRYPTO)
                blk_ksm_register(&hba->ksm, q);
 }
-
-void ufshcd_crypto_destroy_keyslot_manager(struct ufs_hba *hba)
-{
-       blk_ksm_destroy(&hba->ksm);
-}
index d53851b..78a58e7 100644 (file)
@@ -43,8 +43,6 @@ void ufshcd_init_crypto(struct ufs_hba *hba);
 void ufshcd_crypto_setup_rq_keyslot_manager(struct ufs_hba *hba,
                                            struct request_queue *q);
 
-void ufshcd_crypto_destroy_keyslot_manager(struct ufs_hba *hba);
-
 #else /* CONFIG_SCSI_UFS_CRYPTO */
 
 static inline void ufshcd_prepare_lrbp_crypto(struct request *rq,
@@ -69,9 +67,6 @@ static inline void ufshcd_init_crypto(struct ufs_hba *hba) { }
 static inline void ufshcd_crypto_setup_rq_keyslot_manager(struct ufs_hba *hba,
                                                struct request_queue *q) { }
 
-static inline void ufshcd_crypto_destroy_keyslot_manager(struct ufs_hba *hba)
-{ }
-
 #endif /* CONFIG_SCSI_UFS_CRYPTO */
 
 #endif /* _UFSHCD_CRYPTO_H */
index fb32d12..4c24eb7 100644 (file)
@@ -9152,7 +9152,6 @@ EXPORT_SYMBOL_GPL(ufshcd_remove);
  */
 void ufshcd_dealloc_host(struct ufs_hba *hba)
 {
-       ufshcd_crypto_destroy_keyslot_manager(hba);
        scsi_host_put(hba->host);
 }
 EXPORT_SYMBOL_GPL(ufshcd_dealloc_host);