The dax_hmem dependency on cxl_region_contains_resource() is a one-off
special case. It is not suitable for other use cases.
Move the definition to the other CONFIG_CXL_REGION guarded definitions in
drivers/cxl/cxl.h and include that by a relative path include. This matches
what drivers/dax/cxl.c does for its limited private usage of CXL core
symbols.
Reduce the symbol export visibility from global to just dax_hmem, to
further clarify its applicability.
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Reviewed-by: Ira Weiny <ira.weiny@intel.com>
Reviewed-by: Alison Schofield <alison.schofield@intel.com>
Reviewed-by: Dave Jiang <dave.jiang@intel.com>
Link: https://patch.msgid.link/20260327052821.440749-4-dan.j.williams@intel.com
Signed-off-by: Dave Jiang <dave.jiang@intel.com>
#include <linux/idr.h>
#include <linux/memory-tiers.h>
#include <linux/string_choices.h>
-#include <cxl/cxl.h>
#include <cxlmem.h>
#include <cxl.h>
#include "core.h"
return bus_for_each_dev(&cxl_bus_type, NULL, res,
region_contains_resource) != 0;
}
-EXPORT_SYMBOL_GPL(cxl_region_contains_resource);
+EXPORT_SYMBOL_FOR_MODULES(cxl_region_contains_resource, "dax_hmem");
static int cxl_region_can_probe(struct cxl_region *cxlr)
{
int cxl_add_to_region(struct cxl_endpoint_decoder *cxled);
struct cxl_dax_region *to_cxl_dax_region(struct device *dev);
u64 cxl_port_get_spa_cache_alias(struct cxl_port *endpoint, u64 spa);
+bool cxl_region_contains_resource(struct resource *res);
#else
static inline bool is_cxl_pmem_region(struct device *dev)
{
{
return 0;
}
+static inline bool cxl_region_contains_resource(struct resource *res)
+{
+ return false;
+}
#endif
void cxl_endpoint_parse_cdat(struct cxl_port *port);
#include <linux/memregion.h>
#include <linux/module.h>
#include <linux/dax.h>
-#include <cxl/cxl.h>
+#include "../../cxl/cxl.h"
#include "../bus.h"
static bool region_idle;
+++ /dev/null
-/* SPDX-License-Identifier: GPL-2.0-only */
-/* Copyright (c) 2026 Advanced Micro Devices, Inc. */
-#ifndef _CXL_H_
-#define _CXL_H_
-
-#ifdef CONFIG_CXL_REGION
-bool cxl_region_contains_resource(struct resource *res);
-#else
-static inline bool cxl_region_contains_resource(struct resource *res)
-{
- return false;
-}
-#endif
-
-#endif /* _CXL_H_ */