From patchwork Mon Mar 10 14:54:51 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 872232 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7AFE222D4DD; Mon, 10 Mar 2025 15:08:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.19 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741619325; cv=none; b=tIlgiAqTqMbLaMs8rDcVhXGkvx3dIVMbpN6cCxGCAOWT1GjNrN8MWGjd3RO3EpKGekudAXD7SQvKeBSUWtU8ZYVCyDe8bF1vy/FsaE9/LYrRpFsSllsNsjNoTaHtoh8ZQ4ZHfWpQF+cKv+Swp/bqOkPaysNQItXNk90LBhkQvP4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741619325; c=relaxed/simple; bh=9oJVJa0qo0kpfDX4vakbrBm7GZ7WYtWfrZEPpzP3HUU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=K3XjDgriFP+0ZT6eBi6o6ZyK6XC3lsHMEyK3fqoxKsfjMp0+kdxnDZ1NysLcCKUp79GkMPWEMXJ7J2HnUMQAz+6zJJqVixl/UFUbxblBG1y8EnstsxA2D0nVW7DPwRxjaAWhpt9jaXnQPaZ6xXskfy7fcT+iI/5BEYijOkHFmpQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=BeiUr9bw; arc=none smtp.client-ip=198.175.65.19 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="BeiUr9bw" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1741619324; x=1773155324; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=9oJVJa0qo0kpfDX4vakbrBm7GZ7WYtWfrZEPpzP3HUU=; b=BeiUr9bwHAl9GKO0GyTqiq3Ujf6GcVQXoJbROzaYXhU24a2JIlb0yZkG ru/4/8+JTmLuKhIF8SrjhwNXlK7W3QC6/BLH/t/0A1lo0PNqbXasUlBym oymhUYCsjuEGAhPtlbxLtvvNKNYlFqvi90uWPqXSbGtho9/6x5E6Cu+Fa 392OEF998SAB/0XV+FlWJ3Lk7A4TqQJejTiQ8O5Ls0vGzXfhyMh3xVaiV 73Gx2fk5NdDvfoJxv3ZuJ/KKQp09pHsphE48qfGqvGNSX7F+sfvAEozR0 BMTafsexsYRX9hhhyk84cyuhFx9hZpgaKupfoa18ieHfnX5tS2bTaDsVv g==; X-CSE-ConnectionGUID: l0QMQnovRQWNqMLnzB59+Q== X-CSE-MsgGUID: 2yw0lH4XQUCDT0jPbpHRrA== X-IronPort-AV: E=McAfee;i="6700,10204,11369"; a="42470909" X-IronPort-AV: E=Sophos;i="6.14,236,1736841600"; d="scan'208";a="42470909" Received: from fmviesa005.fm.intel.com ([10.60.135.145]) by orvoesa111.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Mar 2025 08:08:42 -0700 X-CSE-ConnectionGUID: flxv6K3FSNqrKieGKtEtFA== X-CSE-MsgGUID: z0IQtfEYTQ6YfH+WNEvbsA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.14,236,1736841600"; d="scan'208";a="124619903" Received: from black.fi.intel.com ([10.237.72.28]) by fmviesa005.fm.intel.com with ESMTP; 10 Mar 2025 08:08:37 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id CE22D130; Mon, 10 Mar 2025 17:08:36 +0200 (EET) From: Andy Shevchenko To: Greg Kroah-Hartman , "Rob Herring (Arm)" , Markus Elfring , Jakob Riepler , Andy Shevchenko , Heikki Krogerus , Jonathan Cameron , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-leds@vger.kernel.org, linux-usb@vger.kernel.org Cc: Daniel Scally , Sakari Ailus , "Rafael J. Wysocki" , Danilo Krummrich , Lee Jones , Pavel Machek , Matti Vaittinen , Jonathan Cameron Subject: [PATCH v1 1/4] device property: Split fwnode_get_child_node_count() Date: Mon, 10 Mar 2025 16:54:51 +0200 Message-ID: <20250310150835.3139322-2-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250310150835.3139322-1-andriy.shevchenko@linux.intel.com> References: <20250310150835.3139322-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-acpi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The new helper is introduced to allow counting the child firmware nodes of their parent without requiring a device to be passed. This also makes the fwnode and device property API more symmetrical with the rest. Signed-off-by: Andy Shevchenko --- drivers/base/property.c | 12 ++++++------ include/linux/property.h | 7 ++++++- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/drivers/base/property.c b/drivers/base/property.c index c1392743df9c..805f75b35115 100644 --- a/drivers/base/property.c +++ b/drivers/base/property.c @@ -928,22 +928,22 @@ bool fwnode_device_is_available(const struct fwnode_handle *fwnode) EXPORT_SYMBOL_GPL(fwnode_device_is_available); /** - * device_get_child_node_count - return the number of child nodes for device - * @dev: Device to count the child nodes for + * fwnode_get_child_node_count - return the number of child nodes for a given firmware node + * @fwnode: Pointer to the parent firmware node * - * Return: the number of child nodes for a given device. + * Return: the number of child nodes for a given firmware node. */ -unsigned int device_get_child_node_count(const struct device *dev) +unsigned int fwnode_get_child_node_count(const struct fwnode_handle *fwnode) { struct fwnode_handle *child; unsigned int count = 0; - device_for_each_child_node(dev, child) + fwnode_for_each_child_node(fwnode, child) count++; return count; } -EXPORT_SYMBOL_GPL(device_get_child_node_count); +EXPORT_SYMBOL_GPL(fwnode_get_child_node_count); bool device_dma_supported(const struct device *dev) { diff --git a/include/linux/property.h b/include/linux/property.h index e214ecd241eb..bc5bfc98176b 100644 --- a/include/linux/property.h +++ b/include/linux/property.h @@ -208,7 +208,12 @@ DEFINE_FREE(fwnode_handle, struct fwnode_handle *, fwnode_handle_put(_T)) int fwnode_irq_get(const struct fwnode_handle *fwnode, unsigned int index); int fwnode_irq_get_byname(const struct fwnode_handle *fwnode, const char *name); -unsigned int device_get_child_node_count(const struct device *dev); +unsigned int fwnode_get_child_node_count(const struct fwnode_handle *fwnode); + +static inline unsigned int device_get_child_node_count(const struct device *dev) +{ + return fwnode_get_child_node_count(dev_fwnode(dev)); +} static inline int device_property_read_u8(const struct device *dev, const char *propname, u8 *val) From patchwork Mon Mar 10 14:54:52 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 872524 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9E20622D78F; Mon, 10 Mar 2025 15:08:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.19 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741619327; cv=none; b=pl5ExvdrouqyKsVDVVqJZ5YEHGYkWMcUXWYtj0ThDrAscRokolZ4SRvrHgsGejwsV7l3/DS/hlEToyrAxW5IJk0DsjQvrUJaTcjlhde5M+TFysXThw02eNfTgndh+zSUF+GB/8dDwpZTnScTnGC7R5GMB+L8tFuMNuhpPw8HWqo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741619327; c=relaxed/simple; bh=MNV2x4YXuI3EbpVLRxfKOQWNxGNCe/SqUoLSpVNi0M0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=dPW914YcqhIL1u2A7aSYp39pe/SqMNTUS/o0k2wu7g00q16YT3vY1lBFDKSH5HyMKIedmuxRVfXeZLM8N0b2BrzwjSpFFLKq4fd66OV5JcQUqyUAh/iA1WogeEUVwK4zyxVU5VLC0e5anoa6stDhoOW8j0EUaE8IdJaWHQiO91w= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=nqzj2mcP; arc=none smtp.client-ip=198.175.65.19 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="nqzj2mcP" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1741619326; x=1773155326; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=MNV2x4YXuI3EbpVLRxfKOQWNxGNCe/SqUoLSpVNi0M0=; b=nqzj2mcPfbK8/SVmB7jauhB/NSU/c1wp406YTxeWw6jDQM09/PYu+j2i fIMou4nHCS5GDTP3ACzlp5DEmRz8RlGDtXuvupW1CSmn1deeU8V1/ktxh MS8sfpdue7wWEfdVnWxtGTx+HsBEN4S9KerXdCzkNT8V2JDPq1GhlpPi7 Ix/9/yR2o3tvNDM3mxHFcC8P5KuHMeKfGhg2hh2OH5owIkYb16wBr+RtU x4s4zUcHPgsWIexPPKuWnc/0EqHdP3APwo58EhKHv9ZrAjvGA8OwOPXkK f/b1J7WbqUywhwjuTE0siqoGDt+E4UeC1UpsWatkyaAAQll20GzVdVXSc g==; X-CSE-ConnectionGUID: dm7l8EEzTkKJgRhbudTNMA== X-CSE-MsgGUID: tf+6VIcoTB6Odz/h+XBdoQ== X-IronPort-AV: E=McAfee;i="6700,10204,11369"; a="42470928" X-IronPort-AV: E=Sophos;i="6.14,236,1736841600"; d="scan'208";a="42470928" Received: from fmviesa005.fm.intel.com ([10.60.135.145]) by orvoesa111.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Mar 2025 08:08:43 -0700 X-CSE-ConnectionGUID: mUmVCTCiScyhQY6GM3rDeA== X-CSE-MsgGUID: A3xcm5rtTmSOkhv6SQuHyA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.14,236,1736841600"; d="scan'208";a="124619904" Received: from black.fi.intel.com ([10.237.72.28]) by fmviesa005.fm.intel.com with ESMTP; 10 Mar 2025 08:08:38 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id DBB89340; Mon, 10 Mar 2025 17:08:36 +0200 (EET) From: Andy Shevchenko To: Greg Kroah-Hartman , "Rob Herring (Arm)" , Markus Elfring , Jakob Riepler , Andy Shevchenko , Heikki Krogerus , Jonathan Cameron , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-leds@vger.kernel.org, linux-usb@vger.kernel.org Cc: Daniel Scally , Sakari Ailus , "Rafael J. Wysocki" , Danilo Krummrich , Lee Jones , Pavel Machek , Matti Vaittinen , Jonathan Cameron Subject: [PATCH v1 2/4] leds: pwm-multicolor: Use fwnode_get_child_node_count() Date: Mon, 10 Mar 2025 16:54:52 +0200 Message-ID: <20250310150835.3139322-3-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250310150835.3139322-1-andriy.shevchenko@linux.intel.com> References: <20250310150835.3139322-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-acpi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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 --- drivers/leds/rgb/leds-pwm-multicolor.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/leds/rgb/leds-pwm-multicolor.c b/drivers/leds/rgb/leds-pwm-multicolor.c index f80a06cc31f8..61f4e17100f8 100644 --- a/drivers/leds/rgb/leds-pwm-multicolor.c +++ b/drivers/leds/rgb/leds-pwm-multicolor.c @@ -107,12 +107,12 @@ static int iterate_subleds(struct device *dev, struct pwm_mc_led *priv, static int led_pwm_mc_probe(struct platform_device *pdev) { - struct fwnode_handle *mcnode, *fwnode; + struct fwnode_handle *mcnode; struct led_init_data init_data = {}; struct led_classdev *cdev; struct mc_subled *subled; struct pwm_mc_led *priv; - int count = 0; + unsigned int count; int ret = 0; mcnode = device_get_named_child_node(&pdev->dev, "multi-led"); @@ -121,8 +121,7 @@ static int led_pwm_mc_probe(struct platform_device *pdev) "expected multi-led node\n"); /* count the nodes inside the multi-led node */ - fwnode_for_each_child_node(mcnode, fwnode) - count++; + count = fwnode_get_child_node_count(mcnode); priv = devm_kzalloc(&pdev->dev, struct_size(priv, leds, count), GFP_KERNEL); From patchwork Mon Mar 10 14:54:53 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 872525 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7B80A22D4DE; Mon, 10 Mar 2025 15:08:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.20 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741619325; cv=none; b=X8eeGJfFb6IhUFuEkKcL5tY5/hvqtw69kQWdQiBOKIS1oHXEVcHiK3V48a2UBxYX94cyQ7MQKQ6R8Jut3LbI2zO0bvNd/VJh/f9YYpmy2mSC01GmEBn/3ULeIGB+3rPJupcIM2+ER9PD9t3TZ13kIzSAPkl2lJXRIQHAQDoIEbE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741619325; c=relaxed/simple; bh=j9ACf3C/6xmuNSerOIzYrxEPtrP4pqy0z2n/p3IOeUA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=K/quVm6vaeZEFCILvhLFA+ge0GTXFO+BiPg4hqDd5SmnqV/14VXkrI3+b0riwPLSjb/ueQm9tGcmBauPD6lrotFF8jMM29xPVB2Kc7yHcZTff0AjYHVCOjgTNZyKuL0+9Z3WGCt5HB7bwEifDtVndImNxQ5v7UwUa7rxzYHswfs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=hIYap6lr; arc=none smtp.client-ip=198.175.65.20 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="hIYap6lr" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1741619324; x=1773155324; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=j9ACf3C/6xmuNSerOIzYrxEPtrP4pqy0z2n/p3IOeUA=; b=hIYap6lrUNCb93nMVpLt85I9Mg+Re2mS8lw0+eJ2fUW7orIcbq08kiKn kaMA/EGUi9+/QPp24hynVLsj8QS2gl14G/B6MgsKjvcZT0XcMgfhNv+fi 7t4+ayewzv+La13hseGAJsfxoETtkadhcyWXETKzyVZMPsacECXZHtSUU jYuDzUeRJDm3p4uInwHx8Kls4bfdVTN6RKJobm+rdz9VfJlKC2HFVYbU0 SYzfYF5kD/i5val2rtb+UxJ4H8DYGvVVyfVL/fzyWmIbSrznVTHQ9oMrX xykkCm1n+LlaL8VpNh5yeBemfRHkVVLrO/aTSVh0xliqjPYP5gRqCiBLO A==; X-CSE-ConnectionGUID: JycGKDslTSWSD92YnI6ExA== X-CSE-MsgGUID: dHiE1rBDSNiFkuta4VOXIg== X-IronPort-AV: E=McAfee;i="6700,10204,11369"; a="42334989" X-IronPort-AV: E=Sophos;i="6.14,236,1736841600"; d="scan'208";a="42334989" Received: from orviesa009.jf.intel.com ([10.64.159.149]) by orvoesa112.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Mar 2025 08:08:43 -0700 X-CSE-ConnectionGUID: FaU1Z4XnSIOFlimyoSy2eQ== X-CSE-MsgGUID: KL9q+jCwQNmdXjfuRWAQqg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.14,236,1736841600"; d="scan'208";a="119731644" Received: from black.fi.intel.com ([10.237.72.28]) by orviesa009.jf.intel.com with ESMTP; 10 Mar 2025 08:08:38 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id E9601476; Mon, 10 Mar 2025 17:08:36 +0200 (EET) From: Andy Shevchenko To: Greg Kroah-Hartman , "Rob Herring (Arm)" , Markus Elfring , Jakob Riepler , Andy Shevchenko , Heikki Krogerus , Jonathan Cameron , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-leds@vger.kernel.org, linux-usb@vger.kernel.org Cc: Daniel Scally , Sakari Ailus , "Rafael J. Wysocki" , Danilo Krummrich , Lee Jones , Pavel Machek , Matti Vaittinen , Jonathan Cameron Subject: [PATCH v1 3/4] leds: ncp5623: Use fwnode_get_child_node_count() Date: Mon, 10 Mar 2025 16:54:53 +0200 Message-ID: <20250310150835.3139322-4-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250310150835.3139322-1-andriy.shevchenko@linux.intel.com> References: <20250310150835.3139322-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-acpi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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 --- drivers/leds/rgb/leds-ncp5623.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/leds/rgb/leds-ncp5623.c b/drivers/leds/rgb/leds-ncp5623.c index f18156683375..7c7d44623a9e 100644 --- a/drivers/leds/rgb/leds-ncp5623.c +++ b/drivers/leds/rgb/leds-ncp5623.c @@ -155,9 +155,9 @@ static int ncp5623_probe(struct i2c_client *client) struct device *dev = &client->dev; struct fwnode_handle *mc_node, *led_node; struct led_init_data init_data = { }; - int num_subleds = 0; struct ncp5623 *ncp; struct mc_subled *subled_info; + unsigned int num_subleds; u32 color_index; u32 reg; int ret; @@ -172,8 +172,7 @@ static int ncp5623_probe(struct i2c_client *client) if (!mc_node) return -EINVAL; - fwnode_for_each_child_node(mc_node, led_node) - num_subleds++; + num_subleds = fwnode_get_child_node_count(mc_node); subled_info = devm_kcalloc(dev, num_subleds, sizeof(*subled_info), GFP_KERNEL); if (!subled_info) { From patchwork Mon Mar 10 14:54:54 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 872230 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B76DF22D79D; Mon, 10 Mar 2025 15:08:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.20 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741619327; cv=none; b=XtW41eraxXffdQvsniZ4b3/dKy0yqQYtiQh9mOJC/X9Du9Olupyh6b6mR2ypqwiRfYl4+iTTXYumId8mnayWj6ZtfyglgVLdzl8yotkSFXI9+t9Ddve0j65Uk10JTyGMRH96cJIj/szI1oa9JCXQRqNvvTcuyl3XjS393v7+XRE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741619327; c=relaxed/simple; bh=kZtafXHrGb7mXS4bvxISt7O8W/fzSi4801NL/wtYIkE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=FICje0UnLZ4//Sf9PHBPxJDlm7Xmw82Uhlwg0GvTOsSBVFXeSlZX/4EMjqXX2pF9ZHYvAixuH04O/iJvu9VZm0R8lryMw2p5C1e3IqEK17NO67ilfiwxxqQX6GDUCB6ezLuaUgoAIR3bhMdiVCz4867zLxF7TSszwzJBcpQtQdY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=iGs9iCzJ; arc=none smtp.client-ip=198.175.65.20 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="iGs9iCzJ" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1741619326; x=1773155326; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=kZtafXHrGb7mXS4bvxISt7O8W/fzSi4801NL/wtYIkE=; b=iGs9iCzJdcTix69aICGUraExy3DK9OAFgEAqEFSqsHKY3Hcniu+0Rmm6 3x28uW2H84S7O0uYybf1YsdGxP/3UZOvHTj+8ritiKQ/QhhWtxgjHtlZs d1KF6KyT3ZT9Sc0jWggtU0g+p52azvM3j1ef7EtY4vbODKV/xeONBZ3Wx UhkIb00Bx2w9w6F+3RNJ42LstKwMUnbufHBIpHKcXlgBpWwcXBSwEi1sn q/zhU8GEhNUz+bs2qqw1q+XArYoymgLlWlxGayCrqx+oXn76paDOEKx4Q nH8lUoi/9TR6cVVa1MYJKkEeeGZNzRYm15Uf4em5llKaMs7x998vPYPjy w==; X-CSE-ConnectionGUID: fNKlSjufSSegG6GtCF7SCg== X-CSE-MsgGUID: kDV/KoxNQW6P6NjxhpG2nA== X-IronPort-AV: E=McAfee;i="6700,10204,11369"; a="42334998" X-IronPort-AV: E=Sophos;i="6.14,236,1736841600"; d="scan'208";a="42334998" Received: from orviesa009.jf.intel.com ([10.64.159.149]) by orvoesa112.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Mar 2025 08:08:43 -0700 X-CSE-ConnectionGUID: 21gImyG7TTufNq2sz9kIzw== X-CSE-MsgGUID: +bgqcGd4R9uID+UOQbR6ww== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.14,236,1736841600"; d="scan'208";a="119731645" Received: from black.fi.intel.com ([10.237.72.28]) by orviesa009.jf.intel.com with ESMTP; 10 Mar 2025 08:08:38 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 05290560; Mon, 10 Mar 2025 17:08:36 +0200 (EET) From: Andy Shevchenko To: Greg Kroah-Hartman , "Rob Herring (Arm)" , Markus Elfring , Jakob Riepler , Andy Shevchenko , Heikki Krogerus , Jonathan Cameron , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-leds@vger.kernel.org, linux-usb@vger.kernel.org Cc: Daniel Scally , Sakari Ailus , "Rafael J. Wysocki" , Danilo Krummrich , Lee Jones , Pavel Machek , Matti Vaittinen , Jonathan Cameron Subject: [PATCH v1 4/4] usb: typec: tcpm: Use fwnode_get_child_node_count() Date: Mon, 10 Mar 2025 16:54:54 +0200 Message-ID: <20250310150835.3139322-5-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250310150835.3139322-1-andriy.shevchenko@linux.intel.com> References: <20250310150835.3139322-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-acpi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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 --- 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;