From patchwork Thu Aug 1 06:13:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Javier Carrasco X-Patchwork-Id: 13749840 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 06C52C3DA4A for ; Thu, 1 Aug 2024 06:24:51 +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:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=enx9v8ZRoRb0TNxn5/5uQkDbor2QF+9a6iuc6VG5jiY=; b=Al1iVUjXWaqlnqh/DmUztyRfKT A0/hVdTAMxxiLBaCLPEhZBFheqrlzum9MXv9kKhw+yzQdNzqF6FTaUA0pBbri90pMFG49qE3DfoxI qaNMAg7jfApBgvw7Z3ovmBGVQHdiKc0j2fNVdMsGbjqYyEwHBkNMLTTpla3KATj5BmUjnhvHAqeNJ iBuWoPQNfmxseqBjrUDukaRzhQx+6D5uzIC3E/BqiyhDq7yM66Ec29KiJQ02OxQQs0lhVAE3pADV0 1HS8vHyNNE9lJFy39fdTtnFAofjLQNY8wYSTj1hYIP8DC91tkdsEGu/BFSwr6iulRuS6rM79z8C10 gymTRMrA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sZPEv-00000003zKy-49Xh; Thu, 01 Aug 2024 06:24:41 +0000 Received: from mail-lf1-x135.google.com ([2a00:1450:4864:20::135]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sZP4b-00000003uPi-3Mf2 for linux-arm-kernel@lists.infradead.org; Thu, 01 Aug 2024 06:14:03 +0000 Received: by mail-lf1-x135.google.com with SMTP id 2adb3069b0e04-52f04c29588so11410533e87.3 for ; Wed, 31 Jul 2024 23:14:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1722492840; x=1723097640; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=enx9v8ZRoRb0TNxn5/5uQkDbor2QF+9a6iuc6VG5jiY=; b=fxyEEAL5wAVLEJGeqDO6suWOTuvlvS3p166CrzyZlodo2umjZTzz661frEfC5a/+BV lztFnYInYSUog5ev+/YI98LKF1EJKVk+D2JgzHoGjp3Ff8g7ERFbQASq28mZbM+uZP5K z5Z5XuRBDs8cKCpA3UTsTMthHks/aZl6G6mnSS6QsgHKy7WY4KwTi746gjfalCyxWrno VOfMpuctYZjhMmUa3FkKICfkrowS0ybfNraV4UFvHS1trHsZ8pKHlOIcYOOXjPwCKHZ4 M82kGgBAbRHeP9RAuvYYdkwyoNKwb6WjlO9Wm+E1JXoNME4W7yQIdjIRJYQDnE7myk2K pwfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722492840; x=1723097640; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=enx9v8ZRoRb0TNxn5/5uQkDbor2QF+9a6iuc6VG5jiY=; b=WSCc8CR9E2zq5WG3r8ZKKkCA5SFNfbqeq0LFw7hCBbXMYD9IE59OvX70prO/rartgM kfhw9L3WeuPXdjRk5li9ysTSfOmh/t0otKqAyHGOCITbbJj6mypyBkC0EngTkuPMdxct pQsvUHcdCU6LGHrfl0KmgL1F/2G59ctx+8nxaaMl/rh4V2mlL9sKlo3faa2wb4mFdxdg NlrW7DWa8L/2UD4Zx1hJsMDNE52YXea9kggJFL1ygdI5GKcVTWcwtj7C1O+zRmBlWaCX hmPIIUSl/RrXBcHtIJ4/aDL+RIVXoiXRML3c7csThz5WRGojOL6PevttEk8hGUHkMm8r vOJg== X-Forwarded-Encrypted: i=1; AJvYcCVtPP2OF5e1yvWQfYW+8lsYvwQxl5ns+bUqslxebyTZWKHCRotoS/mOsuYkIVyzC84Vc87/bXP+ScdE6cxxAVhHMdYr3bjvEovKw8PvnMv1MM7LFAg= X-Gm-Message-State: AOJu0Yy7nGFGj2XqnLsZ9swdSs554020TlG2rTY1gd+jo5eJrE0/IeKD ANE+R/WF+g5vyj8Xjq/+OghTMmtebuBzRtuqJ8CLxJrVvvZ8ru4b X-Google-Smtp-Source: AGHT+IHQ5i0GroWo5AeLzUxGRqZlnfM9Dsi09xbpsd44bG5iNXixHisdHZvKayig69C53T7CfBFZJQ== X-Received: by 2002:a05:6512:3e14:b0:52c:dc57:868b with SMTP id 2adb3069b0e04-530b61aa001mr839626e87.13.1722492839474; Wed, 31 Jul 2024 23:13:59 -0700 (PDT) Received: from [127.0.1.1] ([213.208.157.67]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-36b367c032bsm18696455f8f.12.2024.07.31.23.13.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jul 2024 23:13:59 -0700 (PDT) From: Javier Carrasco Date: Thu, 01 Aug 2024 08:13:51 +0200 Subject: [PATCH 2/4] iio: adc: ad7768-1: use device_* to iterate over device child nodes MIME-Version: 1.0 Message-Id: <20240801-device_child_node_access-v1-2-ddfa21bef6f2@gmail.com> References: <20240801-device_child_node_access-v1-0-ddfa21bef6f2@gmail.com> In-Reply-To: <20240801-device_child_node_access-v1-0-ddfa21bef6f2@gmail.com> To: 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, Javier Carrasco X-Mailer: b4 0.14-dev X-Developer-Signature: v=1; a=ed25519-sha256; t=1722492833; l=1237; i=javier.carrasco.cruz@gmail.com; s=20240312; h=from:subject:message-id; bh=yyQNHjFv6OaCNbO9wuo6ZoLCj4JK3H1u8HwFjN8qxho=; b=oiQRLvjRafZ6kChiVJ1SXsWmSE4ZPM8Bzb8wvKCGEJJKYDspf8vhiz7JFcKhI2WNCnGKJSsdP w0X7lZ8NT9fBHmm9TcOg7g6kH5uj3CiLje7PopravaIDQy3sFa+0VMB X-Developer-Key: i=javier.carrasco.cruz@gmail.com; a=ed25519; pk=lzSIvIzMz0JhJrzLXI0HAdPwsNPSSmEn6RbS+PTS9aQ= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240731_231401_898207_F15C3C56 X-CRM114-Status: GOOD ( 13.41 ) 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 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. Use the `device_for_each_child_node_scoped` macro to iterate over the direct child nodes of the device. Signed-off-by: Javier Carrasco Reviewed-by: Nuno Sa --- drivers/iio/adc/ad7768-1.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) 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, { struct ad7768_state *st = iio_priv(indio_dev); struct device *device = indio_dev->dev.parent; - struct fwnode_handle *fwnode; - struct fwnode_handle *child; const char *label; int crt_ch = 0; - fwnode = dev_fwnode(device); - fwnode_for_each_child_node(fwnode, child) { + device_for_each_child_node_scoped(device, child) { if (fwnode_property_read_u32(child, "reg", &crt_ch)) continue;