Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Dan Williams and committed by
Dave Jiang
b6a61d5b 1eaef15b

+7 -18
+1 -2
drivers/cxl/core/region.c
··· 12 12 #include <linux/idr.h> 13 13 #include <linux/memory-tiers.h> 14 14 #include <linux/string_choices.h> 15 - #include <cxl/cxl.h> 16 15 #include <cxlmem.h> 17 16 #include <cxl.h> 18 17 #include "core.h" ··· 4252 4253 return bus_for_each_dev(&cxl_bus_type, NULL, res, 4253 4254 region_contains_resource) != 0; 4254 4255 } 4255 - EXPORT_SYMBOL_GPL(cxl_region_contains_resource); 4256 + EXPORT_SYMBOL_FOR_MODULES(cxl_region_contains_resource, "dax_hmem"); 4256 4257 4257 4258 static int cxl_region_can_probe(struct cxl_region *cxlr) 4258 4259 {
+5
drivers/cxl/cxl.h
··· 941 941 int cxl_add_to_region(struct cxl_endpoint_decoder *cxled); 942 942 struct cxl_dax_region *to_cxl_dax_region(struct device *dev); 943 943 u64 cxl_port_get_spa_cache_alias(struct cxl_port *endpoint, u64 spa); 944 + bool cxl_region_contains_resource(struct resource *res); 944 945 #else 945 946 static inline bool is_cxl_pmem_region(struct device *dev) 946 947 { ··· 963 962 u64 spa) 964 963 { 965 964 return 0; 965 + } 966 + static inline bool cxl_region_contains_resource(struct resource *res) 967 + { 968 + return false; 966 969 } 967 970 #endif 968 971
+1 -1
drivers/dax/hmem/hmem.c
··· 3 3 #include <linux/memregion.h> 4 4 #include <linux/module.h> 5 5 #include <linux/dax.h> 6 - #include <cxl/cxl.h> 6 + #include "../../cxl/cxl.h" 7 7 #include "../bus.h" 8 8 9 9 static bool region_idle;
-15
include/cxl/cxl.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0-only */ 2 - /* Copyright (c) 2026 Advanced Micro Devices, Inc. */ 3 - #ifndef _CXL_H_ 4 - #define _CXL_H_ 5 - 6 - #ifdef CONFIG_CXL_REGION 7 - bool cxl_region_contains_resource(struct resource *res); 8 - #else 9 - static inline bool cxl_region_contains_resource(struct resource *res) 10 - { 11 - return false; 12 - } 13 - #endif 14 - 15 - #endif /* _CXL_H_ */