linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"Rob Herring (Arm)" <robh@kernel.org>,
	Markus Elfring <elfring@users.sourceforge.net>,
	Jakob Riepler <jakob+lkml@paranoidlabs.org>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Heikki Krogerus <heikki.krogerus@linux.intel.com>,
	Jonathan Cameron <Jonathan.Cameron@huawei.com>,
	linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-leds@vger.kernel.org, linux-usb@vger.kernel.org
Cc: Daniel Scally <djrscally@gmail.com>,
	Sakari Ailus <sakari.ailus@linux.intel.com>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	Danilo Krummrich <dakr@kernel.org>, Lee Jones <lee@kernel.org>,
	Pavel Machek <pavel@kernel.org>,
	Matti Vaittinen <mazziesaccount@gmail.com>,
	Jonathan Cameron <jic23@kernel.org>
Subject: [PATCH v1 4/4] usb: typec: tcpm: Use fwnode_get_child_node_count()
Date: Mon, 10 Mar 2025 16:54:54 +0200	[thread overview]
Message-ID: <20250310150835.3139322-5-andriy.shevchenko@linux.intel.com> (raw)
In-Reply-To: <20250310150835.3139322-1-andriy.shevchenko@linux.intel.com>

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>
---
 drivers/usb/typec/tcpm/tcpm.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
index 9c455f073233..8ca2e26752fb 100644
--- a/drivers/usb/typec/tcpm/tcpm.c
+++ b/drivers/usb/typec/tcpm/tcpm.c
@@ -7166,7 +7166,7 @@ static void tcpm_fw_get_timings(struct tcpm_port *port, struct fwnode_handle *fw
 
 static int tcpm_fw_get_caps(struct tcpm_port *port, struct fwnode_handle *fwnode)
 {
-	struct fwnode_handle *capabilities, *child, *caps = NULL;
+	struct fwnode_handle *capabilities, *caps = NULL;
 	unsigned int nr_src_pdo, nr_snk_pdo;
 	const char *opmode_str;
 	u32 *src_pdo, *snk_pdo;
@@ -7232,9 +7232,7 @@ static int tcpm_fw_get_caps(struct tcpm_port *port, struct fwnode_handle *fwnode
 	if (!capabilities) {
 		port->pd_count = 1;
 	} else {
-		fwnode_for_each_child_node(capabilities, child)
-			port->pd_count++;
-
+		port->pd_count = fwnode_get_child_node_count(capabilities);
 		if (!port->pd_count) {
 			ret = -ENODATA;
 			goto put_capabilities;
-- 
2.47.2


  parent reply	other threads:[~2025-03-10 15:08 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-10 14:54 [PATCH v1 0/4] leds: Introduce and use fwnode_get_child_node_count() Andy Shevchenko
2025-03-10 14:54 ` [PATCH v1 1/4] device property: Split fwnode_get_child_node_count() Andy Shevchenko
2025-03-11  9:51   ` Jonathan Cameron
2025-03-11 12:00   ` [PATCH " Markus Elfring
2025-03-11 12:05     ` Greg Kroah-Hartman
2025-03-12 11:36   ` [PATCH v1 " Heikki Krogerus
2025-03-14 13:43   ` Sakari Ailus
2025-03-14 20:12   ` Rafael J. Wysocki
2025-03-10 14:54 ` [PATCH v1 2/4] leds: pwm-multicolor: Use fwnode_get_child_node_count() Andy Shevchenko
2025-03-11  9:52   ` Jonathan Cameron
2025-03-10 14:54 ` [PATCH v1 3/4] leds: ncp5623: " Andy Shevchenko
2025-03-11  9:54   ` Jonathan Cameron
2025-03-12 10:57     ` Andy Shevchenko
2025-03-10 14:54 ` Andy Shevchenko [this message]
2025-03-11  9:55   ` [PATCH v1 4/4] usb: typec: tcpm: " Jonathan Cameron
2025-03-12  3:29   ` Kyle Tso
2025-03-12 11:36   ` Heikki Krogerus
2025-03-14 12:38 ` [PATCH v1 0/4] leds: Introduce and use fwnode_get_child_node_count() Lee Jones
2025-03-14 12:39 ` Lee Jones
2025-03-14 13:35   ` Andy Shevchenko
2025-03-21 11:03 ` Lee Jones
2025-04-10  9:13   ` Lee Jones
2025-04-10  9:12 ` Lee Jones
2025-04-15 16:57 ` [GIT PULL] Immutable branch between LEDS, Base and USB due for the v6.16 merge window Lee Jones

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250310150835.3139322-5-andriy.shevchenko@linux.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=Jonathan.Cameron@huawei.com \
    --cc=dakr@kernel.org \
    --cc=djrscally@gmail.com \
    --cc=elfring@users.sourceforge.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=jakob+lkml@paranoidlabs.org \
    --cc=jic23@kernel.org \
    --cc=lee@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mazziesaccount@gmail.com \
    --cc=pavel@kernel.org \
    --cc=rafael@kernel.org \
    --cc=robh@kernel.org \
    --cc=sakari.ailus@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).