Skip to contentSkip to conversation

blk-crypto: remove blk_crypto_unregister()

PATCH Applied Eric Biggers 3 participants 3 messages Nov 24, 2021 Block layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 blk-crypto: remove blk_crypto_unregister()

From: Eric Biggers <[email protected]>

This function is trivial and is only used in one place. Having this function is misleading because it implies that blk_crypto_register() needs to be paired with blk_crypto_unregister(), which is not the case. Just set disk->queue->crypto_profile to NULL directly.

---
 block/blk-crypto-profile.c | 5 -----
 block/blk-integrity.c      | 2 +-
 include/linux/blkdev.h     | 4 ----
 3 files changed, 1 insertion(+), 10 deletions(-)
block/blk-crypto-profile.c +0 -5
index 605ba0626a5c0..96c511967386d 100644
@@ -463,11 +463,6 @@ bool blk_crypto_register(struct blk_crypto_profile *profile,
 }
 EXPORT_SYMBOL_GPL(blk_crypto_register);
 
-void blk_crypto_unregister(struct request_queue *q)
-{
-	q->crypto_profile = NULL;
-}
-
 /**
  * blk_crypto_intersect_capabilities() - restrict supported crypto capabilities
  *					 by child device
block/blk-integrity.c +1 -1
index d670d54e5f7ac..69eed260a8239 100644
@@ -411,7 +411,7 @@ void blk_integrity_register(struct gendisk *disk, struct blk_integrity *template
 #ifdef CONFIG_BLK_INLINE_ENCRYPTION
 	if (disk->queue->crypto_profile) {
 		pr_warn("blk-integrity: Integrity and hardware inline encryption are not supported together. Disabling hardware inline encryption.\n");
-		blk_crypto_unregister(disk->queue);
+		disk->queue->crypto_profile = NULL;
 	}
 #endif
 }
include/linux/blkdev.h +0 -4
index bd4370baccca3..26cad06ed9f8d 100644
@@ -1171,8 +1171,6 @@ int kblockd_mod_delayed_work_on(int cpu, struct delayed_work *dwork, unsigned lo
 bool blk_crypto_register(struct blk_crypto_profile *profile,
 			 struct request_queue *q);
 
-void blk_crypto_unregister(struct request_queue *q);
-
 #else /* CONFIG_BLK_INLINE_ENCRYPTION */
 
 static inline bool blk_crypto_register(struct blk_crypto_profile *profile,
@@ -1181,8 +1179,6 @@ static inline bool blk_crypto_register(struct blk_crypto_profile *profile,
 	return true;
 }
 
-static inline void blk_crypto_unregister(struct request_queue *q) { }
-
 #endif /* CONFIG_BLK_INLINE_ENCRYPTION */
 
 enum blk_unique_id {

base-commit: 136057256686de39cc3a07c2e39ef6bc43003ff6

Signature · 1 line
2.34.0
maintainer Applied
#2 lore raw
In reply to Eric Biggers
Quoted 8 lines · Eric Biggers

From: Eric Biggers <[email protected]>

This function is trivial and is only used in one place. Having this function is misleading because it implies that blk_crypto_register() needs to be paired with blk_crypto_unregister(), which is not the case. Just set disk->queue->crypto_profile to NULL directly.

[...]

Applied, thanks!

[1/1] blk-crypto: remove blk_crypto_unregister()

      commit: f08fd5d1f9d146428809a7cd61d557df6af56f7b

Best regards,

Signature · 1 line
Jens Axboe