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

usb: typec: tcpm: Use fwnode_get_child_node_count()

Since fwnode_get_child_node_count() was split from its device property
counterpart, we may utilise it in the driver and drop custom implementation.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Acked-by: Kyle Tso <kyletso@google.com>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Link: https://lore.kernel.org/r/20250310150835.3139322-5-andriy.shevchenko@linux.intel.com
Signed-off-by: Lee Jones <lee@kernel.org>

authored by

Andy Shevchenko and committed by
Lee Jones
08ca89e9 53762bb4

+2 -4
+2 -4
drivers/usb/typec/tcpm/tcpm.c
··· 7166 7166 7167 7167 static int tcpm_fw_get_caps(struct tcpm_port *port, struct fwnode_handle *fwnode) 7168 7168 { 7169 - struct fwnode_handle *capabilities, *child, *caps = NULL; 7169 + struct fwnode_handle *capabilities, *caps = NULL; 7170 7170 unsigned int nr_src_pdo, nr_snk_pdo; 7171 7171 const char *opmode_str; 7172 7172 u32 *src_pdo, *snk_pdo; ··· 7232 7232 if (!capabilities) { 7233 7233 port->pd_count = 1; 7234 7234 } else { 7235 - fwnode_for_each_child_node(capabilities, child) 7236 - port->pd_count++; 7237 - 7235 + port->pd_count = fwnode_get_child_node_count(capabilities); 7238 7236 if (!port->pd_count) { 7239 7237 ret = -ENODATA; 7240 7238 goto put_capabilities;