mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] lib/crc10dif: Update crct10dif_fallback static key to modern api
@ 2018-07-16 20:31 Davidlohr Bueso
  0 siblings, 0 replies; only message in thread
From: Davidlohr Bueso @ 2018-07-16 20:31 UTC (permalink / raw)
  To: herbert; +Cc: linux-kernel, dave, Davidlohr Bueso

No changes in semantics -- key init is false; replace

static_key_slow_inc       with   static_branch_inc
static_key_false          with   static_branch_unlikely

Added a '_key' suffix to crc10dif_fallback for better self
documentation.

Signed-off-by: Davidlohr Bueso <dbueso@suse.de>
---
 lib/crc-t10dif.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/crc-t10dif.c b/lib/crc-t10dif.c
index 1ad33e555805..528b24249ddd 100644
--- a/lib/crc-t10dif.c
+++ b/lib/crc-t10dif.c
@@ -17,7 +17,7 @@
 #include <linux/static_key.h>
 
 static struct crypto_shash *crct10dif_tfm;
-static struct static_key crct10dif_fallback __read_mostly;
+static DEFINE_STATIC_KEY_FALSE(crct10dif_fallback_key);
 
 __u16 crc_t10dif_update(__u16 crc, const unsigned char *buffer, size_t len)
 {
@@ -27,7 +27,7 @@ __u16 crc_t10dif_update(__u16 crc, const unsigned char *buffer, size_t len)
 	} desc;
 	int err;
 
-	if (static_key_false(&crct10dif_fallback))
+	if (static_branch_unlikely(&crct10dif_fallback_key))
 		return crc_t10dif_generic(crc, buffer, len);
 
 	desc.shash.tfm = crct10dif_tfm;
@@ -51,7 +51,7 @@ static int __init crc_t10dif_mod_init(void)
 {
 	crct10dif_tfm = crypto_alloc_shash("crct10dif", 0, 0);
 	if (IS_ERR(crct10dif_tfm)) {
-		static_key_slow_inc(&crct10dif_fallback);
+		static_branch_inc(&crct10dif_fallback_key);
 		crct10dif_tfm = NULL;
 	}
 	return 0;
-- 
2.16.4


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2018-07-16 20:31 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-16 20:31 [PATCH] lib/crc10dif: Update crct10dif_fallback static key to modern api Davidlohr Bueso

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®