Commit 17345145 authored by Zijun Hu's avatar Zijun Hu Committed by Rob Herring (Arm)
Browse files

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: default avatarZijun Hu <quic_zijuhu@quicinc.com>
Link: https://lore.kernel.org/r/20250109-of_core_fix-v4-8-db8a72415b8c@quicinc.com


Signed-off-by: default avatarRob Herring (Arm) <robh@kernel.org>
parent f73780e7
Loading
Loading
Loading
Loading
+3 −18
Original line number Diff line number Diff line
@@ -16,25 +16,10 @@
#include <linux/string.h>
#include <linux/dma-direct.h> /* for bus_dma_region */

#include "of_private.h"

/* 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)
/* Uncomment me to enable of_dump_addr() debugging output */
// #define DEBUG

/* Debug utility */
#ifdef DEBUG
static void 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 of_dump_addr(const char *s, const __be32 *addr, int na) { }
#endif
#include "of_private.h"

/* Callbacks for bus specific translators */
struct of_bus {
+4 −17
Original line number Diff line number Diff line
@@ -17,23 +17,10 @@
#include <linux/of_fdt.h>
#include <linux/sizes.h>

/* Max address size we deal with */
#define OF_MAX_ADDR_CELLS	4
#define OF_CHECK_COUNTS(na, ns)	((na) > 0 && (na) <= OF_MAX_ADDR_CELLS && \
			(ns) > 0)

/* Debug utility */
#ifdef DEBUG
static void __init 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 __init of_dump_addr(const char *s, const __be32 *addr, int na) { }
#endif
/* Uncomment me to enable of_dump_addr() debugging output */
// #define DEBUG

#include "of_private.h"

/* Callbacks for bus specific translators */
struct of_bus {
+18 −0
Original line number Diff line number Diff line
@@ -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 */