return devm_add_action_or_reset(dev, remove_debugfs, dentry);
}
-static int region_contains_resource(struct device *dev, void *data)
+static int region_contains_resource(struct device *dev, const void *data)
{
- struct resource *res = data;
+ const struct resource *res = data;
struct cxl_region *cxlr;
struct cxl_region_params *p;
return resource_contains(p->res, res) ? 1 : 0;
}
-bool cxl_region_contains_resource(struct resource *res)
+bool cxl_region_contains_resource(const struct resource *res)
{
guard(rwsem_read)(&cxl_rwsem.region);
- return bus_for_each_dev(&cxl_bus_type, NULL, res,
- region_contains_resource) != 0;
+ struct device *dev __free(put_device) = bus_find_device(
+ &cxl_bus_type, NULL, res, region_contains_resource);
+ return !!dev;
}
EXPORT_SYMBOL_FOR_MODULES(cxl_region_contains_resource, "dax_hmem");
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);
+bool cxl_region_contains_resource(const 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)
+static inline bool cxl_region_contains_resource(const struct resource *res)
{
return false;
}
IORES_DESC_CXL) == REGION_DISJOINT)
return 0;
- if (cxl_region_contains_resource((struct resource *)res)) {
+ if (cxl_region_contains_resource(res)) {
dev_dbg(host, "CXL claims resource, dropping: %pr\n", res);
return 0;
}