Skip to contentSkip to conversation

generic-radix-tree: Replace kernel.h with the necessary inclusions

PATCH Applied Andy Shevchenko 2 participants 3 messages Oct 27, 2021 – Oct 28, 2021

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

PATCH 1/1 generic-radix-tree: Replace kernel.h with the necessary inclusions

When kernel.h is used in the headers it adds a lot into dependency hell, especially when there are circular dependencies are involved.

Replace kernel.h inclusion with the list of what is really being used.

---
 include/linux/generic-radix-tree.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/generic-radix-tree.h +1 -1
index bfd00320c7f3..89c68df213dd 100644
@@ -38,8 +38,8 @@
 
 #include <asm/page.h>
 #include <linux/bug.h>
-#include <linux/kernel.h>
 #include <linux/log2.h>
+#include <linux/types.h>
 
 struct genradix_root;
 
Signature · 1 line
2.33.0
#1 lore raw
I love your patch! Yet something to improve:

Hi Andy,

I love your patch! Yet something to improve:

[auto build test ERROR on linux/master]
[also build test ERROR on linus/master v5.15-rc7 next-20211027] [cannot apply to hnaz-mm/master]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Andy-Shevchenko/generic-radix-tree-Replace-kernel-h-with-the-necessary-inclusions/20211027-230858
base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 2f111a6fd5b5297b4e92f53798ca086f7c7d33a4
config: hexagon-randconfig-r045-20211027 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 5db7568a6a1fcb408eb8988abdaff2a225a8eb72)

reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/2f6f34a9873a58e8eea432b0f18a2ec8d201085a
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Andy-Shevchenko/generic-radix-tree-Replace-kernel-h-with-the-necessary-inclusions/20211027-230858 git checkout 2f6f34a9873a58e8eea432b0f18a2ec8d201085a
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=hexagon

If you fix the issue, kindly add following tag as appropriate

All errors (new ones prefixed by >>):

In file included from lib/generic-radix-tree.c:3:

>> include/linux/generic-radix-tree.h:190:18: error: implicit declaration of function 'round_up' [-Werror,-Wimplicit-function-declaration]
                   iter->offset = round_up(iter->offset, PAGE_SIZE);
                                  ^

1 error generated.

vim +/round_up +190 include/linux/generic-radix-tree.h

ba20ba2e3743ba Kent Overstreet 2019-03-11  169  
ba20ba2e3743ba Kent Overstreet 2019-03-11  170  /**
ba20ba2e3743ba Kent Overstreet 2019-03-11  171   * genradix_iter_peek - get first entry at or above iterator's current
ba20ba2e3743ba Kent Overstreet 2019-03-11  172   *			position
ba20ba2e3743ba Kent Overstreet 2019-03-11  173   * @_iter:	a genradix_iter
ba20ba2e3743ba Kent Overstreet 2019-03-11  174   * @_radix:	genradix being iterated over
ba20ba2e3743ba Kent Overstreet 2019-03-11  175   *
ba20ba2e3743ba Kent Overstreet 2019-03-11  176   * If no more entries exist at or above @_iter's current position, returns NULL
ba20ba2e3743ba Kent Overstreet 2019-03-11  177   */
ba20ba2e3743ba Kent Overstreet 2019-03-11  178  #define genradix_iter_peek(_iter, _radix)			\
ba20ba2e3743ba Kent Overstreet 2019-03-11  179  	(__genradix_cast(_radix)				\
ba20ba2e3743ba Kent Overstreet 2019-03-11  180  	 __genradix_iter_peek(_iter, &(_radix)->tree,		\
ba20ba2e3743ba Kent Overstreet 2019-03-11  181  			      PAGE_SIZE / __genradix_obj_size(_radix)))
ba20ba2e3743ba Kent Overstreet 2019-03-11  182  
ba20ba2e3743ba Kent Overstreet 2019-03-11  183  static inline void __genradix_iter_advance(struct genradix_iter *iter,
ba20ba2e3743ba Kent Overstreet 2019-03-11  184  					   size_t obj_size)
ba20ba2e3743ba Kent Overstreet 2019-03-11  185  {
ba20ba2e3743ba Kent Overstreet 2019-03-11  186  	iter->offset += obj_size;
ba20ba2e3743ba Kent Overstreet 2019-03-11  187  
ba20ba2e3743ba Kent Overstreet 2019-03-11  188  	if (!is_power_of_2(obj_size) &&
ba20ba2e3743ba Kent Overstreet 2019-03-11  189  	    (iter->offset & (PAGE_SIZE - 1)) + obj_size > PAGE_SIZE)
ba20ba2e3743ba Kent Overstreet 2019-03-11 @190  		iter->offset = round_up(iter->offset, PAGE_SIZE);
ba20ba2e3743ba Kent Overstreet 2019-03-11  191  
ba20ba2e3743ba Kent Overstreet 2019-03-11  192  	iter->pos++;
ba20ba2e3743ba Kent Overstreet 2019-03-11  193  }
ba20ba2e3743ba Kent Overstreet 2019-03-11  194  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

#2 lore raw
In reply to Andy Shevchenko
I love your patch! Yet something to improve:

Hi Andy,

I love your patch! Yet something to improve:

[auto build test ERROR on linux/master]
[also build test ERROR on linus/master v5.15-rc7 next-20211027] [cannot apply to hnaz-mm/master]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Andy-Shevchenko/generic-radix-tree-Replace-kernel-h-with-the-necessary-inclusions/20211027-230858
base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 2f111a6fd5b5297b4e92f53798ca086f7c7d33a4
config: m68k-randconfig-r036-20211027 (attached as .config)
compiler: m68k-linux-gcc (GCC) 11.2.0

reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/2f6f34a9873a58e8eea432b0f18a2ec8d201085a
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Andy-Shevchenko/generic-radix-tree-Replace-kernel-h-with-the-necessary-inclusions/20211027-230858 git checkout 2f6f34a9873a58e8eea432b0f18a2ec8d201085a
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross ARCH=m68k

If you fix the issue, kindly add following tag as appropriate

All errors (new ones prefixed by >>):

In file included from lib/generic-radix-tree.c:3:
include/linux/generic-radix-tree.h: In function '__genradix_iter_advance':

>> include/linux/generic-radix-tree.h:190:32: error: implicit declaration of function 'round_up' [-Werror=implicit-function-declaration]
     190 |                 iter->offset = round_up(iter->offset, PAGE_SIZE);
         |                                ^~~~~~~~

cc1: some warnings being treated as errors

vim +/round_up +190 include/linux/generic-radix-tree.h

ba20ba2e3743ba Kent Overstreet 2019-03-11  169  
ba20ba2e3743ba Kent Overstreet 2019-03-11  170  /**
ba20ba2e3743ba Kent Overstreet 2019-03-11  171   * genradix_iter_peek - get first entry at or above iterator's current
ba20ba2e3743ba Kent Overstreet 2019-03-11  172   *			position
ba20ba2e3743ba Kent Overstreet 2019-03-11  173   * @_iter:	a genradix_iter
ba20ba2e3743ba Kent Overstreet 2019-03-11  174   * @_radix:	genradix being iterated over
ba20ba2e3743ba Kent Overstreet 2019-03-11  175   *
ba20ba2e3743ba Kent Overstreet 2019-03-11  176   * If no more entries exist at or above @_iter's current position, returns NULL
ba20ba2e3743ba Kent Overstreet 2019-03-11  177   */
ba20ba2e3743ba Kent Overstreet 2019-03-11  178  #define genradix_iter_peek(_iter, _radix)			\
ba20ba2e3743ba Kent Overstreet 2019-03-11  179  	(__genradix_cast(_radix)				\
ba20ba2e3743ba Kent Overstreet 2019-03-11  180  	 __genradix_iter_peek(_iter, &(_radix)->tree,		\
ba20ba2e3743ba Kent Overstreet 2019-03-11  181  			      PAGE_SIZE / __genradix_obj_size(_radix)))
ba20ba2e3743ba Kent Overstreet 2019-03-11  182  
ba20ba2e3743ba Kent Overstreet 2019-03-11  183  static inline void __genradix_iter_advance(struct genradix_iter *iter,
ba20ba2e3743ba Kent Overstreet 2019-03-11  184  					   size_t obj_size)
ba20ba2e3743ba Kent Overstreet 2019-03-11  185  {
ba20ba2e3743ba Kent Overstreet 2019-03-11  186  	iter->offset += obj_size;
ba20ba2e3743ba Kent Overstreet 2019-03-11  187  
ba20ba2e3743ba Kent Overstreet 2019-03-11  188  	if (!is_power_of_2(obj_size) &&
ba20ba2e3743ba Kent Overstreet 2019-03-11  189  	    (iter->offset & (PAGE_SIZE - 1)) + obj_size > PAGE_SIZE)
ba20ba2e3743ba Kent Overstreet 2019-03-11 @190  		iter->offset = round_up(iter->offset, PAGE_SIZE);
ba20ba2e3743ba Kent Overstreet 2019-03-11  191  
ba20ba2e3743ba Kent Overstreet 2019-03-11  192  	iter->pos++;
ba20ba2e3743ba Kent Overstreet 2019-03-11  193  }
ba20ba2e3743ba Kent Overstreet 2019-03-11  194  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org