From patchwork Fri Aug 16 15:09:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 13766495 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 6BEB2C531DC for ; Fri, 16 Aug 2024 15:12:44 +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: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=MbmbkUcCYIXjsRgrPS/3FHLQvhhOEq6OSnn8VLc5BA8=; b=wJP9Co5g9uzWgh9+UAZ4Ux2/+b 10fhIW0rMj0ZzGc7w8v4mB27wuHqsdn4oDOEyu9gZxs+Iy2PQNORcKbdhL1ZkzH/p/UMTdnZQmBcj hyP6c0Zx0vWgwGZQRxDf3v65+Idu0UyGnumLVEVNUjpsYZkg9N0z7JYiPq3jRyKJmOgxZl4oINVuD XQGX4NggyPdim7+i0g8COFjzvU4Fgj4yOkbXTXS5Mf8u6Y3N4g8WlkpwFXMWqL3i7whe3Kya3OAuc pcKL9b46/NYf2B3LYgTuNzVUMss8bQW864U/Psym8J/PWMkkTq6tRa31zpo998usU/SRc3OBwTInZ 7FkxfGLg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1seyd1-0000000DKtA-26UT; Fri, 16 Aug 2024 15:12:35 +0000 Received: from mail-lf1-x134.google.com ([2a00:1450:4864:20::134]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1seyaE-0000000DK73-1zGN for linux-arm-kernel@lists.infradead.org; Fri, 16 Aug 2024 15:09:43 +0000 Received: by mail-lf1-x134.google.com with SMTP id 2adb3069b0e04-52f025ab3a7so2852930e87.2 for ; Fri, 16 Aug 2024 08:09:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723820980; x=1724425780; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=MbmbkUcCYIXjsRgrPS/3FHLQvhhOEq6OSnn8VLc5BA8=; b=mHRvDzTzdgmudZpBGlJEM/ParpBDycNuROUUUVExHq8L2jWios/oHcG9ysS2cICG7N HVKLd/aow6v7op0mdT8r5AeMOGmsNrD8XZoY5ZS7zOm5onLBr8JGi+IYrvLrU6Aslg2O Sle5dYCso2o9YJ+cjvuLF3pVslua6wJQZ8NO+pBf0X6ir7vdBbFFmtXpT/vy7prTgQY3 8Lh6ZGU8yoGEEVDZfoIEjsZ4D0pmGuQvDcx0z5mfNOnsPGHCMH2oOlSvSMJAzLJqCxH2 pNpvnOwDaVSROhWLkfP3lhDXgmR4xoKLb2HP16nrONcHp+Nu+nK+hZYPTFedNBUAR8MJ 0M4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723820980; x=1724425780; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=MbmbkUcCYIXjsRgrPS/3FHLQvhhOEq6OSnn8VLc5BA8=; b=qBA94YhAt46xJfS6Nqh2agQLiOM2eufqeIpnxei0xd05hMxMN2AD+HJ8DCrDAPMgQh 1NTtal7Z18BekP5PrvxvChVgpRjGwmqxNH/BjYhLOw59xgyzNL962CBMPl3xF7LQ9Kfb I85xtJWCJ3eoIN3q2h9VN9rFfHXYGcB0F0nn8OeawOp/k0bza6UEGL/f31lOT9BF7Gs+ Lq0wCgXAbTbqXJOkrQFvLIvt9moKAOcGq/NSefdgPlXJho+F5kdY261iNo2+IjxA2hVO 50p5D/yO7W27bugcrx08NRY2grJRnYO2/TBvv2CvllbPBIoxSIdTvH5rrp9MplozIt7Y 1dqA== X-Forwarded-Encrypted: i=1; AJvYcCW+n1oxjLmJRAh7GFQyWcruEIYATzyKZLE+OePdc/60aW1GaMaE73Md75tGFTzzPaDYiSZhEUQgmL21/XajUZT9cz2AgUEcMJTpMTciU529Wo4B5PQ= X-Gm-Message-State: AOJu0YyJeAU6jWRd5IF3HLS9XLrEs0QdEJsXQXoscs6XBOU+aabu+9+5 FgsoVGMtYpWvmmx42dT4s24Gifc6v8Kdwx9m57WzaOJikkZkAh/5mSvr87y+m/g= X-Google-Smtp-Source: AGHT+IFmY/sEGKzTKMYSCVLBNr0cmG/bAj/lYGZIFzFIBymPr4dUDTzJ6fAp0qTNkGSzAxbZDMsqbw== X-Received: by 2002:a05:6512:239e:b0:52f:c0ee:3b5f with SMTP id 2adb3069b0e04-5331c691494mr2172309e87.10.1723820980087; Fri, 16 Aug 2024 08:09:40 -0700 (PDT) Received: from krzk-bin.. ([178.197.215.209]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3718984993fsm3808758f8f.31.2024.08.16.08.09.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Aug 2024 08:09:39 -0700 (PDT) From: Krzysztof Kozlowski To: Ulf Hansson , "Rafael J. Wysocki" , Daniel Lezcano , Anup Patel , Paul Walmsley , Palmer Dabbelt , Albert Ou , linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org Cc: Krzysztof Kozlowski Subject: [PATCH 4/4] cpuidle: dt_idle_genpd: Simplify with scoped for each OF child loop Date: Fri, 16 Aug 2024 17:09:31 +0200 Message-ID: <20240816150931.142208-4-krzysztof.kozlowski@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240816150931.142208-1-krzysztof.kozlowski@linaro.org> References: <20240816150931.142208-1-krzysztof.kozlowski@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240816_080942_535740_66657E01 X-CRM114-Status: GOOD ( 11.11 ) 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 Use scoped for_each_child_of_node_scoped() when iterating over device nodes to make code a bit simpler. Signed-off-by: Krzysztof Kozlowski Reviewed-by: Jonathan Cameron --- drivers/cpuidle/dt_idle_genpd.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/drivers/cpuidle/dt_idle_genpd.c b/drivers/cpuidle/dt_idle_genpd.c index 1af63c189039..203e9b754aea 100644 --- a/drivers/cpuidle/dt_idle_genpd.c +++ b/drivers/cpuidle/dt_idle_genpd.c @@ -130,11 +130,10 @@ struct generic_pm_domain *dt_idle_pd_alloc(struct device_node *np, int dt_idle_pd_init_topology(struct device_node *np) { - struct device_node *node; struct of_phandle_args child, parent; int ret; - for_each_child_of_node(np, node) { + for_each_child_of_node_scoped(np, node) { if (of_parse_phandle_with_args(node, "power-domains", "#power-domain-cells", 0, &parent)) continue; @@ -143,10 +142,8 @@ int dt_idle_pd_init_topology(struct device_node *np) child.args_count = 0; ret = of_genpd_add_subdomain(&parent, &child); of_node_put(parent.np); - if (ret) { - of_node_put(node); + if (ret) return ret; - } } return 0; @@ -154,11 +151,10 @@ int dt_idle_pd_init_topology(struct device_node *np) int dt_idle_pd_remove_topology(struct device_node *np) { - struct device_node *node; struct of_phandle_args child, parent; int ret; - for_each_child_of_node(np, node) { + for_each_child_of_node_scoped(np, node) { if (of_parse_phandle_with_args(node, "power-domains", "#power-domain-cells", 0, &parent)) continue; @@ -167,10 +163,8 @@ int dt_idle_pd_remove_topology(struct device_node *np) child.args_count = 0; ret = of_genpd_remove_subdomain(&parent, &child); of_node_put(parent.np); - if (ret) { - of_node_put(node); + if (ret) return ret; - } } return 0;