linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: tony@atomide.com (Tony Lindgren)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/8] omap: Fix omap_mux_init_signal not to trash muxname
Date: Fri, 01 Oct 2010 16:34:02 -0700	[thread overview]
Message-ID: <20101001233402.31894.59103.stgit@baageli.muru.com> (raw)
In-Reply-To: <20101001233315.31894.49599.stgit@baageli.muru.com>

Otherwise the muxname passed to the function will get truncated.

Based on an earlier patch by rockefeller.lin at innocomm.com.

Reported-by: rockefeller.lin at innocomm.com
Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 arch/arm/mach-omap2/mux.c |   13 +++++++------
 arch/arm/mach-omap2/mux.h |    2 +-
 2 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/arch/arm/mach-omap2/mux.c b/arch/arm/mach-omap2/mux.c
index 6c2f8f0..e33740c 100644
--- a/arch/arm/mach-omap2/mux.c
+++ b/arch/arm/mach-omap2/mux.c
@@ -127,17 +127,16 @@ int __init omap_mux_init_gpio(int gpio, int val)
 	return 0;
 }
 
-int __init omap_mux_init_signal(char *muxname, int val)
+int __init omap_mux_init_signal(const char *muxname, int val)
 {
 	struct omap_mux_entry *e;
-	char *m0_name = NULL, *mode_name = NULL;
-	int found = 0;
+	const char *mode_name;
+	int found = 0, mode0_len = 0;
 
 	mode_name = strchr(muxname, '.');
 	if (mode_name) {
-		*mode_name = '\0';
+		mode0_len = strlen(muxname) - strlen(mode_name);
 		mode_name++;
-		m0_name = muxname;
 	} else {
 		mode_name = muxname;
 	}
@@ -147,9 +146,11 @@ int __init omap_mux_init_signal(char *muxname, int val)
 		char *m0_entry = m->muxnames[0];
 		int i;
 
-		if (m0_name && strcmp(m0_name, m0_entry))
+		/* First check for full name in mode0.muxmode format */
+		if (mode0_len && strncmp(muxname, m0_entry, mode0_len))
 			continue;
 
+		/* Then check for muxmode only */
 		for (i = 0; i < OMAP_MUX_NR_MODES; i++) {
 			char *mode_cur = m->muxnames[i];
 
diff --git a/arch/arm/mach-omap2/mux.h b/arch/arm/mach-omap2/mux.h
index a8e040c..350c04f 100644
--- a/arch/arm/mach-omap2/mux.h
+++ b/arch/arm/mach-omap2/mux.h
@@ -120,7 +120,7 @@ int omap_mux_init_gpio(int gpio, int val);
  * @muxname:		Mux name in mode0_name.signal_name format
  * @val:		Options for the mux register value
  */
-int omap_mux_init_signal(char *muxname, int val);
+int omap_mux_init_signal(const char *muxname, int val);
 
 #else
 

  reply	other threads:[~2010-10-01 23:34 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-01 23:33 [PATCH 0/8] omap2+ patches for v2.6.37 merge window Tony Lindgren
2010-10-01 23:34 ` Tony Lindgren [this message]
2010-10-01 23:34 ` [PATCH 2/8] omap2/3: Update revision identification Tony Lindgren
2010-10-01 23:34 ` [PATCH 3/8] omap: pandora: add fixed regulator for wlan Tony Lindgren
2010-10-01 23:34 ` [PATCH 4/8] omap: pandora: enable twl4030 charger Tony Lindgren
2010-10-01 23:34 ` [PATCH 5/8] OMAP4 ES2: HSMMC soft reset change Tony Lindgren
2010-10-01 23:34 ` [PATCH 6/8] omap4 hsmmc: Fix the init if CONFIG_MMC_OMAP_HS is not set Tony Lindgren
2010-10-01 23:34 ` [PATCH 7/8] omap4 hsmmc: Register offset handling Tony Lindgren
2010-10-01 23:34 ` [PATCH 8/8] omap4 hsmmc: Update ocr mask for MMC2 for regulator to use Tony Lindgren

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=20101001233402.31894.59103.stgit@baageli.muru.com \
    --to=tony@atomide.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).