Skip to content

Commit b6a61d5

Browse files
djbwdavejiang
authored andcommitted
cxl/region: Limit visibility of cxl_region_contains_resource()
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>
1 parent 1eaef15 commit b6a61d5

4 files changed

Lines changed: 7 additions & 18 deletions

File tree

drivers/cxl/core/region.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
#include <linux/idr.h>
1313
#include <linux/memory-tiers.h>
1414
#include <linux/string_choices.h>
15-
#include <cxl/cxl.h>
1615
#include <cxlmem.h>
1716
#include <cxl.h>
1817
#include "core.h"
@@ -4253,7 +4252,7 @@ bool cxl_region_contains_resource(struct resource *res)
42534252
return bus_for_each_dev(&cxl_bus_type, NULL, res,
42544253
region_contains_resource) != 0;
42554254
}
4256-
EXPORT_SYMBOL_GPL(cxl_region_contains_resource);
4255+
EXPORT_SYMBOL_FOR_MODULES(cxl_region_contains_resource, "dax_hmem");
42574256

42584257
static int cxl_region_can_probe(struct cxl_region *cxlr)
42594258
{

drivers/cxl/cxl.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -941,6 +941,7 @@ struct cxl_pmem_region *to_cxl_pmem_region(struct device *dev);
941941
int cxl_add_to_region(struct cxl_endpoint_decoder *cxled);
942942
struct cxl_dax_region *to_cxl_dax_region(struct device *dev);
943943
u64 cxl_port_get_spa_cache_alias(struct cxl_port *endpoint, u64 spa);
944+
bool cxl_region_contains_resource(struct resource *res);
944945
#else
945946
static inline bool is_cxl_pmem_region(struct device *dev)
946947
{
@@ -963,6 +964,10 @@ static inline u64 cxl_port_get_spa_cache_alias(struct cxl_port *endpoint,
963964
{
964965
return 0;
965966
}
967+
static inline bool cxl_region_contains_resource(struct resource *res)
968+
{
969+
return false;
970+
}
966971
#endif
967972

968973
void cxl_endpoint_parse_cdat(struct cxl_port *port);

drivers/dax/hmem/hmem.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#include <linux/memregion.h>
44
#include <linux/module.h>
55
#include <linux/dax.h>
6-
#include <cxl/cxl.h>
6+
#include "../../cxl/cxl.h"
77
#include "../bus.h"
88

99
static bool region_idle;

include/cxl/cxl.h

Lines changed: 0 additions & 15 deletions
This file was deleted.

0 commit comments

Comments
 (0)