All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tony Lindgren <tony@atomide.com>
To: rockefeller <rockefeller.lin@innocomm.com>
Cc: "linux-omap@vger.kernel.org" <linux-omap@vger.kernel.org>
Subject: Re: [PATCH 2/9] omap: mux: Add new style pin multiplexing code for omap3
Date: Tue, 28 Sep 2010 17:06:27 -0700	[thread overview]
Message-ID: <20100929000627.GV3117@atomide.com> (raw)
In-Reply-To: <1283131873.13307.5.camel@I097020.innocomm.com>

Hi,

Sorry for the delay on responding to this..

* rockefeller <rockefeller.lin@innocomm.com> [100829 18:23]:
> On Fri, 2010-08-27 at 11:24 +0200, Cousson, Benoit wrote:
>
> I would like to introduce a new function omap_mux_name_strcmp() that
> adapted from strcmp() as below and verified with android-2.6.32 and
> it works fine.

Looks like we can also do it with strncmp and keep it const, then
we don't have to ad a custom strcmp function.

Care to test the following patch and see if it solves your problem?

Regards,

Tony


From: Tony Lindgren <tony@atomide.com>
Date: Tue, 28 Sep 2010 16:58:04 -0700
Subject: [PATCH] omap: Fix omap_mux_init_signal not to trash muxname

Otherwise the muxname passed to the function will get truncated.

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

Reported-by: rockefeller.lin@innocomm.com
Signed-off-by: Tony Lindgren <tony@atomide.com>

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-09-29  0:06 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <S1752576Ab0H0BhI/20100827013708Z+1681@vger.kernel.org>
2010-08-27  2:29 ` RE:[PATCH 2/9] omap: mux: Add new style pin multiplexing code for omap3 rockefeller
2010-08-27  9:24   ` [PATCH " Cousson, Benoit
2010-08-27 21:26     ` Tony Lindgren
2010-08-30  1:31     ` rockefeller
2010-09-29  0:06       ` Tony Lindgren [this message]
2009-12-03  0:21 [PATCH 0/9] Omap mux changes for v2.6.33 merge window, v2 Tony Lindgren
2009-12-03  0:21 ` [PATCH 2/9] omap: mux: Add new style pin multiplexing code for omap3 Tony Lindgren
2009-12-03  0:21   ` 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=20100929000627.GV3117@atomide.com \
    --to=tony@atomide.com \
    --cc=linux-omap@vger.kernel.org \
    --cc=rockefeller.lin@innocomm.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.