diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2024-05-15 14:28:56 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2024-05-15 14:28:56 -0700 |
commit | c405aa3ea36c1f973a9f10bbcfabc9aeeb38040c (patch) | |
tree | ebd2e373db29a3836cc5ca4e53c984fa66246955 /drivers | |
parent | a49468240e89628236b738b5ab9416eae8f90c15 (diff) | |
parent | 41147b006be2174b825a54b0620ecf4cc7ec5c84 (diff) |
Merge tag 'libnvdimm-for-6.10' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm
Pull nvdimm updates from Ira Weiny:
"The changes include removing duplicate code and updating the nvdimm
tree to the current kernel interfaces such as using const for struct
device_type and changing the platform remove callback signature"
* tag 'libnvdimm-for-6.10' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm:
dax: remove redundant assignment to variable rc
ndtest: Convert to platform remove callback returning void
nvdimm/btt: always set max_integrity_segments
nvdimm: remove nd_integrity_init
dax: constify the struct device_type usage
powerpc/papr_scm: Move duplicate definitions to common header files
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/dax/bus.c | 3 | ||||
-rw-r--r-- | drivers/nvdimm/btt.c | 12 | ||||
-rw-r--r-- | drivers/nvdimm/core.c | 30 | ||||
-rw-r--r-- | drivers/nvdimm/nd.h | 1 |
4 files changed, 9 insertions, 37 deletions
diff --git a/drivers/dax/bus.c b/drivers/dax/bus.c index 797e1ebff299..6ec5db8013e8 100644 --- a/drivers/dax/bus.c +++ b/drivers/dax/bus.c @@ -818,7 +818,7 @@ static const struct attribute_group *dax_mapping_attribute_groups[] = { NULL, }; -static struct device_type dax_mapping_type = { +static const struct device_type dax_mapping_type = { .release = dax_mapping_release, .groups = dax_mapping_attribute_groups, }; @@ -1204,7 +1204,6 @@ static ssize_t mapping_store(struct device *dev, struct device_attribute *attr, if (rc) return rc; - rc = -ENXIO; rc = down_write_killable(&dax_region_rwsem); if (rc) return rc; diff --git a/drivers/nvdimm/btt.c b/drivers/nvdimm/btt.c index 4d0c527e8576..1e5aedaf8c7b 100644 --- a/drivers/nvdimm/btt.c +++ b/drivers/nvdimm/btt.c @@ -6,6 +6,7 @@ #include <linux/highmem.h> #include <linux/debugfs.h> #include <linux/blkdev.h> +#include <linux/blk-integrity.h> #include <linux/pagemap.h> #include <linux/module.h> #include <linux/device.h> @@ -1499,6 +1500,7 @@ static int btt_blk_init(struct btt *btt) struct queue_limits lim = { .logical_block_size = btt->sector_size, .max_hw_sectors = UINT_MAX, + .max_integrity_segments = 1, }; int rc; @@ -1514,10 +1516,12 @@ static int btt_blk_init(struct btt *btt) blk_queue_flag_set(QUEUE_FLAG_NONROT, btt->btt_disk->queue); blk_queue_flag_set(QUEUE_FLAG_SYNCHRONOUS, btt->btt_disk->queue); - if (btt_meta_size(btt)) { - rc = nd_integrity_init(btt->btt_disk, btt_meta_size(btt)); - if (rc) - goto out_cleanup_disk; + if (btt_meta_size(btt) && IS_ENABLED(CONFIG_BLK_DEV_INTEGRITY)) { + struct blk_integrity bi = { + .tuple_size = btt_meta_size(btt), + .tag_size = btt_meta_size(btt), + }; + blk_integrity_register(btt->btt_disk, &bi); } set_capacity(btt->btt_disk, btt->nlba * btt->sector_size >> 9); diff --git a/drivers/nvdimm/core.c b/drivers/nvdimm/core.c index d91799b71d23..2023a661bbb0 100644 --- a/drivers/nvdimm/core.c +++ b/drivers/nvdimm/core.c @@ -7,7 +7,6 @@ #include <linux/export.h> #include <linux/module.h> #include <linux/blkdev.h> -#include <linux/blk-integrity.h> #include <linux/device.h> #include <linux/ctype.h> #include <linux/ndctl.h> @@ -508,35 +507,6 @@ int nvdimm_bus_add_badrange(struct nvdimm_bus *nvdimm_bus, u64 addr, u64 length) } EXPORT_SYMBOL_GPL(nvdimm_bus_add_badrange); -#ifdef CONFIG_BLK_DEV_INTEGRITY -int nd_integrity_init(struct gendisk *disk, unsigned long meta_size) -{ - struct blk_integrity bi; - - if (meta_size == 0) - return 0; - - memset(&bi, 0, sizeof(bi)); - - bi.tuple_size = meta_size; - bi.tag_size = meta_size; - - blk_integrity_register(disk, &bi); - blk_queue_max_integrity_segments(disk->queue, 1); - - return 0; -} -EXPORT_SYMBOL(nd_integrity_init); - -#else /* CONFIG_BLK_DEV_INTEGRITY */ -int nd_integrity_init(struct gendisk *disk, unsigned long meta_size) -{ - return 0; -} -EXPORT_SYMBOL(nd_integrity_init); - -#endif - static __init int libnvdimm_init(void) { int rc; diff --git a/drivers/nvdimm/nd.h b/drivers/nvdimm/nd.h index ae2078eb6a62..2dbb1dca17b5 100644 --- a/drivers/nvdimm/nd.h +++ b/drivers/nvdimm/nd.h @@ -489,7 +489,6 @@ enum nd_async_mode { ND_ASYNC, }; -int nd_integrity_init(struct gendisk *disk, unsigned long meta_size); void wait_nvdimm_bus_probe_idle(struct device *dev); void nd_device_register(struct device *dev); void nd_device_unregister(struct device *dev, enum nd_async_mode mode); |