Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
torvalds
GitHub Repository: torvalds/linux
Path: blob/master/tools/testing/cxl/test/hmem_test.c
170954 views
1
// SPDX-License-Identifier: GPL-2.0
2
/* Copyright (C) 2026 Intel Corporation */
3
#include <linux/moduleparam.h>
4
#include <linux/workqueue.h>
5
#include "../../../drivers/dax/bus.h"
6
7
static bool hmem_test;
8
9
static void hmem_test_work(struct work_struct *work)
10
{
11
}
12
13
static void hmem_test_release(struct device *dev)
14
{
15
struct hmem_platform_device *hpdev =
16
container_of(dev, typeof(*hpdev), pdev.dev);
17
18
memset(hpdev, 0, sizeof(*hpdev));
19
}
20
21
static struct hmem_platform_device hmem_test_device = {
22
.pdev = {
23
.name = "hmem_platform",
24
.id = 1,
25
.dev = {
26
.release = hmem_test_release,
27
},
28
},
29
.work = __WORK_INITIALIZER(hmem_test_device.work, hmem_test_work),
30
};
31
32
int hmem_test_init(void)
33
{
34
if (!hmem_test)
35
return 0;
36
37
return platform_device_register(&hmem_test_device.pdev);
38
}
39
40
void hmem_test_exit(void)
41
{
42
if (hmem_test)
43
platform_device_unregister(&hmem_test_device.pdev);
44
}
45
46
module_param(hmem_test, bool, 0444);
47
MODULE_PARM_DESC(hmem_test, "Enable/disable the dax_hmem test platform device");
48
49