dax: Create a dax device_type
Move the open coded release method and attribute groups to a 'struct device_type' instance. Cc: Ira Weiny <ira.weiny@intel.com> Cc: Vishal Verma <vishal.l.verma@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com> Reviewed-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com> Link: https://lore.kernel.org/r/157309904365.1582359.5451327195246651379.stgit@dwillia2-desk3.amr.corp.intel.com
This commit is contained in:
parent
e755799aef
commit
770619a951
|
@ -373,6 +373,11 @@ static void dev_dax_release(struct device *dev)
|
||||||
kfree(dev_dax);
|
kfree(dev_dax);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const struct device_type dev_dax_type = {
|
||||||
|
.release = dev_dax_release,
|
||||||
|
.groups = dax_attribute_groups,
|
||||||
|
};
|
||||||
|
|
||||||
static void unregister_dev_dax(void *dev)
|
static void unregister_dev_dax(void *dev)
|
||||||
{
|
{
|
||||||
struct dev_dax *dev_dax = to_dev_dax(dev);
|
struct dev_dax *dev_dax = to_dev_dax(dev);
|
||||||
|
@ -430,8 +435,7 @@ struct dev_dax *__devm_create_dev_dax(struct dax_region *dax_region, int id,
|
||||||
else
|
else
|
||||||
dev->class = dax_class;
|
dev->class = dax_class;
|
||||||
dev->parent = parent;
|
dev->parent = parent;
|
||||||
dev->groups = dax_attribute_groups;
|
dev->type = &dev_dax_type;
|
||||||
dev->release = dev_dax_release;
|
|
||||||
dev_set_name(dev, "dax%d.%d", dax_region->id, id);
|
dev_set_name(dev, "dax%d.%d", dax_region->id, id);
|
||||||
|
|
||||||
rc = device_add(dev);
|
rc = device_add(dev);
|
||||||
|
|
Loading…
Reference in a new issue