mirror of
https://github.com/torvalds/linux.git
synced 2025-04-11 04:53:02 +00:00

Clean up the existing export namespace code along the same lines of commit 33def8498fdd ("treewide: Convert macro and uses of __section(foo) to __section("foo")") and for the same reason, it is not desired for the namespace argument to be a macro expansion itself. Scripted using git grep -l -e MODULE_IMPORT_NS -e EXPORT_SYMBOL_NS | while read file; do awk -i inplace ' /^#define EXPORT_SYMBOL_NS/ { gsub(/__stringify\(ns\)/, "ns"); print; next; } /^#define MODULE_IMPORT_NS/ { gsub(/__stringify\(ns\)/, "ns"); print; next; } /MODULE_IMPORT_NS/ { $0 = gensub(/MODULE_IMPORT_NS\(([^)]*)\)/, "MODULE_IMPORT_NS(\"\\1\")", "g"); } /EXPORT_SYMBOL_NS/ { if ($0 ~ /(EXPORT_SYMBOL_NS[^(]*)\(([^,]+),/) { if ($0 !~ /(EXPORT_SYMBOL_NS[^(]*)\(([^,]+), ([^)]+)\)/ && $0 !~ /(EXPORT_SYMBOL_NS[^(]*)\(\)/ && $0 !~ /^my/) { getline line; gsub(/[[:space:]]*\\$/, ""); gsub(/[[:space:]]/, "", line); $0 = $0 " " line; } $0 = gensub(/(EXPORT_SYMBOL_NS[^(]*)\(([^,]+), ([^)]+)\)/, "\\1(\\2, \"\\3\")", "g"); } } { print }' $file; done Requested-by: Masahiro Yamada <masahiroy@kernel.org> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Link: https://mail.google.com/mail/u/2/#inbox/FMfcgzQXKWgMmjdFwwdsfgxzKpVHWPlc Acked-by: Greg KH <gregkh@linuxfoundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
50 lines
1.3 KiB
C
50 lines
1.3 KiB
C
// SPDX-License-Identifier: GPL-2.0-only
|
|
/* Copyright(c) 2023 Intel Corporation. All rights reserved. */
|
|
#include <linux/module.h>
|
|
#include <linux/dax.h>
|
|
|
|
#include "../cxl/cxl.h"
|
|
#include "bus.h"
|
|
|
|
static int cxl_dax_region_probe(struct device *dev)
|
|
{
|
|
struct cxl_dax_region *cxlr_dax = to_cxl_dax_region(dev);
|
|
int nid = phys_to_target_node(cxlr_dax->hpa_range.start);
|
|
struct cxl_region *cxlr = cxlr_dax->cxlr;
|
|
struct dax_region *dax_region;
|
|
struct dev_dax_data data;
|
|
|
|
if (nid == NUMA_NO_NODE)
|
|
nid = memory_add_physaddr_to_nid(cxlr_dax->hpa_range.start);
|
|
|
|
dax_region = alloc_dax_region(dev, cxlr->id, &cxlr_dax->hpa_range, nid,
|
|
PMD_SIZE, IORESOURCE_DAX_KMEM);
|
|
if (!dax_region)
|
|
return -ENOMEM;
|
|
|
|
data = (struct dev_dax_data) {
|
|
.dax_region = dax_region,
|
|
.id = -1,
|
|
.size = range_len(&cxlr_dax->hpa_range),
|
|
.memmap_on_memory = true,
|
|
};
|
|
|
|
return PTR_ERR_OR_ZERO(devm_create_dev_dax(&data));
|
|
}
|
|
|
|
static struct cxl_driver cxl_dax_region_driver = {
|
|
.name = "cxl_dax_region",
|
|
.probe = cxl_dax_region_probe,
|
|
.id = CXL_DEVICE_DAX_REGION,
|
|
.drv = {
|
|
.suppress_bind_attrs = true,
|
|
},
|
|
};
|
|
|
|
module_cxl_driver(cxl_dax_region_driver);
|
|
MODULE_ALIAS_CXL(CXL_DEVICE_DAX_REGION);
|
|
MODULE_DESCRIPTION("CXL DAX: direct access to CXL regions");
|
|
MODULE_LICENSE("GPL");
|
|
MODULE_AUTHOR("Intel Corporation");
|
|
MODULE_IMPORT_NS("CXL");
|