+++ /dev/null
-From dde0a36a4f8a76b774d391771c111449b154be45 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 12 Nov 2019 17:00:24 -0800
-Subject: libnvdimm: Move nd_device_attribute_group to device_type
-
-From: Dan Williams <dan.j.williams@intel.com>
-
-[ Upstream commit adbb68293fc5950a46e3e22f9dc9c619661194ae ]
-
-A 'struct device_type' instance can carry default attributes for the
-device. Use this facility to remove the export of
-nd_device_attribute_group and put the responsibility on the core rather
-than leaf implementations to define this attribute.
-
-For regions this creates a new nd_region_attribute_groups[] added to the
-per-region device-type instances.
-
-Cc: Ira Weiny <ira.weiny@intel.com>
-Cc: Michael Ellerman <mpe@ellerman.id.au>
-Cc: "Oliver O'Halloran" <oohall@gmail.com>
-Cc: Vishal Verma <vishal.l.verma@intel.com>
-Cc: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
-Reviewed-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
-Link: https://lore.kernel.org/r/157309901138.1582359.12909354140826530394.stgit@dwillia2-desk3.amr.corp.intel.com
-Signed-off-by: Dan Williams <dan.j.williams@intel.com>
-Stable-dep-of: 6fd4ebfc4d61 ("libnvdimm/of_pmem: Use devm_kstrdup instead of kstrdup and check its return value")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- arch/powerpc/platforms/pseries/papr_scm.c | 2 --
- drivers/acpi/nfit/core.c | 2 --
- drivers/nvdimm/bus.c | 3 +--
- drivers/nvdimm/dimm_devs.c | 8 +++++++-
- drivers/nvdimm/e820.c | 1 -
- drivers/nvdimm/nd.h | 1 +
- drivers/nvdimm/of_pmem.c | 1 -
- drivers/nvdimm/region_devs.c | 18 +++++++++++++-----
- include/linux/libnvdimm.h | 1 -
- 9 files changed, 22 insertions(+), 15 deletions(-)
-
-diff --git a/arch/powerpc/platforms/pseries/papr_scm.c b/arch/powerpc/platforms/pseries/papr_scm.c
-index 66fd517c48164..59304bade0a5d 100644
---- a/arch/powerpc/platforms/pseries/papr_scm.c
-+++ b/arch/powerpc/platforms/pseries/papr_scm.c
-@@ -286,7 +286,6 @@ int papr_scm_ndctl(struct nvdimm_bus_descriptor *nd_desc, struct nvdimm *nvdimm,
-
- static const struct attribute_group *region_attr_groups[] = {
- &nd_region_attribute_group,
-- &nd_device_attribute_group,
- &nd_mapping_attribute_group,
- &nd_numa_attribute_group,
- NULL,
-@@ -299,7 +298,6 @@ static const struct attribute_group *bus_attr_groups[] = {
-
- static const struct attribute_group *papr_scm_dimm_groups[] = {
- &nvdimm_attribute_group,
-- &nd_device_attribute_group,
- NULL,
- };
-
-diff --git a/drivers/acpi/nfit/core.c b/drivers/acpi/nfit/core.c
-index 793b8d9d749a0..41db477896e8e 100644
---- a/drivers/acpi/nfit/core.c
-+++ b/drivers/acpi/nfit/core.c
-@@ -1700,7 +1700,6 @@ static const struct attribute_group acpi_nfit_dimm_attribute_group = {
-
- static const struct attribute_group *acpi_nfit_dimm_attribute_groups[] = {
- &nvdimm_attribute_group,
-- &nd_device_attribute_group,
- &acpi_nfit_dimm_attribute_group,
- NULL,
- };
-@@ -2200,7 +2199,6 @@ static const struct attribute_group acpi_nfit_region_attribute_group = {
- static const struct attribute_group *acpi_nfit_region_attribute_groups[] = {
- &nd_region_attribute_group,
- &nd_mapping_attribute_group,
-- &nd_device_attribute_group,
- &nd_numa_attribute_group,
- &acpi_nfit_region_attribute_group,
- NULL,
-diff --git a/drivers/nvdimm/bus.c b/drivers/nvdimm/bus.c
-index 56f189c3129af..00f938c0eb497 100644
---- a/drivers/nvdimm/bus.c
-+++ b/drivers/nvdimm/bus.c
-@@ -669,10 +669,9 @@ static struct attribute *nd_device_attributes[] = {
- /*
- * nd_device_attribute_group - generic attributes for all devices on an nd bus
- */
--struct attribute_group nd_device_attribute_group = {
-+const struct attribute_group nd_device_attribute_group = {
- .attrs = nd_device_attributes,
- };
--EXPORT_SYMBOL_GPL(nd_device_attribute_group);
-
- static ssize_t numa_node_show(struct device *dev,
- struct device_attribute *attr, char *buf)
-diff --git a/drivers/nvdimm/dimm_devs.c b/drivers/nvdimm/dimm_devs.c
-index e0f411021c59d..a35be18c5b55f 100644
---- a/drivers/nvdimm/dimm_devs.c
-+++ b/drivers/nvdimm/dimm_devs.c
-@@ -202,9 +202,15 @@ static void nvdimm_release(struct device *dev)
- kfree(nvdimm);
- }
-
--static struct device_type nvdimm_device_type = {
-+static const struct attribute_group *nvdimm_attribute_groups[] = {
-+ &nd_device_attribute_group,
-+ NULL,
-+};
-+
-+static const struct device_type nvdimm_device_type = {
- .name = "nvdimm",
- .release = nvdimm_release,
-+ .groups = nvdimm_attribute_groups,
- };
-
- bool is_nvdimm(struct device *dev)
-diff --git a/drivers/nvdimm/e820.c b/drivers/nvdimm/e820.c
-index 87f72f725e4fe..adde2864c6a46 100644
---- a/drivers/nvdimm/e820.c
-+++ b/drivers/nvdimm/e820.c
-@@ -15,7 +15,6 @@ static const struct attribute_group *e820_pmem_attribute_groups[] = {
-
- static const struct attribute_group *e820_pmem_region_attribute_groups[] = {
- &nd_region_attribute_group,
-- &nd_device_attribute_group,
- NULL,
- };
-
-diff --git a/drivers/nvdimm/nd.h b/drivers/nvdimm/nd.h
-index ee5c04070ef91..2dcd8797e241d 100644
---- a/drivers/nvdimm/nd.h
-+++ b/drivers/nvdimm/nd.h
-@@ -234,6 +234,7 @@ int __init nd_label_init(void);
- void nvdimm_exit(void);
- void nd_region_exit(void);
- struct nvdimm;
-+extern const struct attribute_group nd_device_attribute_group;
- struct nvdimm_drvdata *to_ndd(struct nd_mapping *nd_mapping);
- int nvdimm_check_config_data(struct device *dev);
- int nvdimm_init_nsarea(struct nvdimm_drvdata *ndd);
-diff --git a/drivers/nvdimm/of_pmem.c b/drivers/nvdimm/of_pmem.c
-index 97187d6c0bdb0..41348fa6b74c0 100644
---- a/drivers/nvdimm/of_pmem.c
-+++ b/drivers/nvdimm/of_pmem.c
-@@ -11,7 +11,6 @@
-
- static const struct attribute_group *region_attr_groups[] = {
- &nd_region_attribute_group,
-- &nd_device_attribute_group,
- NULL,
- };
-
-diff --git a/drivers/nvdimm/region_devs.c b/drivers/nvdimm/region_devs.c
-index ca0080b749f37..4c87e77f230b9 100644
---- a/drivers/nvdimm/region_devs.c
-+++ b/drivers/nvdimm/region_devs.c
-@@ -763,19 +763,27 @@ struct attribute_group nd_region_attribute_group = {
- };
- EXPORT_SYMBOL_GPL(nd_region_attribute_group);
-
--static struct device_type nd_blk_device_type = {
-+static const struct attribute_group *nd_region_attribute_groups[] = {
-+ &nd_device_attribute_group,
-+ NULL,
-+};
-+
-+static const struct device_type nd_blk_device_type = {
- .name = "nd_blk",
- .release = nd_region_release,
-+ .groups = nd_region_attribute_groups,
- };
-
--static struct device_type nd_pmem_device_type = {
-+static const struct device_type nd_pmem_device_type = {
- .name = "nd_pmem",
- .release = nd_region_release,
-+ .groups = nd_region_attribute_groups,
- };
-
--static struct device_type nd_volatile_device_type = {
-+static const struct device_type nd_volatile_device_type = {
- .name = "nd_volatile",
- .release = nd_region_release,
-+ .groups = nd_region_attribute_groups,
- };
-
- bool is_nd_pmem(struct device *dev)
-@@ -931,8 +939,8 @@ void nd_region_release_lane(struct nd_region *nd_region, unsigned int lane)
- EXPORT_SYMBOL(nd_region_release_lane);
-
- static struct nd_region *nd_region_create(struct nvdimm_bus *nvdimm_bus,
-- struct nd_region_desc *ndr_desc, struct device_type *dev_type,
-- const char *caller)
-+ struct nd_region_desc *ndr_desc,
-+ const struct device_type *dev_type, const char *caller)
- {
- struct nd_region *nd_region;
- struct device *dev;
-diff --git a/include/linux/libnvdimm.h b/include/linux/libnvdimm.h
-index b6eddf9125685..d7dbf42498af2 100644
---- a/include/linux/libnvdimm.h
-+++ b/include/linux/libnvdimm.h
-@@ -67,7 +67,6 @@ enum {
-
- extern struct attribute_group nvdimm_bus_attribute_group;
- extern struct attribute_group nvdimm_attribute_group;
--extern struct attribute_group nd_device_attribute_group;
- extern struct attribute_group nd_numa_attribute_group;
- extern struct attribute_group nd_region_attribute_group;
- extern struct attribute_group nd_mapping_attribute_group;
---
-2.42.0
-
+++ /dev/null
-From 4b4b991246c461e71822eaf1320f84bf4a057a2c Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 12 Nov 2019 17:07:39 -0800
-Subject: libnvdimm: Move nd_mapping_attribute_group to device_type
-
-From: Dan Williams <dan.j.williams@intel.com>
-
-[ Upstream commit 4ce79fa97e6a54ee028063381346dc2fea91a76b ]
-
-A 'struct device_type' instance can carry default attributes for the
-device. Use this facility to remove the export of
-nd_mapping_attribute_group and put the responsibility on the core rather
-than leaf implementations to define this attribute.
-
-Cc: Ira Weiny <ira.weiny@intel.com>
-Cc: Michael Ellerman <mpe@ellerman.id.au>
-Cc: "Oliver O'Halloran" <oohall@gmail.com>
-Cc: Vishal Verma <vishal.l.verma@intel.com>
-Cc: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.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/157309902686.1582359.6749533709859492704.stgit@dwillia2-desk3.amr.corp.intel.com
-Stable-dep-of: 6fd4ebfc4d61 ("libnvdimm/of_pmem: Use devm_kstrdup instead of kstrdup and check its return value")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- arch/powerpc/platforms/pseries/papr_scm.c | 6 ------
- drivers/acpi/nfit/core.c | 1 -
- drivers/nvdimm/region_devs.c | 4 ++--
- include/linux/libnvdimm.h | 1 -
- 4 files changed, 2 insertions(+), 10 deletions(-)
-
-diff --git a/arch/powerpc/platforms/pseries/papr_scm.c b/arch/powerpc/platforms/pseries/papr_scm.c
-index 4fb8e7466c404..c1ebc21d7e290 100644
---- a/arch/powerpc/platforms/pseries/papr_scm.c
-+++ b/arch/powerpc/platforms/pseries/papr_scm.c
-@@ -284,11 +284,6 @@ int papr_scm_ndctl(struct nvdimm_bus_descriptor *nd_desc, struct nvdimm *nvdimm,
- return 0;
- }
-
--static const struct attribute_group *region_attr_groups[] = {
-- &nd_mapping_attribute_group,
-- NULL,
--};
--
- static const struct attribute_group *bus_attr_groups[] = {
- &nvdimm_bus_attribute_group,
- NULL,
-@@ -363,7 +358,6 @@ static int papr_scm_nvdimm_init(struct papr_scm_priv *p)
- mapping.size = p->blocks * p->block_size; // XXX: potential overflow?
-
- memset(&ndr_desc, 0, sizeof(ndr_desc));
-- ndr_desc.attr_groups = region_attr_groups;
- target_nid = dev_to_node(&p->pdev->dev);
- online_nid = papr_scm_node(target_nid);
- ndr_desc.numa_node = online_nid;
-diff --git a/drivers/acpi/nfit/core.c b/drivers/acpi/nfit/core.c
-index 2e944ecdb163e..5f2a19c516cdb 100644
---- a/drivers/acpi/nfit/core.c
-+++ b/drivers/acpi/nfit/core.c
-@@ -2197,7 +2197,6 @@ static const struct attribute_group acpi_nfit_region_attribute_group = {
- };
-
- static const struct attribute_group *acpi_nfit_region_attribute_groups[] = {
-- &nd_mapping_attribute_group,
- &acpi_nfit_region_attribute_group,
- NULL,
- };
-diff --git a/drivers/nvdimm/region_devs.c b/drivers/nvdimm/region_devs.c
-index ece2a074defea..aac6708d33caa 100644
---- a/drivers/nvdimm/region_devs.c
-+++ b/drivers/nvdimm/region_devs.c
-@@ -751,11 +751,10 @@ static struct attribute *mapping_attributes[] = {
- NULL,
- };
-
--struct attribute_group nd_mapping_attribute_group = {
-+static const struct attribute_group nd_mapping_attribute_group = {
- .is_visible = mapping_visible,
- .attrs = mapping_attributes,
- };
--EXPORT_SYMBOL_GPL(nd_mapping_attribute_group);
-
- static const struct attribute_group nd_region_attribute_group = {
- .attrs = nd_region_attributes,
-@@ -766,6 +765,7 @@ static const struct attribute_group *nd_region_attribute_groups[] = {
- &nd_device_attribute_group,
- &nd_region_attribute_group,
- &nd_numa_attribute_group,
-+ &nd_mapping_attribute_group,
- NULL,
- };
-
-diff --git a/include/linux/libnvdimm.h b/include/linux/libnvdimm.h
-index 312248d334c7e..eb597d1cb8919 100644
---- a/include/linux/libnvdimm.h
-+++ b/include/linux/libnvdimm.h
-@@ -67,7 +67,6 @@ enum {
-
- extern struct attribute_group nvdimm_bus_attribute_group;
- extern struct attribute_group nvdimm_attribute_group;
--extern struct attribute_group nd_mapping_attribute_group;
-
- struct nvdimm;
- struct nvdimm_bus_descriptor;
---
-2.42.0
-
+++ /dev/null
-From 663928cac3e9b524379fd4a290ca4c6334e18632 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 19 Nov 2019 09:51:54 -0800
-Subject: libnvdimm: Move nd_numa_attribute_group to device_type
-
-From: Dan Williams <dan.j.williams@intel.com>
-
-[ Upstream commit e2f6a0e34870ff1bdb1411e250dd2f03908cfa9f ]
-
-A 'struct device_type' instance can carry default attributes for the
-device. Use this facility to remove the export of
-nd_numa_attribute_group and put the responsibility on the core rather
-than leaf implementations to define this attribute.
-
-Cc: Ira Weiny <ira.weiny@intel.com>
-Cc: Michael Ellerman <mpe@ellerman.id.au>
-Cc: "Oliver O'Halloran" <oohall@gmail.com>
-Cc: Vishal Verma <vishal.l.verma@intel.com>
-Cc: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
-Reviewed-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
-Link: https://lore.kernel.org/r/157401269537.43284.14411189404186877352.stgit@dwillia2-desk3.amr.corp.intel.com
-Signed-off-by: Dan Williams <dan.j.williams@intel.com>
-Stable-dep-of: 6fd4ebfc4d61 ("libnvdimm/of_pmem: Use devm_kstrdup instead of kstrdup and check its return value")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- arch/powerpc/platforms/pseries/papr_scm.c | 1 -
- drivers/acpi/nfit/core.c | 1 -
- drivers/nvdimm/bus.c | 3 +--
- drivers/nvdimm/nd.h | 1 +
- drivers/nvdimm/region_devs.c | 1 +
- include/linux/libnvdimm.h | 1 -
- 6 files changed, 3 insertions(+), 5 deletions(-)
-
-diff --git a/arch/powerpc/platforms/pseries/papr_scm.c b/arch/powerpc/platforms/pseries/papr_scm.c
-index 59304bade0a5d..48fd93c5d6874 100644
---- a/arch/powerpc/platforms/pseries/papr_scm.c
-+++ b/arch/powerpc/platforms/pseries/papr_scm.c
-@@ -287,7 +287,6 @@ int papr_scm_ndctl(struct nvdimm_bus_descriptor *nd_desc, struct nvdimm *nvdimm,
- static const struct attribute_group *region_attr_groups[] = {
- &nd_region_attribute_group,
- &nd_mapping_attribute_group,
-- &nd_numa_attribute_group,
- NULL,
- };
-
-diff --git a/drivers/acpi/nfit/core.c b/drivers/acpi/nfit/core.c
-index 41db477896e8e..09b0156b0f531 100644
---- a/drivers/acpi/nfit/core.c
-+++ b/drivers/acpi/nfit/core.c
-@@ -2199,7 +2199,6 @@ static const struct attribute_group acpi_nfit_region_attribute_group = {
- static const struct attribute_group *acpi_nfit_region_attribute_groups[] = {
- &nd_region_attribute_group,
- &nd_mapping_attribute_group,
-- &nd_numa_attribute_group,
- &acpi_nfit_region_attribute_group,
- NULL,
- };
-diff --git a/drivers/nvdimm/bus.c b/drivers/nvdimm/bus.c
-index 00f938c0eb497..389e3c60d10a9 100644
---- a/drivers/nvdimm/bus.c
-+++ b/drivers/nvdimm/bus.c
-@@ -697,11 +697,10 @@ static umode_t nd_numa_attr_visible(struct kobject *kobj, struct attribute *a,
- /*
- * nd_numa_attribute_group - NUMA attributes for all devices on an nd bus
- */
--struct attribute_group nd_numa_attribute_group = {
-+const struct attribute_group nd_numa_attribute_group = {
- .attrs = nd_numa_attributes,
- .is_visible = nd_numa_attr_visible,
- };
--EXPORT_SYMBOL_GPL(nd_numa_attribute_group);
-
- int nvdimm_bus_create_ndctl(struct nvdimm_bus *nvdimm_bus)
- {
-diff --git a/drivers/nvdimm/nd.h b/drivers/nvdimm/nd.h
-index 2dcd8797e241d..8a3ce0b4b2b12 100644
---- a/drivers/nvdimm/nd.h
-+++ b/drivers/nvdimm/nd.h
-@@ -235,6 +235,7 @@ void nvdimm_exit(void);
- void nd_region_exit(void);
- struct nvdimm;
- extern const struct attribute_group nd_device_attribute_group;
-+extern const struct attribute_group nd_numa_attribute_group;
- struct nvdimm_drvdata *to_ndd(struct nd_mapping *nd_mapping);
- int nvdimm_check_config_data(struct device *dev);
- int nvdimm_init_nsarea(struct nvdimm_drvdata *ndd);
-diff --git a/drivers/nvdimm/region_devs.c b/drivers/nvdimm/region_devs.c
-index 4c87e77f230b9..8abe9c514b36b 100644
---- a/drivers/nvdimm/region_devs.c
-+++ b/drivers/nvdimm/region_devs.c
-@@ -765,6 +765,7 @@ EXPORT_SYMBOL_GPL(nd_region_attribute_group);
-
- static const struct attribute_group *nd_region_attribute_groups[] = {
- &nd_device_attribute_group,
-+ &nd_numa_attribute_group,
- NULL,
- };
-
-diff --git a/include/linux/libnvdimm.h b/include/linux/libnvdimm.h
-index d7dbf42498af2..e9a4e25fc7084 100644
---- a/include/linux/libnvdimm.h
-+++ b/include/linux/libnvdimm.h
-@@ -67,7 +67,6 @@ enum {
-
- extern struct attribute_group nvdimm_bus_attribute_group;
- extern struct attribute_group nvdimm_attribute_group;
--extern struct attribute_group nd_numa_attribute_group;
- extern struct attribute_group nd_region_attribute_group;
- extern struct attribute_group nd_mapping_attribute_group;
-
---
-2.42.0
-
+++ /dev/null
-From 828aecf2bfea04fa8c51ee4da52f03efc5b94d5a Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 12 Nov 2019 17:07:16 -0800
-Subject: libnvdimm: Move nd_region_attribute_group to device_type
-
-From: Dan Williams <dan.j.williams@intel.com>
-
-[ Upstream commit 7c4fc8cde1641e3213eb1dafc6854331e9e0828c ]
-
-A 'struct device_type' instance can carry default attributes for the
-device. Use this facility to remove the export of
-nd_region_attribute_group and put the responsibility on the core rather
-than leaf implementations to define this attribute.
-
-Cc: Ira Weiny <ira.weiny@intel.com>
-Cc: Michael Ellerman <mpe@ellerman.id.au>
-Cc: "Oliver O'Halloran" <oohall@gmail.com>
-Cc: Vishal Verma <vishal.l.verma@intel.com>
-Cc: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.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/157309902169.1582359.16828508538444551337.stgit@dwillia2-desk3.amr.corp.intel.com
-Stable-dep-of: 6fd4ebfc4d61 ("libnvdimm/of_pmem: Use devm_kstrdup instead of kstrdup and check its return value")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- arch/powerpc/platforms/pseries/papr_scm.c | 1 -
- drivers/acpi/nfit/core.c | 1 -
- drivers/nvdimm/e820.c | 6 ------
- drivers/nvdimm/of_pmem.c | 6 ------
- drivers/nvdimm/region_devs.c | 4 ++--
- include/linux/libnvdimm.h | 1 -
- 6 files changed, 2 insertions(+), 17 deletions(-)
-
-diff --git a/arch/powerpc/platforms/pseries/papr_scm.c b/arch/powerpc/platforms/pseries/papr_scm.c
-index 48fd93c5d6874..4fb8e7466c404 100644
---- a/arch/powerpc/platforms/pseries/papr_scm.c
-+++ b/arch/powerpc/platforms/pseries/papr_scm.c
-@@ -285,7 +285,6 @@ int papr_scm_ndctl(struct nvdimm_bus_descriptor *nd_desc, struct nvdimm *nvdimm,
- }
-
- static const struct attribute_group *region_attr_groups[] = {
-- &nd_region_attribute_group,
- &nd_mapping_attribute_group,
- NULL,
- };
-diff --git a/drivers/acpi/nfit/core.c b/drivers/acpi/nfit/core.c
-index 09b0156b0f531..2e944ecdb163e 100644
---- a/drivers/acpi/nfit/core.c
-+++ b/drivers/acpi/nfit/core.c
-@@ -2197,7 +2197,6 @@ static const struct attribute_group acpi_nfit_region_attribute_group = {
- };
-
- static const struct attribute_group *acpi_nfit_region_attribute_groups[] = {
-- &nd_region_attribute_group,
- &nd_mapping_attribute_group,
- &acpi_nfit_region_attribute_group,
- NULL,
-diff --git a/drivers/nvdimm/e820.c b/drivers/nvdimm/e820.c
-index adde2864c6a46..9a971a59dec7e 100644
---- a/drivers/nvdimm/e820.c
-+++ b/drivers/nvdimm/e820.c
-@@ -13,11 +13,6 @@ static const struct attribute_group *e820_pmem_attribute_groups[] = {
- NULL,
- };
-
--static const struct attribute_group *e820_pmem_region_attribute_groups[] = {
-- &nd_region_attribute_group,
-- NULL,
--};
--
- static int e820_pmem_remove(struct platform_device *pdev)
- {
- struct nvdimm_bus *nvdimm_bus = platform_get_drvdata(pdev);
-@@ -45,7 +40,6 @@ static int e820_register_one(struct resource *res, void *data)
-
- memset(&ndr_desc, 0, sizeof(ndr_desc));
- ndr_desc.res = res;
-- ndr_desc.attr_groups = e820_pmem_region_attribute_groups;
- ndr_desc.numa_node = e820_range_to_nid(res->start);
- ndr_desc.target_node = ndr_desc.numa_node;
- set_bit(ND_REGION_PAGEMAP, &ndr_desc.flags);
-diff --git a/drivers/nvdimm/of_pmem.c b/drivers/nvdimm/of_pmem.c
-index 41348fa6b74c0..c0b5ac36df9d0 100644
---- a/drivers/nvdimm/of_pmem.c
-+++ b/drivers/nvdimm/of_pmem.c
-@@ -9,11 +9,6 @@
- #include <linux/ioport.h>
- #include <linux/slab.h>
-
--static const struct attribute_group *region_attr_groups[] = {
-- &nd_region_attribute_group,
-- NULL,
--};
--
- static const struct attribute_group *bus_attr_groups[] = {
- &nvdimm_bus_attribute_group,
- NULL,
-@@ -65,7 +60,6 @@ static int of_pmem_region_probe(struct platform_device *pdev)
- * structures so passing a stack pointer is fine.
- */
- memset(&ndr_desc, 0, sizeof(ndr_desc));
-- ndr_desc.attr_groups = region_attr_groups;
- ndr_desc.numa_node = dev_to_node(&pdev->dev);
- ndr_desc.target_node = ndr_desc.numa_node;
- ndr_desc.res = &pdev->resource[i];
-diff --git a/drivers/nvdimm/region_devs.c b/drivers/nvdimm/region_devs.c
-index 8abe9c514b36b..ece2a074defea 100644
---- a/drivers/nvdimm/region_devs.c
-+++ b/drivers/nvdimm/region_devs.c
-@@ -757,14 +757,14 @@ struct attribute_group nd_mapping_attribute_group = {
- };
- EXPORT_SYMBOL_GPL(nd_mapping_attribute_group);
-
--struct attribute_group nd_region_attribute_group = {
-+static const struct attribute_group nd_region_attribute_group = {
- .attrs = nd_region_attributes,
- .is_visible = region_visible,
- };
--EXPORT_SYMBOL_GPL(nd_region_attribute_group);
-
- static const struct attribute_group *nd_region_attribute_groups[] = {
- &nd_device_attribute_group,
-+ &nd_region_attribute_group,
- &nd_numa_attribute_group,
- NULL,
- };
-diff --git a/include/linux/libnvdimm.h b/include/linux/libnvdimm.h
-index e9a4e25fc7084..312248d334c7e 100644
---- a/include/linux/libnvdimm.h
-+++ b/include/linux/libnvdimm.h
-@@ -67,7 +67,6 @@ enum {
-
- extern struct attribute_group nvdimm_bus_attribute_group;
- extern struct attribute_group nvdimm_attribute_group;
--extern struct attribute_group nd_region_attribute_group;
- extern struct attribute_group nd_mapping_attribute_group;
-
- struct nvdimm;
---
-2.42.0
-
+++ /dev/null
-From cc20dc4cd763223d88883425022adf4d788988c5 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 12 Nov 2019 17:08:04 -0800
-Subject: libnvdimm: Move nvdimm_attribute_group to device_type
-
-From: Dan Williams <dan.j.williams@intel.com>
-
-[ Upstream commit 360eba7ebdf716194ed2ede1ebc3ce0f9790a91c ]
-
-A 'struct device_type' instance can carry default attributes for the
-device. Use this facility to remove the export of
-nvdimm_attribute_group and put the responsibility on the core rather
-than leaf implementations to define this attribute.
-
-Cc: Ira Weiny <ira.weiny@intel.com>
-Cc: Michael Ellerman <mpe@ellerman.id.au>
-Cc: "Oliver O'Halloran" <oohall@gmail.com>
-Cc: Vishal Verma <vishal.l.verma@intel.com>
-Cc: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.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/157309903201.1582359.10966209746585062329.stgit@dwillia2-desk3.amr.corp.intel.com
-Stable-dep-of: 6fd4ebfc4d61 ("libnvdimm/of_pmem: Use devm_kstrdup instead of kstrdup and check its return value")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- arch/powerpc/platforms/pseries/papr_scm.c | 9 ++----
- drivers/acpi/nfit/core.c | 1 -
- drivers/nvdimm/dimm_devs.c | 36 +++++++++++------------
- include/linux/libnvdimm.h | 1 -
- 4 files changed, 20 insertions(+), 27 deletions(-)
-
-diff --git a/arch/powerpc/platforms/pseries/papr_scm.c b/arch/powerpc/platforms/pseries/papr_scm.c
-index c1ebc21d7e290..42aac16208a5e 100644
---- a/arch/powerpc/platforms/pseries/papr_scm.c
-+++ b/arch/powerpc/platforms/pseries/papr_scm.c
-@@ -289,11 +289,6 @@ static const struct attribute_group *bus_attr_groups[] = {
- NULL,
- };
-
--static const struct attribute_group *papr_scm_dimm_groups[] = {
-- &nvdimm_attribute_group,
-- NULL,
--};
--
- static inline int papr_scm_node(int node)
- {
- int min_dist = INT_MAX, dist;
-@@ -340,8 +335,8 @@ static int papr_scm_nvdimm_init(struct papr_scm_priv *p)
- dimm_flags = 0;
- set_bit(NDD_ALIASING, &dimm_flags);
-
-- p->nvdimm = nvdimm_create(p->bus, p, papr_scm_dimm_groups,
-- dimm_flags, PAPR_SCM_DIMM_CMD_MASK, 0, NULL);
-+ p->nvdimm = nvdimm_create(p->bus, p, NULL, dimm_flags,
-+ PAPR_SCM_DIMM_CMD_MASK, 0, NULL);
- if (!p->nvdimm) {
- dev_err(dev, "Error creating DIMM object for %pOF\n", p->dn);
- goto err;
-diff --git a/drivers/acpi/nfit/core.c b/drivers/acpi/nfit/core.c
-index 5f2a19c516cdb..ae472a40e5443 100644
---- a/drivers/acpi/nfit/core.c
-+++ b/drivers/acpi/nfit/core.c
-@@ -1699,7 +1699,6 @@ static const struct attribute_group acpi_nfit_dimm_attribute_group = {
- };
-
- static const struct attribute_group *acpi_nfit_dimm_attribute_groups[] = {
-- &nvdimm_attribute_group,
- &acpi_nfit_dimm_attribute_group,
- NULL,
- };
-diff --git a/drivers/nvdimm/dimm_devs.c b/drivers/nvdimm/dimm_devs.c
-index a35be18c5b55f..365b9ad06b7a9 100644
---- a/drivers/nvdimm/dimm_devs.c
-+++ b/drivers/nvdimm/dimm_devs.c
-@@ -202,22 +202,6 @@ static void nvdimm_release(struct device *dev)
- kfree(nvdimm);
- }
-
--static const struct attribute_group *nvdimm_attribute_groups[] = {
-- &nd_device_attribute_group,
-- NULL,
--};
--
--static const struct device_type nvdimm_device_type = {
-- .name = "nvdimm",
-- .release = nvdimm_release,
-- .groups = nvdimm_attribute_groups,
--};
--
--bool is_nvdimm(struct device *dev)
--{
-- return dev->type == &nvdimm_device_type;
--}
--
- struct nvdimm *to_nvdimm(struct device *dev)
- {
- struct nvdimm *nvdimm = container_of(dev, struct nvdimm, dev);
-@@ -468,11 +452,27 @@ static umode_t nvdimm_visible(struct kobject *kobj, struct attribute *a, int n)
- return 0;
- }
-
--struct attribute_group nvdimm_attribute_group = {
-+static const struct attribute_group nvdimm_attribute_group = {
- .attrs = nvdimm_attributes,
- .is_visible = nvdimm_visible,
- };
--EXPORT_SYMBOL_GPL(nvdimm_attribute_group);
-+
-+static const struct attribute_group *nvdimm_attribute_groups[] = {
-+ &nd_device_attribute_group,
-+ &nvdimm_attribute_group,
-+ NULL,
-+};
-+
-+static const struct device_type nvdimm_device_type = {
-+ .name = "nvdimm",
-+ .release = nvdimm_release,
-+ .groups = nvdimm_attribute_groups,
-+};
-+
-+bool is_nvdimm(struct device *dev)
-+{
-+ return dev->type == &nvdimm_device_type;
-+}
-
- struct nvdimm *__nvdimm_create(struct nvdimm_bus *nvdimm_bus,
- void *provider_data, const struct attribute_group **groups,
-diff --git a/include/linux/libnvdimm.h b/include/linux/libnvdimm.h
-index eb597d1cb8919..3644af97bcb47 100644
---- a/include/linux/libnvdimm.h
-+++ b/include/linux/libnvdimm.h
-@@ -66,7 +66,6 @@ enum {
- };
-
- extern struct attribute_group nvdimm_bus_attribute_group;
--extern struct attribute_group nvdimm_attribute_group;
-
- struct nvdimm;
- struct nvdimm_bus_descriptor;
---
-2.42.0
-
+++ /dev/null
-From d981c17cbbdcd19914270518e7ef3e7135f3b9d1 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 12 Nov 2019 17:08:56 -0800
-Subject: libnvdimm: Move nvdimm_bus_attribute_group to device_type
-
-From: Dan Williams <dan.j.williams@intel.com>
-
-[ Upstream commit e755799aefa9385469bec49b2c2ccf1aaa33829a ]
-
-A 'struct device_type' instance can carry default attributes for the
-device. Use this facility to remove the export of
-nvdimm_bus_attribute_group and put the responsibility on the core rather
-than leaf implementations to define this attribute.
-
-Cc: Ira Weiny <ira.weiny@intel.com>
-Cc: Michael Ellerman <mpe@ellerman.id.au>
-Cc: "Oliver O'Halloran" <oohall@gmail.com>
-Cc: Vishal Verma <vishal.l.verma@intel.com>
-Cc: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.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/157309903815.1582359.6418211876315050283.stgit@dwillia2-desk3.amr.corp.intel.com
-Stable-dep-of: 6fd4ebfc4d61 ("libnvdimm/of_pmem: Use devm_kstrdup instead of kstrdup and check its return value")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- arch/powerpc/platforms/pseries/papr_scm.c | 6 ------
- drivers/acpi/nfit/core.c | 1 -
- drivers/nvdimm/bus.c | 9 +++++++--
- drivers/nvdimm/core.c | 8 ++++++--
- drivers/nvdimm/e820.c | 6 ------
- drivers/nvdimm/nd.h | 1 +
- drivers/nvdimm/of_pmem.c | 6 ------
- include/linux/libnvdimm.h | 2 --
- 8 files changed, 14 insertions(+), 25 deletions(-)
-
-diff --git a/arch/powerpc/platforms/pseries/papr_scm.c b/arch/powerpc/platforms/pseries/papr_scm.c
-index 42aac16208a5e..16d4ed7357bcf 100644
---- a/arch/powerpc/platforms/pseries/papr_scm.c
-+++ b/arch/powerpc/platforms/pseries/papr_scm.c
-@@ -284,11 +284,6 @@ int papr_scm_ndctl(struct nvdimm_bus_descriptor *nd_desc, struct nvdimm *nvdimm,
- return 0;
- }
-
--static const struct attribute_group *bus_attr_groups[] = {
-- &nvdimm_bus_attribute_group,
-- NULL,
--};
--
- static inline int papr_scm_node(int node)
- {
- int min_dist = INT_MAX, dist;
-@@ -319,7 +314,6 @@ static int papr_scm_nvdimm_init(struct papr_scm_priv *p)
- p->bus_desc.ndctl = papr_scm_ndctl;
- p->bus_desc.module = THIS_MODULE;
- p->bus_desc.of_node = p->pdev->dev.of_node;
-- p->bus_desc.attr_groups = bus_attr_groups;
- p->bus_desc.provider_name = kstrdup(p->pdev->name, GFP_KERNEL);
-
- if (!p->bus_desc.provider_name)
-diff --git a/drivers/acpi/nfit/core.c b/drivers/acpi/nfit/core.c
-index ae472a40e5443..b9335409e7ecc 100644
---- a/drivers/acpi/nfit/core.c
-+++ b/drivers/acpi/nfit/core.c
-@@ -1405,7 +1405,6 @@ static const struct attribute_group acpi_nfit_attribute_group = {
- };
-
- static const struct attribute_group *acpi_nfit_attribute_groups[] = {
-- &nvdimm_bus_attribute_group,
- &acpi_nfit_attribute_group,
- NULL,
- };
-diff --git a/drivers/nvdimm/bus.c b/drivers/nvdimm/bus.c
-index 389e3c60d10a9..5ee9bc068e9c9 100644
---- a/drivers/nvdimm/bus.c
-+++ b/drivers/nvdimm/bus.c
-@@ -300,9 +300,14 @@ static void nvdimm_bus_release(struct device *dev)
- kfree(nvdimm_bus);
- }
-
-+static const struct device_type nvdimm_bus_dev_type = {
-+ .release = nvdimm_bus_release,
-+ .groups = nvdimm_bus_attribute_groups,
-+};
-+
- bool is_nvdimm_bus(struct device *dev)
- {
-- return dev->release == nvdimm_bus_release;
-+ return dev->type == &nvdimm_bus_dev_type;
- }
-
- struct nvdimm_bus *walk_to_nvdimm_bus(struct device *nd_dev)
-@@ -355,7 +360,7 @@ struct nvdimm_bus *nvdimm_bus_register(struct device *parent,
- badrange_init(&nvdimm_bus->badrange);
- nvdimm_bus->nd_desc = nd_desc;
- nvdimm_bus->dev.parent = parent;
-- nvdimm_bus->dev.release = nvdimm_bus_release;
-+ nvdimm_bus->dev.type = &nvdimm_bus_dev_type;
- nvdimm_bus->dev.groups = nd_desc->attr_groups;
- nvdimm_bus->dev.bus = &nvdimm_bus_type;
- nvdimm_bus->dev.of_node = nd_desc->of_node;
-diff --git a/drivers/nvdimm/core.c b/drivers/nvdimm/core.c
-index 9204f1e9fd141..81231ca23db00 100644
---- a/drivers/nvdimm/core.c
-+++ b/drivers/nvdimm/core.c
-@@ -385,10 +385,14 @@ static struct attribute *nvdimm_bus_attributes[] = {
- NULL,
- };
-
--struct attribute_group nvdimm_bus_attribute_group = {
-+static const struct attribute_group nvdimm_bus_attribute_group = {
- .attrs = nvdimm_bus_attributes,
- };
--EXPORT_SYMBOL_GPL(nvdimm_bus_attribute_group);
-+
-+const struct attribute_group *nvdimm_bus_attribute_groups[] = {
-+ &nvdimm_bus_attribute_group,
-+ NULL,
-+};
-
- int nvdimm_bus_add_badrange(struct nvdimm_bus *nvdimm_bus, u64 addr, u64 length)
- {
-diff --git a/drivers/nvdimm/e820.c b/drivers/nvdimm/e820.c
-index 9a971a59dec7e..e02f60ad6c99f 100644
---- a/drivers/nvdimm/e820.c
-+++ b/drivers/nvdimm/e820.c
-@@ -8,11 +8,6 @@
- #include <linux/libnvdimm.h>
- #include <linux/module.h>
-
--static const struct attribute_group *e820_pmem_attribute_groups[] = {
-- &nvdimm_bus_attribute_group,
-- NULL,
--};
--
- static int e820_pmem_remove(struct platform_device *pdev)
- {
- struct nvdimm_bus *nvdimm_bus = platform_get_drvdata(pdev);
-@@ -55,7 +50,6 @@ static int e820_pmem_probe(struct platform_device *pdev)
- struct nvdimm_bus *nvdimm_bus;
- int rc = -ENXIO;
-
-- nd_desc.attr_groups = e820_pmem_attribute_groups;
- nd_desc.provider_name = "e820";
- nd_desc.module = THIS_MODULE;
- nvdimm_bus = nvdimm_bus_register(dev, &nd_desc);
-diff --git a/drivers/nvdimm/nd.h b/drivers/nvdimm/nd.h
-index 8a3ce0b4b2b12..bd720eebcf4e7 100644
---- a/drivers/nvdimm/nd.h
-+++ b/drivers/nvdimm/nd.h
-@@ -236,6 +236,7 @@ void nd_region_exit(void);
- struct nvdimm;
- extern const struct attribute_group nd_device_attribute_group;
- extern const struct attribute_group nd_numa_attribute_group;
-+extern const struct attribute_group *nvdimm_bus_attribute_groups[];
- struct nvdimm_drvdata *to_ndd(struct nd_mapping *nd_mapping);
- int nvdimm_check_config_data(struct device *dev);
- int nvdimm_init_nsarea(struct nvdimm_drvdata *ndd);
-diff --git a/drivers/nvdimm/of_pmem.c b/drivers/nvdimm/of_pmem.c
-index c0b5ac36df9d0..8224d1431ea94 100644
---- a/drivers/nvdimm/of_pmem.c
-+++ b/drivers/nvdimm/of_pmem.c
-@@ -9,11 +9,6 @@
- #include <linux/ioport.h>
- #include <linux/slab.h>
-
--static const struct attribute_group *bus_attr_groups[] = {
-- &nvdimm_bus_attribute_group,
-- NULL,
--};
--
- struct of_pmem_private {
- struct nvdimm_bus_descriptor bus_desc;
- struct nvdimm_bus *bus;
-@@ -35,7 +30,6 @@ static int of_pmem_region_probe(struct platform_device *pdev)
- if (!priv)
- return -ENOMEM;
-
-- priv->bus_desc.attr_groups = bus_attr_groups;
- priv->bus_desc.provider_name = kstrdup(pdev->name, GFP_KERNEL);
- priv->bus_desc.module = THIS_MODULE;
- priv->bus_desc.of_node = np;
-diff --git a/include/linux/libnvdimm.h b/include/linux/libnvdimm.h
-index 3644af97bcb47..9df091bd30ba6 100644
---- a/include/linux/libnvdimm.h
-+++ b/include/linux/libnvdimm.h
-@@ -65,8 +65,6 @@ enum {
- DPA_RESOURCE_ADJUSTED = 1 << 0,
- };
-
--extern struct attribute_group nvdimm_bus_attribute_group;
--
- struct nvdimm;
- struct nvdimm_bus_descriptor;
- typedef int (*ndctl_fn)(struct nvdimm_bus_descriptor *nd_desc,
---
-2.42.0
-
+++ /dev/null
-From d3658d14f18c314b59993d12a94b62f4ff2c38e1 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Wed, 6 Nov 2019 19:56:46 -0800
-Subject: libnvdimm: Move region attribute group definition
-
-From: Dan Williams <dan.j.williams@intel.com>
-
-[ Upstream commit cb719d5fefc508bc80c25ac6c875a4fe6240ba73 ]
-
-In preparation for moving region attributes from device attribute groups
-to the region device-type, reorder the declaration so that it can be
-referenced by the device-type definition without forward declarations.
-No functional changes are intended to result from this change.
-
-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/157309900624.1582359.6929998072035982264.stgit@dwillia2-desk3.amr.corp.intel.com
-Stable-dep-of: 6fd4ebfc4d61 ("libnvdimm/of_pmem: Use devm_kstrdup instead of kstrdup and check its return value")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/nvdimm/region_devs.c | 208 +++++++++++++++++------------------
- 1 file changed, 104 insertions(+), 104 deletions(-)
-
-diff --git a/drivers/nvdimm/region_devs.c b/drivers/nvdimm/region_devs.c
-index b8236a9e8750d..ca0080b749f37 100644
---- a/drivers/nvdimm/region_devs.c
-+++ b/drivers/nvdimm/region_devs.c
-@@ -140,36 +140,6 @@ static void nd_region_release(struct device *dev)
- kfree(nd_region);
- }
-
--static struct device_type nd_blk_device_type = {
-- .name = "nd_blk",
-- .release = nd_region_release,
--};
--
--static struct device_type nd_pmem_device_type = {
-- .name = "nd_pmem",
-- .release = nd_region_release,
--};
--
--static struct device_type nd_volatile_device_type = {
-- .name = "nd_volatile",
-- .release = nd_region_release,
--};
--
--bool is_nd_pmem(struct device *dev)
--{
-- return dev ? dev->type == &nd_pmem_device_type : false;
--}
--
--bool is_nd_blk(struct device *dev)
--{
-- return dev ? dev->type == &nd_blk_device_type : false;
--}
--
--bool is_nd_volatile(struct device *dev)
--{
-- return dev ? dev->type == &nd_volatile_device_type : false;
--}
--
- struct nd_region *to_nd_region(struct device *dev)
- {
- struct nd_region *nd_region = container_of(dev, struct nd_region, dev);
-@@ -674,80 +644,6 @@ static umode_t region_visible(struct kobject *kobj, struct attribute *a, int n)
- return 0;
- }
-
--struct attribute_group nd_region_attribute_group = {
-- .attrs = nd_region_attributes,
-- .is_visible = region_visible,
--};
--EXPORT_SYMBOL_GPL(nd_region_attribute_group);
--
--u64 nd_region_interleave_set_cookie(struct nd_region *nd_region,
-- struct nd_namespace_index *nsindex)
--{
-- struct nd_interleave_set *nd_set = nd_region->nd_set;
--
-- if (!nd_set)
-- return 0;
--
-- if (nsindex && __le16_to_cpu(nsindex->major) == 1
-- && __le16_to_cpu(nsindex->minor) == 1)
-- return nd_set->cookie1;
-- return nd_set->cookie2;
--}
--
--u64 nd_region_interleave_set_altcookie(struct nd_region *nd_region)
--{
-- struct nd_interleave_set *nd_set = nd_region->nd_set;
--
-- if (nd_set)
-- return nd_set->altcookie;
-- return 0;
--}
--
--void nd_mapping_free_labels(struct nd_mapping *nd_mapping)
--{
-- struct nd_label_ent *label_ent, *e;
--
-- lockdep_assert_held(&nd_mapping->lock);
-- list_for_each_entry_safe(label_ent, e, &nd_mapping->labels, list) {
-- list_del(&label_ent->list);
-- kfree(label_ent);
-- }
--}
--
--/*
-- * When a namespace is activated create new seeds for the next
-- * namespace, or namespace-personality to be configured.
-- */
--void nd_region_advance_seeds(struct nd_region *nd_region, struct device *dev)
--{
-- nvdimm_bus_lock(dev);
-- if (nd_region->ns_seed == dev) {
-- nd_region_create_ns_seed(nd_region);
-- } else if (is_nd_btt(dev)) {
-- struct nd_btt *nd_btt = to_nd_btt(dev);
--
-- if (nd_region->btt_seed == dev)
-- nd_region_create_btt_seed(nd_region);
-- if (nd_region->ns_seed == &nd_btt->ndns->dev)
-- nd_region_create_ns_seed(nd_region);
-- } else if (is_nd_pfn(dev)) {
-- struct nd_pfn *nd_pfn = to_nd_pfn(dev);
--
-- if (nd_region->pfn_seed == dev)
-- nd_region_create_pfn_seed(nd_region);
-- if (nd_region->ns_seed == &nd_pfn->ndns->dev)
-- nd_region_create_ns_seed(nd_region);
-- } else if (is_nd_dax(dev)) {
-- struct nd_dax *nd_dax = to_nd_dax(dev);
--
-- if (nd_region->dax_seed == dev)
-- nd_region_create_dax_seed(nd_region);
-- if (nd_region->ns_seed == &nd_dax->nd_pfn.ndns->dev)
-- nd_region_create_ns_seed(nd_region);
-- }
-- nvdimm_bus_unlock(dev);
--}
--
- static ssize_t mappingN(struct device *dev, char *buf, int n)
- {
- struct nd_region *nd_region = to_nd_region(dev);
-@@ -861,6 +757,110 @@ struct attribute_group nd_mapping_attribute_group = {
- };
- EXPORT_SYMBOL_GPL(nd_mapping_attribute_group);
-
-+struct attribute_group nd_region_attribute_group = {
-+ .attrs = nd_region_attributes,
-+ .is_visible = region_visible,
-+};
-+EXPORT_SYMBOL_GPL(nd_region_attribute_group);
-+
-+static struct device_type nd_blk_device_type = {
-+ .name = "nd_blk",
-+ .release = nd_region_release,
-+};
-+
-+static struct device_type nd_pmem_device_type = {
-+ .name = "nd_pmem",
-+ .release = nd_region_release,
-+};
-+
-+static struct device_type nd_volatile_device_type = {
-+ .name = "nd_volatile",
-+ .release = nd_region_release,
-+};
-+
-+bool is_nd_pmem(struct device *dev)
-+{
-+ return dev ? dev->type == &nd_pmem_device_type : false;
-+}
-+
-+bool is_nd_blk(struct device *dev)
-+{
-+ return dev ? dev->type == &nd_blk_device_type : false;
-+}
-+
-+bool is_nd_volatile(struct device *dev)
-+{
-+ return dev ? dev->type == &nd_volatile_device_type : false;
-+}
-+
-+u64 nd_region_interleave_set_cookie(struct nd_region *nd_region,
-+ struct nd_namespace_index *nsindex)
-+{
-+ struct nd_interleave_set *nd_set = nd_region->nd_set;
-+
-+ if (!nd_set)
-+ return 0;
-+
-+ if (nsindex && __le16_to_cpu(nsindex->major) == 1
-+ && __le16_to_cpu(nsindex->minor) == 1)
-+ return nd_set->cookie1;
-+ return nd_set->cookie2;
-+}
-+
-+u64 nd_region_interleave_set_altcookie(struct nd_region *nd_region)
-+{
-+ struct nd_interleave_set *nd_set = nd_region->nd_set;
-+
-+ if (nd_set)
-+ return nd_set->altcookie;
-+ return 0;
-+}
-+
-+void nd_mapping_free_labels(struct nd_mapping *nd_mapping)
-+{
-+ struct nd_label_ent *label_ent, *e;
-+
-+ lockdep_assert_held(&nd_mapping->lock);
-+ list_for_each_entry_safe(label_ent, e, &nd_mapping->labels, list) {
-+ list_del(&label_ent->list);
-+ kfree(label_ent);
-+ }
-+}
-+
-+/*
-+ * When a namespace is activated create new seeds for the next
-+ * namespace, or namespace-personality to be configured.
-+ */
-+void nd_region_advance_seeds(struct nd_region *nd_region, struct device *dev)
-+{
-+ nvdimm_bus_lock(dev);
-+ if (nd_region->ns_seed == dev) {
-+ nd_region_create_ns_seed(nd_region);
-+ } else if (is_nd_btt(dev)) {
-+ struct nd_btt *nd_btt = to_nd_btt(dev);
-+
-+ if (nd_region->btt_seed == dev)
-+ nd_region_create_btt_seed(nd_region);
-+ if (nd_region->ns_seed == &nd_btt->ndns->dev)
-+ nd_region_create_ns_seed(nd_region);
-+ } else if (is_nd_pfn(dev)) {
-+ struct nd_pfn *nd_pfn = to_nd_pfn(dev);
-+
-+ if (nd_region->pfn_seed == dev)
-+ nd_region_create_pfn_seed(nd_region);
-+ if (nd_region->ns_seed == &nd_pfn->ndns->dev)
-+ nd_region_create_ns_seed(nd_region);
-+ } else if (is_nd_dax(dev)) {
-+ struct nd_dax *nd_dax = to_nd_dax(dev);
-+
-+ if (nd_region->dax_seed == dev)
-+ nd_region_create_dax_seed(nd_region);
-+ if (nd_region->ns_seed == &nd_dax->nd_pfn.ndns->dev)
-+ nd_region_create_ns_seed(nd_region);
-+ }
-+ nvdimm_bus_unlock(dev);
-+}
-+
- int nd_blk_region_init(struct nd_region *nd_region)
- {
- struct device *dev = &nd_region->dev;
---
-2.42.0
-
Reviewed-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Ira Weiny <ira.weiny@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
- drivers/nvdimm/of_pmem.c | 8 +++++++-
+ drivers/nvdimm/of_pmem.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
-diff --git a/drivers/nvdimm/of_pmem.c b/drivers/nvdimm/of_pmem.c
-index 8224d1431ea94..9d6664fcceb87 100644
--- a/drivers/nvdimm/of_pmem.c
+++ b/drivers/nvdimm/of_pmem.c
-@@ -30,7 +30,13 @@ static int of_pmem_region_probe(struct platform_device *pdev)
- if (!priv)
+@@ -42,7 +42,13 @@ static int of_pmem_region_probe(struct p
return -ENOMEM;
+ priv->bus_desc.attr_groups = bus_attr_groups;
- priv->bus_desc.provider_name = kstrdup(pdev->name, GFP_KERNEL);
+ priv->bus_desc.provider_name = devm_kstrdup(&pdev->dev, pdev->name,
+ GFP_KERNEL);
priv->bus_desc.module = THIS_MODULE;
priv->bus_desc.of_node = np;
---
-2.42.0
-
firmware-ti_sci-mark-driver-as-non-removable.patch
clk-scmi-free-scmi_clk-allocated-when-the-clocks-wit.patch
hwrng-geode-fix-accessing-registers.patch
-libnvdimm-move-region-attribute-group-definition.patch
-libnvdimm-move-nd_device_attribute_group-to-device_t.patch
-libnvdimm-move-nd_numa_attribute_group-to-device_typ.patch
-libnvdimm-move-nd_region_attribute_group-to-device_t.patch
-libnvdimm-move-nd_mapping_attribute_group-to-device_.patch
-libnvdimm-move-nvdimm_attribute_group-to-device_type.patch
-libnvdimm-move-nvdimm_bus_attribute_group-to-device_.patch
libnvdimm-of_pmem-use-devm_kstrdup-instead-of-kstrdu.patch
sched-rt-provide-migrate_disable-enable-inlines.patch
nd_btt-make-btt-lanes-preemptible.patch