Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp670210pxb; Tue, 5 Apr 2022 18:06:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzn6p234Lc0w5s9QvM7WkVyXnwmDOsE5ui0g7b6CiRlYJaOFrSxyhI0AEVzGx1HiF+Jy/rq X-Received: by 2002:a17:907:6d19:b0:6db:89c8:52e3 with SMTP id sa25-20020a1709076d1900b006db89c852e3mr6184070ejc.754.1649207176103; Tue, 05 Apr 2022 18:06:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649207176; cv=none; d=google.com; s=arc-20160816; b=TaO7I+ssFikAJhYCoiDkI72i2r3Vhbsb+ExYBcTz1IZLkFbO5vedxo/SdlgE8pAj2I 3KcSnT5qzDsPDFcsU0DweJ0TRYAvpLB70Ve9SiSGvGVGAYXPSAvESovrikFY9uDlP7GJ c+tO9hhEZMIZKZcGzqu3aL8MgFYOdSgCCrxvfogNDvXpBDIaO6J6+9V5ixpzO/yI6ibV k2c6DGl/SOmApBCUCuQ4Uz51eoKkVpIaaF8I/aEBPPbmyMEplOFp95t4QMGiF5xKQRiJ xwbaUWf1heREr/ZnAY9vVkbB2YbHT7NyKIosEb5TMvZ4elqUYCKTKROifO/jRFdaJvJ3 /HMg== 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=UhMEE8fcuPB/84yapSjGJbg/cS8fUbomcdNZe8KHz+DmQf3ppoR2H4I/VegGtoELZN oMgtlrwXthOshfdYb2/ufRxcc78fATQc/VaVT2BI1hyL2aiX0LJXx3+QPzAPsRSyr/rV XWLeGm8f+34bDP9xHb8mBlfN63Oxb3t0rOaMfW7tgEbS3J8iLzKQgGbg+t+x7TGFCeZp 1O9gEByF484Mrkt+hB/iqM2jalRlMrwnHakkgCU6+fGEIbRiB2OuqaQM5L7My5fwCFZC aKpBJH/sIS6jCSgjVDtjjobMRx/hclH3+tJQ+yVu5Kkom1czm28q+RqXu3an6GgrbJcv FoxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=LRTKb7mr; 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 b10-20020a056402350a00b00418c2b5bd3fsi13062586edd.33.2022.04.05.18.05.51; Tue, 05 Apr 2022 18:06:16 -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=LRTKb7mr; 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 S239570AbiDEPGS (ORCPT + 99 others); Tue, 5 Apr 2022 11:06:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59388 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345353AbiDEJnY (ORCPT ); Tue, 5 Apr 2022 05:43:24 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 41991C1CB7; Tue, 5 Apr 2022 02:28:44 -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 66A4EB81CAC; Tue, 5 Apr 2022 09:28:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BD1F0C385A0; Tue, 5 Apr 2022 09:28:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649150922; bh=bgJm6wH0LQOptKnK7GXaPPAhDXn78DplyNlwQZkCo08=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LRTKb7mrRlGyzDOk5hMOzCOer7JpPXjsYNDcFa5qYQ6LLxiDieuHV7UkUne4KunSG lQ40te7LAtY6XcbGD6LY/apoH7bBnal2EvKtbleGru0LsENQ66uYbrjLZQRgjGFQ7B VA5/QqMzsS64iU1xZUA+TzzyazXbNo5vvGNQ0+54= 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.15 229/913] clocksource/drivers/exynos_mct: Refactor resources allocation Date: Tue, 5 Apr 2022 09:21:31 +0200 Message-Id: <20220405070346.720460406@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070339.801210740@linuxfoundation.org> References: <20220405070339.801210740@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