mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2025-01-19 04:14:49 +08:00
libnvdimm, pfn: clean up pfn create parameters
In all cases __nd_pfn_create is called with default parameters which are then overridden by values in the info block. Clean up pfn creation by dropping the parameters and setting default values internal to __nd_pfn_create. Signed-off-by: Dan Williams <dan.j.williams@intel.com>
This commit is contained in:
parent
9f1e8cee77
commit
f7c6ab80fa
@ -179,7 +179,6 @@ static const struct attribute_group *nd_pfn_attribute_groups[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static struct device *__nd_pfn_create(struct nd_region *nd_region,
|
static struct device *__nd_pfn_create(struct nd_region *nd_region,
|
||||||
u8 *uuid, enum nd_pfn_mode mode,
|
|
||||||
struct nd_namespace_common *ndns)
|
struct nd_namespace_common *ndns)
|
||||||
{
|
{
|
||||||
struct nd_pfn *nd_pfn;
|
struct nd_pfn *nd_pfn;
|
||||||
@ -199,10 +198,7 @@ static struct device *__nd_pfn_create(struct nd_region *nd_region,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
nd_pfn->mode = mode;
|
nd_pfn->mode = PFN_MODE_NONE;
|
||||||
if (uuid)
|
|
||||||
uuid = kmemdup(uuid, 16, GFP_KERNEL);
|
|
||||||
nd_pfn->uuid = uuid;
|
|
||||||
dev = &nd_pfn->dev;
|
dev = &nd_pfn->dev;
|
||||||
dev_set_name(dev, "pfn%d.%d", nd_region->id, nd_pfn->id);
|
dev_set_name(dev, "pfn%d.%d", nd_region->id, nd_pfn->id);
|
||||||
dev->parent = &nd_region->dev;
|
dev->parent = &nd_region->dev;
|
||||||
@ -220,8 +216,7 @@ static struct device *__nd_pfn_create(struct nd_region *nd_region,
|
|||||||
|
|
||||||
struct device *nd_pfn_create(struct nd_region *nd_region)
|
struct device *nd_pfn_create(struct nd_region *nd_region)
|
||||||
{
|
{
|
||||||
struct device *dev = __nd_pfn_create(nd_region, NULL, PFN_MODE_NONE,
|
struct device *dev = __nd_pfn_create(nd_region, NULL);
|
||||||
NULL);
|
|
||||||
|
|
||||||
if (dev)
|
if (dev)
|
||||||
__nd_device_register(dev);
|
__nd_device_register(dev);
|
||||||
@ -304,7 +299,7 @@ int nd_pfn_probe(struct nd_namespace_common *ndns, void *drvdata)
|
|||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
|
||||||
nvdimm_bus_lock(&ndns->dev);
|
nvdimm_bus_lock(&ndns->dev);
|
||||||
dev = __nd_pfn_create(nd_region, NULL, PFN_MODE_NONE, ndns);
|
dev = __nd_pfn_create(nd_region, ndns);
|
||||||
nvdimm_bus_unlock(&ndns->dev);
|
nvdimm_bus_unlock(&ndns->dev);
|
||||||
if (!dev)
|
if (!dev)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
Loading…
Reference in New Issue
Block a user