nvdimm(4): Persist unit numbers in cdev

They're formatted into the device name like unit numbers, anyway; store the
number in mda_unit => si_drv0 like dev2unit() expects.

No functional change intended.

Sponsored by:	Dell EMC Isilon
This commit is contained in:
Conrad Meyer 2019-10-18 21:32:45 +00:00
parent 263323711d
commit 43e4b6ca7f
3 changed files with 5 additions and 4 deletions

View File

@ -74,7 +74,7 @@ nvdimm_create_namespaces(struct SPA_mapping *spa, ACPI_TABLE_NFIT *nfitbl)
ns->dev.spa_efi_mem_flags = spa->dev.spa_efi_mem_flags;
ns->dev.spa_memattr = spa->dev.spa_memattr;
asprintf(&name, M_NVDIMM, "spa%dns%d", spa->spa_nfit_idx, i);
error = nvdimm_spa_dev_init(&ns->dev, name);
error = nvdimm_spa_dev_init(&ns->dev, name, i);
free(name, M_NVDIMM);
if (error != 0)
break;

View File

@ -462,13 +462,13 @@ nvdimm_spa_init(struct SPA_mapping *spa, ACPI_NFIT_SYSTEM_ADDRESS *nfitaddr,
return (0);
asprintf(&name, M_NVDIMM, "spa%d", spa->spa_nfit_idx);
error = nvdimm_spa_dev_init(&spa->dev, name);
error = nvdimm_spa_dev_init(&spa->dev, name, spa->spa_nfit_idx);
free(name, M_NVDIMM);
return (error);
}
int
nvdimm_spa_dev_init(struct nvdimm_spa_dev *dev, const char *name)
nvdimm_spa_dev_init(struct nvdimm_spa_dev *dev, const char *name, int unit)
{
struct make_dev_args mda;
struct sglist *spa_sg;
@ -507,6 +507,7 @@ nvdimm_spa_dev_init(struct nvdimm_spa_dev *dev, const char *name)
mda.mda_gid = GID_OPERATOR;
mda.mda_mode = 0660;
mda.mda_si_drv1 = dev;
mda.mda_unit = unit;
asprintf(&devname, M_NVDIMM, "nvdimm_%s", name);
error = make_dev_s(&mda, &dev->spa_dev, "%s", devname);
free(devname, M_NVDIMM);

View File

@ -170,7 +170,7 @@ struct nvdimm_dev *nvdimm_find_by_handle(nfit_handle_t nv_handle);
int nvdimm_spa_init(struct SPA_mapping *spa, ACPI_NFIT_SYSTEM_ADDRESS *nfitaddr,
enum SPA_mapping_type spa_type);
void nvdimm_spa_fini(struct SPA_mapping *spa);
int nvdimm_spa_dev_init(struct nvdimm_spa_dev *dev, const char *name);
int nvdimm_spa_dev_init(struct nvdimm_spa_dev *dev, const char *name, int unit);
void nvdimm_spa_dev_fini(struct nvdimm_spa_dev *dev);
int nvdimm_create_namespaces(struct SPA_mapping *spa, ACPI_TABLE_NFIT *nfitbl);
void nvdimm_destroy_namespaces(struct SPA_mapping *spa);