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 19859C3DA4A for ; Thu, 8 Aug 2024 15:14:12 +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=NsR5B3ItCWjBfOsE5nCIT88oAU lFA9yEVpC5+6OgWlV7QqYApNmF3S+sytDbWAE5R+df2rtBlQRdW7Ttx4R0m15Fkf8E8dOG84Nhdll vdse4MHcIo23XOmfraWv6N3SZgThkGUXt7wRxvSlwcghN+WAh85H0NOq/HyeYSEQ8EmwDItBxlo2D uMvWAeG+yVhKlByCPHJzfodpNqc258cNIC1ZMFzDOLV6fqkj8XvTJG48Be+azqwdnjDKdcVCMZ7Cc aBfXsvcFPwCoO+CiGDFdUTuu4Ef6xVjfl44E6/Mgz3DgX1iM+ZxbYnwKoikbNZ6B5jO9v344jL1SX qs7rMAAg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sc4py-00000008gA6-2Zpo; Thu, 08 Aug 2024 15:13:58 +0000 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sc4ou-00000008frN-0YTS for linux-arm-kernel@lists.infradead.org; Thu, 08 Aug 2024 15:12:53 +0000 Received: by mail-wr1-x42b.google.com with SMTP id ffacd0b85a97d-3683329f787so568455f8f.1 for ; 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=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=MLkaw/b/rD+xlYm7ws1+1rwvbWj8Xw/SnnlmkOT354spLcTVnIZUegAte5grl1lnkb wvB8hJH99/qmtTEqdfK54uP/CI6efZYU0BXLI5LsurGkoKMJ9CA9cAwxUw8RayogGdbh XvFxGhR9ZFlE+kKnOHehFUxuY/KTzWlZb4HpoWpmv1xVlff9o/eQaahTeqlMcGyiCsAl 9IMMcEbOojJCtYrG43gjRJlpCpyWSH9VXY2vLBd7lecR+ickf0adaAcyu4gqtdyW92iM z/CaToCxj/hgQMJz8MQOEJzDhHRzvs77pNXpM+zATn5bXpU+Jf3yhSG4zEYyyVVTLneB SDTw== 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=WlNKyYnRyRV8/Kn7B1p7XTo7C4Kcq6R0lKaYwZg8KgZ8e1Z5if0pgntFXOpx1z5yUI QR6Hy9c1xQuJOj00jtl+7iq6lvWU9FT9WyqRk5HkPgVplccymByttcWy4EoR/anHB5MN aIdWnKAb4Tdf3zicqGn2Fqv4tlFzTevh0EJ018uOX//HKoJlhVz14FiJ7EeXQWVheFbN HFsjIzKPnpmBjLPN3IAVZ51wuyCiMzYGiIfAIBQEaHA4IbelBXuemvCXSq4CBYKpxoyD RJJqDE6jwhJEhoAvm3MDnkbffoCwq0Ttl6wUnDdoNbFRa/QVS7UlSNElztB4Umd56mhX pm2A== X-Forwarded-Encrypted: i=1; AJvYcCVbUVTr7aj36a6IFBJQ0wNCUuwBomoSPsW9wFSzAYmpbkYSyxzZuhgh/4mV6lN2wyfwvnMJWF+kmyx/kWq/IU1kk0wfyZ5F7GODC5c/shNQMgmWBbQ= X-Gm-Message-State: AOJu0YwRSQcXZJ5n/1SjSAI4AhhQU0E4Zq+vXIseDl7rxuBh50v5aCFd 0qH3kC2cMt/G1QoMnKU5yrie/D3IbSg87pGg8Bp0GJAJqd35R8p9BSXXErtX 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 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit 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= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240808_081252_207404_6F66FEDC X-CRM114-Status: GOOD ( 14.44 ) 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; } -- 2.43.0