Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'libnvdimm-for-6.7' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm

Pull libnvdimm updates from Ira Weiny:

- updates to deprecated and changed interfaces

- bug/kdoc fixes

* tag 'libnvdimm-for-6.7' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm:
libnvdimm: remove kernel-doc warnings:
testing: nvdimm: make struct class structures constant
libnvdimm: Annotate struct nd_region with __counted_by
nd_btt: Make BTT lanes preemptible
libnvdimm/of_pmem: Use devm_kstrdup instead of kstrdup and check its return value
dax: refactor deprecated strncpy

+32 -25
+1 -1
drivers/dax/bus.c
··· 103 103 if (action == ID_ADD) { 104 104 dax_id = kzalloc(sizeof(*dax_id), GFP_KERNEL); 105 105 if (dax_id) { 106 - strncpy(dax_id->dev_name, buf, DAX_NAME_LEN); 106 + strscpy(dax_id->dev_name, buf, DAX_NAME_LEN); 107 107 list_add(&dax_id->list, &dax_drv->ids); 108 108 } else 109 109 rc = -ENOMEM;
+2 -2
drivers/nvdimm/badrange.c
··· 257 257 258 258 /** 259 259 * nvdimm_badblocks_populate() - Convert a list of badranges to badblocks 260 - * @region: parent region of the range to interrogate 260 + * @nd_region: parent region of the range to interrogate 261 261 * @bb: badblocks instance to populate 262 - * @res: resource range to consider 262 + * @range: resource range to consider 263 263 * 264 264 * The badrange list generated during bus initialization may contain 265 265 * multiple, possibly overlapping physical address ranges. Compare each
+1 -1
drivers/nvdimm/nd.h
··· 422 422 struct nd_interleave_set *nd_set; 423 423 struct nd_percpu_lane __percpu *lane; 424 424 int (*flush)(struct nd_region *nd_region, struct bio *bio); 425 - struct nd_mapping mapping[]; 425 + struct nd_mapping mapping[] __counted_by(ndr_mappings); 426 426 }; 427 427 428 428 static inline bool nsl_validate_nlabel(struct nd_region *nd_region,
+7 -1
drivers/nvdimm/of_pmem.c
··· 30 30 if (!priv) 31 31 return -ENOMEM; 32 32 33 - priv->bus_desc.provider_name = kstrdup(pdev->name, GFP_KERNEL); 33 + priv->bus_desc.provider_name = devm_kstrdup(&pdev->dev, pdev->name, 34 + GFP_KERNEL); 35 + if (!priv->bus_desc.provider_name) { 36 + kfree(priv); 37 + return -ENOMEM; 38 + } 39 + 34 40 priv->bus_desc.module = THIS_MODULE; 35 41 priv->bus_desc.of_node = np; 36 42
+5 -5
drivers/nvdimm/region_devs.c
··· 939 939 { 940 940 unsigned int cpu, lane; 941 941 942 - cpu = get_cpu(); 942 + migrate_disable(); 943 + cpu = smp_processor_id(); 943 944 if (nd_region->num_lanes < nr_cpu_ids) { 944 945 struct nd_percpu_lane *ndl_lock, *ndl_count; 945 946 ··· 959 958 void nd_region_release_lane(struct nd_region *nd_region, unsigned int lane) 960 959 { 961 960 if (nd_region->num_lanes < nr_cpu_ids) { 962 - unsigned int cpu = get_cpu(); 961 + unsigned int cpu = smp_processor_id(); 963 962 struct nd_percpu_lane *ndl_lock, *ndl_count; 964 963 965 964 ndl_count = per_cpu_ptr(nd_region->lane, cpu); 966 965 ndl_lock = per_cpu_ptr(nd_region->lane, lane); 967 966 if (--ndl_count->count == 0) 968 967 spin_unlock(&ndl_lock->lock); 969 - put_cpu(); 970 968 } 971 - put_cpu(); 969 + migrate_enable(); 972 970 } 973 971 EXPORT_SYMBOL(nd_region_release_lane); 974 972 ··· 1028 1028 1029 1029 if (!nd_region) 1030 1030 return NULL; 1031 + nd_region->ndr_mappings = ndr_desc->num_mappings; 1031 1032 /* CXL pre-assigns memregion ids before creating nvdimm regions */ 1032 1033 if (test_bit(ND_REGION_CXL, &ndr_desc->flags)) { 1033 1034 nd_region->id = ndr_desc->memregion; ··· 1063 1062 1064 1063 get_device(&nvdimm->dev); 1065 1064 } 1066 - nd_region->ndr_mappings = ndr_desc->num_mappings; 1067 1065 nd_region->provider_data = ndr_desc->provider_data; 1068 1066 nd_region->nd_set = ndr_desc->nd_set; 1069 1067 nd_region->num_lanes = ndr_desc->num_lanes;
+9 -8
tools/testing/nvdimm/test/ndtest.c
··· 38 38 39 39 static DEFINE_SPINLOCK(ndtest_lock); 40 40 static struct ndtest_priv *instances[NUM_INSTANCES]; 41 - static struct class *ndtest_dimm_class; 41 + 42 + static const struct class ndtest_dimm_class = { 43 + .name = "nfit_test_dimm", 44 + }; 45 + 42 46 static struct gen_pool *ndtest_pool; 43 47 44 48 static struct ndtest_dimm dimm_group1[] = { ··· 741 737 return -ENXIO; 742 738 } 743 739 744 - dimm->dev = device_create_with_groups(ndtest_dimm_class, 740 + dimm->dev = device_create_with_groups(&ndtest_dimm_class, 745 741 &priv->pdev.dev, 746 742 0, dimm, dimm_attribute_groups, 747 743 "test_dimm%d", id); ··· 910 906 gen_pool_destroy(ndtest_pool); 911 907 912 908 913 - if (ndtest_dimm_class) 914 - class_destroy(ndtest_dimm_class); 909 + class_unregister(&ndtest_dimm_class); 915 910 } 916 911 917 912 static __init int ndtest_init(void) ··· 924 921 925 922 nfit_test_setup(ndtest_resource_lookup, NULL); 926 923 927 - ndtest_dimm_class = class_create("nfit_test_dimm"); 928 - if (IS_ERR(ndtest_dimm_class)) { 929 - rc = PTR_ERR(ndtest_dimm_class); 924 + rc = class_regster(&ndtest_dimm_class); 925 + if (rc) 930 926 goto err_register; 931 - } 932 927 933 928 ndtest_pool = gen_pool_create(ilog2(SZ_4M), NUMA_NO_NODE); 934 929 if (!ndtest_pool) {
+7 -7
tools/testing/nvdimm/test/nfit.c
··· 1712 1712 device_unregister(t->dimm_dev[i]); 1713 1713 } 1714 1714 1715 - static struct class *nfit_test_dimm; 1715 + static const struct class nfit_test_dimm = { 1716 + .name = "nfit_test_dimm", 1717 + }; 1716 1718 1717 1719 static int dimm_name_to_id(struct device *dev) 1718 1720 { ··· 1832 1830 if (devm_add_action_or_reset(&t->pdev.dev, put_dimms, t)) 1833 1831 return -ENOMEM; 1834 1832 for (i = 0; i < t->num_dcr; i++) { 1835 - t->dimm_dev[i] = device_create_with_groups(nfit_test_dimm, 1833 + t->dimm_dev[i] = device_create_with_groups(&nfit_test_dimm, 1836 1834 &t->pdev.dev, 0, NULL, 1837 1835 nfit_test_dimm_attribute_groups, 1838 1836 "test_dimm%d", i + t->dcr_idx); ··· 3278 3276 if (!nfit_wq) 3279 3277 return -ENOMEM; 3280 3278 3281 - nfit_test_dimm = class_create("nfit_test_dimm"); 3282 - if (IS_ERR(nfit_test_dimm)) { 3283 - rc = PTR_ERR(nfit_test_dimm); 3279 + rc = class_register(&nfit_test_dimm); 3280 + if (rc) 3284 3281 goto err_register; 3285 - } 3286 3282 3287 3283 nfit_pool = gen_pool_create(ilog2(SZ_4M), NUMA_NO_NODE); 3288 3284 if (!nfit_pool) { ··· 3377 3377 3378 3378 for (i = 0; i < NUM_NFITS; i++) 3379 3379 put_device(&instances[i]->pdev.dev); 3380 - class_destroy(nfit_test_dimm); 3380 + class_unregister(&nfit_test_dimm); 3381 3381 } 3382 3382 3383 3383 module_init(nfit_test_init);