From patchwork Fri Aug 16 15:09:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 13766494 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 188D5C531DC for ; Fri, 16 Aug 2024 15:12:07 +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=td2rg5GyKlqce51WO+zvnPs34jMkYsAdv+WksjCyFsM=; b=ii3Lbcx23yLfp27Irp0LZOUXzW cKZdbhHL/6ciOxKbHq9sJjj4HzrtKJWlc0XoFRQnENbtnfASuE3fmP39zi9pEHrpfR/V908LJo1ij hHCOhpciQfU0VIO2TwpsvuXKIXGeFrJi5sf5yagffhhWeZG86IB3jeIJ8IX4E34L0EUL8EyY3TjAY CI2XKxWv8/o4BAPAN9D12r7F+MCT3QKJmK5ChF91danDZpJ0FEQfx551635mt8aQ1/xibRZPX30HG 7HaJI8Vz8ToKH/oWcXBlUeMxrxLv1mcluhRP+xagJ2tDoRljn9P2QHIkPMOxIinWBDjXi3z5CAQyc K+1SfA2w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1seycN-0000000DKhd-2ZE6; Fri, 16 Aug 2024 15:11:55 +0000 Received: from mail-lf1-x12f.google.com ([2a00:1450:4864:20::12f]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1seyaC-0000000DK6n-1ZPR for linux-arm-kernel@lists.infradead.org; Fri, 16 Aug 2024 15:09:41 +0000 Received: by mail-lf1-x12f.google.com with SMTP id 2adb3069b0e04-52f025bc147so2499307e87.3 for ; Fri, 16 Aug 2024 08:09:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723820979; x=1724425779; 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=td2rg5GyKlqce51WO+zvnPs34jMkYsAdv+WksjCyFsM=; b=bNfNsL9V2FrInMEeMggdtLpO9JhTYBrK4l80P+Jyiowx/byws7KmTXL7V5oNoeO0XR MjpcfiiVZO50ItZ0pEMChBPaKiYQx1PjBs3F3MZRJUIY2pS5Zg7VKnwZjBj1+6AJHGuE WjTbXiANasVieYb0RYT8mCK38FioT1UuC3B/pJ6aeiul7j93QzUhlLOxFKGgSatrIkob J3IjWs7xk/RZZ8DdONVR5Pb7ukEe2Jrg/hL52ANAmoHcZWCQG9D9KjlfxLmQ1aG4VD4C pkJGHN7pgiB5r5WRGHqoPTGekDG/Puy7dSnJc6jaGuUWP4n5l2FeQE996ngTBlMjeC1O lLzg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723820979; x=1724425779; 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=td2rg5GyKlqce51WO+zvnPs34jMkYsAdv+WksjCyFsM=; b=NSv7zzMiIMeKXaQt7OXyRoRXQ6ab03M61R37IXpTimf80UiLpNnVh4/I8TxigusGu5 fhLzbRQhYij4Z1isnU0BKJqEgw3y8/rrw/8JwaVqid3z50OEO82nMtiesXWL1VgxugYt wjm7Otp49AzbiJl2hHgOnj/6a6/mXGkfco/3kGOeuF4WZlJgKCqqRJsuNerv5dr9Jnwj d8oAMxP3JmkuZEl7NDzBeOjEbqrtyKDDVMZ9vv+0uUos4F/L+yHLRkK/K2CZU/h4IFXl eOcYuHGATTfVBMnTBFdXfj/SL+GrZ4D8LYWZ3bU9jnoNadYE31G1nqaQMV/h0x/N3BXE 6WJA== X-Forwarded-Encrypted: i=1; AJvYcCUjK329iYy6kDyI0nc6i79LdGpPunpAGnUQEnJR8JHYkMyM03KcixTZI7T7kAmtfaxnVOt/8nW81bs3pLfa7zDF+KlN2In1ewPtgdOSzBnuk9sVY3E= X-Gm-Message-State: AOJu0Yx7xtjnImcu3rl4ukVer5B1AmEPtfqyPF0UjIlRRiloPs0ukATM rr3QxWCh+ERXl2HhZgBBtjqMHCmaMaSPikA3pM+UAFlxFA3cZm/3wxagOswx3sA= X-Google-Smtp-Source: AGHT+IHaJrVe+YG7WrIsIhySz+TrI0z8q1N6+97MbyrpU5ReE7HuOkmva7Y8+xgV05N9m9+gUaX3EQ== X-Received: by 2002:a05:6512:10c2:b0:530:da95:b54c with SMTP id 2adb3069b0e04-5331c6acec2mr2537162e87.23.1723820978496; Fri, 16 Aug 2024 08:09:38 -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.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Aug 2024 08:09:37 -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 3/4] cpuidle: riscv-sbi: Simplify with scoped for each OF child loop Date: Fri, 16 Aug 2024 17:09:30 +0200 Message-ID: <20240816150931.142208-3-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_080940_432039_6A8BA031 X-CRM114-Status: GOOD ( 13.20 ) 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/cpuidle-riscv-sbi.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/cpuidle/cpuidle-riscv-sbi.c b/drivers/cpuidle/cpuidle-riscv-sbi.c index 5bb3401220d2..d228b4d18d56 100644 --- a/drivers/cpuidle/cpuidle-riscv-sbi.c +++ b/drivers/cpuidle/cpuidle-riscv-sbi.c @@ -448,7 +448,6 @@ static void sbi_pd_remove(void) static int sbi_genpd_probe(struct device_node *np) { - struct device_node *node; int ret = 0, pd_count = 0; if (!np) @@ -458,13 +457,13 @@ static int sbi_genpd_probe(struct device_node *np) * Parse child nodes for the "#power-domain-cells" property and * initialize a genpd/genpd-of-provider pair when it's found. */ - for_each_child_of_node(np, node) { + for_each_child_of_node_scoped(np, node) { if (!of_property_present(node, "#power-domain-cells")) continue; ret = sbi_pd_init(node); if (ret) - goto put_node; + goto remove_pd; pd_count++; } @@ -480,8 +479,6 @@ static int sbi_genpd_probe(struct device_node *np) return 0; -put_node: - of_node_put(node); remove_pd: sbi_pd_remove(); pr_err("failed to create CPU PM domains ret=%d\n", ret);