diff mbox series

[v1,1/1] maple_tree: Drop unused functions to fix the build

Message ID 20240906150533.568994-1-andriy.shevchenko@linux.intel.com (mailing list archive)
State New
Headers show
Series [v1,1/1] maple_tree: Drop unused functions to fix the build | expand

Commit Message

Andy Shevchenko Sept. 6, 2024, 3:05 p.m. UTC
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")
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 lib/maple_tree.c | 15 ---------------
 1 file changed, 15 deletions(-)

Comments

Liam R. Howlett Sept. 6, 2024, 3:26 p.m. UTC | #1
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.

* Andy Shevchenko <andriy.shevchenko@linux.intel.com> [240906 11:05]:
> 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")
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>  lib/maple_tree.c | 15 ---------------
>  1 file changed, 15 deletions(-)
> 
> diff --git a/lib/maple_tree.c b/lib/maple_tree.c
> index aa3a5df15b8e..f7601aa470e0 100644
> --- a/lib/maple_tree.c
> +++ b/lib/maple_tree.c
> @@ -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);
> -- 
> 2.43.0.rc1.1336.g36b5255a03ac
>
Andy Shevchenko Sept. 6, 2024, 3:43 p.m. UTC | #2
On Fri, Sep 06, 2024 at 11:26:26AM -0400, Liam R. Howlett wrote:
> 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?

> * Andy Shevchenko <andriy.shevchenko@linux.intel.com> [240906 11:05]:
> > 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")
Liam R. Howlett Sept. 6, 2024, 8:05 p.m. UTC | #3
* Andy Shevchenko <andriy.shevchenko@linux.intel.com> [240906 11:43]:
> On Fri, Sep 06, 2024 at 11:26:26AM -0400, Liam R. Howlett wrote:
> > 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

> 
> > * Andy Shevchenko <andriy.shevchenko@linux.intel.com> [240906 11:05]:
> > > 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")
> 
> -- 
> With Best Regards,
> Andy Shevchenko
> 
>
Andy Shevchenko Sept. 9, 2024, 9:41 a.m. UTC | #4
On Fri, Sep 06, 2024 at 04:05:47PM -0400, Liam R. Howlett wrote:
> * Andy Shevchenko <andriy.shevchenko@linux.intel.com> [240906 11:43]:
> > On Fri, Sep 06, 2024 at 11:26:26AM -0400, Liam R. Howlett wrote:
> > > 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?
Andy Shevchenko Sept. 9, 2024, 9:55 a.m. UTC | #5
On Mon, Sep 09, 2024 at 12:41:06PM +0300, Andy Shevchenko wrote:
> On Fri, Sep 06, 2024 at 04:05:47PM -0400, Liam R. Howlett wrote:
> > * Andy Shevchenko <andriy.shevchenko@linux.intel.com> [240906 11:43]:
> > > On Fri, Sep 06, 2024 at 11:26:26AM -0400, Liam R. Howlett wrote:
> > > > 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?

Btw, if you really, really need those stubs the workarond can be moving them to
a header file (IIUC what's this all about).
Lorenzo Stoakes Sept. 9, 2024, 10:16 a.m. UTC | #6
On Mon, Sep 09, 2024 at 12:55:50PM GMT, Andy Shevchenko wrote:
> On Mon, Sep 09, 2024 at 12:41:06PM +0300, Andy Shevchenko wrote:
> > On Fri, Sep 06, 2024 at 04:05:47PM -0400, Liam R. Howlett wrote:
> > > * Andy Shevchenko <andriy.shevchenko@linux.intel.com> [240906 11:43]:
> > > > On Fri, Sep 06, 2024 at 11:26:26AM -0400, Liam R. Howlett wrote:
> > > > > 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?
>
> 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/20240907021506.4018676-1-Liam.Howlett@oracle.com/

> --
> With Best Regards,
> Andy Shevchenko
>
>
Andy Shevchenko Sept. 9, 2024, 10:24 a.m. UTC | #7
On Mon, Sep 09, 2024 at 11:16:49AM +0100, Lorenzo Stoakes wrote:
> On Mon, Sep 09, 2024 at 12:55:50PM GMT, Andy Shevchenko wrote:
> > On Mon, Sep 09, 2024 at 12:41:06PM +0300, Andy Shevchenko wrote:
> > > On Fri, Sep 06, 2024 at 04:05:47PM -0400, Liam R. Howlett wrote:
> > > > * Andy Shevchenko <andriy.shevchenko@linux.intel.com> [240906 11:43]:
> > > > > On Fri, Sep 06, 2024 at 11:26:26AM -0400, Liam R. Howlett wrote:
> > > > > > 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?
> >
> > 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/20240907021506.4018676-1-Liam.Howlett@oracle.com/

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

Patch

diff --git a/lib/maple_tree.c b/lib/maple_tree.c
index aa3a5df15b8e..f7601aa470e0 100644
--- a/lib/maple_tree.c
+++ b/lib/maple_tree.c
@@ -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);