Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp699876pxb; Tue, 5 Apr 2022 19:19:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzbAbdeaUEtXLG7LPabtX3X/sruopD+ZNx5RPEMLAcR58XhcmtfNUkJRnmVy4TcWBGF9rhs X-Received: by 2002:a63:330a:0:b0:398:22e4:3e34 with SMTP id z10-20020a63330a000000b0039822e43e34mr5275321pgz.349.1649211570280; Tue, 05 Apr 2022 19:19:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649211570; cv=none; d=google.com; s=arc-20160816; b=rbotqfoLpwPYht38YChvEj9IrLYSlAR5Bo5wAzdyYx87mVqCAbxvqwobpLQNVttW6T EfexvA+ZvxG6o7J164f9ZGunuBDi0gd3m5ZMcxXrnJ+ZOYEv4iSjgPE/GCLhfCXtK2Nq yNXx3K8KMGAK0RiwldcMcQec473Aqy3jhaUJ/0gYW93iOnTxLIVLfEWCRUEJkoM2Oqjl sQ/mqciJfct32LGQxTmFmI7JJsdcXD/zvURKaYQ9AFYpsbakNnW57ViIvbt2v44S4mA8 yIggXrnEugV31iQ/IQW7hSkfKAPRVze3bwKVgLXvVG2arx1pCow6UhzJhwKwkd0iDVPB jYfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=gMFvNrJ+0tgK+QwHGUQGQApE55Htc5mYds92kuBraEw=; b=yRwr+6iHnGbwQwUgshkV/+tTvhfyGj5ut8JHFIGypxDpZkGxz/ArOCoLGwWbF8Ed9M 6T8h9uijRP0x7VmDaHA6+35Qsfp1s11gq6dEfNhqZabz0NA90QCiaiYyZrDzYyj20GoP YUdkUgfRsikZ2vmuro6xmv42lwmpilFIP73jOamFNv1/Vqk9ec9K9kYn9gag02xH1f/p wTDFT+4QMH5ijms6TQaLKOpg7dVHkkP+v5SU4TolG6C78WEcMdxpa0XnVxoAPza+Zdew r8y78sKvIfpZw1ibxIgWmgR6GhFmkoD7V307VuqXbXr4jhq2RlCvMAkH02CZXU1fAs7n PA6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ThAiFEGc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 9-20020a056a00070900b004fb2e2495e3si12757838pfl.252.2022.04.05.19.19.10; Tue, 05 Apr 2022 19:19:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ThAiFEGc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1356165AbiDEMJr (ORCPT + 99 others); Tue, 5 Apr 2022 08:09:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53834 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244693AbiDEIwe (ORCPT ); Tue, 5 Apr 2022 04:52:34 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 01690D8F4E; Tue, 5 Apr 2022 01:42:04 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 8B1F1B81C15; Tue, 5 Apr 2022 08:42:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D6CB0C385A1; Tue, 5 Apr 2022 08:42:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649148122; bh=bgJm6wH0LQOptKnK7GXaPPAhDXn78DplyNlwQZkCo08=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ThAiFEGcpxZFgDgk7K5QyAmRfLQ+bs1BBNyA0z82tZPtWHz39VTWuzisUNDyXJWAo fr4M7jBOm2pqJCbLfcgH3miuhlpmusBNSSoPZoJ+fK4mcY2YPSrnP25EyaTp+pAf7J m6Ei8yUXujmF7HhRk35hiXyXPhZVU1zdhUjZzKTk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marek Szyprowski , Chanwoo Choi , Krzysztof Kozlowski , Sam Protsenko , Daniel Lezcano , Sasha Levin Subject: [PATCH 5.16 0242/1017] clocksource/drivers/exynos_mct: Refactor resources allocation Date: Tue, 5 Apr 2022 09:19:15 +0200 Message-Id: <20220405070401.441469213@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070354.155796697@linuxfoundation.org> References: <20220405070354.155796697@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Marek Szyprowski [ Upstream commit 7cd925a8823d16de5614d3f0aabea9948747accd ] Move interrupts allocation from exynos4_timer_resources() into separate function together with the interrupt number parsing code from mct_init_dt(), so the code for managing interrupts is kept together. While touching exynos4_timer_resources() function, move of_iomap() to it. No functional changes. Signed-off-by: Marek Szyprowski Reviewed-by: Chanwoo Choi Tested-by: Chanwoo Choi Reviewed-by: Krzysztof Kozlowski Signed-off-by: Sam Protsenko Link: https://lore.kernel.org/r/20211101193531.15078-2-semen.protsenko@linaro.org Signed-off-by: Daniel Lezcano Signed-off-by: Sasha Levin --- drivers/clocksource/exynos_mct.c | 50 +++++++++++++++++++------------- 1 file changed, 30 insertions(+), 20 deletions(-) diff --git a/drivers/clocksource/exynos_mct.c b/drivers/clocksource/exynos_mct.c index 5e3e96d3d1b9..857cf12ebe57 100644 --- a/drivers/clocksource/exynos_mct.c +++ b/drivers/clocksource/exynos_mct.c @@ -504,11 +504,14 @@ static int exynos4_mct_dying_cpu(unsigned int cpu) return 0; } -static int __init exynos4_timer_resources(struct device_node *np, void __iomem *base) +static int __init exynos4_timer_resources(struct device_node *np) { - int err, cpu; struct clk *mct_clk, *tick_clk; + reg_base = of_iomap(np, 0); + if (!reg_base) + panic("%s: unable to ioremap mct address space\n", __func__); + tick_clk = of_clk_get_by_name(np, "fin_pll"); if (IS_ERR(tick_clk)) panic("%s: unable to determine tick clock rate\n", __func__); @@ -519,9 +522,27 @@ static int __init exynos4_timer_resources(struct device_node *np, void __iomem * panic("%s: unable to retrieve mct clock instance\n", __func__); clk_prepare_enable(mct_clk); - reg_base = base; - if (!reg_base) - panic("%s: unable to ioremap mct address space\n", __func__); + return 0; +} + +static int __init exynos4_timer_interrupts(struct device_node *np, + unsigned int int_type) +{ + int nr_irqs, i, err, cpu; + + mct_int_type = int_type; + + /* This driver uses only one global timer interrupt */ + mct_irqs[MCT_G0_IRQ] = irq_of_parse_and_map(np, MCT_G0_IRQ); + + /* + * Find out the number of local irqs specified. The local + * timer irqs are specified after the four global timer + * irqs are specified. + */ + nr_irqs = of_irq_count(np); + for (i = MCT_L0_IRQ; i < nr_irqs; i++) + mct_irqs[i] = irq_of_parse_and_map(np, i); if (mct_int_type == MCT_INT_PPI) { @@ -581,24 +602,13 @@ static int __init exynos4_timer_resources(struct device_node *np, void __iomem * static int __init mct_init_dt(struct device_node *np, unsigned int int_type) { - u32 nr_irqs, i; int ret; - mct_int_type = int_type; - - /* This driver uses only one global timer interrupt */ - mct_irqs[MCT_G0_IRQ] = irq_of_parse_and_map(np, MCT_G0_IRQ); - - /* - * Find out the number of local irqs specified. The local - * timer irqs are specified after the four global timer - * irqs are specified. - */ - nr_irqs = of_irq_count(np); - for (i = MCT_L0_IRQ; i < nr_irqs; i++) - mct_irqs[i] = irq_of_parse_and_map(np, i); + ret = exynos4_timer_resources(np); + if (ret) + return ret; - ret = exynos4_timer_resources(np, of_iomap(np, 0)); + ret = exynos4_timer_interrupts(np, int_type); if (ret) return ret; -- 2.34.1