From patchwork Fri Aug 16 15:09:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 13766485 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 BEF48C3DA4A for ; Fri, 16 Aug 2024 15:10:12 +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: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:In-Reply-To:References:List-Owner; bh=6Y/2/2QPjp2CCrGuI9Ms5NRey/T6m/cyuOy2EaBJqus=; b=afe1+hN2DguJ5HEl190QJIHaKO QdqSCf9F4XJdVjKbKzGTlQRV08GnvzpcmIDaaJ0pyHmKgQXbT997GIciueEAm5hoVlRTVirqJo4p0 u0LfsMhsRhmcff26UV4KA3h8cjnmp4mv/rHliQSG4zSGlg2CiW01B5hggrWsDagR5+wh8uvDt9GDw EfWOT4+lg7Dc8/qrOeB9AsgDMxvo7jlKrMJXE3Qkfc2md1rvU7fzFzq0K3D9OYxIYZf6OcdI6oL5s 5/ZTkrIdIun9I70ncVd9Y5V0uLzNLsGTfdDHVO4GCSa3urQG2Fl1HaGk3KS0iTxGstNwSO3kNIDV8 PsZuXmlA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1seyaT-0000000DKAl-0Z0E; Fri, 16 Aug 2024 15:09:57 +0000 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1seyZn-0000000DK22-2Bfz for linux-arm-kernel@lists.infradead.org; Fri, 16 Aug 2024 15:09:17 +0000 Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-428178fc07eso14537365e9.3 for ; Fri, 16 Aug 2024 08:09:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723820953; x=1724425753; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=6Y/2/2QPjp2CCrGuI9Ms5NRey/T6m/cyuOy2EaBJqus=; b=t4i3WIU9QpH9oRqNToGZjDGhG2f39Fvt1bvDRfs6CF5PUG7FfMsjWydI5wFu9mMmir PZpPMmlRa2rHh1yNWrVd2YhQwkFow7LyvIufbOxvHZpN/59VAV7cn7BA0q7G+NsGWpaC XJmVLLg3zLcITbLWKv/QxnwOmM2D2BJex+zkk0REfLNHckMPGbNBw56dFzuGEDXKwcqC Uw5Qqvad7PeiXTMTFD+Zo2WbJ28FvG85LwATrtaU3CrMSFUXaT+idNPLwjix0rsnV/4C RlVtajY95hftDYJT2G9QIgInKUMJKiWGi95IzFP/Fss3xRT9I3SA3SjN+Vprrbf9QMJ7 BKxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723820953; x=1724425753; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=6Y/2/2QPjp2CCrGuI9Ms5NRey/T6m/cyuOy2EaBJqus=; b=LL65Kf39c/j9oB8Cw9UrCWorydSsmxz7eQdNb4/Pau3fLvB0toU20QoBHO8BnUz87z QYI7YYaWxT4hY61W9qpL4W/nKpb2QCmS36eLdOvgMDJi3v3JkkTap++gylDlhcoKoneh 0b80JX+WTvGwErASxEi+dwEnBFH+XUODd2tiQvnbfZpJv5bQyt59vuAe9hnUw44emGTU K9e5qqcQQ4ToisNpV5z0S6crdLJsJ3wuWA+M0pv78gCwPiB61O5zukOqiY2/xRPiMkHq bQrDHLktQWW871f9DLD54VRsDxQB8zsrAhJYQPtKyBcZA/3xPWaqjvN7gmfFchzosWKs hSQg== X-Forwarded-Encrypted: i=1; AJvYcCXepTupb+3tfRZB8UZPO5lW2NAdOgyqa/KzH65odXgW40ks8co006PUk7UfHg+Ya6S+JPqbrJVNDisxF4Mqjx8yKIr0NIwXatYqZF/5+vNYMX86t8c= X-Gm-Message-State: AOJu0Yy84CieHDlt6E2ZzuaYXS+o9IwfKgVJnQMPy3LqBK7Uyuy81PCL 4HKDipGIeqYQCtW0Dfzp7+3c2Z5oi3OfMF0VInfzAMMgQilf7GaXnzUqT2THAq8= X-Google-Smtp-Source: AGHT+IEGE7qid6bcOUge2vf5VRQJCQr3Rw2VNcuneDurrGavxMp9Iq5a+wqkSQwkgJJSGl/zhKx/UA== X-Received: by 2002:a05:600c:310f:b0:426:5b21:97fa with SMTP id 5b1f17b1804b1-429ed7e432cmr25613225e9.29.1723820953137; Fri, 16 Aug 2024 08:09:13 -0700 (PDT) Received: from krzk-bin.. ([178.197.215.209]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-429ed648f3fsm24984675e9.6.2024.08.16.08.09.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Aug 2024 08:09:12 -0700 (PDT) From: Krzysztof Kozlowski To: Mark Rutland , Marc Zyngier , Daniel Lezcano , Thomas Gleixner , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Krzysztof Kozlowski Subject: [PATCH] clocksource/drivers/arm_arch_timer: Simplify with scoped for each OF child loop Date: Fri, 16 Aug 2024 17:09:08 +0200 Message-ID: <20240816150908.142142-1-krzysztof.kozlowski@linaro.org> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240816_080915_672174_83965895 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_available_child_of_node_scoped() when iterating over device nodes to make code a bit simpler. Signed-off-by: Krzysztof Kozlowski --- drivers/clocksource/arm_arch_timer.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm_arch_timer.c index aeafc74181f0..03733101e231 100644 --- a/drivers/clocksource/arm_arch_timer.c +++ b/drivers/clocksource/arm_arch_timer.c @@ -1594,7 +1594,6 @@ static int __init arch_timer_mem_of_init(struct device_node *np) { struct arch_timer_mem *timer_mem; struct arch_timer_mem_frame *frame; - struct device_node *frame_node; struct resource res; int ret = -EINVAL; u32 rate; @@ -1608,33 +1607,29 @@ static int __init arch_timer_mem_of_init(struct device_node *np) timer_mem->cntctlbase = res.start; timer_mem->size = resource_size(&res); - for_each_available_child_of_node(np, frame_node) { + for_each_available_child_of_node_scoped(np, frame_node) { u32 n; struct arch_timer_mem_frame *frame; if (of_property_read_u32(frame_node, "frame-number", &n)) { pr_err(FW_BUG "Missing frame-number.\n"); - of_node_put(frame_node); goto out; } if (n >= ARCH_TIMER_MEM_MAX_FRAMES) { pr_err(FW_BUG "Wrong frame-number, only 0-%u are permitted.\n", ARCH_TIMER_MEM_MAX_FRAMES - 1); - of_node_put(frame_node); goto out; } frame = &timer_mem->frame[n]; if (frame->valid) { pr_err(FW_BUG "Duplicated frame-number.\n"); - of_node_put(frame_node); goto out; } - if (of_address_to_resource(frame_node, 0, &res)) { - of_node_put(frame_node); + if (of_address_to_resource(frame_node, 0, &res)) goto out; - } + frame->cntbase = res.start; frame->size = resource_size(&res);