Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp733164imm; Wed, 17 Oct 2018 07:30:54 -0700 (PDT) X-Google-Smtp-Source: ACcGV62XZIB0Tj9f23rPTR3Hh5D3gYxGlytjtF1Vau0L9nWXeJz7N7yYO0MD7jot04m8i4OT8OcO X-Received: by 2002:a17:902:a5cc:: with SMTP id t12-v6mr26763376plq.229.1539786654490; Wed, 17 Oct 2018 07:30:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539786654; cv=none; d=google.com; s=arc-20160816; b=vm0HmMyQAc4xMOi4nccO3a3aJvqDU05PvyLV7CBczqPNJJsljmqXok2ZUYN55BN1Up EVEcXnyUunssBV/2N/1Dt3EKjQQLP6fq4Ij595TXgdhvP80+bRPtU6dtPjhlCHI18Hnx vSj26CtAM++dWj1BlQyAbXaWJwdhkg/ZuLu9XA2KEoNwGqY9KepN7UCvvqenjAVw1JUT lWeejGyOPiwcB231W0VuVlIYjBNKbqj86sIGktiU7Y8FIa4LFV3IHHVcJfWg05L7hZee WFzuI+X3vhnrSoN1dh7AoLnGbZtKRfd0UcPtA9Qje27EH5k1o4Iw99HUSyzP+3tAUHyD YEWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=h9gZ234d3jvuV9BLC9ALNyU6e3pGRXI66aCn1LSMcYY=; b=s4+LhWkeWsI+w8P0pOj6yzf7Fuoo5hDdZ5tEdaV4aDSqGxyl1S0o6f1JJBjgQjf10o 3faK+h8X1cO8Pr63Wm3VuvQvLnCX98C1XUuFWe+ePibDdJ0MbYN9FNPl/wAeZikTBz/r K2YNwQv2bAYzZFmQduhl3u/+hlDJqqT7Y0r87Ho+yzFstZzmO+ZLJMkdzO+fz3sQRlwF /2u8HxTyjcqxSSL032Xr9UNszv6HdD4yf3lzQc+UIfarAkwzv2k1CVFpwVRRNaX1ElIy DCOKL2ZOmdA9I9Vunpf3lwdoRUJvNuTh2DIA0Yy+iTRInHR9dmhQBiNocK8k5FgkX2ZQ dBhg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=t9YOG5pa; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s1-v6si16994621plr.141.2018.10.17.07.30.38; Wed, 17 Oct 2018 07:30:54 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=t9YOG5pa; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727692AbeJQWZ1 (ORCPT + 99 others); Wed, 17 Oct 2018 18:25:27 -0400 Received: from mail.kernel.org ([198.145.29.99]:57018 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726974AbeJQWZ1 (ORCPT ); Wed, 17 Oct 2018 18:25:27 -0400 Received: from mail-lj1-f181.google.com (mail-lj1-f181.google.com [209.85.208.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B127E2152A; Wed, 17 Oct 2018 14:29:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1539786569; bh=kd6s3D4GrWS1cjFOPZPGzCTb4DfICUVnR1+wtlkoIPY=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=t9YOG5pa8YWlEqK1FkloORZxEMfVQwwDUBKadVHpOW+ZvCZM/nWJWk+X+f2x7CgYb WB81cpqu1cK0yj+6vQazO+EaFvgiYpNcX+vHu1pXudhMePP18aTsrN9b+flRRrQEpR 3Qb3hBnYPi799Y8C4zK+LanhHnllFIH0XFnGCLZA= Received: by mail-lj1-f181.google.com with SMTP id o14-v6so24559040ljj.2; Wed, 17 Oct 2018 07:29:28 -0700 (PDT) X-Gm-Message-State: ABuFfoi/jqrHtH0sf+lgyFGDGwbO6POY7LSFWBVAi9eeCd63Q1nnrlZ3 IMF+pWG4TM7CaLXglKDcWLEzpIHokvZtAtwSId8= X-Received: by 2002:a2e:50e:: with SMTP id 14-v6mr2670546ljf.152.1539786566748; Wed, 17 Oct 2018 07:29:26 -0700 (PDT) MIME-Version: 1.0 References: <20181017134159.9656-1-m.szyprowski@samsung.com> <20181017134159.9656-4-m.szyprowski@samsung.com> In-Reply-To: <20181017134159.9656-4-m.szyprowski@samsung.com> From: Krzysztof Kozlowski Date: Wed, 17 Oct 2018 16:29:15 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v3 3/6] clocksource: exynos_mct: Refactor resources allocation To: Marek Szyprowski Cc: "linux-samsung-soc@vger.kernel.org" , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, will.deacon@arm.com, catalin.marinas@arm.com, marc.zyngier@arm.com, tglx@linutronix.de, daniel.lezcano@linaro.org, Chanwoo Choi , =?UTF-8?B?QmFydMWCb21pZWogxbtvxYJuaWVya2lld2ljeg==?= , Inki Dae Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 17 Oct 2018 at 15:42, Marek Szyprowski wrote: > > 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 > --- > drivers/clocksource/exynos_mct.c | 49 +++++++++++++++++++------------- > 1 file changed, 30 insertions(+), 19 deletions(-) > > diff --git a/drivers/clocksource/exynos_mct.c b/drivers/clocksource/exynos_mct.c > index 49413900b24c..02ad55db390b 100644 > --- a/drivers/clocksource/exynos_mct.c > +++ b/drivers/clocksource/exynos_mct.c > @@ -502,11 +502,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__); > @@ -517,9 +520,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 i, err, cpu; > + > + mct_int_type = int_type; This does not look good. Before, assignment was done before call to exynos4_timer_resources(). Now, if I follow the path correctly, it will be after. Therefore the exynos4_timer_resources() will use wrong value. This should pop up during tests. Best regards, Krzysztof > + > + /* 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) { > > @@ -579,24 +600,14 @@ 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); > + ret = exynos4_timer_resources(np); > + if (ret) > + return ret; > > - /* > - * 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, of_iomap(np, 0)); > + ret = exynos4_timer_interrupts(np, int_type); > if (ret) > return ret; > > -- > 2.17.1 >