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: 13749728 Received: from mail-wr1-f54.google.com (mail-wr1-f54.google.com [209.85.221.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 606EF16D9CC; Thu, 1 Aug 2024 06:13:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722492841; cv=none; b=mzyKooZ1pG9kk4B2QwlovoLqzfzFByHpIZh22j4V2Df7Oazwa6jaq8LJe968fp5ECB1ZMJEs1wj6mHVq9brWIaYuL6Hb07BOtQJoqIjv89xvTlmyzoFbdjRK95rcaGS7htCjywlmFdkxYyVvPKyrz6PIA714NQ2aNXlFubM7wu8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722492841; c=relaxed/simple; bh=QFolg12C6V7SfGr1X/Q07nrFu7zCcR/xL99lde/5xoQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=XBV/a9NA3eA8K1I+HooYNyaYPt9hsAE1iW34qjm2QJz9f6/qYrt+m6sI0/4Hl+CLGRoa90XY+/7tiU+TLMgxI486hNOaEyjwlsOtsCSRX9yJ+PQiOyQoIUakwrKGlsCvgZ07y+GE3DjbXh8dhuSvZvG7nWtKeUnlEjGjlwYIG8M= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=A1foEVOA; arc=none smtp.client-ip=209.85.221.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="A1foEVOA" Received: by mail-wr1-f54.google.com with SMTP id ffacd0b85a97d-3684407b2deso3294794f8f.1; Wed, 31 Jul 2024 23:13:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1722492837; x=1723097637; darn=vger.kernel.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=A1foEVOAZwu71P2Di3Iw//nZMpZ1EoMYh41DlfHJXChAft2EhgfRdo4PnQn74TSg5t hwsZE0WoSzo9F5XmughfeHfHK+JAPIaaXqFxVNmsR3bwfpf9jitQs/kzDKykh4cEo3hF hYaDS2HkfXAAfuq9VryRs25UGMXACc+HEoSIozO1ZKf9t/QnNUVEFA9Blv4AqgdY1t25 UIkHEP50dC7afypVWqp1fU4EH+Oeel6pPnv3DlLhCjTkiqeGXSLnOKREP4TqimNc+6IM jFAe1MBhpJW05xUK1gaX0zX7oG4Ta0qp+CEmv9U1YlMW9oHA7FMlH23gtvgRYnaUh2pq vKAA== 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=m4VTROotavASzJUJoMUK94h/ULINTI2yAJgtovuOtDDma0b7yzBeeZPlzVXfZ+qK0k fKDhWIvH7iii1bcuMPUIhv04xMg7XGNZGiKak12wEnPtv/s9MF112wSqJt4iGeYuyVOw B9/7qm5iglpAlVpx7DWOc6eC5g4XLhA4N9qC5UUybc4O6H2ObvScTY+L3ZUB+oerDbSb EpK5+cuXkoO4+h6vp1mTDiTRFjnapg6xPnZbY8sUe7e/V+qHsF0TT1uYzLH6a3KjUig0 ukfMfuKpUEqfR9122Zefdn3YOKSkP2kAHpLPkUVfUP2G4FRdSbPdigcCaZLTlZWF8uIi 4eEA== X-Forwarded-Encrypted: i=1; AJvYcCVV0690kTQkJjq62flpopiPX3QD8HZwIu73Tvtc3/T5iyCEi+qXtxCGLgAb45dUYaWCaBQMB9soVlM=@vger.kernel.org, AJvYcCWFjcw8Y+G1felDH4MRJE0/NrxBWN/1fVUD+jGcZT1195vWuPFlripcqkHc5fWSC1ku/QOyXLJBwmahKg==@vger.kernel.org, AJvYcCWzgxi0pDtUC8lhAw8dHKLSi9haBvA5xRWP8GXv4afI+Wo0+CaDNF64O6NZTCi8jRSE/KQ2J0pu+wC/Wx3y@vger.kernel.org X-Gm-Message-State: AOJu0Yyrywe7OP1xPvzsEUVyX5jbNTi5AO1breJAZ+crHfn/L2KWRA6U hYJCf2W1UGg3MMI3+pkX0ZwKMWytnetPeuuKFBN5+J7XMqXg9TzPmF38s9Db 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 Precedence: bulk X-Mailing-List: linux-iio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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= 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: 13749729 Received: from mail-lf1-f52.google.com (mail-lf1-f52.google.com [209.85.167.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 481B2170A2F; Thu, 1 Aug 2024 06:14:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722492843; cv=none; b=iRn17Yf7jDfoykRjWgrf5CDsBAlSf/jQ5O89JqSCd6G47zOt3iU4DQsMIEr2QAmYRfVFzbIL0hAUNWDmuR+xGemO+ZWTZxlNa109bB2RtG/UYv+BRF9K3Kq/+DV6iw3E+Ac3/9Vhgm7+zth8Nd2Pl2SLyFVfK1dXmAnTAnRP/uo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722492843; c=relaxed/simple; bh=yyQNHjFv6OaCNbO9wuo6ZoLCj4JK3H1u8HwFjN8qxho=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Bj7Dh3Czl80JwKMYT0ObmvOqxBwcf43tVTBR2U/b0iA6/MuiVCflt4myieSgdxZ9xa8HzHzPYrS8cqc7TyRym+SgsPYtyE2UmEDxWirS9zFd7MepyZYSacV2bM0sR27gCnClXWfh/nvIq12TUItx6L9DEYRpJCDEu69i6+Z7pQ0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=dqQd41u2; arc=none smtp.client-ip=209.85.167.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="dqQd41u2" Received: by mail-lf1-f52.google.com with SMTP id 2adb3069b0e04-52f04c29588so11410551e87.3; Wed, 31 Jul 2024 23:14:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1722492840; x=1723097640; darn=vger.kernel.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=dqQd41u2ovAeeOdENvLN8+kEvkNlwaqugIl+/VxPbEGOtLY4v5g9eStY6L0F9QYhSU uKLJHksJjNtvb1ZkZd9Cun8EQNtyA7Y/DQSrmwvxeHEh+pfPeawvgJ8GpfdWjNhjViU8 q6hS2V/cYrmpXHA5HFUaMNMjGPykNfNXQ8Nvf2lmB11CcNjoCKSOTG640ynBEfzDUaNN kY+2xWsaGeXrSglDWZefBsnpHAUHrbHpKVTg7rWdd15UbzD7dzxE7iIZk+iwTN06+aFG rUEoZ0jufFXP7Y2FRXPGMOYRlMr8Qj0oH+YX3PdhlOANNEP3kp0s8GWjGK4WKi8hZKfV 8tbg== 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=qxzw/OmThCM4MrKe3ZSbV0PyCwwhdXNTuNM/n5jJFVnIIsvSBAfukD36KxrRqJePnq Gtiz4Y7DBsbqzBvY+yRg+Gl6qn8WQucRcWFDeHE6L4a6j1EFUcpH5XntvHcJ28CbiOB8 YEhWdd6NIawB3wm535MFaLfrujJ1nqnN9EaUmPjqYuRD5m+b8n6zf6UpURkuysQC4o9E W7fftGwe5LfDtdxuEyrbAvt5hqxuxSQ8O7qx/H8u8jGUsRmhzXvUixmBXJiygKp2PFxD WoxsI67pqlmwYfHH8BYLmV3I00AK4xE65r1pzDWMTHCZZ0czIbv2ZDJvB4ZX0NQ3VDlB saSw== X-Forwarded-Encrypted: i=1; AJvYcCVH3mZvqLvjfjxm/kfI1fTc34KGwRtuOSwj8gvuGl3w9lpGbBeHaERU3oLr3u0UPfCRFspR62reRPjm+TLbJ68IHvUVEFDXpeCI9FVfSREoxsYER8NXMYLimfHWqRwQHVPH1Dybo3NGBojM2MlY8iiFED4dSHmi0c7YZ0Sq1pRbXTGX0w== X-Gm-Message-State: AOJu0YzKBednYT4AQ7quraKoBLmuDbvKjWboD4OgtNDXuCbyMZViHYF5 SRJuGyRxNaciKs7JjsSoEEKgfHpD4ng78BHolqqLK1Kf4JJa9bOGFH1PX06k 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 Precedence: bulk X-Mailing-List: linux-iio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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= 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: 13749730 Received: from mail-wr1-f46.google.com (mail-wr1-f46.google.com [209.85.221.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D8A471A08A4; Thu, 1 Aug 2024 06:14:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722492845; cv=none; b=WsxVO4D/hdDZYYyAsncNPdyaxDF41vtQhVKktTiXwuOSrR3w5AqnNq7BLzasiDwW1Dv7yDc6NTSJHA0IH4Ud/ntLEqYSNt6mt+R6Rm40LFeK7fOwrMKUc4a+HsddNP6Cd0XJqC9TRdPtZMN8ykCwQdRSbcv44FROmhch07bwFkk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722492845; c=relaxed/simple; bh=i0sBRG11zXAIKwjcoVFnL1Y8Swho6X1BW3kA0cfdhTg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=WyhWA6AjF399m2SYmPrU7pOktBlITWIDTiHAtJiHltUxrpjh7Yhy9qucOZ43dn0b7SjcBSd2YPy0GOTBhe21dPomm9pA9W3x4UIVLfX2lB/J2NUlZ/vCjqtZzdit7ePbXVRgv7AOluQ+q1sZDsKVwR5ZIGyXC0UtbCD6u5d+CsI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Bovwho/k; arc=none smtp.client-ip=209.85.221.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Bovwho/k" Received: by mail-wr1-f46.google.com with SMTP id ffacd0b85a97d-369c609d0c7so4489185f8f.3; 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=vger.kernel.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=Bovwho/k4yDvfqoSjHdLIS60/G7fhkw9rdfCv9uEYqDjtEFk4cZS9/O6QswdOYXJKA AY3WuQTxlxYCCphfZZTiZRJZaqkyZxk7HAGvPfmTLyQwl3SBd2bl6XwJcNlbfrSPmSRm YYP58zxYJx0XYwWO/dAbS/IsqtAc7gSfXxNGNQ+imymm+DD9j2YUkogJKX27EWWoW3+e 7LE5DzBHY9A+wzZ5K7LzoUUh56MXS69u/Fnx3aXwquUkcTkBzSnFVfvs4FQGVa+dT5pr ZJYQYpxqxsqslJOHJ6gXABbRiiPdmNGBghY/NyXwTlaN0U27Plf9uC/M1malWdZxm/3g jnQg== 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=uJMaBKZhAfsf4W+jDJj7HKYcw3kl/UC0wtnJlwqKNe+2LpdTNElpRzwNX0oSWg/+h0 s54OvcE8Vzp0a8djD43YvLZc1Xv3NtNJ8J4TEU/N7odi7xYu5RTrpubcHIBx0eRzjqSl vfx0kBXtcJqkf2VMUbWGgV/p3cY6+FhoemEQoROowwofu4vIAMSB63ekYxpJSH4xJciz aKGb9rJfqb/kOhYsbCpkZU04h/y28Bzv+cChRnBQBeciKbdbMY6XzvveGFwl+gihlzGh CEeBRGwtD8UUbNAShJSR+9x7J6UjFCzCiDk85otFkpTlZunL9KN87s5KKCexUtWVEe3B DB0A== X-Forwarded-Encrypted: i=1; AJvYcCVoLpqXJEjqrAVJku65sfxrfKxjxWFiHfA9cBcm+v/nloCkqRMEUvoqps7wTmL8LwDKDlMdtQwXhwW+cjd8Hy4N75SpyEjqudRpGnWZ5nmvjsJIGqcNWd1gX19F1zZtM54NIE9F1DAZ+iGudSvpG+6swawm1bXe/UKZiPXl/WQVU+jXtA== X-Gm-Message-State: AOJu0YyE4PcmIOk7zx6+KTJtlZqXw+NUfnoCxHtWLQn2r+pjy8XfoUd+ U+w7o62yh1WjhbI7xsXXsfZy3nHgHoHsnaSQDJrpxo8BzWbTJIvsfZbtXYBj 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 Precedence: bulk X-Mailing-List: linux-iio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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= 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: 13749731 Received: from mail-wm1-f49.google.com (mail-wm1-f49.google.com [209.85.128.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AA3391A2551; Thu, 1 Aug 2024 06:14:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722492847; cv=none; b=JFT/Z1dKTCNIpBIQ5g/Zr76x0S2TobmfbvuDpancIVKN3LcJQOzjd+li4aHgznUDwXHAJhSu8e5p6dvfyBiz5bp7xadm3F0UiBQQapenXCOp0gRvW7DApQfrNCpRF8JEexm2PpFZ6KKdogD/dS35YSgVO7+mAYFsbgZPK4VOYNk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722492847; c=relaxed/simple; bh=n9RPwA0mKwp8E3yrA5e5bskfywWjPvxynbcgRtP66H4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=IWCkX3kE+7YAKoAFCCScEtJeBFiQR7sBs8uUG1JOP/WKqtu/Nsmpna4gm/OHRx5lMGXaUTfeWHKjT57Xp0Gb9sB0kCc+r5eaGjfZV4TvugUT9OqGJlgV5uKPLt2AeOTyWk8x5C95ZJqoF1O8MsjGFrgieLa2FmT55RyCNASvX50= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=MJLx9RXB; arc=none smtp.client-ip=209.85.128.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="MJLx9RXB" Received: by mail-wm1-f49.google.com with SMTP id 5b1f17b1804b1-4280ca0791bso40591235e9.1; 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=vger.kernel.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=MJLx9RXB/tEWuFUnLEWIY7qOzlSfhPjAyqSo935TOPngNRW8QSIHi7w/tKs6MPy9UA DFHFQVkWZ0/dQD/Ri3j4Yum1yXgYaLOsJJ8vFtxYjjdFBUbu4tIUtQZtyuBMHE6aYYCr NktHzgc/FroMEucVPOZ2lAzMKOagsnhEjGV6MUqQhKF5G5wPxzmpUibL0VQueQG3WCI/ YyifT7GAAxaCXp5LZtp6iDRxeJ4n2Ym/SQ05Wdb8xyIY0FHE1HyYJ+uPyi4sbbphEVBS j8anh+cXEv9zBnzQmpo1+3xJcPjAJRODIfolzFZ8FNTRFUHPpGEHO9abQI4IeiBbve7X rlew== 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=LRjHaZbbo6O7qc2emuEXBYQVi/Cx0MB6DTotYLOSSxd4Xen82Jjy9UVkfjvdsifw0P 3U8lxhO7f3sTePFgFCmKJwyYDDvnmcVGj/Ru3cDm9t5odQffpFLKjvt/2l30blsUAF5+ mE3JTBjrlcdKSVoaCXhEMjHX6P0lGNYDGju9HTQsRJj04jeVOLTR/eu91BKuIiUuQBwn B7DW3H7zSgC27MKw+ko7WxKyGXQsf3bynCOatmJ01NsBLDpcoFR7nr28xkbZ1AHLSrbU vr1iQU/jo9+lXTvriOkYiITjILPqII1DaH2Jyow+4likJMUF69wJjqAncZgA2m1hjq4o FTCw== X-Forwarded-Encrypted: i=1; AJvYcCW2iWvRd64WrDS1RezTEi6CuIrYg5dCo61azx0spX5ZQzSQGZRN5lZb6gpDShxFqS9JpCkKn6EGy9hxJbkp1ZzZAHyRydELhUpiW9BQtiZMWOTVoqaN4/w3rzwXQKMWrKjuhDwbCUtZc8Aj/xt1wK3ArgXdhJ0GACQ4+40PsBl5V3Fwcg== X-Gm-Message-State: AOJu0YzHmLZhi0GcmOrVtty3mt3bE2mNOYXHMDg+QAoTcaUKJ8Or/GTo tSGsYOR/B7kvL59UItrn1vJXCBO/qttHNiiG5KHYKyBagz/VAfqxiGHbB67R 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 Precedence: bulk X-Mailing-List: linux-iio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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= 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;