From patchwork Fri Aug 16 07:40:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 13765636 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 E2FE7C3DA4A for ; Fri, 16 Aug 2024 07:46:46 +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=NpiLIHd7RwewW+o/fTDGbmxF9iEJfCFxBRNxKUku6uc=; b=FdNySADITad8EyNUkTnUBhc443 BYqYAmx0SZnISkxx9NU9d7fEWRQGNvTyiXKO5YH4PSbbjPkJFUj8Bq+om1dc43EO2KOlBlHVqytfn E2AjkGrMQtc54T8l8kESV/ZkQBxI6OxmXNdWuKJWYkuj4SXvdw/SV9jEFngidTaxyzi8f/a+mUQOB vV/7vO4MPHaHFssiiQPdcx0MTH8kPwaPqfzsWwENITaYbrv8ESILfCSjpLhODKIWlzuNLB2c+Tszp Y8tt8WqzoFAbHB60Gw0GG9WNMptnuyOHm7utTP3Dp0F0nLiehkgiiSCcnjjqHT4GwW+CIiCIslSL0 +26Z4SXA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1serfK-0000000C9Pz-0qhH; Fri, 16 Aug 2024 07:46:30 +0000 Received: from mail-lj1-x22a.google.com ([2a00:1450:4864:20::22a]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1serZt-0000000C82g-3dNM for linux-arm-kernel@lists.infradead.org; Fri, 16 Aug 2024 07:40:55 +0000 Received: by mail-lj1-x22a.google.com with SMTP id 38308e7fff4ca-2eeb1ba040aso24096531fa.1 for ; Fri, 16 Aug 2024 00:40:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723794052; x=1724398852; 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=NpiLIHd7RwewW+o/fTDGbmxF9iEJfCFxBRNxKUku6uc=; b=NJdsf8SxTlUGTLv8BapW5V/8Fu7IywtkE6ZFIXTZfbCdo9dLeXdT2PZSB7tgHYaDoR MNKp7+lHsYBZUnAFLqlnPjf4N8lMp/k+eYlQmWuCS0im7ROQ1eZny4F/XTUEFw0W5hms K83EswI8IWTRC1BOoxleWR28Eci4aZRNP7Lv3MinJIW9JkMZwI0tHJ/yxHDt8NwFyedI 3bQuVzw3NfeemB0GbLJCph7P0qKzIx89XEE9SLdGIGT+/7Oh32bg/AhNbZWI1LTgM3EB M3YGL16Df4jIHamb4iKKJK9/FpPNAmKTKaToB0CHD5e7kTR81LJscbtZ6G5NxUKwgIYH GKuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723794052; x=1724398852; 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=NpiLIHd7RwewW+o/fTDGbmxF9iEJfCFxBRNxKUku6uc=; b=S375+gxWCWyI0wZp3H0TyGfkoctpmLVfv2hTRYjMjCLaUtId2+AqYT4F+AJh21JvxZ 0mMrIopwz2x2vW6mGqjY8uT7FfwteKtVxvQDxC/ptvpD4/YHlBVAjgd7Nbh4mra57e44 vAEUzNRwPIS8plqDOKxw5OXYY+/Cjxg4FgCc4k1dh57UBPlfsQljVtUp52GMvbsJrEGL 7ZK4qaTuKDB6Nxu7grRjZJCxdlUV8aPyU+8x4I9uWcS0P6uO08t3RkrrtUX/QdT5oOqZ I4xH6FXuK667UGSfNhQDoFaAmOeyjDwMDHoCYYIc7gJrnRoLe/Yji4M3/Q+LCrSsoNO6 dOLw== X-Forwarded-Encrypted: i=1; AJvYcCU7bV+u/ZNV3BFgJ6kaP1bs7lePWiIxP0h6dbJ6fSZW2W0pg8p2ubgK64aJFerxrWGecdYy8t+Dl4SS3hSLFuiXn2UOr7jpevDwY+UVs1SCbXZrEz8= X-Gm-Message-State: AOJu0Yz6TMY65D+AxFtGc9j9R3bMdEAQR9cc4PEq9tupaX3p2jqK2ump KDDO8TaOzGClpiqApbRsDY6kCFQdTuRahm+ntOfCunJ31ZBSUa0oyAEel601P0E= X-Google-Smtp-Source: AGHT+IELCc+OCzcJ/Js9NwPDwHfifOzvE4gl8BthiWmIBR2Eaem8CWHrHiKiF111j3uXtD+30pxdXA== X-Received: by 2002:a2e:a99d:0:b0:2ef:2490:46fb with SMTP id 38308e7fff4ca-2f3be5f59femr14797761fa.37.1723794051688; Fri, 16 Aug 2024 00:40:51 -0700 (PDT) Received: from [127.0.1.1] ([178.197.215.209]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-429ded3596esm68549625e9.22.2024.08.16.00.40.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Aug 2024 00:40:51 -0700 (PDT) From: Krzysztof Kozlowski Date: Fri, 16 Aug 2024 09:40:34 +0200 Subject: [PATCH v2 4/7] thermal: of: Simplify thermal_of_for_each_cooling_maps() with scoped for each OF child loop MIME-Version: 1.0 Message-Id: <20240816-b4-cleanup-h-of-node-put-thermal-v2-4-cee9fc490478@linaro.org> References: <20240816-b4-cleanup-h-of-node-put-thermal-v2-0-cee9fc490478@linaro.org> In-Reply-To: <20240816-b4-cleanup-h-of-node-put-thermal-v2-0-cee9fc490478@linaro.org> To: "Rafael J. Wysocki" , Daniel Lezcano , Zhang Rui , Lukasz Luba , Amit Kucheria , Thara Gopinath , Thierry Reding , Jonathan Hunter , Vasily Khoruzhick , Yangtao Li , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-tegra@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, Chen-Yu Tsai , Krzysztof Kozlowski X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=1310; i=krzysztof.kozlowski@linaro.org; h=from:subject:message-id; bh=9M5ntznKTX5NDEFACMt23t7+gXPt/dasJVMFbG8WF/M=; b=owEBbQKS/ZANAwAKAcE3ZuaGi4PXAcsmYgBmvwJ3KbC+CIW/wgMP/qsQhWUwSxbE78dCD5pPL pLwIbQ3KvGJAjMEAAEKAB0WIQTd0mIoPREbIztuuKjBN2bmhouD1wUCZr8CdwAKCRDBN2bmhouD 1wEiD/9ZPNQh9CCdAjJ7tvBzsxq+KQKtvaWC/fQDIECn5V/X2lAA0i7fPqDihwYNGci0qdbP77c nGwvi5k79aqQ/K9EHna3OBQR343woYrPjcIQ/3kYcvzY9DdqIXbNaGVHtypT154nMeZysDY1jbd ZxM2XiVBivBQvsad9X21O6NKdbP3u6KvuLXNj6aaIJ0gPQYU9/PInP2wU/21gIYSAZTsVLEwxaf 9Gb0c87Irgoq1zyV/6LIzngJVoJtQavHuWHgA66hTlAlYhZYAqq/TTUsJzNP2tWmEVUVz7qL8rw 8nGc9pL64W+FFW2EvNgZNbFFT42DsghleR66MnBH/hMxcLpyg4lYtAt6Nzd6kHBYzexQzp2Tq3m dXNHetyc4N0Qg24s02eeR8eILN/iHrAKJAhYEPuLrRNODZs3yBDSk+ZxJJ78w2B/I7jRDiwTnaj fZxW9te26WMReCULmYh/TV3wBj/O2qgl8ZwEogLuB5xZ3fEqfBnHRfT5mIGSzJ4YG85T+K/hJMR ayrpjXDymP7W+xnSv8auBecvBDVuTBMeHWvoxaSIf7jqrathAKibinrv5qi8KU2uG4A2i6rQtZ+ 2QlPWRmMoyiFKZdF+ylcC+RC2TyCdKGZLQFkq7SwSQXMs2KTP358oSRs6MeyTky/OfRLPvq+Xy5 52INWgb0WAFW/4Q== X-Developer-Key: i=krzysztof.kozlowski@linaro.org; a=openpgp; fpr=9BD07E0E0C51F8D59677B7541B93437D3B41629B X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240816_004053_940422_5C1AEF0C X-CRM114-Status: GOOD ( 13.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. Reviewed-by: Chen-Yu Tsai Signed-off-by: Krzysztof Kozlowski --- drivers/thermal/thermal_of.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/thermal/thermal_of.c b/drivers/thermal/thermal_of.c index 94cc077ab3a1..ce398fde48bb 100644 --- a/drivers/thermal/thermal_of.c +++ b/drivers/thermal/thermal_of.c @@ -373,7 +373,7 @@ static int thermal_of_for_each_cooling_maps(struct thermal_zone_device *tz, int (*action)(struct device_node *, int, int, struct thermal_zone_device *, struct thermal_cooling_device *)) { - struct device_node *tz_np, *cm_np, *child; + struct device_node *tz_np, *cm_np; int ret = 0; tz_np = thermal_of_zone_get_by_name(tz); @@ -386,12 +386,10 @@ static int thermal_of_for_each_cooling_maps(struct thermal_zone_device *tz, if (!cm_np) goto out; - for_each_child_of_node(cm_np, child) { + for_each_child_of_node_scoped(cm_np, child) { ret = thermal_of_for_each_cooling_device(tz_np, child, tz, cdev, action); - if (ret) { - of_node_put(child); + if (ret) break; - } } of_node_put(cm_np);