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; }