xref: /openbmc/linux/drivers/dax/pmem/pmem.c (revision 730926c3)
1 // SPDX-License-Identifier: GPL-2.0
2 /* Copyright(c) 2016 - 2018 Intel Corporation. All rights reserved. */
3 #include <linux/percpu-refcount.h>
4 #include <linux/memremap.h>
5 #include <linux/module.h>
6 #include <linux/pfn_t.h>
7 #include <linux/nd.h>
8 #include "../bus.h"
9 
10 static int dax_pmem_probe(struct device *dev)
11 {
12 	return PTR_ERR_OR_ZERO(__dax_pmem_probe(dev, DEV_DAX_BUS));
13 }
14 
15 static struct nd_device_driver dax_pmem_driver = {
16 	.probe = dax_pmem_probe,
17 	.drv = {
18 		.name = "dax_pmem",
19 	},
20 	.type = ND_DRIVER_DAX_PMEM,
21 };
22 
23 static int __init dax_pmem_init(void)
24 {
25 	return nd_driver_register(&dax_pmem_driver);
26 }
27 module_init(dax_pmem_init);
28 
29 static void __exit dax_pmem_exit(void)
30 {
31 	driver_unregister(&dax_pmem_driver.drv);
32 }
33 module_exit(dax_pmem_exit);
34 
35 MODULE_LICENSE("GPL v2");
36 MODULE_AUTHOR("Intel Corporation");
37 #if !IS_ENABLED(CONFIG_DEV_DAX_PMEM_COMPAT)
38 /* For compat builds, don't load this module by default */
39 MODULE_ALIAS_ND_DEVICE(ND_DEVICE_DAX_PMEM);
40 #endif
41