On Wed, Apr 06, 2022 at 04:49:23PM +1200, Kai Huang <kai.huang@xxxxxxxxx> wrote: > +/* > + * Helper to loop all e820 RAM entries with low 1MB excluded > + * in a given e820 table. > + */ > +#define _e820_for_each_mem(_table, _i, _start, _end) \ > + for ((_i) = 0, e820_next_mem((_table), &(_i), &(_start), &(_end)); \ > + (_start) < (_end); \ > + e820_next_mem((_table), &(_i), &(_start), &(_end))) > + > +/* > + * Helper to loop all e820 RAM entries with low 1MB excluded > + * in kernel modified 'e820_table' to honor 'mem' and 'memmap' kernel > + * command lines. > + */ > +#define e820_for_each_mem(_i, _start, _end) \ > + _e820_for_each_mem(e820_table, _i, _start, _end) > + > +/* Check whether first range is the subrange of the second */ > +static bool is_subrange(u64 r1_start, u64 r1_end, u64 r2_start, u64 r2_end) > +{ > + return (r1_start >= r2_start && r1_end <= r2_end) ? true : false; nitpick: Just "return (r1_start >= r2_start && r1_end <= r2_end)" Maybe this is a matter of preference, though. -- Isaku Yamahata <isaku.yamahata@xxxxxxxxx>