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>
10 /* we need the private definitions to implement compat suport */
11 #include "../dax-private.h"
13 static int dax_pmem_compat_probe(struct device *dev)
15 struct dev_dax *dev_dax = __dax_pmem_probe(dev, DEV_DAX_CLASS);
19 return PTR_ERR(dev_dax);
21 if (!devres_open_group(&dev_dax->dev, dev_dax, GFP_KERNEL))
24 device_lock(&dev_dax->dev);
25 rc = dev_dax_probe(dev_dax);
26 device_unlock(&dev_dax->dev);
28 devres_close_group(&dev_dax->dev, dev_dax);
30 devres_release_group(&dev_dax->dev, dev_dax);
35 static int dax_pmem_compat_release(struct device *dev, void *data)
38 devres_release_group(dev, to_dev_dax(dev));
44 static void dax_pmem_compat_remove(struct device *dev)
46 device_for_each_child(dev, NULL, dax_pmem_compat_release);
49 static struct nd_device_driver dax_pmem_compat_driver = {
50 .probe = dax_pmem_compat_probe,
51 .remove = dax_pmem_compat_remove,
53 .name = "dax_pmem_compat",
55 .type = ND_DRIVER_DAX_PMEM,
58 static int __init dax_pmem_compat_init(void)
60 return nd_driver_register(&dax_pmem_compat_driver);
62 module_init(dax_pmem_compat_init);
64 static void __exit dax_pmem_compat_exit(void)
66 driver_unregister(&dax_pmem_compat_driver.drv);
68 module_exit(dax_pmem_compat_exit);
70 MODULE_LICENSE("GPL v2");
71 MODULE_AUTHOR("Intel Corporation");
72 MODULE_ALIAS_ND_DEVICE(ND_DEVICE_DAX_PMEM);