#include <linux/device.h>
static void nd_dax_release(struct device *dev)
struct nd_region *nd_region = to_nd_region(dev->parent);
struct nd_dax *nd_dax = to_nd_dax(dev);
struct nd_pfn *nd_pfn = &nd_dax->nd_pfn;
nd_detach_ndns(dev, &nd_pfn->ndns);
ida_simple_remove(&nd_region->dax_ida, nd_pfn->id);
static struct device_type nd_dax_device_type = {
.release = nd_dax_release,
bool is_nd_dax(struct device *dev)
return dev ? dev->type == &nd_dax_device_type : false;
EXPORT_SYMBOL(is_nd_dax);
struct nd_dax *to_nd_dax(struct device *dev)
struct nd_dax *nd_dax = container_of(dev, struct nd_dax, nd_pfn.dev);
WARN_ON(!is_nd_dax(dev));
EXPORT_SYMBOL(to_nd_dax);
static const struct attribute_group *nd_dax_attribute_groups[] = {
&nd_device_attribute_group,
&nd_numa_attribute_group,
static struct nd_dax *nd_dax_alloc(struct nd_region *nd_region)