From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 2CB9B4F5EC; Sun, 7 Jul 2024 16:57:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720371447; cv=none; b=tabVhQ6WsEoDz5qrYPdnUyDicbiYmPt+ol57QcBmL1ANUJ2HBLmt/Z8lwMa5ifNMu9aT0IOtuy3ffV/yQ7C1qT/+eyJ9i+KDYm0s06yoMx9IKQWTUJXe0yPEX3f+LDAlvX65dgUE3kLhbxaU1DwBv59lsK0DWwGHLbBAXKbjeZs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720371447; c=relaxed/simple; bh=7FQfAqx5QrqdtuO/noa37pWuVXAVEEJ9FdaqMS8ffPU=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=K9tr7mxxBN+U0pXmqjm+HU57jSeSWdfggbTTyMAcnSMkVWpOBU592Qt5+RCwT0KHXkiRaFFcF3gw7atOGZZVOYzCKuIoWKA9t1krrpzVz3qElzqQUBO035lelsOzIEcaOIdbiXlAhtsC3ZtFjaY4Wzjx3mhZms0CCOHA8JpOIbQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=u6ENFVWy; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="u6ENFVWy" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 91739C32781; Sun, 7 Jul 2024 16:57:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1720371447; bh=7FQfAqx5QrqdtuO/noa37pWuVXAVEEJ9FdaqMS8ffPU=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=u6ENFVWy+DvAkOIvrXQXhRICTc6SKKJVLs8OEnaz7XXwf/CQ/v7YUkZjvnb7I/geJ TX5PjmexYY+PBepSjKylsmL5zsNNYDEyG3lmz3AmeGPCs7U7tKS2IUi6J6CKS+a6hi a7dVvLJJlZ+aHSqTL4e7+IIXBA8beBYgYCFPTaUywtnD5REmV7yDWMKnQaps4A/+8i QNTqPVOIqM649hKog/eMvjP8yj8pI+7t/+jeWhB6xdnS+j0vycAv6VFoHemHnMYzoM FeTfCSNwjoU9vxmzC+N1UYAfL8OZGW76/VNjg7tgmLUxcYqvnd8Ph1W5FJENI7kN1B INInHKsWfNaFA== Date: Sun, 7 Jul 2024 17:57:13 +0100 From: Jonathan Cameron To: Javier Carrasco Cc: Greg Kroah-Hartman , "Rafael J. Wysocki" , Andy Shevchenko , Rob Herring , Daniel Scally , Heikki Krogerus , Sakari Ailus , Jean Delvare , Guenter Roeck , Pavel Machek , Lee Jones , Marcin Wojtas , Russell King , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hwmon@vger.kernel.org, linux-leds@vger.kernel.org, netdev@vger.kernel.org Subject: Re: [PATCH 3/6] leds: bd2606mvv: use device_for_each_child_node() to access device child nodes Message-ID: <20240707175713.4deb559f@jic23-huawei> In-Reply-To: <20240706-device_for_each_child_node-available-v1-3-8a3f7615e41c@gmail.com> References: <20240706-device_for_each_child_node-available-v1-0-8a3f7615e41c@gmail.com> <20240706-device_for_each_child_node-available-v1-3-8a3f7615e41c@gmail.com> X-Mailer: Claws Mail 4.3.0 (GTK 3.24.42; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: linux-acpi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Sat, 06 Jul 2024 17:23:35 +0200 Javier Carrasco wrote: > The iterated nodes are direct children of the device node, and the > `device_for_each_child_node()` macro accounts for child node > availability. > > `fwnode_for_each_available_child_node()` is meant to access the child > nodes of an fwnode, and therefore not direct child nodes of the device > node. > > Use `device_for_each_child_node()` to indicate device's direct child > nodes. > > Signed-off-by: Javier Carrasco Why not the scoped variant? There look to be two error paths in there which would be simplified. > --- > drivers/leds/leds-bd2606mvv.c | 7 +++---- > 1 file changed, 3 insertions(+), 4 deletions(-) > > diff --git a/drivers/leds/leds-bd2606mvv.c b/drivers/leds/leds-bd2606mvv.c > index 3fda712d2f80..4f38b7b4d9d1 100644 > --- a/drivers/leds/leds-bd2606mvv.c > +++ b/drivers/leds/leds-bd2606mvv.c > @@ -69,7 +69,7 @@ static const struct regmap_config bd2606mvv_regmap = { > > static int bd2606mvv_probe(struct i2c_client *client) > { > - struct fwnode_handle *np, *child; > + struct fwnode_handle *child; > struct device *dev = &client->dev; > struct bd2606mvv_priv *priv; > struct fwnode_handle *led_fwnodes[BD2606_MAX_LEDS] = { 0 }; > @@ -77,8 +77,7 @@ static int bd2606mvv_probe(struct i2c_client *client) > int err, reg; > int i; > > - np = dev_fwnode(dev); > - if (!np) > + if (!dev_fwnode(dev)) > return -ENODEV; > > priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); > @@ -94,7 +93,7 @@ static int bd2606mvv_probe(struct i2c_client *client) > > i2c_set_clientdata(client, priv); > > - fwnode_for_each_available_child_node(np, child) { > + device_for_each_child_node(dev, child) { > struct bd2606mvv_led *led; > > err = fwnode_property_read_u32(child, "reg", ®); >