From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3B055C3DA4A for ; Thu, 1 Aug 2024 07:28:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:MIME-Version: Content-Transfer-Encoding:Content-Type:References:In-Reply-To:Date:Cc:To:From :Subject:Message-ID:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=VDaQ/XLqFOxVKm2NIkUI8ZRKKv0IjyT6x4eynWB+efQ=; b=2IDu4zaI9yycpNnxR9C1pfgZBB aCfeOs2sLAjClp95val/Dqvev/BcK2yM5+pi3U/X7d8way2b9Nl+BXhx0goYetWFyGEffZfw+QSkD Ohtfop3ExB9Z5vdhyNW1cLcBRQzxEkeZgsym7A5KLZ8P3L+UcHau5Rc8ghQYLogKLlJ5BqYnrbb80 FEINpstmBGUZFWyZUmoFhw4VN5IFJ8jqJiwnWlDcWeSWThzBSdzUpT3VkC7e/4GiYrdYbXYCSjHKq Du5+o3lw8Jm7SG4pE5AKjEWDssXcfqcX9OFVEkTPMmLalFtuIKIJxtUWhF5hZaf7GUsrNb6N2e4jb RMydXVtQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sZQE2-00000004A7k-1nao; Thu, 01 Aug 2024 07:27:50 +0000 Received: from mail-ej1-x631.google.com ([2a00:1450:4864:20::631]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sZQDX-000000049yg-2dDs for linux-arm-kernel@lists.infradead.org; Thu, 01 Aug 2024 07:27:20 +0000 Received: by mail-ej1-x631.google.com with SMTP id a640c23a62f3a-a7a9e25008aso887216066b.0 for ; Thu, 01 Aug 2024 00:27:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1722497237; x=1723102037; darn=lists.infradead.org; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:from:to:cc:subject :date:message-id:reply-to; bh=VDaQ/XLqFOxVKm2NIkUI8ZRKKv0IjyT6x4eynWB+efQ=; b=ESVazKxTC/gyBeXyi3I0bBlb/mtRdOzaQrdsuQjiHGMCJncX1c7BDtHvygTSDFZdRY /b9vBQjHdK+VF6lKpnnCeC+oMQiaGDw/pjtgwNXbHjdbo6HKUufI/rNv1ZbTWmQ8rsls b9nsXTV2M/hLwZ0xpTonZE9No3/RREzDlUKDBh3jR2q3v8NqI8fkBU7Qj8RAOGbi7eTA xbx3t1RTrltmtoLOpaWKlpTGCDS2W8Kuf8GRuajJNCmWoZOCc8ONkC5AYiyAw6HN6Xdo otHLnjXHGar7F3RP2dc8HK9tNhZ4X3mJPeYLhCwtPdvpCjN3W1fpaKjHhLET5HbUrZaF Wu5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722497237; x=1723102037; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=VDaQ/XLqFOxVKm2NIkUI8ZRKKv0IjyT6x4eynWB+efQ=; b=k09/sKoSU8jYaJS/p5rYzC3ZN2BgIRsRaBtifiXdEyYsrJPclN9sI44Giv1DZN78X7 vZKncO1yPY3JNzfuy7NfwZ/qyc0W7ildgBnZQzu9SW5C5ZJO6fwMNEYBvDhf4ZFjaf5b cBFwA3bmOt7Rbn0/sSwelsSolHcZcy3mecV4Ha31hKqBkLauqGWFoqiG3S7CRCgOrjIV 3CtFaKa/0IMi510aWYrDZ8fp9grQFG/GI1RT/MpxrANbS3v1Rp1KKGvJn7rEfo9rMFKt WZWYPSXyhBEpokGMEiuckeICYSfGMOlJ+WQqazDIMTWY9OX0gIgiQo+4bSDbbzF+TKL3 EPBw== X-Forwarded-Encrypted: i=1; AJvYcCUc1mLypqQ7scOSrLjosfrZ531kibxkgs85nyFqEcuthcxrjelVgYdt1WQOjqokSKiz10I23pHjbphmmFfyk+ivR3bQ8R8jW/0f+8Q6E7IUqEB71Qg= X-Gm-Message-State: AOJu0YxLs66XPWBAjaeiZdbE/9qtarczeN94M/JQzETPchF4y2BHm3ky p6KhVgN0mTDRYJp/8+1/8Wu14F0dvsq33xgEwq4rDfygyPFAhkPU X-Google-Smtp-Source: AGHT+IH/70r1yEd0ZRNC82j7r32/G4ScQiEWhCT0rp8swngQe3uZ6EiGp/nlrRbIK397TZc47zc4BA== X-Received: by 2002:a17:907:e9f:b0:a77:c824:b4c5 with SMTP id a640c23a62f3a-a7daf9b165fmr100435966b.18.1722497237264; Thu, 01 Aug 2024 00:27:17 -0700 (PDT) Received: from ?IPv6:2003:f6:ef1c:c500:ee59:d953:f148:40ba? (p200300f6ef1cc500ee59d953f14840ba.dip0.t-ipconnect.de. [2003:f6:ef1c:c500:ee59:d953:f148:40ba]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a7d23e8bd62sm802293166b.73.2024.08.01.00.27.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Aug 2024 00:27:16 -0700 (PDT) Message-ID: <02bda6f37ac5ed171429a980b9a3ac69cd4efcf9.camel@gmail.com> Subject: Re: [PATCH 2/4] iio: adc: ad7768-1: use device_* to iterate over device child nodes From: Nuno =?ISO-8859-1?Q?S=E1?= To: Javier Carrasco , Suzuki K Poulose , Mike Leach , James Clark , Alexander Shishkin , Michael Hennerich , Lars-Peter Clausen , Jonathan Cameron , Anand Ashok Dumbre , Michal Simek , Sakari Ailus , Pavel Machek , Lee Jones Cc: coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org, linux-leds@vger.kernel.org Date: Thu, 01 Aug 2024 09:31:16 +0200 In-Reply-To: <20240801-device_child_node_access-v1-2-ddfa21bef6f2@gmail.com> References: <20240801-device_child_node_access-v1-0-ddfa21bef6f2@gmail.com> <20240801-device_child_node_access-v1-2-ddfa21bef6f2@gmail.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.52.3 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240801_002719_687416_1CE3936C X-CRM114-Status: GOOD ( 15.81 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, 2024-08-01 at 08:13 +0200, Javier Carrasco wrote: > Drop the manual access to the fwnode of the device to iterate over its > child nodes. `device_for_each_child_node` macro provides direct access > to the child nodes, and given that they are only required within the > loop, the scoped variant of the macro can be used. >=20 > Use the `device_for_each_child_node_scoped` macro to iterate over the > direct child nodes of the device. >=20 > Signed-off-by: Javier Carrasco > --- Reviewed-by: Nuno Sa > =C2=A0drivers/iio/adc/ad7768-1.c | 5 +---- > =C2=A01 file changed, 1 insertion(+), 4 deletions(-) >=20 > diff --git a/drivers/iio/adc/ad7768-1.c b/drivers/iio/adc/ad7768-1.c > index 70a25949142c..721672fe84ab 100644 > --- a/drivers/iio/adc/ad7768-1.c > +++ b/drivers/iio/adc/ad7768-1.c > @@ -544,13 +544,10 @@ static int ad7768_set_channel_label(struct iio_dev > *indio_dev, > =C2=A0{ > =C2=A0 struct ad7768_state *st =3D iio_priv(indio_dev); > =C2=A0 struct device *device =3D indio_dev->dev.parent; > - struct fwnode_handle *fwnode; > - struct fwnode_handle *child; > =C2=A0 const char *label; > =C2=A0 int crt_ch =3D 0; > =C2=A0 > - fwnode =3D dev_fwnode(device); > - fwnode_for_each_child_node(fwnode, child) { > + device_for_each_child_node_scoped(device, child) { > =C2=A0 if (fwnode_property_read_u32(child, "reg", &crt_ch)) > =C2=A0 continue; > =C2=A0 >=20