* [PATCH] lib/xxhash: Comment out unused functions
@ 2025-07-14 0:09 linux
2025-07-15 6:09 ` Christoph Hellwig
0 siblings, 1 reply; 3+ messages in thread
From: linux @ 2025-07-14 0:09 UTC (permalink / raw)
To: akpm, terrelln; +Cc: linux-kernel, Dr. David Alan Gilbert
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] lib/xxhash: Comment out unused functions
2025-07-14 0:09 [PATCH] lib/xxhash: Comment out unused functions linux
@ 2025-07-15 6:09 ` Christoph Hellwig
2025-07-16 13:33 ` Dr. David Alan Gilbert
0 siblings, 1 reply; 3+ messages in thread
From: Christoph Hellwig @ 2025-07-15 6:09 UTC (permalink / raw)
To: linux; +Cc: akpm, terrelln, linux-kernel
On Mon, Jul 14, 2025 at 01:09:27AM +0100, linux@treblig.org wrote:
> 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)
Please just remove it like all other dead code. The same argument
that folks can easily look at the git history to resurrect it applies
here as everywhere else.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] lib/xxhash: Comment out unused functions
2025-07-15 6:09 ` Christoph Hellwig
@ 2025-07-16 13:33 ` Dr. David Alan Gilbert
0 siblings, 0 replies; 3+ messages in thread
From: Dr. David Alan Gilbert @ 2025-07-16 13:33 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: akpm, terrelln, linux-kernel
* Christoph Hellwig (hch@infradead.org) wrote:
> On Mon, Jul 14, 2025 at 01:09:27AM +0100, linux@treblig.org wrote:
> > 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)
>
> Please just remove it like all other dead code. The same argument
> that folks can easily look at the git history to resurrect it applies
> here as everywhere else.
Hmm OK, as requested, v2 posted:
Subject: [PATCH v2] lib/xxhash: Remove unused functions
Date: Wed, 16 Jul 2025 14:32:45 +0100
Message-ID: <20250716133245.243363-1-linux@treblig.org>
Dave
--
-----Open up your eyes, open up your mind, open up your code -------
/ Dr. David Alan Gilbert | Running GNU/Linux | Happy \
\ dave @ treblig.org | | In Hex /
\ _________________________|_____ http://www.treblig.org |_______/
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-07-16 13:33 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-14 0:09 [PATCH] lib/xxhash: Comment out unused functions linux
2025-07-15 6:09 ` Christoph Hellwig
2025-07-16 13:33 ` Dr. David Alan Gilbert
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).