Skip to contentSkip to conversation

powerpc/boot: remove unused min_t/max_t macros

PATCH In review Thorsten Blum 3 participants 5 messages May 25 – May 29 PowerPC

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 powerpc/boot: remove unused min_t/max_t macros

The min_t() and max_t() macros are no longer used by the boot wrapper, remove them.

---
 arch/powerpc/boot/types.h | 3 ---
 1 file changed, 3 deletions(-)
arch/powerpc/boot/types.h +0 -3
index 8a4c418b7260..c5085c2632bf 100644
@@ -37,9 +37,6 @@ typedef s64 int64_t;
 	(void) (&_x == &_y);	\
 	_x > _y ? _x : _y; })
 
-#define min_t(type, a, b) min(((type) a), ((type) b))
-#define max_t(type, a, b) max(((type) a), ((type) b))
-
 typedef int bool;
 
 #ifndef true
#1 lore raw

Le 25/05/2026 à 11:18, Thorsten Blum a écrit :

Quoted 2 lines

The min_t() and max_t() macros are no longer used by the boot wrapper, remove them.

Did you test your change ?

BOOTCC arch/powerpc/boot/decompress.o
In file included from arch/powerpc/boot/../../../lib/decompress_unxz.c:241,
from arch/powerpc/boot/decompress.c:37:
arch/powerpc/boot/../../../lib/xz/xz_dec_stream.c: In function 'fill_temp':
arch/powerpc/boot/../../../lib/xz/xz_dec_stream.c:158:28: error: implicit declaration of function 'min_t'; did you mean 'min'? [-Wimplicit-function-declaration]

  158 |         size_t copy_size = min_t(size_t,
      |                            ^~~~~
      |                            min

arch/powerpc/boot/../../../lib/xz/xz_dec_stream.c:158:34: error: expected expression before 'size_t'
158 | size_t copy_size = min_t(size_t,
| ^~~~~~
In file included from arch/powerpc/boot/../../../lib/decompress_unxz.c:242:
arch/powerpc/boot/../../../lib/xz/xz_dec_lzma2.c: In function 'dict_repeat':
arch/powerpc/boot/../../../lib/xz/xz_dec_lzma2.c:357:22: error: expected expression before 'size_t'
357 | left = min_t(size_t, dict->limit - dict->pos, *len);
| ^~~~~~
arch/powerpc/boot/../../../lib/xz/xz_dec_lzma2.c: In function 'xz_dec_lzma2_run':
arch/powerpc/boot/../../../lib/xz/xz_dec_lzma2.c:1101:52: error: expected expression before 'size_t'
1101 | dict_limit(&s->dict, min_t(size_t,
| ^~~~~~
In file included from arch/powerpc/boot/../../../lib/decompress_unxz.c:243:
arch/powerpc/boot/../../../lib/xz/xz_dec_bcj.c: In function 'bcj_flush':
arch/powerpc/boot/../../../lib/xz/xz_dec_bcj.c:469:27: error: expected expression before 'size_t'
469 | copy_size = min_t(size_t, s->temp.filtered, b->out_size
- b->out_pos);
| ^~~~~~
make[2]: *** [arch/powerpc/boot/Makefile:235: arch/powerpc/boot/decompress.o] Error 1 make[1]: *** [arch/powerpc/Makefile:236: zImage] Error 2
make: *** [Makefile:248: __sub-make] Error 2

Quoted 20 lines
---
  arch/powerpc/boot/types.h | 3 ---
  1 file changed, 3 deletions(-)
arch/powerpc/boot/types.h +0 -3
index 8a4c418b7260..c5085c2632bf 100644
@@ -37,9 +37,6 @@ typedef s64 int64_t;
  	(void) (&_x == &_y);	\
  	_x > _y ? _x : _y; })
 
-#define min_t(type, a, b) min(((type) a), ((type) b))
-#define max_t(type, a, b) max(((type) a), ((type) b))
-
  typedef int bool;
 
  #ifndef true
#2 lore raw

Hi Christophe,

Quoted 7 lines · Christophe Leroy (CS GROUP)

Le 25/05/2026 à 11:18, Thorsten Blum a écrit :

Quoted 2 lines

The min_t() and max_t() macros are no longer used by the boot wrapper, remove them.

Did you test your change ?

Yes, but with Gzip and not with XZ, and by grepping for min_t/max_t in arch/powerpc/boot/. I (wrongly) assumed that arch/powerpc/boot/ is self-contained.

Thanks for catching this, and please drop this patch for now as I wasn't aware of the dependency to lib/xz/.

Thorsten

#3 lore raw

Le 29/05/2026 à 11:45, Thorsten Blum a écrit :

Quoted 6 lines

Hi Christophe,

Quoted 3 lines · Christophe Leroy (CS GROUP)

Le 25/05/2026 à 11:18, Thorsten Blum a écrit :

Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

The min_t() and max_t() macros are no longer used by the boot wrapper, remove them.

Did you test your change ?

Yes, but with Gzip and not with XZ, and by grepping for min_t/max_t in arch/powerpc/boot/. I (wrongly) assumed that arch/powerpc/boot/ is self-contained.

You could have figured out with 'git blame arch/powerpc/boot/types.h' that those lines were added by commit c762c69e106f ("powerpc/boot: Add support for XZ compression")

Quoted 3 lines

Thanks for catching this, and please drop this patch for now as I wasn't aware of the dependency to lib/xz/.

#4 lore raw
In reply to Thorsten Blum
kernel test robot noticed the following build errors:

Hi Thorsten,

kernel test robot noticed the following build errors:

[auto build test ERROR on powerpc/next]
[also build test ERROR on powerpc/fixes linus/master v7.1-rc5 next-20260528] [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#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Thorsten-Blum/powerpc-boot-remove-unused-min_t-max_t-macros/20260525-172120
base:   https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next
patch link:    https://lore.kernel.org/r/20260525091839.817778-3-thorsten.blum%40linux.dev
patch subject: [PATCH] powerpc/boot: remove unused min_t/max_t macros
config: powerpc64-randconfig-r061-20260529 (https://download.01.org/0day-ci/archive/20260530/[email protected]/config)
compiler: clang version 23.0.0git (https://github.com/llvm/llvm-project 9409c07de6378507397ecdb6f05f628f58110112)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260530/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

In file included from arch/powerpc/boot/decompress.c:37:
In file included from arch/powerpc/boot/../../../lib/decompress_unxz.c:241:

>> arch/powerpc/boot/../../../lib/xz/xz_dec_stream.c:158:21: error: call to undeclared function 'min_t'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
     158 |         size_t copy_size = min_t(size_t,
         |                            ^
>> arch/powerpc/boot/../../../lib/xz/xz_dec_stream.c:158:27: error: unexpected type name 'size_t': expected expression
     158 |         size_t copy_size = min_t(size_t,
         |                                  ^
   In file included from arch/powerpc/boot/decompress.c:37:
   In file included from arch/powerpc/boot/../../../lib/decompress_unxz.c:242:
>> arch/powerpc/boot/../../../lib/xz/xz_dec_lzma2.c:357:9: error: call to undeclared function 'min_t'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
     357 |         left = min_t(size_t, dict->limit - dict->pos, *len);
         |                ^
>> arch/powerpc/boot/../../../lib/xz/xz_dec_lzma2.c:357:15: error: unexpected type name 'size_t': expected expression
     357 |         left = min_t(size_t, dict->limit - dict->pos, *len);
         |                      ^
   arch/powerpc/boot/../../../lib/xz/xz_dec_lzma2.c:1101:25: error: call to undeclared function 'min_t'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
    1101 |                         dict_limit(&s->dict, min_t(size_t,
         |                                              ^
   arch/powerpc/boot/../../../lib/xz/xz_dec_lzma2.c:1101:31: error: unexpected type name 'size_t': expected expression
    1101 |                         dict_limit(&s->dict, min_t(size_t,
         |                                                    ^
   In file included from arch/powerpc/boot/decompress.c:37:
   In file included from arch/powerpc/boot/../../../lib/decompress_unxz.c:243:
>> arch/powerpc/boot/../../../lib/xz/xz_dec_bcj.c:469:14: error: call to undeclared function 'min_t'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
     469 |         copy_size = min_t(size_t, s->temp.filtered, b->out_size - b->out_pos);
         |                     ^
>> arch/powerpc/boot/../../../lib/xz/xz_dec_bcj.c:469:20: error: unexpected type name 'size_t': expected expression
     469 |         copy_size = min_t(size_t, s->temp.filtered, b->out_size - b->out_pos);
         |                           ^

8 errors generated.

vim +/min_t +158 arch/powerpc/boot/../../../lib/xz/xz_dec_stream.c

24fa0402a9b6a5 Lasse Collin 2011-01-12  149  
24fa0402a9b6a5 Lasse Collin 2011-01-12  150  /*
24fa0402a9b6a5 Lasse Collin 2011-01-12  151   * Fill s->temp by copying data starting from b->in[b->in_pos]. Caller
24fa0402a9b6a5 Lasse Collin 2011-01-12  152   * must have set s->temp.pos to indicate how much data we are supposed
24fa0402a9b6a5 Lasse Collin 2011-01-12  153   * to copy into s->temp.buf. Return true once s->temp.pos has reached
24fa0402a9b6a5 Lasse Collin 2011-01-12  154   * s->temp.size.
24fa0402a9b6a5 Lasse Collin 2011-01-12  155   */
24fa0402a9b6a5 Lasse Collin 2011-01-12  156  static bool fill_temp(struct xz_dec *s, struct xz_buf *b)
24fa0402a9b6a5 Lasse Collin 2011-01-12  157  {
24fa0402a9b6a5 Lasse Collin 2011-01-12 @158  	size_t copy_size = min_t(size_t,
24fa0402a9b6a5 Lasse Collin 2011-01-12  159  			b->in_size - b->in_pos, s->temp.size - s->temp.pos);
24fa0402a9b6a5 Lasse Collin 2011-01-12  160  
24fa0402a9b6a5 Lasse Collin 2011-01-12  161  	memcpy(s->temp.buf + s->temp.pos, b->in + b->in_pos, copy_size);
24fa0402a9b6a5 Lasse Collin 2011-01-12  162  	b->in_pos += copy_size;
24fa0402a9b6a5 Lasse Collin 2011-01-12  163  	s->temp.pos += copy_size;
24fa0402a9b6a5 Lasse Collin 2011-01-12  164  
24fa0402a9b6a5 Lasse Collin 2011-01-12  165  	if (s->temp.pos == s->temp.size) {
24fa0402a9b6a5 Lasse Collin 2011-01-12  166  		s->temp.pos = 0;
24fa0402a9b6a5 Lasse Collin 2011-01-12  167  		return true;
24fa0402a9b6a5 Lasse Collin 2011-01-12  168  	}
24fa0402a9b6a5 Lasse Collin 2011-01-12  169  
24fa0402a9b6a5 Lasse Collin 2011-01-12  170  	return false;
24fa0402a9b6a5 Lasse Collin 2011-01-12  171  }
24fa0402a9b6a5 Lasse Collin 2011-01-12  172  

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki