On Sun, 25 Aug 2024, Jiaxun Yang wrote:
Maybe something like:
static inline bool valid_fw_arg(unsigned long arg) { #ifdef CONFIG_64BIT if (arg >= XKPHYS && arg < XKSEG) return TRUE; #endif return arg >= CKSEG0 && arg < CKSSEG; }
Or rather:
if (IS_ENABLED(CONFIG_64BIT) && arg >= XKPHYS && arg < XKSEG) return TRUE;
as we want to avoid code interspersed with preprocessor conditionals where possible (cf. "21) Conditional Compilation" in our coding style document, also for the rationale).
Maciej