diff options
author | Dave Jiang <dave.jiang@intel.com> | 2017-08-23 12:48:26 -0700 |
---|---|---|
committer | Dan Williams <dan.j.williams@intel.com> | 2017-11-02 10:42:30 -0700 |
commit | aa9ad44a42b4cf4387f8ecddaf8e51707fdcda5a (patch) | |
tree | 3d4e9398d0c07cf1fac26da1d1d540697145ef3a /include/linux/libnvdimm.h | |
parent | 11e142701609546632ba1fda586252d391026a3f (diff) | |
download | lwn-aa9ad44a42b4cf4387f8ecddaf8e51707fdcda5a.tar.gz lwn-aa9ad44a42b4cf4387f8ecddaf8e51707fdcda5a.zip |
libnvdimm: move poison list functions to a new 'badrange' file
nfit_test needs to use the poison list manipulation code as well. Make
it more generic and in the process rename poison to badrange, and move
all the related helpers to a new file.
Signed-off-by: Dave Jiang <dave.jiang@intel.com>
[vishal: Add badrange.o to nfit_test's Kbuild]
[vishal: add a missed include in bus.c for the new badrange functions]
[vishal: rename all instances of 'be' to 'bre']
Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'include/linux/libnvdimm.h')
-rw-r--r-- | include/linux/libnvdimm.h | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/include/linux/libnvdimm.h b/include/linux/libnvdimm.h index 3eaad2fbf284..f8109ddb5ef1 100644 --- a/include/linux/libnvdimm.h +++ b/include/linux/libnvdimm.h @@ -18,6 +18,18 @@ #include <linux/sizes.h> #include <linux/types.h> #include <linux/uuid.h> +#include <linux/spinlock.h> + +struct badrange_entry { + u64 start; + u64 length; + struct list_head list; +}; + +struct badrange { + struct list_head list; + spinlock_t lock; +}; enum { /* when a dimm supports both PMEM and BLK access a label is required */ @@ -129,9 +141,12 @@ static inline struct nd_blk_region_desc *to_blk_region_desc( } -int nvdimm_bus_add_poison(struct nvdimm_bus *nvdimm_bus, u64 addr, u64 length); -void nvdimm_forget_poison(struct nvdimm_bus *nvdimm_bus, - phys_addr_t start, unsigned int len); +void badrange_init(struct badrange *badrange); +int badrange_add(struct badrange *badrange, u64 addr, u64 length); +void badrange_forget(struct badrange *badrange, phys_addr_t start, + unsigned int len); +int nvdimm_bus_add_badrange(struct nvdimm_bus *nvdimm_bus, u64 addr, + u64 length); struct nvdimm_bus *nvdimm_bus_register(struct device *parent, struct nvdimm_bus_descriptor *nfit_desc); void nvdimm_bus_unregister(struct nvdimm_bus *nvdimm_bus); |