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 0939DC3DA4A for ; Thu, 1 Aug 2024 10:38:41 +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:Content-Transfer-Encoding: Content-Type:In-Reply-To:From:References:Cc:To:Subject:MIME-Version:Date: Message-ID:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=6auF9SihaRv0NHeZgPwWgcp87LY5pPO2A6cg+JnSinA=; b=L3VLr/v+EQtEHplaDfx0Y9LEjZ KQad6pzPb4OV20ipGE7B2B8CIlPKCT0BOPISmVtVu7adNcMI374D6Gl7/1Aapileem7FI7FpS3FhX L/4o0W7WPM9aHvgC0vr79hQadBiIZeQHFYkrJSXJTeMmOfhZLZTKYHZEnANzU7dkGPSQabx8z3JHY XtnC/L3+Ue485XTcmee6Z98iPU8zw1dHFKHWG425Fv4V6+hwltMRcXCGLgLJEEXCPSRpbc+gLe3Mt IcsaxOg4ZiZazSaHHh3YPY2Fo/PfuUefKPudEEue1SOVYBI9tXvXhUm7S2GNEI1sCS+gThC+5okq2 PlzpAavw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sZTCY-00000004mLY-16d5; Thu, 01 Aug 2024 10:38:30 +0000 Received: from mail-lf1-x12d.google.com ([2a00:1450:4864:20::12d]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sZTC4-00000004mEO-1bRQ for linux-arm-kernel@lists.infradead.org; Thu, 01 Aug 2024 10:38:01 +0000 Received: by mail-lf1-x12d.google.com with SMTP id 2adb3069b0e04-52f04c29588so11747254e87.3 for ; Thu, 01 Aug 2024 03:37:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1722508678; x=1723113478; darn=lists.infradead.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=6auF9SihaRv0NHeZgPwWgcp87LY5pPO2A6cg+JnSinA=; b=WRBuJiWmqkMvH3wqsA3TtrU3SC8jzqf/JnFIJmS7F8AAxXYRJlbTvzg5jN14Orplfp tJCp/SnM3XeeUULNQ9D3oqamAfqwtIy8VYR++rJn6l8FpOSNR97fZdf/IpHpLKS2uAHJ CZ8iIJ0HsNJpxEjmv6IFt8gSa0ymcOxFAMD7w/SPC+ItqmGu4SYnWYmBH6wOiEaCEUtI OOoEQ0q8dzuWNIkMBrOJmMMItzBdfwXDbanJItxIqbTUzRFj+9H/BhkhGshmmaJOMZ1X splm2Kn4opauFLQVjVtZ5Sa+5E38UctFoj7lbSbRHWR8J1sJjLRBjGNNPFuY9dAbnGNG UXmw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722508678; x=1723113478; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=6auF9SihaRv0NHeZgPwWgcp87LY5pPO2A6cg+JnSinA=; b=S6yxn9S18zpWW2it2c9XlWGT4I1OYGm0jOj6sO8pchmjaH6ZdpqXQTMx7ZYppDaiXP wr7mNIg421S+OsdMBph9SCK3RG7RJ7xnhqm/akzmiulP5VIktskf7e7d0a0rBNqXrds6 kf5NhwM7uzx2BvsCS32sDU+hfCMyfK9EeTkBi351VtPhCQvaOHQ+3BBBC5+aOKmMoyzz IPqP4Z6ekAiFh6hqqJ2DBJcDvB27hvmnZgNtnvv73ifF6C0JMqPo7unefgt+asvX9mek C32DTknq0qCA+ihuQc1aksrcsTxA6kpN7Zcjv0Oo/oFDkemxx5070xu48wmE/8MZjFZk bHqg== X-Forwarded-Encrypted: i=1; AJvYcCVId1AXSx8v/pBXcXqUzgTdLDLYjbXQ4iJhNuQ3uzJmRW3KzIaEVnw0YKlSaPRN6pO+VASQBPXAnPj4P5CBhyktNU7TxGGUES9Mz8Ds5dclV+2HSl0= X-Gm-Message-State: AOJu0Yx6rTaAfO29ZGRT6J+/UdHSEUE6WsO4os6z/FFRStwU1vxU0YEx ueJfHRtvVytw5fUTn/PqBCNpcjMQ1Igjfst4ZpPSrrJZbX5mYUai X-Google-Smtp-Source: AGHT+IHUQDe91xXDzoxuK90Fn56g8aZCSk7RPm/BkRWjmCrRl2zyPkAPw1H4PF0CTu3AaisIzJvq9w== X-Received: by 2002:a05:6512:b96:b0:52c:88d7:ae31 with SMTP id 2adb3069b0e04-530b61ebe2emr1506606e87.48.1722508677700; Thu, 01 Aug 2024 03:37:57 -0700 (PDT) Received: from [10.10.12.27] (91-118-163-37.static.upcbusiness.at. [91.118.163.37]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a7acad416d0sm875712766b.101.2024.08.01.03.37.56 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 01 Aug 2024 03:37:57 -0700 (PDT) Message-ID: Date: Thu, 1 Aug 2024 12:37:55 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 1/4] coresight: cti: use device_* to iterate over device child nodes 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 References: <20240801-device_child_node_access-v1-0-ddfa21bef6f2@gmail.com> <20240801-device_child_node_access-v1-1-ddfa21bef6f2@gmail.com> <381fd199-640a-4ca0-8d7e-1c4dae11ef7f@arm.com> Content-Language: en-US, de-AT From: Javier Carrasco In-Reply-To: <381fd199-640a-4ca0-8d7e-1c4dae11ef7f@arm.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240801_033800_441652_B16BA4B4 X-CRM114-Status: GOOD ( 17.81 ) 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 On 01/08/2024 11:20, Suzuki K Poulose wrote: > On 01/08/2024 07:13, Javier Carrasco wrote: >> 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; > > Don't we need to fwnode_handle_put(child) here, since we removed the > outer one ? > > Suzuki > Hi Suzuki, No, we don't need fwnode_handle_put(child) anymore because the scoped variant of the macro is used. Best regards, Javier Carrasco