Message ID | 20210121082155.111333-3-ebiggers@kernel.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Resource-managed blk_ksm_init() | expand |
On Thu, Jan 21, 2021 at 12:23 AM Eric Biggers <ebiggers@kernel.org> wrote: > > From: Eric Biggers <ebiggers@google.com> > > 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> > --- > drivers/scsi/ufs/ufshcd-crypto.c | 9 ++------- > drivers/scsi/ufs/ufshcd-crypto.h | 5 ----- > drivers/scsi/ufs/ufshcd.c | 1 - > 3 files changed, 2 insertions(+), 13 deletions(-) > > diff --git a/drivers/scsi/ufs/ufshcd-crypto.c b/drivers/scsi/ufs/ufshcd-crypto.c > index 07310b12a5dc8..153dd5765d9ca 100644 > --- a/drivers/scsi/ufs/ufshcd-crypto.c > +++ b/drivers/scsi/ufs/ufshcd-crypto.c > @@ -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); > -} > diff --git a/drivers/scsi/ufs/ufshcd-crypto.h b/drivers/scsi/ufs/ufshcd-crypto.h > index d53851be55416..78a58e788dff9 100644 > --- a/drivers/scsi/ufs/ufshcd-crypto.h > +++ b/drivers/scsi/ufs/ufshcd-crypto.h > @@ -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 */ > diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c > index e31d2c5c7b23b..d905c84474c2c 100644 > --- a/drivers/scsi/ufs/ufshcd.c > +++ b/drivers/scsi/ufs/ufshcd.c > @@ -9139,7 +9139,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); > -- > 2.30.0 > Looks good to me. Please feel free to add Reviewed-by: Satya Tangirala <satyat@google.com>
+ Martin, James On Thu, 21 Jan 2021 at 09:23, Eric Biggers <ebiggers@kernel.org> wrote: > > From: Eric Biggers <ebiggers@google.com> > > 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> I took the liberty of applying this one to my mmc tree along with patch1, as it looks trivial to me. Martin/James - if you have objections or want to ack it, please tell me. Thanks and kind regards Uffe > --- > drivers/scsi/ufs/ufshcd-crypto.c | 9 ++------- > drivers/scsi/ufs/ufshcd-crypto.h | 5 ----- > drivers/scsi/ufs/ufshcd.c | 1 - > 3 files changed, 2 insertions(+), 13 deletions(-) > > diff --git a/drivers/scsi/ufs/ufshcd-crypto.c b/drivers/scsi/ufs/ufshcd-crypto.c > index 07310b12a5dc8..153dd5765d9ca 100644 > --- a/drivers/scsi/ufs/ufshcd-crypto.c > +++ b/drivers/scsi/ufs/ufshcd-crypto.c > @@ -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); > -} > diff --git a/drivers/scsi/ufs/ufshcd-crypto.h b/drivers/scsi/ufs/ufshcd-crypto.h > index d53851be55416..78a58e788dff9 100644 > --- a/drivers/scsi/ufs/ufshcd-crypto.h > +++ b/drivers/scsi/ufs/ufshcd-crypto.h > @@ -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 */ > diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c > index e31d2c5c7b23b..d905c84474c2c 100644 > --- a/drivers/scsi/ufs/ufshcd.c > +++ b/drivers/scsi/ufs/ufshcd.c > @@ -9139,7 +9139,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); > -- > 2.30.0 >
Ulf, > I took the liberty of applying this one to my mmc tree along with > patch1, as it looks trivial to me. > > Martin/James - if you have objections or want to ack it, please tell > me. That's fine. Just a heads-up that there has been a lot of churn in UFS in this cycle so there may be some merge fuzz.
diff --git a/drivers/scsi/ufs/ufshcd-crypto.c b/drivers/scsi/ufs/ufshcd-crypto.c index 07310b12a5dc8..153dd5765d9ca 100644 --- a/drivers/scsi/ufs/ufshcd-crypto.c +++ b/drivers/scsi/ufs/ufshcd-crypto.c @@ -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); -} diff --git a/drivers/scsi/ufs/ufshcd-crypto.h b/drivers/scsi/ufs/ufshcd-crypto.h index d53851be55416..78a58e788dff9 100644 --- a/drivers/scsi/ufs/ufshcd-crypto.h +++ b/drivers/scsi/ufs/ufshcd-crypto.h @@ -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 */ diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index e31d2c5c7b23b..d905c84474c2c 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -9139,7 +9139,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);