From patchwork Fri Oct 5 14:35:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 148185 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp527705lji; Fri, 5 Oct 2018 07:36:19 -0700 (PDT) X-Google-Smtp-Source: ACcGV615nTpL5GkDKZgeMFtJhYRSaBi0Q6mNlUvPjtu48M9fg6bShXts2exOp2yDwc37ns3RVoTa X-Received: by 2002:a17:902:b78c:: with SMTP id e12-v6mr11875723pls.67.1538750179524; Fri, 05 Oct 2018 07:36:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538750179; cv=none; d=google.com; s=arc-20160816; b=0bqDAmRaE3+FGNdJTBq6+u2NHL0+PGhsI15ksitLcBPe4yrkq7PD6eYwa0oBSshzXa ugzXxr4QhWuQs90FaOUR/y6sRtiidHcFn5NjFkfcrR9+TnGNsCLorNgcxp0uhMcUwrIs /gbrENxa1nWLeuuamfq6kYFwtU7Mhsn0Qm+aV37BF70UrmJo8PVBBFnL4MdaGaXzDczx oyj/0ccYU1fNLBOUhOzfeEqlxb1oPGVr2U5H6dYtvsOloj6YELUdELj5LHh1+Cs6ymTX 02QH+8T7Ss8CVg/j9NAuAOyKkQjHgBicXcv2sUn4mNaBVyne+bFvD+8snZ3Aeo80n/RJ jJZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=zYFW6zRcVWgOSX94iYyvnnU1cnHxMesXqS4FKh6YYF8=; b=LRumhm9nV5lApIC2upyP4qdnq8OoF6pWPj7q9wuIA8c/DO7uBmTV3F9tXgiFO0/ilq NSNKYUehgc9xs69/ZpmO3aspaJz5ekSdD+iB0sRdfaw2ZpTSI1I4o56RfH2vsQdHucDU XcwvldH2MB/7ywv+NfnhHWaxm3oaYbrgGBeiOgAt7Gtmvd70XOHafBmGL39lK3y5LIE9 wQKSDX5h17dGz4DDX/R8bcARANw1I1N7Cn6BcEzpMVcbsrx4NMT2Ax38tstMsjmEOwTS wtKC2Dpl5Wh21Sx1iblwSkwsVtdWZ1fkOD9w0sEWEGO4Qnk1sXq9cW2ZiiCGNvWCr1Ly buFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=N4fkSwRf; 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=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i64-v6si8856972pli.56.2018.10.05.07.36.19; Fri, 05 Oct 2018 07:36:19 -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=@linaro.org header.s=google header.b=N4fkSwRf; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729119AbeJEVfQ (ORCPT + 32 others); Fri, 5 Oct 2018 17:35:16 -0400 Received: from mail-wm1-f65.google.com ([209.85.128.65]:40463 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729079AbeJEVfP (ORCPT ); Fri, 5 Oct 2018 17:35:15 -0400 Received: by mail-wm1-f65.google.com with SMTP id z204-v6so2158200wmc.5 for ; Fri, 05 Oct 2018 07:36:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=zYFW6zRcVWgOSX94iYyvnnU1cnHxMesXqS4FKh6YYF8=; b=N4fkSwRf9I2ditkSIc0ew9bugOW4GXH2AMxHF4n/1Fkcv2NdGRKEyYkJwjjb5JIMOo NT6uX7S0Yud+k6qj0wjG9VriMs5UqYuKrzbpwZYdj0aVeX8YUsatNFMo8dIr92JXxvD1 jsxWyhi29xUq5J9i4k2Cvwg1U1nF5JMHBnLlY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=zYFW6zRcVWgOSX94iYyvnnU1cnHxMesXqS4FKh6YYF8=; b=AaJgdUaUDuSkX7sf51eSkfio71XfhbL8mzrPKWSI6MPESi2fVqj8Vm2viU54LFwogW vb1jboeout1hu5mGksFCdiuspp2Iwk6401ITKfRR/V4Q4qRL8916AWpZHmKTwwS+BgwS mS3iKqQ+TocSPt33oL/lwqA69QvPAsQRzdnyExv2mquv/8ThqvnFD5PBpFq5vNjaiel3 BnzDD6g0bT8TGO0Vrz+ViFdYnVA479p7hjbSRqFKQLmhTR5WhoSEl2Nj/ABcTLJ3dNos tkzf9nfIWu01NwM0aE7lHUx9yxceVM8jyl40ihHW1s23O67YZhI8V8OJNfcAXTiypoLu XBFw== X-Gm-Message-State: ABuFfohvJaIj/2mxtaLnWK5p//AuelsU6ecygIMLyH6jQ8+/ktn11F8d pKwrKus7deEyI3mbupBVNUqicA== X-Received: by 2002:a1c:ae08:: with SMTP id x8-v6mr7796891wme.86.1538750174762; Fri, 05 Oct 2018 07:36:14 -0700 (PDT) Received: from localhost.localdomain (151.240.136.77.rev.sfr.net. [77.136.240.151]) by smtp.gmail.com with ESMTPSA id t24-v6sm14080377wra.5.2018.10.05.07.36.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 05 Oct 2018 07:36:14 -0700 (PDT) From: Daniel Lezcano To: tglx@linutronix.de Cc: linux-kernel@vger.kernel.org, Sergei Shtylyov , Geert Uytterhoeven Subject: [PATCH 07/13] clocksource/drivers/sh_cmt: Fix clocksource width for 32-bit machines Date: Fri, 5 Oct 2018 16:35:36 +0200 Message-Id: <1538750143-4282-7-git-send-email-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1538750143-4282-1-git-send-email-daniel.lezcano@linaro.org> References: <20181005143253.GE1881@mai> <1538750143-4282-1-git-send-email-daniel.lezcano@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sergei Shtylyov The driver seems to abuse *unsigned long* not only for the (32-bit) register values but also for the 'sh_cmt_channel::total_cycles' which needs to always be 64-bit -- as a result, the clocksource's mask is needlessly clamped down to 32-bits on the 32-bit machines... Fixes: 19bdc9d061bc ("clocksource: sh_cmt clocksource support") Reported-by: Geert Uytterhoeven Signed-off-by: Sergei Shtylyov Reviewed-by: Simon Horman Reviewed-by: Geert Uytterhoeven Signed-off-by: Daniel Lezcano --- drivers/clocksource/sh_cmt.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) -- 2.7.4 diff --git a/drivers/clocksource/sh_cmt.c b/drivers/clocksource/sh_cmt.c index efaf00d..0c74489 100644 --- a/drivers/clocksource/sh_cmt.c +++ b/drivers/clocksource/sh_cmt.c @@ -100,7 +100,7 @@ struct sh_cmt_channel { raw_spinlock_t lock; struct clock_event_device ced; struct clocksource cs; - unsigned long total_cycles; + u64 total_cycles; bool cs_enabled; }; @@ -605,8 +605,8 @@ static u64 sh_cmt_clocksource_read(struct clocksource *cs) { struct sh_cmt_channel *ch = cs_to_sh_cmt(cs); unsigned long flags; - unsigned long value; u32 has_wrapped; + u64 value; u32 raw; raw_spin_lock_irqsave(&ch->lock, flags); @@ -680,7 +680,7 @@ static int sh_cmt_register_clocksource(struct sh_cmt_channel *ch, cs->disable = sh_cmt_clocksource_disable; cs->suspend = sh_cmt_clocksource_suspend; cs->resume = sh_cmt_clocksource_resume; - cs->mask = CLOCKSOURCE_MASK(sizeof(unsigned long) * 8); + cs->mask = CLOCKSOURCE_MASK(sizeof(u64) * 8); cs->flags = CLOCK_SOURCE_IS_CONTINUOUS; dev_info(&ch->cmt->pdev->dev, "ch%u: used as clock source\n",