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

libnvdimm: Replace namespace_match() with device_find_child_by_name()

Simplify nd_namespace_store() implementation by
using device_find_child_by_name().

Reviewed-by: Alison Schofield <alison.schofield@intel.com>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com>
Link: https://lore.kernel.org/r/20241224-const_dfc_done-v5-1-6623037414d4@quicinc.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Zijun Hu and committed by
Greg Kroah-Hartman
a7512bda 86a5f32e

+1 -8
+1 -8
drivers/nvdimm/claim.c
··· 67 67 return claimed; 68 68 } 69 69 70 - static int namespace_match(struct device *dev, void *data) 71 - { 72 - char *name = data; 73 - 74 - return strcmp(name, dev_name(dev)) == 0; 75 - } 76 - 77 70 static bool is_idle(struct device *dev, struct nd_namespace_common *ndns) 78 71 { 79 72 struct nd_region *nd_region = to_nd_region(dev->parent); ··· 161 168 goto out; 162 169 } 163 170 164 - found = device_find_child(dev->parent, name, namespace_match); 171 + found = device_find_child_by_name(dev->parent, name); 165 172 if (!found) { 166 173 dev_dbg(dev, "'%s' not found under %s\n", name, 167 174 dev_name(dev->parent));