diff options
author | Zijun Hu <quic_zijuhu@quicinc.com> | 2025-01-09 21:26:59 +0800 |
---|---|---|
committer | Rob Herring (Arm) <robh@kernel.org> | 2025-01-13 08:39:28 -0600 |
commit | 1734514560ad810352ab745b668330b85c0d4d40 (patch) | |
tree | cfc71df05f014fab6da43d618d9168a2a8e315c5 /drivers/of/of_private.h | |
parent | f73780e772c06901e99b2ad114b7f0f3fbe73ad4 (diff) |
of: Remove a duplicated code block
address.c has a same code block with fdt_address.c.
Remove a copy by moving the duplicated code block into of_private.h.
Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com>
Link: https://lore.kernel.org/r/20250109-of_core_fix-v4-8-db8a72415b8c@quicinc.com
Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
Diffstat (limited to 'drivers/of/of_private.h')
-rw-r--r-- | drivers/of/of_private.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/drivers/of/of_private.h b/drivers/of/of_private.h index ea5a0951ec5e..58819222279a 100644 --- a/drivers/of/of_private.h +++ b/drivers/of/of_private.h @@ -188,4 +188,22 @@ void __init fdt_scan_reserved_mem_reg_nodes(void); bool of_fdt_device_is_available(const void *blob, unsigned long node); +/* Max address size we deal with */ +#define OF_MAX_ADDR_CELLS 4 +#define OF_CHECK_ADDR_COUNT(na) ((na) > 0 && (na) <= OF_MAX_ADDR_CELLS) +#define OF_CHECK_COUNTS(na, ns) (OF_CHECK_ADDR_COUNT(na) && (ns) > 0) + +/* Debug utility */ +#ifdef DEBUG +static void __maybe_unused of_dump_addr(const char *s, const __be32 *addr, int na) +{ + pr_debug("%s", s); + while (na--) + pr_cont(" %08x", be32_to_cpu(*(addr++))); + pr_cont("\n"); +} +#else +static void __maybe_unused of_dump_addr(const char *s, const __be32 *addr, int na) { } +#endif + #endif /* _LINUX_OF_PRIVATE_H */ |