diff options
-rw-r--r-- | drivers/acpi/nfit/core.c | 7 | ||||
-rw-r--r-- | drivers/nvdimm/label.c | 12 | ||||
-rw-r--r-- | drivers/nvdimm/namespace_devs.c | 20 |
3 files changed, 26 insertions, 13 deletions
diff --git a/drivers/acpi/nfit/core.c b/drivers/acpi/nfit/core.c index 436cfdd1215b..b930d12f636b 100644 --- a/drivers/acpi/nfit/core.c +++ b/drivers/acpi/nfit/core.c | |||
@@ -1736,12 +1736,12 @@ static int acpi_nfit_init_interleave_set(struct acpi_nfit_desc *acpi_desc, | |||
1736 | struct nd_region_desc *ndr_desc, | 1736 | struct nd_region_desc *ndr_desc, |
1737 | struct acpi_nfit_system_address *spa) | 1737 | struct acpi_nfit_system_address *spa) |
1738 | { | 1738 | { |
1739 | int i, spa_type = nfit_spa_type(spa); | ||
1740 | struct device *dev = acpi_desc->dev; | 1739 | struct device *dev = acpi_desc->dev; |
1741 | struct nd_interleave_set *nd_set; | 1740 | struct nd_interleave_set *nd_set; |
1742 | u16 nr = ndr_desc->num_mappings; | 1741 | u16 nr = ndr_desc->num_mappings; |
1743 | struct nfit_set_info2 *info2; | 1742 | struct nfit_set_info2 *info2; |
1744 | struct nfit_set_info *info; | 1743 | struct nfit_set_info *info; |
1744 | int i; | ||
1745 | 1745 | ||
1746 | nd_set = devm_kzalloc(dev, sizeof(*nd_set), GFP_KERNEL); | 1746 | nd_set = devm_kzalloc(dev, sizeof(*nd_set), GFP_KERNEL); |
1747 | if (!nd_set) | 1747 | if (!nd_set) |
@@ -1749,11 +1749,6 @@ static int acpi_nfit_init_interleave_set(struct acpi_nfit_desc *acpi_desc, | |||
1749 | ndr_desc->nd_set = nd_set; | 1749 | ndr_desc->nd_set = nd_set; |
1750 | guid_copy(&nd_set->type_guid, (guid_t *) spa->range_guid); | 1750 | guid_copy(&nd_set->type_guid, (guid_t *) spa->range_guid); |
1751 | 1751 | ||
1752 | if (spa_type == NFIT_SPA_PM || spa_type == NFIT_SPA_VOLATILE) | ||
1753 | /* pass */; | ||
1754 | else | ||
1755 | return 0; | ||
1756 | |||
1757 | info = devm_kzalloc(dev, sizeof_nfit_set_info(nr), GFP_KERNEL); | 1752 | info = devm_kzalloc(dev, sizeof_nfit_set_info(nr), GFP_KERNEL); |
1758 | if (!info) | 1753 | if (!info) |
1759 | return -ENOMEM; | 1754 | return -ENOMEM; |
diff --git a/drivers/nvdimm/label.c b/drivers/nvdimm/label.c index d8b87d3a0ebe..ba0582fb0e21 100644 --- a/drivers/nvdimm/label.c +++ b/drivers/nvdimm/label.c | |||
@@ -787,7 +787,17 @@ static int __blk_label_update(struct nd_region *nd_region, | |||
787 | nd_label->flags = __cpu_to_le32(NSLABEL_FLAG_LOCAL); | 787 | nd_label->flags = __cpu_to_le32(NSLABEL_FLAG_LOCAL); |
788 | nd_label->nlabel = __cpu_to_le16(0); /* N/A */ | 788 | nd_label->nlabel = __cpu_to_le16(0); /* N/A */ |
789 | nd_label->position = __cpu_to_le16(0); /* N/A */ | 789 | nd_label->position = __cpu_to_le16(0); /* N/A */ |
790 | nd_label->isetcookie = __cpu_to_le64(0); /* N/A */ | 790 | |
791 | /* | ||
792 | * Use the presence of the type_guid as a flag to | ||
793 | * determine isetcookie usage for blk-aperture | ||
794 | * namespaces. | ||
795 | */ | ||
796 | if (namespace_label_has(ndd, type_guid)) | ||
797 | nd_label->isetcookie = __cpu_to_le64(nd_set->cookie2); | ||
798 | else | ||
799 | nd_label->isetcookie = __cpu_to_le64(0); /* N/A */ | ||
800 | |||
791 | nd_label->dpa = __cpu_to_le64(res->start); | 801 | nd_label->dpa = __cpu_to_le64(res->start); |
792 | nd_label->rawsize = __cpu_to_le64(resource_size(res)); | 802 | nd_label->rawsize = __cpu_to_le64(resource_size(res)); |
793 | nd_label->lbasize = __cpu_to_le64(nsblk->lbasize); | 803 | nd_label->lbasize = __cpu_to_le64(nsblk->lbasize); |
diff --git a/drivers/nvdimm/namespace_devs.c b/drivers/nvdimm/namespace_devs.c index e101aec186c7..7aba9a569c8e 100644 --- a/drivers/nvdimm/namespace_devs.c +++ b/drivers/nvdimm/namespace_devs.c | |||
@@ -2065,12 +2065,20 @@ struct device *create_namespace_blk(struct nd_region *nd_region, | |||
2065 | struct device *dev = NULL; | 2065 | struct device *dev = NULL; |
2066 | struct resource *res; | 2066 | struct resource *res; |
2067 | 2067 | ||
2068 | if (namespace_label_has(ndd, type_guid) | 2068 | if (namespace_label_has(ndd, type_guid)) { |
2069 | && !guid_equal(&nd_set->type_guid, | 2069 | if (!guid_equal(&nd_set->type_guid, &nd_label->type_guid)) { |
2070 | &nd_label->type_guid)) { | 2070 | dev_dbg(ndd->dev, "expect type_guid %pUb got %pUb\n", |
2071 | dev_dbg(ndd->dev, "expect type_guid %pUb got %pUb\n", | 2071 | nd_set->type_guid.b, |
2072 | nd_set->type_guid.b, nd_label->type_guid.b); | 2072 | nd_label->type_guid.b); |
2073 | return ERR_PTR(-EAGAIN); | 2073 | return ERR_PTR(-EAGAIN); |
2074 | } | ||
2075 | |||
2076 | if (nd_label->isetcookie != __cpu_to_le64(nd_set->cookie2)) { | ||
2077 | dev_dbg(ndd->dev, "expect cookie %#llx got %#llx\n", | ||
2078 | nd_set->cookie2, | ||
2079 | __le64_to_cpu(nd_label->isetcookie)); | ||
2080 | return ERR_PTR(-EAGAIN); | ||
2081 | } | ||
2074 | } | 2082 | } |
2075 | 2083 | ||
2076 | nsblk = kzalloc(sizeof(*nsblk), GFP_KERNEL); | 2084 | nsblk = kzalloc(sizeof(*nsblk), GFP_KERNEL); |