From: Hiroshi DOYU <hdoyu@nvidia.com>
To: <gregkh@linuxfoundation.org>, <swarren@wwwdotorg.org>
Cc: <linux-tegra@vger.kernel.org>, Hiroshi DOYU <hdoyu@nvidia.com>,
<linux-kernel@vger.kernel.org>
Subject: [v2 2/2] ARM: tegra30: MC: Remove unnecessary BUG*()
Date: Fri, 11 May 2012 13:04:45 +0300 [thread overview]
Message-ID: <1336730689-27092-2-git-send-email-hdoyu@nvidia.com> (raw)
In-Reply-To: <1336730689-27092-1-git-send-email-hdoyu@nvidia.com>
Accessing interleaved MC register offsets/ranges are verified. BUG*()s
in accessors can be removed.
Signed-off-by: Hiroshi DOYU <hdoyu@nvidia.com>
---
drivers/memory/tegra30-mc.c | 20 ++++++++------------
1 files changed, 8 insertions(+), 12 deletions(-)
diff --git a/drivers/memory/tegra30-mc.c b/drivers/memory/tegra30-mc.c
index c982125..ec9fc78 100644
--- a/drivers/memory/tegra30-mc.c
+++ b/drivers/memory/tegra30-mc.c
@@ -91,18 +91,18 @@ struct tegra30_mc {
static inline u32 mc_readl(struct tegra30_mc *mc, u32 offs)
{
+ u32 val = 0;
+
if (offs < 0x10)
- return readl(mc->regs[0] + offs);
- BUG_ON(offs < 0x3c);
+ val = readl(mc->regs[0] + offs);
if (offs < 0x1f0)
- return readl(mc->regs[1] + offs - 0x3c);
- BUG_ON(offs < 0x200);
+ val = readl(mc->regs[1] + offs - 0x3c);
if (offs < 0x228)
- return readl(mc->regs[2] + offs - 0x200);
- BUG_ON(offs < 0x284);
+ val = readl(mc->regs[2] + offs - 0x200);
if (offs < 0x400)
- return readl(mc->regs[3] + offs - 0x284);
- BUG();
+ val = readl(mc->regs[3] + offs - 0x284);
+
+ return val;
}
static inline void mc_writel(struct tegra30_mc *mc, u32 val, u32 offs)
@@ -111,22 +111,18 @@ static inline void mc_writel(struct tegra30_mc *mc, u32 val, u32 offs)
writel(val, mc->regs[0] + offs);
return;
}
- BUG_ON(offs < 0x3c);
if (offs < 0x1f0) {
writel(val, mc->regs[1] + offs - 0x3c);
return;
}
- BUG_ON(offs < 0x200);
if (offs < 0x228) {
writel(val, mc->regs[2] + offs - 0x200);
return;
}
- BUG_ON(offs < 0x284);
if (offs < 0x400) {
writel(val, mc->regs[3] + offs - 0x284);
return;
}
- BUG();
}
static const char * const tegra30_mc_client[] = {
--
1.7.5.4
next prev parent reply other threads:[~2012-05-11 10:05 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-10 7:42 [PATCH 1/4] ARM: tegra20: Add Tegra Memory Controller(MC) driver Hiroshi DOYU
2012-05-10 7:42 ` [PATCH 2/4] ARM: dt: tegra20.dtsi: Add Memory Controller(MC) nodes Hiroshi DOYU
2012-05-16 6:35 ` Olof Johansson
2012-05-16 6:51 ` Hiroshi Doyu
2012-05-10 7:42 ` [PATCH 3/4] ARM: tegra30: Add Tegra Memory Controller(MC) driver Hiroshi DOYU
2012-05-10 21:46 ` Greg Kroah-Hartman
2012-05-11 6:16 ` Hiroshi Doyu
2012-05-11 6:22 ` [PATCH 1/2] ARM: tegra20: MC: Remove unnecessary BUG*() Hiroshi DOYU
2012-05-11 6:22 ` [PATCH 2/2] ARM: tegra30: " Hiroshi DOYU
2012-05-11 10:04 ` [v2 1/2] ARM: tegra20: " Hiroshi DOYU
2012-05-11 10:04 ` Hiroshi DOYU [this message]
2012-05-10 7:42 ` [PATCH 4/4] ARM: dt: tegra30.dtsi: Add Memory Controller(MC) nodes Hiroshi DOYU
2012-05-10 17:23 ` [PATCH 1/4] ARM: tegra20: Add Tegra Memory Controller(MC) driver Stephen Warren
2012-05-10 18:18 ` Greg Kroah-Hartman
2012-05-11 6:50 ` Hiroshi Doyu
2012-05-11 6:56 ` [PATCH 1/3] ARM: tegra20: Make MC optional in Kconfig Hiroshi DOYU
2012-05-11 6:56 ` [PATCH 2/3] ARM: tegra30: " Hiroshi DOYU
2012-05-11 6:56 ` [PATCH 3/3] ARM: tegra: Make TEGRA{20,30}_MC selectable in defconfig Hiroshi DOYU
2012-05-11 17:54 ` [PATCH 1/3] ARM: tegra20: Make MC optional in Kconfig Stephen Warren
2012-05-11 22:25 ` Greg KH
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1336730689-27092-2-git-send-email-hdoyu@nvidia.com \
--to=hdoyu@nvidia.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=swarren@wwwdotorg.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox