From patchwork Tue Dec 1 10:09:26 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 57482 Delivered-To: patch@linaro.org Received: by 10.112.155.196 with SMTP id vy4csp2068426lbb; Tue, 1 Dec 2015 02:11:21 -0800 (PST) X-Received: by 10.66.150.228 with SMTP id ul4mr98774438pab.15.1448964681022; Tue, 01 Dec 2015 02:11:21 -0800 (PST) Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id vq10si16264333pab.74.2015.12.01.02.11.20 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 01 Dec 2015 02:11:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) client-ip=2001:1868:205::9; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) smtp.mailfrom=linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org; dkim=neutral (body hash did not verify) header.i=@linaro-org.20150623.gappssmtp.com Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1a3hsd-0005hZ-IL; Tue, 01 Dec 2015 10:09:51 +0000 Received: from mail-ob0-x233.google.com ([2607:f8b0:4003:c01::233]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1a3hsZ-0005Ys-RD for linux-arm-kernel@lists.infradead.org; Tue, 01 Dec 2015 10:09:48 +0000 Received: by obdgf3 with SMTP id gf3so816753obd.3 for ; Tue, 01 Dec 2015 02:09:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro-org.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=PTBY6glWGjUu+6UkUrU6ohB15XvbMyEREFdXMfTHK2Q=; b=EtN8QKPMB5pETIvV0RH+5tZedSHB9N+SnIHfor058l6vHDFvCConAMm8KrPaxZhDNw 3Ysnu9YSE1kRuHX82MxREWVw4S2pxrG2JgbgOSxTXyNOW/Uc9s72bc6tI9W5inElC5fY GKqODc0Cd9tkgSlwyRxnnllSP6pQPS7/sDMUu2jc8Qbeq96B9EnFo3taM7JkfeYJhuNh I+c+m5F/E6o7dHwpRvOIA1UxRT3JKnbd8Ez8dDoG6b0lUXyRAWGoLU+i5piKjvR7D70/ tUz5CQnqI2jyyF9hwMFOPdoXRw7OD8x2AFxMlocNCwxawnWvgRLuT13iI84U57ytIu+S bkVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=PTBY6glWGjUu+6UkUrU6ohB15XvbMyEREFdXMfTHK2Q=; b=VDZM3rBzntMwi1m7HePzwusD29QM8WaoFTzspwh73hEOzP5lAwXP3ARSx7KSd6F36X 0Sr1P8ymC2RBjrp3edtgSk2DRhjM0kXgJrmeZEkfWzuG3gALHMK8lsA6qU8ay+Z++1Ua mnrZOA6ZyhHJqYPHxgDSBee684rPcbRimTxO0kU8aZjj3lSS+YtFyjW7/ddIckFJMKBU aMnB3cTI+vxH5W4Tn2W83wriUAnR9N+Q7P6CFw0AxY1P6UCS1c7MN0n3m/bZY2k1HFpD tdgCzLgY/wEG0IhrsKrMK+SMTo09qB+ltixvxNirYzUX8lMuOohcdr5ibaZVmjXtb4K7 QYnA== X-Gm-Message-State: ALoCoQmHmx4jZsd0oOKjX55qVkemkqzmLguLGK073A42x82NfYiRvwC4+uz/QcL+/ci/BOEUGzrj MIME-Version: 1.0 X-Received: by 10.182.219.228 with SMTP id pr4mr42996141obc.76.1448964566348; Tue, 01 Dec 2015 02:09:26 -0800 (PST) Received: by 10.182.32.70 with HTTP; Tue, 1 Dec 2015 02:09:26 -0800 (PST) In-Reply-To: <565513EA.6020603@gmail.com> References: <565513EA.6020603@gmail.com> Date: Tue, 1 Dec 2015 11:09:26 +0100 Message-ID: Subject: Re: [PATCH] ARM: ep93xx: Fix clocksource registration From: Linus Walleij To: Alexander Sverdlin , Thomas Gleixner X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151201_020948_098860_6E76951A X-CRM114-Status: GOOD ( 17.56 ) X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [2607:f8b0:4003:c01:0:0:0:233 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Hartley Sweeten , Russell King , Ryan Mallon , "linux-arm-kernel@lists.infradead.org" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org On Wed, Nov 25, 2015 at 2:50 AM, Alexander Sverdlin wrote: > clocksource_mmio_init() explicitly checks for counter's width and refuses to > register anything with resolution higher than 32 bits. We need to use > clocksource_register_hz() directly to repair HIGH_RES_TIMERS. Maybe tglx want to jump in on this. Isn't it better to fix clocksource_mmio_init() to accept > 32 bits? What is really prompting this in drivers/clocksource/mmio.c: if (bits > 32 || bits < 16) return -EINVAL; > +static struct clocksource timer4_clocksource = { > + .name = "timer4", > + .rating = 200, > + .read = ep93xx_clocksource_read, > + .mask = CLOCKSOURCE_MASK(40), > + .flags = CLOCK_SOURCE_IS_CONTINUOUS, > +}; > + > static int ep93xx_clkevt_set_next_event(unsigned long next, > struct clock_event_device *evt) > { > @@ -128,9 +136,8 @@ void __init ep93xx_timer_init(void) > /* Enable and register clocksource and sched_clock on timer 4 */ > writel(EP93XX_TIMER4_VALUE_HIGH_ENABLE, > EP93XX_TIMER4_VALUE_HIGH); > - clocksource_mmio_init(NULL, "timer4", > - EP93XX_TIMER4_RATE, 200, 40, > - ep93xx_clocksource_read); > + if (clocksource_register_hz(&timer4_clocksource, EP93XX_TIMER4_RATE)) > + pr_warn("Failed to register Timer4 as clocksource"); > sched_clock_register(ep93xx_read_sched_clock, 40, > EP93XX_TIMER4_RATE); Isn't this a better fix: cs = kzalloc(sizeof(struct clocksource_mmio), GFP_KERNEL); Yours, Linus Walleij _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel diff --git a/drivers/clocksource/mmio.c b/drivers/clocksource/mmio.c index 1593ade2a815..c4f7d7a9b689 100644 --- a/drivers/clocksource/mmio.c +++ b/drivers/clocksource/mmio.c @@ -55,7 +55,7 @@ int __init clocksource_mmio_init(void __iomem *base, const char *name, { struct clocksource_mmio *cs; - if (bits > 32 || bits < 16) + if (bits > 64 || bits < 16) return -EINVAL;