18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0
28c2ecf20Sopenharmony_ci/* Copyright(c) 2016 - 2018 Intel Corporation. All rights reserved. */
38c2ecf20Sopenharmony_ci#include <linux/percpu-refcount.h>
48c2ecf20Sopenharmony_ci#include <linux/memremap.h>
58c2ecf20Sopenharmony_ci#include <linux/module.h>
68c2ecf20Sopenharmony_ci#include <linux/pfn_t.h>
78c2ecf20Sopenharmony_ci#include <linux/nd.h>
88c2ecf20Sopenharmony_ci#include "../bus.h"
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_cistatic int dax_pmem_probe(struct device *dev)
118c2ecf20Sopenharmony_ci{
128c2ecf20Sopenharmony_ci	return PTR_ERR_OR_ZERO(__dax_pmem_probe(dev, DEV_DAX_BUS));
138c2ecf20Sopenharmony_ci}
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_cistatic struct nd_device_driver dax_pmem_driver = {
168c2ecf20Sopenharmony_ci	.probe = dax_pmem_probe,
178c2ecf20Sopenharmony_ci	.drv = {
188c2ecf20Sopenharmony_ci		.name = "dax_pmem",
198c2ecf20Sopenharmony_ci	},
208c2ecf20Sopenharmony_ci	.type = ND_DRIVER_DAX_PMEM,
218c2ecf20Sopenharmony_ci};
228c2ecf20Sopenharmony_ci
238c2ecf20Sopenharmony_cistatic int __init dax_pmem_init(void)
248c2ecf20Sopenharmony_ci{
258c2ecf20Sopenharmony_ci	return nd_driver_register(&dax_pmem_driver);
268c2ecf20Sopenharmony_ci}
278c2ecf20Sopenharmony_cimodule_init(dax_pmem_init);
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_cistatic void __exit dax_pmem_exit(void)
308c2ecf20Sopenharmony_ci{
318c2ecf20Sopenharmony_ci	driver_unregister(&dax_pmem_driver.drv);
328c2ecf20Sopenharmony_ci}
338c2ecf20Sopenharmony_cimodule_exit(dax_pmem_exit);
348c2ecf20Sopenharmony_ci
358c2ecf20Sopenharmony_ciMODULE_LICENSE("GPL v2");
368c2ecf20Sopenharmony_ciMODULE_AUTHOR("Intel Corporation");
378c2ecf20Sopenharmony_ci#if !IS_ENABLED(CONFIG_DEV_DAX_PMEM_COMPAT)
388c2ecf20Sopenharmony_ci/* For compat builds, don't load this module by default */
398c2ecf20Sopenharmony_ciMODULE_ALIAS_ND_DEVICE(ND_DEVICE_DAX_PMEM);
408c2ecf20Sopenharmony_ci#endif
41