From: lee.jones@linaro.org (Lee Jones)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 8/9] mfd: db8500-prcmu: Return early if the TCPM cannot be located
Date: Tue, 2 Apr 2013 14:21:55 +0100 [thread overview]
Message-ID: <1364908916-29803-8-git-send-email-lee.jones@linaro.org> (raw)
In-Reply-To: <1364908916-29803-1-git-send-email-lee.jones@linaro.org>
Currently we check to see if we obtained the Tightly Coupled Program
Memory (TCPM) base and only execute the code within the check if we
have it. It's more traditional to return early if we don't have it.
This way we can flatten most of the function's code down to a single
tab spacing.
Cc: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
drivers/mfd/db8500-prcmu.c | 40 +++++++++++++++++++++-------------------
1 file changed, 21 insertions(+), 19 deletions(-)
diff --git a/drivers/mfd/db8500-prcmu.c b/drivers/mfd/db8500-prcmu.c
index 21f261b..1c4edbf8 100644
--- a/drivers/mfd/db8500-prcmu.c
+++ b/drivers/mfd/db8500-prcmu.c
@@ -2794,6 +2794,7 @@ static void dbx500_fw_version_init(struct platform_device *pdev,
{
struct resource *res;
void __iomem *tcpm_base;
+ u32 version;
res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
"prcmu-tcpm");
@@ -2803,26 +2804,27 @@ static void dbx500_fw_version_init(struct platform_device *pdev,
return;
}
tcpm_base = ioremap(res->start, resource_size(res));
- if (tcpm_base != NULL) {
- u32 version;
-
- version = readl(tcpm_base + version_offset);
- fw_info.version.project = (version & 0xFF);
- fw_info.version.api_version = (version >> 8) & 0xFF;
- fw_info.version.func_version = (version >> 16) & 0xFF;
- fw_info.version.errata = (version >> 24) & 0xFF;
- strncpy(fw_info.version.project_name,
- fw_project_name(fw_info.version.project),
- PRCMU_FW_PROJECT_NAME_LEN);
- fw_info.valid = true;
- pr_info("PRCMU firmware: %s(%d), version %d.%d.%d\n",
- fw_info.version.project_name,
- fw_info.version.project,
- fw_info.version.api_version,
- fw_info.version.func_version,
- fw_info.version.errata);
- iounmap(tcpm_base);
+ if (!tcpm_base) {
+ dev_err(&pdev->dev, "no prcmu tcpm mem region provided\n");
+ return;
}
+
+ version = readl(tcpm_base + version_offset);
+ fw_info.version.project = (version & 0xFF);
+ fw_info.version.api_version = (version >> 8) & 0xFF;
+ fw_info.version.func_version = (version >> 16) & 0xFF;
+ fw_info.version.errata = (version >> 24) & 0xFF;
+ strncpy(fw_info.version.project_name,
+ fw_project_name(fw_info.version.project),
+ PRCMU_FW_PROJECT_NAME_LEN);
+ fw_info.valid = true;
+ pr_info("PRCMU firmware: %s(%d), version %d.%d.%d\n",
+ fw_info.version.project_name,
+ fw_info.version.project,
+ fw_info.version.api_version,
+ fw_info.version.func_version,
+ fw_info.version.errata);
+ iounmap(tcpm_base);
}
void __init db8500_prcmu_early_init(void)
--
1.7.10.4
next prev parent reply other threads:[~2013-04-02 13:21 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-02 13:21 [PATCH 1/9] ARM: ux500: Increase the size of the PRCMU's TCPM size Lee Jones
2013-04-02 13:21 ` [PATCH 2/9] ARM: ux500: Remove incorrect DB9540 PRCMU TCDM base location Lee Jones
2013-04-03 20:33 ` Linus Walleij
2013-04-02 13:21 ` [PATCH 3/9] ARM: ux500: Supply a DTS file for the u8540 platform Lee Jones
2013-04-03 20:34 ` Linus Walleij
2013-04-04 7:29 ` [PATCH] " Lee Jones
2013-04-23 10:42 ` Linus Walleij
2013-04-23 10:58 ` Linus Walleij
2013-04-24 7:52 ` Lee Jones
2013-04-02 13:21 ` [PATCH 4/9] ARM: ux500: Move Snowball's thermal DT node into existing PRCMU one Lee Jones
2013-04-03 20:38 ` Linus Walleij
2013-04-03 21:36 ` Linus Walleij
2013-04-03 21:45 ` Linus Walleij
2013-04-04 7:20 ` Lee Jones
2013-04-02 13:21 ` [PATCH 5/9] ARM: ux500: Over-ride TCDM size when booting the DB8540 platform Lee Jones
2013-04-03 20:39 ` Linus Walleij
2013-04-04 7:33 ` [PATCH] " Lee Jones
2013-04-23 10:59 ` Linus Walleij
2013-04-23 15:09 ` Lee Jones
2013-04-02 13:21 ` [PATCH 6/9] ARM: ux500: Create a new of_dev_auxdata structure for u8540 enablement Lee Jones
2013-04-03 20:42 ` Linus Walleij
2013-04-02 13:21 ` [PATCH 7/9] ARM: ux500: Add a VQMMC (level-shifting) regulator DT node for Snowball Lee Jones
2013-04-03 20:44 ` Linus Walleij
2013-04-02 13:21 ` Lee Jones [this message]
2013-04-03 20:46 ` [PATCH 8/9] mfd: db8500-prcmu: Return early if the TCPM cannot be located Linus Walleij
2013-04-02 13:21 ` [PATCH 9/9] mfd: db8500-prcmu: Support platform dependant device selection Lee Jones
2013-04-03 20:47 ` Linus Walleij
2013-04-04 10:15 ` Lee Jones
2013-04-03 20:32 ` [PATCH 1/9] ARM: ux500: Increase the size of the PRCMU's TCPM size Linus Walleij
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=1364908916-29803-8-git-send-email-lee.jones@linaro.org \
--to=lee.jones@linaro.org \
--cc=linux-arm-kernel@lists.infradead.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;
as well as URLs for NNTP newsgroup(s).