mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-22 22:34:56 +07:00
730926c3b0
On the expectation that some environments may not upgrade libdaxctl (userspace component that depends on the /sys/class/dax hierarchy), provide a default / legacy dax_pmem_compat driver. The dax_pmem_compat driver implements the original /sys/class/dax sysfs layout rather than /sys/bus/dax. When userspace is upgraded it can blacklist this module and switch to the dax_pmem driver going forward. CONFIG_DEV_DAX_PMEM_COMPAT and supporting code will be deleted according to the dax_pmem entry in Documentation/ABI/obsolete/. Signed-off-by: Dan Williams <dan.j.williams@intel.com>
74 lines
1.7 KiB
C
74 lines
1.7 KiB
C
// SPDX-License-Identifier: GPL-2.0
|
|
/* Copyright(c) 2016 - 2018 Intel Corporation. All rights reserved. */
|
|
#include <linux/percpu-refcount.h>
|
|
#include <linux/memremap.h>
|
|
#include <linux/module.h>
|
|
#include <linux/pfn_t.h>
|
|
#include <linux/nd.h>
|
|
#include "../bus.h"
|
|
|
|
/* we need the private definitions to implement compat suport */
|
|
#include "../dax-private.h"
|
|
|
|
static int dax_pmem_compat_probe(struct device *dev)
|
|
{
|
|
struct dev_dax *dev_dax = __dax_pmem_probe(dev, DEV_DAX_CLASS);
|
|
int rc;
|
|
|
|
if (IS_ERR(dev_dax))
|
|
return PTR_ERR(dev_dax);
|
|
|
|
if (!devres_open_group(&dev_dax->dev, dev_dax, GFP_KERNEL))
|
|
return -ENOMEM;
|
|
|
|
device_lock(&dev_dax->dev);
|
|
rc = dev_dax_probe(&dev_dax->dev);
|
|
device_unlock(&dev_dax->dev);
|
|
|
|
devres_close_group(&dev_dax->dev, dev_dax);
|
|
if (rc)
|
|
devres_release_group(&dev_dax->dev, dev_dax);
|
|
|
|
return rc;
|
|
}
|
|
|
|
static int dax_pmem_compat_release(struct device *dev, void *data)
|
|
{
|
|
device_lock(dev);
|
|
devres_release_group(dev, to_dev_dax(dev));
|
|
device_unlock(dev);
|
|
|
|
return 0;
|
|
}
|
|
|
|
static int dax_pmem_compat_remove(struct device *dev)
|
|
{
|
|
device_for_each_child(dev, NULL, dax_pmem_compat_release);
|
|
return 0;
|
|
}
|
|
|
|
static struct nd_device_driver dax_pmem_compat_driver = {
|
|
.probe = dax_pmem_compat_probe,
|
|
.remove = dax_pmem_compat_remove,
|
|
.drv = {
|
|
.name = "dax_pmem_compat",
|
|
},
|
|
.type = ND_DRIVER_DAX_PMEM,
|
|
};
|
|
|
|
static int __init dax_pmem_compat_init(void)
|
|
{
|
|
return nd_driver_register(&dax_pmem_compat_driver);
|
|
}
|
|
module_init(dax_pmem_compat_init);
|
|
|
|
static void __exit dax_pmem_compat_exit(void)
|
|
{
|
|
driver_unregister(&dax_pmem_compat_driver.drv);
|
|
}
|
|
module_exit(dax_pmem_compat_exit);
|
|
|
|
MODULE_LICENSE("GPL v2");
|
|
MODULE_AUTHOR("Intel Corporation");
|
|
MODULE_ALIAS_ND_DEVICE(ND_DEVICE_DAX_PMEM);
|