From patchwork Thu Aug 8 15:12:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Javier Carrasco X-Patchwork-Id: 13757796 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 20A9018EFF1; Thu, 8 Aug 2024 15:12:51 +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=1723129973; cv=none; b=pHr1fXrI5R4UJB8KOk0kwaGivjq2crO0O3R0NUPEjy3ix7He2LkWSIw8UJFXagOkNFlK3swTPH7DWKzQ1Nb3JTtec0rMTzb1DIdY+ZmrIKRFR60z800hqgzGv24XVhjt06HR7eGudZd+qgJm8F/plGAr9JqekMBpGMAgE8LQa18= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723129973; 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=KO3QS7smB4K9O7rJQ3RCV+X/vKuiVbn/9QRMDiPDUkTLuRN8zogcJoQ6MoKmZi6SO18/Gdf0x2sgOS/MDVX3FswgTiQOVGWlQasQQPoeMHn/iscekTV1dOtZUJnBiL2fVrkuru0ATIlApSDbk8GPly4Dy5k/l1z+yfVPSIxtfLU= 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=PUCIZsYK; 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="PUCIZsYK" Received: by mail-wr1-f54.google.com with SMTP id ffacd0b85a97d-367940c57ddso570315f8f.3; Thu, 08 Aug 2024 08:12:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723129970; x=1723734770; 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=PUCIZsYKUJZqP/02p6/ixevumQKvlVDJOSIKtWPBtSrl4de7RyWY5cWNeSnWFHcUxc f8BBrdcFfcqeuURz8LWFtsY7jutnU6LmjrQ1pRrkX32YP7jAPVnPjkCAONInsANjNbPN 9v5jwAFrFPdH6xRynDTzYSjsZPMudDFPXpLt3b9bUyF9PQ4rudlcaVZZV+ZWvBaV4PP7 NQRX7p7WcKtsn7W5lKIXNzSqPMFSIhSR6fw/hnJmwtXxIwqfDewOcvVzfFwIxTDLsC3k u9SABpDzdEs9rbr4r/zfDRtirxDpJV2rCDGRqlMANHojmQTemZk6F9ZYLhXnUbQro53v 0HVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723129970; x=1723734770; 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=JdSj674A6RNL2PCeEpSc02uAiMjtXZFZh04FqhC6jTiQTTjwomJY21yfj82RcyoadK 6+RL7BEx8+l72oKHsQaw/vJTV1XUYvEns9h+xmbnKOAGKEYSsA28YHy0/hlV9k6gyIPw bCtnsYBtJ7m6APuzOz0U+ooSTgG4093oYYKAPD4V0UIp4ghBI7HMrI5zNq4G9Bcadodd JNNQF59N4MpcMtkJVcJNvy6xZmItuEXMwyu8FzooBTfa5DWLB0HY7zJ1jtP0DUZvjte2 vTNPwL5loJ+BydvifNaIvT9Pi3HWho55j0cDg9PEsEYqcx95A/RnUOkv5vlMIuIfLM0B RhRA== X-Forwarded-Encrypted: i=1; AJvYcCVtHthq3Xqy6he8lJNyxErUVCfYmW33cFPx8WOcKpKWHnzboXayg6zkRIe3T0NiGSLnxjUiUpI75xxMkHASv9Ca3neb2qLrwLymSN0paGS+3a5aAmlc/OF6pDYWFe1Z1K/buUi4Hq0KBvXMrrsEbvFloDMF4D8H2+Jb6ztA9Yzlu5rMPw== X-Gm-Message-State: AOJu0YwoQthBC6U1284lLsh93+0weGQung7w1Fztf+lw/dj8L+UU63+U Xd2M1NVSyu3/YY2N7id8LulDqXp/jmTCt0zRIuBp/Nsoacw4csQQ+h8jMMz4 X-Google-Smtp-Source: AGHT+IH9zltZpOm/sE0qkVmJak8o/Wd6bbjajrHZx2HdZPpfnPVfdKLBv3qix+FWpktAZofLhGYfmA== X-Received: by 2002:a5d:4f11:0:b0:367:9851:4f22 with SMTP id ffacd0b85a97d-36d27582187mr1389045f8f.58.1723129969708; Thu, 08 Aug 2024 08:12:49 -0700 (PDT) Received: from [127.0.1.1] ([213.208.157.67]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-36d27157145sm2179881f8f.12.2024.08.08.08.12.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Aug 2024 08:12:49 -0700 (PDT) From: Javier Carrasco Date: Thu, 08 Aug 2024 17:12:37 +0200 Subject: [PATCH v2 1/3] 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: <20240808-device_child_node_access-v2-1-fc757cc76650@gmail.com> References: <20240808-device_child_node_access-v2-0-fc757cc76650@gmail.com> In-Reply-To: <20240808-device_child_node_access-v2-0-fc757cc76650@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=1723129965; l=1565; i=javier.carrasco.cruz@gmail.com; s=20240312; h=from:subject:message-id; bh=QFolg12C6V7SfGr1X/Q07nrFu7zCcR/xL99lde/5xoQ=; b=OW+baiBcFL4t7BSu+v4bQLudFJn9v9nSRRI71zmTA4BvickjiebvByENRZ1XCURLG1Rhe4A9B C8q8bxBiPIsBlxR8l+U43AGA6m1Sf04yGaJj/FB0pRVpgGoUKmRCvAA 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: Mike Leach --- 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 8 15:12:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Javier Carrasco X-Patchwork-Id: 13757797 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 D482018F2FB; Thu, 8 Aug 2024 15:12:53 +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=1723129975; cv=none; b=t4nlwfbAgDqSfkWfxv7ZFc/ekDea+FGp0ow7qz2St1vkU7RsTBJ1A57jR1YVWFNq4Kp+jOM18i7NYzXiqa3YnUxxTdwDCqH7hseTq1XN/KvH28ZdVNiV5sTfu3kwnbR95zBvdeXssMNQvoXbfXJBUwn2ULeO5wgXDpqJ99ZT6bA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723129975; c=relaxed/simple; bh=cl0OgwWFGj09y5TwwEPvN3u/Sy1PyJsfo8HSpKT7rW0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=A5o9b0PeSyw3FXrJPtyeqqR6mhTpZovEWf0bwOukqTl12im0y2NhKOHfep53OXYZwOrjL2QycVKQucAPRFtwP/wN1NOWMKj6gqfytwJ23AC/qfkHar7vUl02LfMc1g0O04agpPSM6ohL/2Uo0p5q5Wc/lTxe3TlNUr+Em8Y49IA= 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=nHMr7fUm; 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="nHMr7fUm" Received: by mail-wr1-f46.google.com with SMTP id ffacd0b85a97d-368712acb8dso606498f8f.2; Thu, 08 Aug 2024 08:12:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723129972; x=1723734772; 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=RlwKey+PJeZN0A9rh/S0vL1F8rX1MwKvwXZ2q25uwGA=; b=nHMr7fUmqJUGVdH3MWOl0SW2qJLHhU4fzlpZAZw8M7W/qTwQXuSkab+EIvhG6LSi4+ rIPTQQEUK4V8k4xE6Y5wRaHQ8JVRn8adef/thS8K4Vj8oA9VWdmcgyRru2qF4CPKBf2E O9TMNOPZ70tCkUADaAmkRZ6rFd1nZul0T1rdkolzNCrt388hlxtYXu7sOLzf/fZEv/AP 6c8QxYQ0DEPJVKXktVuK9ZzKCqjWZVpcmjyI7r9DqEP5o3sfzCdvuLaeaK0o/h8SQ/3S ZZZxJLAwhFqDjy9zZDjhcTxKWiVgZ9A2R4kFDltmM/rWEx9nWmodcUQwScJxkhw7Mj/a tVGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723129972; x=1723734772; 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=RlwKey+PJeZN0A9rh/S0vL1F8rX1MwKvwXZ2q25uwGA=; b=qCPZhtIxpi7n0W0s2rL/zDl206sAfMuLn3pG95gku2MOxYKaqZn44UcdjqCH0bDWu1 pvia3Jhelp6KCxERJPdGnOVK2tUWs9QdPejXWXXEP4n4yippr2gpHo6p4F0LujnPDW1V euskBybKKYo4WUi40GX1Wi5H2XPxE504v6vyLWJ3E+/fkt/Y7BzHJrWeOJ8pxwfGkyY9 /B057AVrdfDcmP5Q1cXFI9IXhnkskHTWwU//xfuyNciUN70OKS6wEtCp6uEWjb57Z+Lf RqSWKc2wxc23v5AFW20Rk0qrIup9teCO4o7sEqH979OA8wtUX08WsD1taTpXqSS2fZlC L9Wg== X-Forwarded-Encrypted: i=1; AJvYcCWMlqUFxLD2AMS8CeuzfAl102mpZCAEAeQBNSZdUnUIP9Ir/cMGjja4QNrPftGJdPJaUm+3IzaCFASKv5uVASBRR5XeDB8twDaBaqXHkdw5SHECjFfWCv3twtZ2C41mAti469dAX1TCxlUMGQ9jK9pGCIm3RrWNGa/bh7UwwwMPy9q36g== X-Gm-Message-State: AOJu0YwHi505VolTQ8QRHhV0BSeQMBTNmMCDaGqLEPyDIdvYaX2NGRPu i1pTEW/C9giqNVLyf34lV9ESvjgu9NcPqWa2uhm6dSXwZx/q1Rs9AxgYxfZO X-Google-Smtp-Source: AGHT+IFzix7VIeZTIQg0zBbjhj5GUek1tgQE9LwRj9V7JHckkhnN4U9cHGMO4vhsBtlpWQ50/ywkIg== X-Received: by 2002:a5d:5743:0:b0:368:6d75:1bde with SMTP id ffacd0b85a97d-36d274df3eamr1785039f8f.15.1723129971713; Thu, 08 Aug 2024 08:12:51 -0700 (PDT) Received: from [127.0.1.1] ([213.208.157.67]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-36d27157145sm2179881f8f.12.2024.08.08.08.12.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Aug 2024 08:12:51 -0700 (PDT) From: Javier Carrasco Date: Thu, 08 Aug 2024 17:12:38 +0200 Subject: [PATCH v2 2/3] 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: <20240808-device_child_node_access-v2-2-fc757cc76650@gmail.com> References: <20240808-device_child_node_access-v2-0-fc757cc76650@gmail.com> In-Reply-To: <20240808-device_child_node_access-v2-0-fc757cc76650@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=1723129965; l=1584; i=javier.carrasco.cruz@gmail.com; s=20240312; h=from:subject:message-id; bh=cl0OgwWFGj09y5TwwEPvN3u/Sy1PyJsfo8HSpKT7rW0=; b=Nr9fmxg24DocQ91AeftJ57YIQtrR9pYh1YfzOyKJzkowwMkDRORul2NZFUngK6AIViNcppMLe 0oceNoCGid6Bb3ghyIr/zXz1d+2ydI/2tahKQ4WzdvYLIC0HsYJEnZz 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 | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/drivers/iio/adc/xilinx-ams.c b/drivers/iio/adc/xilinx-ams.c index f051358d6b50..ebc583b07e0c 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,16 +1296,12 @@ static int ams_parse_firmware(struct iio_dev *indio_dev) num_channels += ret; } - fwnode_for_each_child_node(fwnode, 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); - return ret; - } + device_for_each_child_node_scoped(dev, child) { + ret = ams_init_module(indio_dev, child, ams_channels + num_channels); + if (ret < 0) + return ret; - num_channels += ret; - } + num_channels += ret; } for (i = 0; i < num_channels; i++) { From patchwork Thu Aug 8 15:12:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Javier Carrasco X-Patchwork-Id: 13757798 Received: from mail-wr1-f42.google.com (mail-wr1-f42.google.com [209.85.221.42]) (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 EF8DD18FDA0; Thu, 8 Aug 2024 15:12:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723129977; cv=none; b=YEQyyXz6eYCLx5N4Qczs8nevrRi2q7JCxdwO3AKzeP1vXytFuCCxBwfihbTX3zx0m3TKFyULvipLmL4UiHu0GjyVYNG049a8QGYhKZG4/HR0vPXnZVymzl+gtBackyklZAyFCr70WiScXinB146vkmNHThr3/EROGFje2H5gJh0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723129977; c=relaxed/simple; bh=nEcNIE1U7DZAocIwTQqOGm97es75K5AAksPENUTjEFw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=q6FY4pUueSX9XdKfq7T8wX2/BbyLIBX8dc0/mwNEv96iqB1/5vMSXY5ycdUEmmH8kmSfX3yfRyYxJqdomC46zjhKPlHc1ZRVUEAvdj4riXJ6MSd4Mxf5Xl4aq4J1PCdI3QCYfliJhI+sIGfrNZRYOE3Ady7JCMZgvekkATiy3jM= 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=ScWH6O+L; arc=none smtp.client-ip=209.85.221.42 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="ScWH6O+L" Received: by mail-wr1-f42.google.com with SMTP id ffacd0b85a97d-368380828d6so590247f8f.1; Thu, 08 Aug 2024 08:12:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723129974; x=1723734774; 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=PZh6tA0jiESoXoOtY5qAvIE49vo04MTxnTUHVFSqNH4=; b=ScWH6O+LzAyDokNzeXUQxwvD5uqOsOtWu5aw29m2KN+dIofjksNVksZ0IwFUnHCTPw VxQplMMHkD+waBsU+D8ncIcC0mq9jI9Q4Wgzib5TXy6wqyCpxNqjTsGT2ZimtQ5XBCBT Tzq/crS0vxAn0gCkEOe4Xt8gnG7x/s3kSUFFXUOw2q/s6oXvHn3xv+ZQlRRiha/Pt2Bz ywrfoT7/f+6G2JrEvHyA1lVfLb2GwXskMuEAaRc5Hr3wDFqtXQs4H3fUnFmajQBsR9n9 UcJbnjgnzIi761fFgm3fJDR3WR/0aeS3sJu+LYSrarCg5TCBFkmNyhxEHG0uW8G3+kkF /8oQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723129974; x=1723734774; 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=PZh6tA0jiESoXoOtY5qAvIE49vo04MTxnTUHVFSqNH4=; b=RUNSL9WjbSpVRekygDmqBt6XvLgl2p1wcfvC4kmPPExso27Ll471qs0vExYGLc9lS/ I6huE1Mmb+wZebiFiFFFogFvvzae2FYMvy5BkbcZAkEbd4JahE2NQtIP9J7ZoF2Ctoh8 TqFzPhMwGMD/h4+8K74Tg14lLU3E6Z1KKM/Z4KhdupVR2OIKBb88iAyYgEpvcIz3OGyG OpPVU8xjDPevv0n+7gXhu1dpYxEi0cfkFze1NAdOSz7++VEaOMWXkLzMsnJfCWSR9GzV 2sypEuMTMzK2UH8Dtj/bU8EtofRRF2Zy1i1MyTHgM3q2pB2hgm7nvtu0jXARddGDw7zL wfbg== X-Forwarded-Encrypted: i=1; AJvYcCVj9OBhNCM2oFzaZfmD35wk4WQfwgzmUeLqLQxymbgYmpiNC9NEA+KnwgWRc20Eso3j0WKDnfvhuUHd2bk+dWDMgzKE6NxT+JcsMJuQCnIJh3zkIezOKSg4dri/VtQHl3uTpzhM175i1KEL7Pu/1nwNUTZRG9M5Qh0f2RcgOap+vwLlig== X-Gm-Message-State: AOJu0Yx7gL17+P4oZFrJCX62dv4CnxP8MxeaiutWul7NHZahnT4ZXH/5 Kz3yBUUm9/YZNSvo7wKW80kNph47GXgH7QpFwhtL8Y2jHyC1hZzBsIKty6gD X-Google-Smtp-Source: AGHT+IENRUZXk9+CpUdQ4r+iBA879/lG619Wzdm/977nxAbjK/6QNybTGmdaKvHJD6uVBnsY8QbpSQ== X-Received: by 2002:a5d:58f2:0:b0:368:714e:5a5e with SMTP id ffacd0b85a97d-36d273d0673mr1662793f8f.2.1723129973764; Thu, 08 Aug 2024 08:12:53 -0700 (PDT) Received: from [127.0.1.1] ([213.208.157.67]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-36d27157145sm2179881f8f.12.2024.08.08.08.12.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Aug 2024 08:12:53 -0700 (PDT) From: Javier Carrasco Date: Thu, 08 Aug 2024 17:12:39 +0200 Subject: [PATCH v2 3/3] 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: <20240808-device_child_node_access-v2-3-fc757cc76650@gmail.com> References: <20240808-device_child_node_access-v2-0-fc757cc76650@gmail.com> In-Reply-To: <20240808-device_child_node_access-v2-0-fc757cc76650@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=1723129965; l=1681; i=javier.carrasco.cruz@gmail.com; s=20240312; h=from:subject:message-id; bh=nEcNIE1U7DZAocIwTQqOGm97es75K5AAksPENUTjEFw=; b=yK5A5zMeB7sJ1oAnNbYGRuh0S9Y0nLJS/9nl8xfh6aDTDvvJRaVGSdFyccjPSKkv0RBXsa9yn kTVocwI/IrBBGlgGPYpMb9nlcqZKE9bVZrGFgVSRkFl3eRsPBOtEwcU 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. Acked-by: Sakari Ailus Signed-off-by: Javier Carrasco --- 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;