Skip to contentSkip to conversation

maple_tree: Drop unused functions to fix the build

PATCH In review Andy Shevchenko 3 participants 8 messages Sep 6, 2024 – Sep 9, 2024

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 maple_tree: Drop unused functions to fix the build

A few functions defined but not used. This, in particular, prevents kernel builds with clang, make W=1 and CONFIG_WERROR=y:

lib/maple_tree.c:351:21: error: unused function 'mte_set_full' [-Werror,-Wunused-function]
351 | static inline void *mte_set_full(const struct maple_enode *node)

      |                     ^~~~~~~~~~~~
lib/maple_tree.c:356:21: error: unused function 'mte_clear_full' [-Werror,-Wunused-function]
  356 | static inline void *mte_clear_full(const struct maple_enode *node)
      |                     ^~~~~~~~~~~~~~
lib/maple_tree.c:361:20: error: unused function 'mte_has_null' [-Werror,-Wunused-function]
  361 | static inline bool mte_has_null(const struct maple_enode *node)
      |                    ^~~~~~~~~~~~

Fix this by dropping unused functions.

See also commit 6863f5643dd7 ("kbuild: allow Clang to find unused static inline functions for W=1 build").

Fixes 6e7ba8b5e238 ("maple_tree: mte_set_full() and mte_clear_full() clang-analyzer clean up")
Fixes 54a611b60590 ("Maple Tree: add new data structure")
---
 lib/maple_tree.c | 15 ---------------
 1 file changed, 15 deletions(-)
lib/maple_tree.c +0 -15
index aa3a5df15b8e..f7601aa470e0 100644
@@ -348,21 +348,6 @@ static inline void *mte_safe_root(const struct maple_enode *node)
 	return (void *)((unsigned long)node & ~MAPLE_ROOT_NODE);
 }
 
-static inline void *mte_set_full(const struct maple_enode *node)
-{
-	return (void *)((unsigned long)node & ~MAPLE_ENODE_NULL);
-}
-
-static inline void *mte_clear_full(const struct maple_enode *node)
-{
-	return (void *)((unsigned long)node | MAPLE_ENODE_NULL);
-}
-
-static inline bool mte_has_null(const struct maple_enode *node)
-{
-	return (unsigned long)node & MAPLE_ENODE_NULL;
-}
-
 static __always_inline bool ma_is_root(struct maple_node *node)
 {
 	return ((unsigned long)node->parent & MA_ROOT_PARENT);
Signature · 1 line
2.43.0.rc1.1336.g36b5255a03ac
#1 lore raw

This exists to stop people from using the bits while the feature is in active development. We had the same patch a few days (weeks?) ago.

Quoted 54 lines · Andy Shevchenko

A few functions defined but not used. This, in particular, prevents kernel builds with clang, make W=1 and CONFIG_WERROR=y:

lib/maple_tree.c:351:21: error: unused function 'mte_set_full' [-Werror,-Wunused-function]
351 | static inline void *mte_set_full(const struct maple_enode *node)

      |                     ^~~~~~~~~~~~
lib/maple_tree.c:356:21: error: unused function 'mte_clear_full' [-Werror,-Wunused-function]
  356 | static inline void *mte_clear_full(const struct maple_enode *node)
      |                     ^~~~~~~~~~~~~~
lib/maple_tree.c:361:20: error: unused function 'mte_has_null' [-Werror,-Wunused-function]
  361 | static inline bool mte_has_null(const struct maple_enode *node)
      |                    ^~~~~~~~~~~~

Fix this by dropping unused functions.

See also commit 6863f5643dd7 ("kbuild: allow Clang to find unused static inline functions for W=1 build").

Fixes 6e7ba8b5e238 ("maple_tree: mte_set_full() and mte_clear_full() clang-analyzer clean up")
Fixes 54a611b60590 ("Maple Tree: add new data structure")
---
 lib/maple_tree.c | 15 ---------------
 1 file changed, 15 deletions(-)
lib/maple_tree.c +0 -15
index aa3a5df15b8e..f7601aa470e0 100644
@@ -348,21 +348,6 @@ static inline void *mte_safe_root(const struct maple_enode *node)
 	return (void *)((unsigned long)node & ~MAPLE_ROOT_NODE);
 }
 
-static inline void *mte_set_full(const struct maple_enode *node)
-{
-	return (void *)((unsigned long)node & ~MAPLE_ENODE_NULL);
-}
-
-static inline void *mte_clear_full(const struct maple_enode *node)
-{
-	return (void *)((unsigned long)node | MAPLE_ENODE_NULL);
-}
-
-static inline bool mte_has_null(const struct maple_enode *node)
-{
-	return (unsigned long)node & MAPLE_ENODE_NULL;
-}
-
 static __always_inline bool ma_is_root(struct maple_node *node)
 {
 	return ((unsigned long)node->parent & MA_ROOT_PARENT);
Signature · 1 line
2.43.0.rc1.1336.g36b5255a03ac
#2 lore raw
Quoted 2 lines · Liam R. Howlett

This exists to stop people from using the bits while the feature is in active development. We had the same patch a few days (weeks?) ago.

This breaks build. Can you propose better solution, please?

Quoted 21 lines · Andy Shevchenko
Quoted 20 lines

A few functions defined but not used. This, in particular, prevents kernel builds with clang, make W=1 and CONFIG_WERROR=y:

lib/maple_tree.c:351:21: error: unused function 'mte_set_full' [-Werror,-Wunused-function]
351 | static inline void *mte_set_full(const struct maple_enode *node)

      |                     ^~~~~~~~~~~~
lib/maple_tree.c:356:21: error: unused function 'mte_clear_full' [-Werror,-Wunused-function]
  356 | static inline void *mte_clear_full(const struct maple_enode *node)
      |                     ^~~~~~~~~~~~~~
lib/maple_tree.c:361:20: error: unused function 'mte_has_null' [-Werror,-Wunused-function]
  361 | static inline bool mte_has_null(const struct maple_enode *node)
      |                    ^~~~~~~~~~~~

Fix this by dropping unused functions.

See also commit 6863f5643dd7 ("kbuild: allow Clang to find unused static inline functions for W=1 build").

Fixes 6e7ba8b5e238 ("maple_tree: mte_set_full() and mte_clear_full() clang-analyzer clean up")
Fixes 54a611b60590 ("Maple Tree: add new data structure")
Signature · 2 lines
With Best Regards,
Andy Shevchenko
#3 lore raw
Quoted 5 lines · Andy Shevchenko
Quoted 2 lines · Liam R. Howlett

This exists to stop people from using the bits while the feature is in active development. We had the same patch a few days (weeks?) ago.

This breaks build. Can you propose better solution, please?

Can you please provide the config file and clang version that fails on this error?

Thanks,
Liam

Quoted 28 lines
Quoted 22 lines · Andy Shevchenko
Quoted 20 lines

A few functions defined but not used. This, in particular, prevents kernel builds with clang, make W=1 and CONFIG_WERROR=y:

lib/maple_tree.c:351:21: error: unused function 'mte_set_full' [-Werror,-Wunused-function]
351 | static inline void *mte_set_full(const struct maple_enode *node)

      |                     ^~~~~~~~~~~~
lib/maple_tree.c:356:21: error: unused function 'mte_clear_full' [-Werror,-Wunused-function]
  356 | static inline void *mte_clear_full(const struct maple_enode *node)
      |                     ^~~~~~~~~~~~~~
lib/maple_tree.c:361:20: error: unused function 'mte_has_null' [-Werror,-Wunused-function]
  361 | static inline bool mte_has_null(const struct maple_enode *node)
      |                    ^~~~~~~~~~~~

Fix this by dropping unused functions.

See also commit 6863f5643dd7 ("kbuild: allow Clang to find unused static inline functions for W=1 build").

Fixes 6e7ba8b5e238 ("maple_tree: mte_set_full() and mte_clear_full() clang-analyzer clean up")
Fixes 54a611b60590 ("Maple Tree: add new data structure")
Signature · 2 lines
With Best Regards,
Andy Shevchenko
#4 lore raw
Quoted 9 lines · Liam R. Howlett
Quoted 5 lines · Andy Shevchenko
Quoted 2 lines · Liam R. Howlett

This exists to stop people from using the bits while the feature is in active development. We had the same patch a few days (weeks?) ago.

This breaks build. Can you propose better solution, please?

Can you please provide the config file and clang version that fails on this error?

I believe any of them where this module is marked to compile (and since it's listed as lib-y, means _any_ configuration will fail). For your convenience it's x86_64_defconfig in the source tree.

Have you had a chance to read the referred commit?

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#5 lore raw
Quoted 8 lines · Andy Shevchenko
Quoted 7 lines · Liam R. Howlett
Quoted 5 lines · Andy Shevchenko
Quoted 2 lines · Liam R. Howlett

This exists to stop people from using the bits while the feature is in active development. We had the same patch a few days (weeks?) ago.

This breaks build. Can you propose better solution, please?

Quoted 8 lines
Quoted 2 lines

Can you please provide the config file and clang version that fails on this error?

I believe any of them where this module is marked to compile (and since it's listed as lib-y, means _any_ configuration will fail). For your convenience it's x86_64_defconfig in the source tree.

Have you had a chance to read the referred commit?

Btw, if you really, really need those stubs the workarond can be moving them to a header file (IIUC what's this all about).

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#6 lore raw
Quoted 12 lines · Andy Shevchenko
Quoted 11 lines · Andy Shevchenko
Quoted 9 lines · Liam R. Howlett
Quoted 5 lines · Andy Shevchenko
Quoted 2 lines · Liam R. Howlett

This exists to stop people from using the bits while the feature is in active development. We had the same patch a few days (weeks?) ago.

This breaks build. Can you propose better solution, please?

Can you please provide the config file and clang version that fails on this error?

Quoted 9 lines
Quoted 5 lines

I believe any of them where this module is marked to compile (and since it's listed as lib-y, means _any_ configuration will fail). For your convenience it's x86_64_defconfig in the source tree.

Have you had a chance to read the referred commit?

Btw, if you really, really need those stubs the workarond can be moving them to a header file (IIUC what's this all about).

This issue is resolved by
https://lore.kernel.org/all/[email protected]/

Quoted 5 lines

--
With Best Regards,
Andy Shevchenko

#7 lore raw
Quoted 17 lines · Lorenzo Stoakes
Quoted 16 lines · Andy Shevchenko
Quoted 15 lines · Andy Shevchenko
Quoted 9 lines · Liam R. Howlett
Quoted 5 lines · Andy Shevchenko
Quoted 2 lines · Liam R. Howlett

This exists to stop people from using the bits while the feature is in active development. We had the same patch a few days (weeks?) ago.

This breaks build. Can you propose better solution, please?

Can you please provide the config file and clang version that fails on this error?

I believe any of them where this module is marked to compile (and since it's listed as lib-y, means _any_ configuration will fail). For your convenience it's x86_64_defconfig in the source tree.

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

Have you had a chance to read the referred commit?

Btw, if you really, really need those stubs the workarond can be moving them to a header file (IIUC what's this all about).

This issue is resolved by
https://lore.kernel.org/all/[email protected]/

Thanks, however I was expecting to see myself either in Cc or as reported in that change. Whatever, the problem solved!

Signature · 2 lines
With Best Regards,
Andy Shevchenko