Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp1110535ybi; Fri, 14 Jun 2019 08:48:46 -0700 (PDT) X-Google-Smtp-Source: APXvYqwtfmegHGN1yopkgI1nio5Gfgwi/AEItWb10fbuC3NKzh2JNSBtqR7g4vhfXeOIcQmWVjnF X-Received: by 2002:a17:90a:8d0c:: with SMTP id c12mr11404883pjo.140.1560527326632; Fri, 14 Jun 2019 08:48:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560527326; cv=none; d=google.com; s=arc-20160816; b=CvmxAiAHvg7CPxCwC4OSWbvAAsc0kj7vFwrGF2zQq7KWULqKzOZ/exn8l39NAPDqnV nwFWUKMTWuF1U1UsM58wzcphuNVUsJLbZIZ+OgBlpgmGD/xNWG6Labx98rLfYCSdE36y 228P8Of9fSCqxajMo7ba8MtzK1dd1wGV6i1ATsN6Woo7Rgm8aqjzaBUsOZkAsEgAK7My oRHE7vNRROB+nHHKQWojsNSz6w9Q/WcL8CkMpi+Mdz+NazbsmztmRWd2F2A13OkAcKhs CgDHtIUPgBQG4XaqFQDcmrzNnTlRTbFvpb1Usk39rcz2wIl2hxC3U7z2c0k98r11xbsl aCjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:dkim-signature:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=d0CqwZtrd3MjNIrGnFs7ZW/50hIL3KZX0LJnt3QZFBM=; b=jCJLUVsLEt6tYt8NllUxx838EyxJBGlxc46iwCwHNHXGIE/Vx4y/R21uWnBPW28EJv J96qQbVXbigdPitseEcmJ+u3VDmprV2E45nqQH9GpWE88xmtQ7kq8uXJCimWU+H+gWFO zfOgS1EsTXM4otPaChoXxVvo91/B67GfsLVS2gym8rMuMG6i4ftYCpXm7/1JkmDREgrJ 0MECMtTahz6DrIwcY3fQF3xjDJErJkPfPwgMSqz+7za7a46YOMaxL6JP/o5ZdJ4/QySR /m4wGz1ejEobce/IH10QD13EW3MS4ev9QhcsJnQNjglgWxoqWxfvh3TO99hJYq9jEl9z IqKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=FYfbiYiy; 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=nvidia.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 36si2592666pgl.237.2019.06.14.08.48.31; Fri, 14 Jun 2019 08:48:46 -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=@nvidia.com header.s=n1 header.b=FYfbiYiy; 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=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725891AbfFNPsU (ORCPT + 99 others); Fri, 14 Jun 2019 11:48:20 -0400 Received: from hqemgate15.nvidia.com ([216.228.121.64]:14453 "EHLO hqemgate15.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725775AbfFNPsT (ORCPT ); Fri, 14 Jun 2019 11:48:19 -0400 Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqemgate15.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Fri, 14 Jun 2019 08:48:19 -0700 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Fri, 14 Jun 2019 08:48:19 -0700 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Fri, 14 Jun 2019 08:48:19 -0700 Received: from [10.26.11.12] (172.20.13.39) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Fri, 14 Jun 2019 15:48:16 +0000 Subject: Re: [PATCH v2 2/6] clocksource/drivers/tegra: Remove duplicated use of per_cpu_ptr To: Dmitry Osipenko , Daniel Lezcano , Joseph Lo , Thierry Reding , Peter De Schrijver CC: , References: <20190610164400.11830-1-digetx@gmail.com> <20190610164400.11830-3-digetx@gmail.com> From: Jon Hunter Message-ID: <1aea7e18-fd5a-5ec7-4ae3-fb19826495bb@nvidia.com> Date: Fri, 14 Jun 2019 16:48:12 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.0 MIME-Version: 1.0 In-Reply-To: <20190610164400.11830-3-digetx@gmail.com> X-Originating-IP: [172.20.13.39] X-ClientProxiedBy: HQMAIL106.nvidia.com (172.18.146.12) To HQMAIL107.nvidia.com (172.20.187.13) Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1560527299; bh=d0CqwZtrd3MjNIrGnFs7ZW/50hIL3KZX0LJnt3QZFBM=; h=X-PGP-Universal:Subject:To:CC:References:From:Message-ID:Date: User-Agent:MIME-Version:In-Reply-To:X-Originating-IP: X-ClientProxiedBy:Content-Type:Content-Language: Content-Transfer-Encoding; b=FYfbiYiy2n6VZ3OqRUnig6QIZ78kdfaNUInMVVyZilKpl1UKW8yC68JnrIdGKjptd mToHNHrtdI9PBXeEJfUdqM5rM4MsQiu7eoD2f39i58S7q9PJWHfhYJm+D14UOpnqs9 9w1UlaYe8S5KqNxnaM2Off3ohwNQ6CK2FetEXJv/oqymHuNPZKcdfPYTAWW0LUPo05 6XMg6LTr9AOXsfwnIPF4O0ruz+v87aPKaWEBAYXRcqDlxzbqxgKSwC+5LSIsn22poB Xs7WPexzN4hrScT2dmCe1i/3icXZeeQP72CCD0y4twcw2M9ChiM7x5KDkylH6zwe4j 2s+r5Kjkl2esA== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/06/2019 17:43, Dmitry Osipenko wrote: > It was left unnoticed by accident, which means that the code could be > cleaned up a tad more. > > Signed-off-by: Dmitry Osipenko > --- > drivers/clocksource/timer-tegra.c | 42 ++++++++++++++++++------------- > 1 file changed, 25 insertions(+), 17 deletions(-) > > diff --git a/drivers/clocksource/timer-tegra.c b/drivers/clocksource/timer-tegra.c > index 830c66e2d927..810b4e7435cf 100644 > --- a/drivers/clocksource/timer-tegra.c > +++ b/drivers/clocksource/timer-tegra.c > @@ -216,6 +216,19 @@ static inline unsigned int tegra_irq_idx_for_cpu(int cpu, bool tegra20) > return TIMER10_IRQ_IDX + cpu; > } > > +static inline unsigned long tegra_rate_for_timer(struct timer_of *to, > + bool tegra20) > +{ > + /* > + * TIMER1-9 are fixed to 1MHz, TIMER10-13 are running off the > + * parent clock. > + */ > + if (tegra20) > + return 1000000; > + > + return timer_of_rate(to); > +} > + > static int __init tegra_init_timer(struct device_node *np, bool tegra20, > int rating) > { > @@ -268,32 +281,27 @@ static int __init tegra_init_timer(struct device_node *np, bool tegra20, > > for_each_possible_cpu(cpu) { > struct timer_of *cpu_to = per_cpu_ptr(&tegra_to, cpu); > + unsigned long flags = IRQF_TIMER | IRQF_NOBALANCING; > + unsigned long rate = tegra_rate_for_timer(to, tegra20); > unsigned int base = tegra_base_for_cpu(cpu, tegra20); > unsigned int idx = tegra_irq_idx_for_cpu(cpu, tegra20); > + unsigned int irq = irq_of_parse_and_map(np, idx); > > - /* > - * TIMER1-9 are fixed to 1MHz, TIMER10-13 are running off the > - * parent clock. > - */ > - if (tegra20) > - cpu_to->of_clk.rate = 1000000; > - else > - cpu_to->of_clk.rate = timer_of_rate(to); > - > - cpu_to = per_cpu_ptr(&tegra_to, cpu); > - cpu_to->of_base.base = timer_reg_base + base; > - cpu_to->clkevt.rating = rating; > - cpu_to->clkevt.cpumask = cpumask_of(cpu); > - cpu_to->clkevt.irq = irq_of_parse_and_map(np, idx); > - if (!cpu_to->clkevt.irq) { > + if (!irq) { > pr_err("failed to map irq for cpu%d\n", cpu); > ret = -EINVAL; > goto out_irq; > } > > + cpu_to->clkevt.irq = irq; > + cpu_to->clkevt.rating = rating; > + cpu_to->clkevt.cpumask = cpumask_of(cpu); > + cpu_to->of_base.base = timer_reg_base + base; > + cpu_to->of_clk.rate = rate; > + > irq_set_status_flags(cpu_to->clkevt.irq, IRQ_NOAUTOEN); > - ret = request_irq(cpu_to->clkevt.irq, tegra_timer_isr, > - IRQF_TIMER | IRQF_NOBALANCING, > + > + ret = request_irq(cpu_to->clkevt.irq, tegra_timer_isr, flags, > cpu_to->clkevt.name, &cpu_to->clkevt); > if (ret) { > pr_err("failed to set up irq for cpu%d: %d\n", > Acked-by: Jon Hunter Cheers Jon -- nvpublic