From: paul@pwsan.com (Paul Walmsley)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/6] OMAP3: id: remove useless strcpy()s
Date: Tue, 13 Sep 2011 15:28:03 -0600 [thread overview]
Message-ID: <20110913212802.26161.42003.stgit@dusk> (raw)
In-Reply-To: <20110913212638.26161.62284.stgit@dusk>
omap3_cpuinfo() is filled with useless strcpy() calls; remove them.
Signed-off-by: Paul Walmsley <paul@pwsan.com>
Cc: Sanjeev Premi <premi@ti.com>
---
arch/arm/mach-omap2/id.c | 48 +++++++++++++++++++++-------------------------
1 files changed, 22 insertions(+), 26 deletions(-)
diff --git a/arch/arm/mach-omap2/id.c b/arch/arm/mach-omap2/id.c
index 723e2f8..46bc2f9 100644
--- a/arch/arm/mach-omap2/id.c
+++ b/arch/arm/mach-omap2/id.c
@@ -429,84 +429,80 @@ static void __init omap4_check_revision(void)
static void __init omap3_cpuinfo(void)
{
u8 rev = GET_OMAP_REVISION();
- char cpu_name[16], cpu_rev[16];
+ const char *cpu_name, *cpu_rev;
- /* OMAP3430 and OMAP3530 are assumed to be same.
+ /*
+ * OMAP3430 and OMAP3530 are assumed to be same.
*
* OMAP3525, OMAP3515 and OMAP3503 can be detected only based
* on available features. Upon detection, update the CPU id
* and CPU class bits.
*/
if (cpu_is_omap3630()) {
- strcpy(cpu_name, "OMAP3630");
+ cpu_name = "OMAP3630";
} else if (cpu_is_omap3505()) {
- /*
- * AM35xx devices
- */
- if (omap3_has_sgx())
- strcpy(cpu_name, "AM3517");
- else
- strcpy(cpu_name, "AM3505");
+ /* AM35xx devices */
+ cpu_name = (omap3_has_sgx()) ? "AM3517" : "AM3505";
} else if (cpu_is_ti816x()) {
- strcpy(cpu_name, "TI816X");
+ cpu_name = "TI816X";
} else if (omap3_has_iva() && omap3_has_sgx()) {
/* OMAP3430, OMAP3525, OMAP3515, OMAP3503 devices */
- strcpy(cpu_name, "OMAP3430/3530");
+ cpu_name = "OMAP3430/3530";
} else if (omap3_has_iva()) {
- strcpy(cpu_name, "OMAP3525");
+ cpu_name = "OMAP3525";
} else if (omap3_has_sgx()) {
- strcpy(cpu_name, "OMAP3515");
+ cpu_name = "OMAP3515";
} else {
- strcpy(cpu_name, "OMAP3503");
+ cpu_name = "OMAP3503";
}
if (cpu_is_omap3630() || cpu_is_ti816x()) {
switch (rev) {
case OMAP_REVBITS_00:
- strcpy(cpu_rev, "1.0");
+ cpu_rev = "1.0";
break;
case OMAP_REVBITS_01:
- strcpy(cpu_rev, "1.1");
+ cpu_rev = "1.1";
break;
case OMAP_REVBITS_02:
/* FALLTHROUGH */
default:
/* Use the latest known revision as default */
- strcpy(cpu_rev, "1.2");
+ cpu_rev = "1.2";
}
} else if (cpu_is_omap3505() || cpu_is_omap3517()) {
switch (rev) {
case OMAP_REVBITS_00:
- strcpy(cpu_rev, "1.0");
+ cpu_rev = "1.0";
break;
case OMAP_REVBITS_01:
/* FALLTHROUGH */
default:
/* Use the latest known revision as default */
- strcpy(cpu_rev, "1.1");
+ cpu_rev = "1.1";
}
} else {
switch (rev) {
case OMAP_REVBITS_00:
- strcpy(cpu_rev, "1.0");
+ cpu_rev = "1.0";
break;
case OMAP_REVBITS_01:
- strcpy(cpu_rev, "2.0");
+ cpu_rev = "2.0";
break;
case OMAP_REVBITS_02:
- strcpy(cpu_rev, "2.1");
+ cpu_rev = "2.1";
break;
case OMAP_REVBITS_03:
- strcpy(cpu_rev, "3.0");
+ cpu_rev = "3.0";
break;
case OMAP_REVBITS_04:
- strcpy(cpu_rev, "3.1");
+ cpu_rev = "3.1";
break;
case OMAP_REVBITS_05:
/* FALLTHROUGH */
default:
/* Use the latest known revision as default */
- strcpy(cpu_rev, "3.1.2");
+ cpu_rev = "3.1.2";
}
}
next prev parent reply other threads:[~2011-09-13 21:28 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-13 21:28 [PATCH 0/6] OMAP2+: id: cleanup for 3.2 Paul Walmsley
2011-09-13 21:28 ` [PATCH 1/6] OMAP3: id: remove identification codes that only correspond to marketing names Paul Walmsley
2011-09-14 11:39 ` [PATCH v2 " Paul Walmsley
2011-09-13 21:28 ` Paul Walmsley [this message]
2011-09-13 21:28 ` [PATCH 3/6] OMAP3: id: use explicit omap_revision codes for 3505/3517 ES levels Paul Walmsley
2011-09-14 12:23 ` Igor Grinberg
2011-09-13 21:28 ` [PATCH 4/6] OMAP3: id: add fallthrough warning; fix some CodingStyle issues Paul Walmsley
2011-09-13 21:28 ` [PATCH 5/6] OMAP3: id: remove duplicate code for testing SoC ES level Paul Walmsley
2011-09-13 21:28 ` [PATCH 6/6] OMAP2+: id: remove OMAP_REVBITS_* macros Paul Walmsley
2011-09-14 12:24 ` Igor Grinberg
2011-09-14 12:29 ` Paul Walmsley
2011-09-14 12:51 ` Igor Grinberg
2011-09-14 13:10 ` Paul Walmsley
2011-09-14 13:30 ` Igor Grinberg
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=20110913212802.26161.42003.stgit@dusk \
--to=paul@pwsan.com \
--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).