lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240811-simply_api_dfcbn-v2-1-d0398acdc366@quicinc.com>
Date: Sun, 11 Aug 2024 13:49:58 +0800
From: Zijun Hu <zijun_hu@...oud.com>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>, 
 "Rafael J. Wysocki" <rafael@...nel.org>
Cc: Zijun Hu <zijun_hu@...oud.com>, linux-kernel@...r.kernel.org, 
 Zijun Hu <quic_zijuhu@...cinc.com>
Subject: [PATCH v2] driver core: Simplify driver API
 device_find_child_by_name() implementation

From: Zijun Hu <quic_zijuhu@...cinc.com>

Simplify device_find_child_by_name() implementation by using existing
driver APIs device_find_child() and device_match_name().

Signed-off-by: Zijun Hu <quic_zijuhu@...cinc.com>
---
Changes in v2:
- Correct commit message and remove all unnecessary comments and codes
- Link to v1: https://lore.kernel.org/lkml/20240720-simplify_drv_api-v1-1-07c5e028cccf@quicinc.com
---
 drivers/base/core.c | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)

diff --git a/drivers/base/core.c b/drivers/base/core.c
index f152e0f8fb03..8ed593d7e0be 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -4093,18 +4093,7 @@ EXPORT_SYMBOL_GPL(device_find_child);
 struct device *device_find_child_by_name(struct device *parent,
 					 const char *name)
 {
-	struct klist_iter i;
-	struct device *child;
-
-	if (!parent)
-		return NULL;
-
-	klist_iter_init(&parent->p->klist_children, &i);
-	while ((child = next_device(&i)))
-		if (sysfs_streq(dev_name(child), name) && get_device(child))
-			break;
-	klist_iter_exit(&i);
-	return child;
+	return device_find_child(parent, name, device_match_name);
 }
 EXPORT_SYMBOL_GPL(device_find_child_by_name);
 

---
base-commit: bfa54a793ba77ef696755b66f3ac4ed00c7d1248
change-id: 20240811-simply_api_dfcbn-eebeb153bec7
prerequisite-change-id: 20240811-const_dfc_done-c5c206675c6b:v1
prerequisite-patch-id: 475b810c1ccacab955c654c223d5214f70c4f6c8
prerequisite-patch-id: 81a5ccaa144a7732cae29fc5ea1a13426becee5b
prerequisite-patch-id: 9b77254186b7366809f949f5643f9437fa2528a0
prerequisite-patch-id: 95308bb3eedcf8c4a5e30aa3071116148495329e
prerequisite-patch-id: ee643a52674e2aead02f7be3d011d88507970436
prerequisite-patch-id: 0625de1f03ef4350b1828f0faff7a9d9bdebae94
prerequisite-patch-id: 6e671f2891f6ed906a35e0a90b5d8cd71c382b9c
prerequisite-patch-id: 8859b6fa330c363ef37567fc0a5421c0b9ecd8dc
prerequisite-patch-id: fe9aa57807bbb8b98dba32abd614d8f2e27565cd
prerequisite-patch-id: d03febd9c0afd5d21a2f664d748da7d7811a8e84
prerequisite-patch-id: c7425de06cf7032d54ff72f610d7632941be976e
prerequisite-patch-id: 54c942a1a492ba04480337f99dc901a8d4def782
prerequisite-patch-id: 7e8f4a3e378d5329b886a9a3719add3cbb10e3e3
prerequisite-patch-id: 34ff831994ac7bc265f567bacefff8ae687ccd40
prerequisite-patch-id: 66d46c755c25065e9d440a4137e1e8ccc245e0be
prerequisite-patch-id: 15bc81129ee07324b5a8faa39a5e6aea59952573
prerequisite-patch-id: fe9ca6ae244761b48469f375fe1fc8c9c7b24204
prerequisite-patch-id: a6fd24b37269a06a91fd926fa5111a19cdec7551
prerequisite-patch-id: 2f584b03145bc7d01e3ea632c6abb89d3b543d93
prerequisite-patch-id: 10e0d06e0340ce5028cd109fffa7f0720c70d242
prerequisite-patch-id: 0f9ea4a7c63d15c5c1324c5666901f0704c129ca
prerequisite-patch-id: 4f56ebd28ae00a50130f58409d934ca79ccec6a9
prerequisite-patch-id: 70e7432951b43a67204bb7eb6c437ba135def0f1
prerequisite-patch-id: 1718891e69e1d2031336b4a6e7f251c50619f336
prerequisite-patch-id: 5f838fb00256dbadfd36735ef3a1b1e43ec20549
prerequisite-patch-id: f4b36e4136d462c8ba9f94f777a6fa1a054b8809
prerequisite-patch-id: 56c12ce5dc6bfb090fa7801fa3f31c4e52b50775
prerequisite-patch-id: 2b23c8c2ae90030a59d267297b478584447b78ac
prerequisite-patch-id: 294c325d517e318063c61af218607d9721f1cc5f
prerequisite-patch-id: 38fb282ac119a88af58a88b38c9cdc74372df404
prerequisite-patch-id: d3ab2693194b77403d6ce20edf25ee3896d0260b
prerequisite-patch-id: 19b69184800129923777ee2acd2629565c69291b
prerequisite-patch-id: f58374cebf0ada070fc0825736424dd177e49676

Best regards,
-- 
Zijun Hu <quic_zijuhu@...cinc.com>


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ