From patchwork Thu Aug 1 06:13:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Javier Carrasco X-Patchwork-Id: 13749839 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 5D5B0C3DA64 for ; Thu, 1 Aug 2024 06:24:26 +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=cZB0CSSKP7vKOy+3pwEVaiFc3nb6WEPjBuqxABKIpgI=; b=gCt8wn9dSuFqms2CR7zEC783Kp dTnm2PUiuNq5k1WdzCqJTMKnzyCzhIce8eRnp0hnHS1/+/jAeeLWMZKGAon4evSQSP/oLSziUqjFh 1WBIm+V1YckpXjpkBmNEMWvF89jJA6yhjoATrEWK6IPPCRDPIQ6G3JyyRlJqya98qQ4yQ+6g/bjeD C30ACF69EgKLnhu9e+EgQCYeoc9lRgTXZbSEtvhrQNFG2JIwusu4DWrgKJCu/AAfPiUfK6iSklN8f O65TcWPCc2Em4LWu+MRmL3ySAyGQjHeOOJIj607v7r4TWZ7seaqj4HPzonb/FzubcMe9tel+keKM0 4dpMa+qQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sZPEU-00000003zDZ-2iiL; Thu, 01 Aug 2024 06:24:14 +0000 Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sZP4a-00000003uOE-0Jsm for linux-arm-kernel@lists.infradead.org; Thu, 01 Aug 2024 06:14:01 +0000 Received: by mail-wr1-x42e.google.com with SMTP id ffacd0b85a97d-3687f8fcab5so3222852f8f.3 for ; Wed, 31 Jul 2024 23:13:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1722492837; x=1723097637; 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=cZB0CSSKP7vKOy+3pwEVaiFc3nb6WEPjBuqxABKIpgI=; b=crY/HO0fm9h0HWKKFtqezZ2Cfvn9I1dyu2gJlkroxVW5gvprYb7XQuF/tyn4DX0A2/ S2wYFPoIFHztJNG65W1HGtN15uEUdXgPdCHiv+PIS4EQw3y7YpFnvrrYLyDbrXIMrkUV kPa2LWy3PVtp4gH3mPsEm2AHMEBPDTnI1W+K84V316oyFXUrBVTbcAx5DiVHxl812qF/ WB/wJntepUhl+6KjcQhZHaNa6GA45+jqA5xe8F5aKcEcSvCuP2+L+wZS9Rwzc4Qf4Rde rDv4un6Mvbgzqq+xn3PlCWrJrCSumeBpHvXGKzkOCoVhf5dfdN88Mgkk7/sR7s3YO2Oi G5OA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722492837; x=1723097637; 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=cZB0CSSKP7vKOy+3pwEVaiFc3nb6WEPjBuqxABKIpgI=; b=JHY0s5ILz0Kjyyuk8R7ULcKpFx2wwKR7vktplcX0ExLkIHVS7MN/EjgxHFuvLJlUEM 7+1oASsRH4s/hT6ZaQnPoH05maiE9VeFsfb43MeT/go0AYtxl7tfH66KXdC2OSRwtgnj VBgpC1o6wxeen1Vnvbzd2jZlhsw2tzYSrKd/Mjx+sPI16IqHSR59dnx1eGdU9vhC2Dl6 9TSrZuroCHTgLXJNOwBtA2YfPU7V6NmpsN35denZ78OvqCtEt3r/0B5VgQtYF9fqn/h2 WSeKaWGxGUf4kJncsb+Ioaus7uxIlfKLOosgRgEkrLdU9RHWs1jUh9DuEqwDl1Y/sJHO WOmg== X-Forwarded-Encrypted: i=1; AJvYcCXIod7J9+oi/VW/vpz7LFxRKRqKcA3oRfGjuxkl7SbhmwS6VXJVVSlFfyq9dEuITjeExr5lsKHsk+yLTBQqQQUY@lists.infradead.org X-Gm-Message-State: AOJu0YzIaHaoNMsOe988OHS9tpZ2xo9yLk58FL3LsCUstbKngLuXtl5P vuONhEeWiCpmIgkyeiPpe4+q+tcJHKrLrR2W1F5j/B6Rn/B41HPm X-Google-Smtp-Source: AGHT+IEDx1lFFvhyLYrfDWOf/SFm9wlq+0bhXem0FcY/UH1bEa05NtFSrSKuMhziSZBt3G1nrSYMEQ== X-Received: by 2002:adf:e7cc:0:b0:368:3f56:b24a with SMTP id ffacd0b85a97d-36baacd2ec4mr945016f8f.15.1722492837171; Wed, 31 Jul 2024 23:13:57 -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.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jul 2024 23:13:56 -0700 (PDT) From: Javier Carrasco Date: Thu, 01 Aug 2024 08:13:50 +0200 Subject: [PATCH 1/4] coresight: cti: use device_* to iterate over device child nodes MIME-Version: 1.0 Message-Id: <20240801-device_child_node_access-v1-1-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=1565; i=javier.carrasco.cruz@gmail.com; s=20240312; h=from:subject:message-id; bh=QFolg12C6V7SfGr1X/Q07nrFu7zCcR/xL99lde/5xoQ=; b=o1NXng6xwZU2bsAiSqsuCOR2/JS3PHQwTAD/8n1zoxZLZQalnqVR3k0a7inWk8yVvTao6fOkF Ftyxo1QzuLrBzMoP0hIJSns2cTyVWLJ3s25EZVaOxbH6HTl1dTm64K8 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_231400_268047_EA646580 X-CRM114-Status: GOOD ( 14.58 ) 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 --- drivers/hwtracing/coresight/coresight-cti-platform.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-cti-platform.c b/drivers/hwtracing/coresight/coresight-cti-platform.c index ccef04f27f12..d0ae10bf6128 100644 --- a/drivers/hwtracing/coresight/coresight-cti-platform.c +++ b/drivers/hwtracing/coresight/coresight-cti-platform.c @@ -416,20 +416,16 @@ static int cti_plat_create_impdef_connections(struct device *dev, struct cti_drvdata *drvdata) { int rc = 0; - struct fwnode_handle *fwnode = dev_fwnode(dev); - struct fwnode_handle *child = NULL; - if (IS_ERR_OR_NULL(fwnode)) + if (IS_ERR_OR_NULL(dev_fwnode(dev))) return -EINVAL; - fwnode_for_each_child_node(fwnode, child) { + device_for_each_child_node_scoped(dev, child) { if (cti_plat_node_name_eq(child, CTI_DT_CONNS)) - rc = cti_plat_create_connection(dev, drvdata, - child); + rc = cti_plat_create_connection(dev, drvdata, child); if (rc != 0) break; } - fwnode_handle_put(child); return rc; } 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; From patchwork Thu Aug 1 06:13:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Javier Carrasco X-Patchwork-Id: 13749841 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 04305C3DA64 for ; Thu, 1 Aug 2024 06:25:23 +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=CNuDB4bLwR4acprYzX2JMVmPgj/lKzcikki7sLZSJG0=; b=ypVZDX9hXcFKN1lQQIXhcuaNL2 MH46e9FLnOD2q2CpmRGZ9Axw5pdMzCzgulG4DCUiiOBo83oLSLYZOjf+ntj13DLmM3fLyJeqA4d4A H9349dQ3axCykVlG+xSbPRSEqxyRV956HGjv6ZClGwmJQy6HO63t3eqqMXfmTW55oPXyH7y6jKYNF 0ozztX+tUz0FI0hcKKUcpPxvThJeUXj8FWUpCm8seHmZYETyySvlHgQkJWA7+dd+xHzRrUiIXXYX5 3No8bVBEyMNMJpKsXZA0cRW0TMfxX3uqAS3r7GUrqq1GaFGULDySffO4gzAnPeG562uQHXOGXY7EC WVAT+Q7Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sZPFM-00000003zQg-32kF; Thu, 01 Aug 2024 06:25:08 +0000 Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sZP4d-00000003uR8-2zg5 for linux-arm-kernel@lists.infradead.org; Thu, 01 Aug 2024 06:14:06 +0000 Received: by mail-wr1-x429.google.com with SMTP id ffacd0b85a97d-3687ea0521cso4266589f8f.1 for ; Wed, 31 Jul 2024 23:14:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1722492842; x=1723097642; 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=CNuDB4bLwR4acprYzX2JMVmPgj/lKzcikki7sLZSJG0=; b=bMoAFJpdDNlY5/8GX2EXj6HIcCkEctj5TbOX+lsnrU+nLDhuBRwf9zen1vpT4XarpR OEQ+lXcJ2G32eMgSo0wfSUFl3vJl5ItD+bBb4WOmkUpuixxZAcJRJGfPAjG6/hDfQJF7 0qgL+r3lfdzj21p8cPHaS3pHYtWpy1JMIhON2IPl7PyCed+q+6KCioV/jCLnN6KiaLmL 9FJx8U0p0ygQF5IW+wgUz+fTXgsthmAeVH9zzNOJ7DeOXq/bEJTXdwOYt8/skWMHEkkN +pBSbCkn9SA+j1CXHS7gBW+nkYBkcl9GliANaDa7X7o2EYrcNl4SkknFi8LtO2rYfuOz jW6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722492842; x=1723097642; 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=CNuDB4bLwR4acprYzX2JMVmPgj/lKzcikki7sLZSJG0=; b=MHAabc0edkQoKNNauIh98lPawo6xtgygRLHH68v9rzPhTgmndNqTz6WKWZG87d/cD0 QRfKm3Y0M0gqa2yTpA2eneAotKf3S7TzE3E4GPkj2YWat3OuHWCkjx2e7uHz5DPtXSTn 41MrJCRyYkMfxVqmEC4HBp3fGG2gf34DQ8wdnx2nrGTyHTYpoDQCWJAmBKMvo61pVLMw 4agkDbe9npSx8QrNBwyBDxKbJwfCCJWNwFPCJg2x0Ts6dYAZyubwJXnY4kD2RYgZf4JP qa94qoHxm20g2LfbFKT9Vvk6phqiGkp7fJflxL0kvQZEGDeFbxXjqMH5zRN3KNofZItP 7Hqg== X-Forwarded-Encrypted: i=1; AJvYcCXhl8igRayj5StrmYzExdc0gnv7I6QofPSRPzvn59hTmGV5P4lyzD++WTKIsUF2iY0UZ+xbDUbGHJV6qt9x4PvkqdsrGM7/c07cE60ltZlSi3z/ib4= X-Gm-Message-State: AOJu0YxHszNshrDs0Pf3MXjCfRAGSfspgdkd2KCK2weyXwmL9idFZPEm yri042fPkFeMTA965ZXqedcDYa3puJGhmG0hoOECqdzgMQpMJKMP X-Google-Smtp-Source: AGHT+IEvftdwznEgDkq633cEgtwng1mS7I9fQC5OIBPjDd3jttKupLDcxY7G5Nlc3ySfC//AjuL7Gw== X-Received: by 2002:a05:6000:1445:b0:368:4b9d:ee2c with SMTP id ffacd0b85a97d-36baace1998mr1455919f8f.19.1722492841664; Wed, 31 Jul 2024 23:14:01 -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.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jul 2024 23:14:01 -0700 (PDT) From: Javier Carrasco Date: Thu, 01 Aug 2024 08:13:52 +0200 Subject: [PATCH 3/4] iio: adc: xilinx-ams: use device_* to iterate over device child nodes MIME-Version: 1.0 Message-Id: <20240801-device_child_node_access-v1-3-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=1411; i=javier.carrasco.cruz@gmail.com; s=20240312; h=from:subject:message-id; bh=i0sBRG11zXAIKwjcoVFnL1Y8Swho6X1BW3kA0cfdhTg=; b=7m5HHkACNNgu/mKXKiw3ayPLFGCDzWUt0OJixovqW9e6tKnbUu5tW6DIs8OjCzuCw1sjzjPGM 1aSWHyGe+yAAbReOXBk5pMYYe2cBhrBvsU4VvOuvv1pEID9ysZtlWuo 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_231404_184756_305E1C1D X-CRM114-Status: GOOD ( 14.43 ) 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 Use `device_for_each_child_node_scoped()` in `ams_parse_firmware()` to explicitly state device child node access, and simplify the child node handling as it is not required outside the loop. Signed-off-by: Javier Carrasco --- drivers/iio/adc/xilinx-ams.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/iio/adc/xilinx-ams.c b/drivers/iio/adc/xilinx-ams.c index f051358d6b50..27d5e4a6f9d6 100644 --- a/drivers/iio/adc/xilinx-ams.c +++ b/drivers/iio/adc/xilinx-ams.c @@ -1275,7 +1275,6 @@ static int ams_parse_firmware(struct iio_dev *indio_dev) struct ams *ams = iio_priv(indio_dev); struct iio_chan_spec *ams_channels, *dev_channels; struct device *dev = indio_dev->dev.parent; - struct fwnode_handle *child = NULL; struct fwnode_handle *fwnode = dev_fwnode(dev); size_t ams_size; int ret, ch_cnt = 0, i, rising_off, falling_off; @@ -1297,13 +1296,11 @@ static int ams_parse_firmware(struct iio_dev *indio_dev) num_channels += ret; } - fwnode_for_each_child_node(fwnode, child) { + device_for_each_child_node_scoped(dev, child) { if (fwnode_device_is_available(child)) { ret = ams_init_module(indio_dev, child, ams_channels + num_channels); - if (ret < 0) { - fwnode_handle_put(child); + if (ret < 0) return ret; - } num_channels += ret; } From patchwork Thu Aug 1 06:13:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Javier Carrasco X-Patchwork-Id: 13749842 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 C43B9C3DA64 for ; Thu, 1 Aug 2024 06:25:45 +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=+L8YiRjBiJi2NiFbZ6hVKOuXnOLL1u0RNfoOt4ZnPSw=; b=1XhWSAmIXE/Gi//nVRzoKQZDFG QCaL88Z2QXcMuaiMJ72ilbCS4sAg5S/BB43+sA2xqAchVAXrtMxqh751ceJTB2EWNeLByUsFjQLDS wrmIH+JSAflwmPg8Jo9MAIRArpicSrICNVqdfodVAsHlM27LLVoDqB/8Q8QL9lHcBsnSPO4YMHn0j +ucfxRX0wGBNHaea1tcy3hNHtzwqQ/YLvuKCAIPjbxP5FxXDrrDwEC4crsuerjidLe646LALtyW3v YkjUp0u4zVRv4OWFC9RiCfyOW37CXz2wmVspnt/bgG+eyZlDLlJ+1lnsL56GQ9SFb+TR1Ka2ZYvwA 2wReJBTw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sZPFo-00000003zYw-2Wh5; Thu, 01 Aug 2024 06:25:36 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sZP4n-00000003uXb-0Hix for linux-arm-kernel@bombadil.infradead.org; Thu, 01 Aug 2024 06:14:13 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Cc:To:In-Reply-To:References: Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Sender:Reply-To:Content-ID:Content-Description; bh=+L8YiRjBiJi2NiFbZ6hVKOuXnOLL1u0RNfoOt4ZnPSw=; b=etZY++6h57dJkTurIe4SdIi4A3 46tBGGfIFr0BhgVphDnnrWwvHjBRfSkP+yXf7GAVUSq3mWD0ow0xEr0u3Hm0uYm31sxGSKTz3ZSxk vhY//uP7IEOmxpFLj+LRhn3PPIX9tUe5ZcTCZBTl7yzovjEAMRD4k+VIm6U60GyxvoKA1Nt8UgZ8R hKOIl/gmC/Kpa7EbIWDS9iUnTda/9pFK6XxKhICU3Vqeo8rG+amoGMRCYFsQiC4NMIV/iGHoa5TzX pg5IJqkRsdT2wRNcf8Yr56/KGSYEoW4jDgHVN/ay1hsYyy6SGcq7tNELnA9OO7KCLNWWuc/YWeODA Kz8E+Lbg==; Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by desiato.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sZP4j-00000005NVX-0W6t for linux-arm-kernel@lists.infradead.org; Thu, 01 Aug 2024 06:14:11 +0000 Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-4266dc7591fso40651155e9.0 for ; Wed, 31 Jul 2024 23:14:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1722492844; x=1723097644; 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=+L8YiRjBiJi2NiFbZ6hVKOuXnOLL1u0RNfoOt4ZnPSw=; b=joqgz3OzzUGySSY3rNsSU9AQr3RHHprRni3W20yVaIf6Cbid9IunDOyuXcKUTutwFA F8TqXy3PD07iujPaeOMds9yjEqPNSWckokXLy4Cb/nsDW/Jcwb0BOcGwSz6D2hCqFJR4 AtZDQnELMF8LJ2wIcV5QZ9IS0EUId5q76a9xHv7UZ84iSU8DRezG51kAohCy92Vlv9am GicxlRwW22tpnzVViUNz/o4pB4SCPz47DdsHqY9sjUN7MUoeYr9pZjEfHvxl/DiOF/WB tZsDj/UIFnUtbriNWHcMTudpuMKjxGCYvRJTCEadCB+tuU0fkj1q7qhVHFZdfwsbMBHZ dBeg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722492844; x=1723097644; 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=+L8YiRjBiJi2NiFbZ6hVKOuXnOLL1u0RNfoOt4ZnPSw=; b=KFoGHVTMlNUBUhTrkygvYsgjbQYFRs4WMsAQjJbHC2ksRm/4xbgPtNXvvA188gnStN 25rk9mwd7J+V7jg/tL/lT7+A1P6TocF2pRzYqGlqhpieS1wphQfeV+Ot6jqtwovumlkT HMmZ3DVps2cHx48iMT1F0TnKgLtw+xD6uE2TaKuTp91V2yzXAMN8mn/euqqPzbFciyB8 kqP9psZ/npnQyqAkgvbuocmVUlAK6+k746W9nVqlpCFkWZp51CFbtjXs9y7DauVX8Bv1 w4pYAvprwIrnvvWRvpvLD3ewVJznnOyXVZf1yPLw+suOLwrvpTDJ+7GWKk/GmASruxeO ZHoA== X-Forwarded-Encrypted: i=1; AJvYcCXdtrhq+FsyDrnhNSz8n8a80v4B4M7lGbUrdqpDAaFHXASejdA63o831yN4LtORTxRaiU14Ki58WJZk2ZBWUFM3Zg0PRalJY/bFkZP8mEzOG34Se+U= X-Gm-Message-State: AOJu0YxUiknl11qDhViFYlnD7P7XqdWHFugR9aGbpag/jolC5K6G45/b v6kyJBLO/p9vcx5YmP3IJSOOSvJOGZccCNjyrql1e0GEhyDL4jTm X-Google-Smtp-Source: AGHT+IG6tOf0ZuCj66jBUdpJ75hyTaGQvDe8snbMCEnWWBBmA6qrhcWqvsDkB9zYFI73n7i+mB+l3Q== X-Received: by 2002:a05:600c:46c6:b0:425:7c95:75d0 with SMTP id 5b1f17b1804b1-428afa57c17mr11596585e9.18.1722492843548; Wed, 31 Jul 2024 23:14:03 -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.14.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jul 2024 23:14:03 -0700 (PDT) From: Javier Carrasco Date: Thu, 01 Aug 2024 08:13:53 +0200 Subject: [PATCH 4/4] leds: as3645a: use device_* to iterate over device child nodes MIME-Version: 1.0 Message-Id: <20240801-device_child_node_access-v1-4-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=1626; i=javier.carrasco.cruz@gmail.com; s=20240312; h=from:subject:message-id; bh=n9RPwA0mKwp8E3yrA5e5bskfywWjPvxynbcgRtP66H4=; b=KKQapzC7/u9Jck7tT1Y5QlkimkoXnQapCJf6536uEU1HbJu0a4w+37OvHj4efHxY128VYMVz3 D/ifXMyfdkhChw8FAcWBd4j29NwiDIeLsBB2IVdOHzin6zUKRqB2DRV 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-20240801_071409_618515_63662E9C X-CRM114-Status: GOOD ( 14.08 ) 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 the `child` variable is 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 Acked-by: Sakari Ailus --- drivers/leds/flash/leds-as3645a.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/leds/flash/leds-as3645a.c b/drivers/leds/flash/leds-as3645a.c index 2c6ef321b7c8..8e6abedf6e00 100644 --- a/drivers/leds/flash/leds-as3645a.c +++ b/drivers/leds/flash/leds-as3645a.c @@ -478,14 +478,12 @@ static int as3645a_detect(struct as3645a *flash) return as3645a_write(flash, AS_BOOST_REG, AS_BOOST_CURRENT_DISABLE); } -static int as3645a_parse_node(struct as3645a *flash, - struct fwnode_handle *fwnode) +static int as3645a_parse_node(struct as3645a *flash, struct device *dev) { struct as3645a_config *cfg = &flash->cfg; - struct fwnode_handle *child; int rval; - fwnode_for_each_child_node(fwnode, child) { + device_for_each_child_node_scoped(dev, child) { u32 id = 0; fwnode_property_read_u32(child, "reg", &id); @@ -686,7 +684,7 @@ static int as3645a_probe(struct i2c_client *client) flash->client = client; - rval = as3645a_parse_node(flash, dev_fwnode(&client->dev)); + rval = as3645a_parse_node(flash, &client->dev); if (rval < 0) return rval;