summaryrefslogtreecommitdiff
path: root/tools/testing/cxl/test/hmem_test.c
blob: 3a1a089e1721be403f48dc26a394eb37707011d2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// SPDX-License-Identifier: GPL-2.0
/* Copyright (C) 2026 Intel Corporation */
#include <linux/moduleparam.h>
#include <linux/workqueue.h>
#include "../../../drivers/dax/bus.h"

static bool hmem_test;

static void hmem_test_work(struct work_struct *work)
{
}

static void hmem_test_release(struct device *dev)
{
	struct hmem_platform_device *hpdev =
		container_of(dev, typeof(*hpdev), pdev.dev);

	memset(hpdev, 0, sizeof(*hpdev));
}

static struct hmem_platform_device hmem_test_device = {
	.pdev = {
		.name = "hmem_platform",
		.id = 1,
		.dev = {
			.release = hmem_test_release,
		},
	},
	.work = __WORK_INITIALIZER(hmem_test_device.work, hmem_test_work),
};

int hmem_test_init(void)
{
	if (!hmem_test)
		return 0;

	return platform_device_register(&hmem_test_device.pdev);
}

void hmem_test_exit(void)
{
	if (hmem_test)
		platform_device_unregister(&hmem_test_device.pdev);
}

module_param(hmem_test, bool, 0444);
MODULE_PARM_DESC(hmem_test, "Enable/disable the dax_hmem test platform device");