mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: linux@treblig.org
To: akpm@linux-foundation.org, terrelln@fb.com
Cc: linux-kernel@vger.kernel.org,
	"Dr. David Alan Gilbert" <linux@treblig.org>
Subject: [PATCH] lib/xxhash: Comment out unused functions
Date: Mon, 14 Jul 2025 01:09:27 +0100	[thread overview]
Message-ID: <20250714000927.294767-1-linux@treblig.org> (raw)

From: "Dr. David Alan Gilbert" <linux@treblig.org>

xxh32_digest() and xxh32_update() were added in 2017 in the original
xxhash commit, but have remained unused.

While I've mostly been deleting unused functions, this is a general
library and I see erofs is using other bits of xxh32, so it didn't
seem right just to delete them.

Comment them out with #if 0.
(Which checkpatch rightly warns about)

Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>
---
 include/linux/xxhash.h | 4 ++++
 lib/xxhash.c           | 2 ++
 2 files changed, 6 insertions(+)

diff --git a/include/linux/xxhash.h b/include/linux/xxhash.h
index df42511438d0..46d513a0212a 100644
--- a/include/linux/xxhash.h
+++ b/include/linux/xxhash.h
@@ -177,6 +177,9 @@ struct xxh64_state {
  */
 void xxh32_reset(struct xxh32_state *state, uint32_t seed);
 
+#if 0
+/* Currently unused, feel free to uncomment them if you use them. */
+
 /**
  * xxh32_update() - hash the data given and update the xxh32 state
  *
@@ -202,6 +205,7 @@ int xxh32_update(struct xxh32_state *state, const void *input, size_t length);
  * Return: The xxh32 hash stored in the state.
  */
 uint32_t xxh32_digest(const struct xxh32_state *state);
+#endif
 
 /**
  * xxh64_reset() - reset the xxh64 state to start a new hashing operation
diff --git a/lib/xxhash.c b/lib/xxhash.c
index b5bd567aa6b3..988a22e9a139 100644
--- a/lib/xxhash.c
+++ b/lib/xxhash.c
@@ -267,6 +267,7 @@ void xxh64_reset(struct xxh64_state *statePtr, const uint64_t seed)
 }
 EXPORT_SYMBOL(xxh64_reset);
 
+#if 0
 int xxh32_update(struct xxh32_state *state, const void *input, const size_t len)
 {
 	const uint8_t *p = (const uint8_t *)input;
@@ -373,6 +374,7 @@ uint32_t xxh32_digest(const struct xxh32_state *state)
 	return h32;
 }
 EXPORT_SYMBOL(xxh32_digest);
+#endif
 
 int xxh64_update(struct xxh64_state *state, const void *input, const size_t len)
 {
-- 
2.50.1


             reply	other threads:[~2025-07-14  0:09 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-14  0:09 linux [this message]
2025-07-15  6:09 ` Christoph Hellwig
2025-07-16 13:33   ` Dr. David Alan Gilbert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250714000927.294767-1-linux@treblig.org \
    --to=linux@treblig.org \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=terrelln@fb.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®