Author: cem Date: Fri Oct 18 21:32:45 2019 New Revision: 353740 URL: https://svnweb.freebsd.org/changeset/base/353740
Log: 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 Modified: head/sys/dev/nvdimm/nvdimm_ns.c head/sys/dev/nvdimm/nvdimm_spa.c head/sys/dev/nvdimm/nvdimm_var.h Modified: head/sys/dev/nvdimm/nvdimm_ns.c ============================================================================== --- head/sys/dev/nvdimm/nvdimm_ns.c Fri Oct 18 20:05:27 2019 (r353739) +++ head/sys/dev/nvdimm/nvdimm_ns.c Fri Oct 18 21:32:45 2019 (r353740) @@ -74,7 +74,7 @@ nvdimm_create_namespaces(struct SPA_mapping *spa, ACPI 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; Modified: head/sys/dev/nvdimm/nvdimm_spa.c ============================================================================== --- head/sys/dev/nvdimm/nvdimm_spa.c Fri Oct 18 20:05:27 2019 (r353739) +++ head/sys/dev/nvdimm/nvdimm_spa.c Fri Oct 18 21:32:45 2019 (r353740) @@ -462,13 +462,13 @@ nvdimm_spa_init(struct SPA_mapping *spa, ACPI_NFIT_SYS 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 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); Modified: head/sys/dev/nvdimm/nvdimm_var.h ============================================================================== --- head/sys/dev/nvdimm/nvdimm_var.h Fri Oct 18 20:05:27 2019 (r353739) +++ head/sys/dev/nvdimm/nvdimm_var.h Fri Oct 18 21:32:45 2019 (r353740) @@ -170,7 +170,7 @@ struct nvdimm_dev *nvdimm_find_by_handle(nfit_handle_t 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); _______________________________________________ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"