From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932611AbbCQKfU (ORCPT ); Tue, 17 Mar 2015 06:35:20 -0400 Received: from pandora.arm.linux.org.uk ([78.32.30.218]:51162 "EHLO pandora.arm.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754133AbbCQKfP (ORCPT ); Tue, 17 Mar 2015 06:35:15 -0400 Date: Tue, 17 Mar 2015 10:35:03 +0000 From: Russell King - ARM Linux To: Paul Walmsley Cc: linux-tegra@vger.kernel.org, linux-arm-kernel@vger.kernel.org, Alexandre Courbot , Stephen Warren , linux-kernel@vger.kernel.org, Thierry Reding , Hiroshi DOYU Subject: Re: [PATCH 2/3] amba: tegra-ahb: use correct base address for future chip support Message-ID: <20150317103503.GT8656@n2100.arm.linux.org.uk> References: <20150317083221.32662.14647.stgit@baseline> <20150317083221.32662.7448.stgit@baseline> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150317083221.32662.7448.stgit@baseline> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 17, 2015 at 01:32:21AM -0700, Paul Walmsley wrote: > static inline u32 gizmo_readl(struct tegra_ahb *ahb, u32 offset) > { > - return readl(ahb->regs - 4 + offset); > + return readl(ahb->regs + ahb->offset + offset); > } > > static inline void gizmo_writel(struct tegra_ahb *ahb, u32 value, u32 offset) > { > - writel(value, ahb->regs - 4 + offset); > + writel(value, ahb->regs + ahb->offset + offset); Rather than storing the offset... > @@ -262,18 +283,15 @@ static int tegra_ahb_probe(struct platform_device *pdev) > if (IS_ERR(ahb->regs)) > return PTR_ERR(ahb->regs); > > + ad = of_id->data; > ahb->dev = &pdev->dev; > + ahb->offset = ad->offset; What about ahb->regs += ad->offset; here and avoid the addition and extra loads on every access. -- FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up according to speedtest.net.