diff options
author | Tony Lindgren <tony@atomide.com> | 2010-10-01 19:35:24 -0400 |
---|---|---|
committer | Tony Lindgren <tony@atomide.com> | 2010-10-01 19:35:24 -0400 |
commit | 5a3b2f7a5a79082dd3a5f2294cbd85fc3b173d98 (patch) | |
tree | f61d646ca266ae1133d3e203a923f19da5c6ba95 /arch/arm/mach-omap2/mux.c | |
parent | 7ad0e386d46e9edff64705ab25337ad9130baf63 (diff) |
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>
Diffstat (limited to 'arch/arm/mach-omap2/mux.c')
-rw-r--r-- | arch/arm/mach-omap2/mux.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/arch/arm/mach-omap2/mux.c b/arch/arm/mach-omap2/mux.c index 6c2f8f0c0edb..e33740c091be 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) | |||
127 | return 0; | 127 | return 0; |
128 | } | 128 | } |
129 | 129 | ||
130 | int __init omap_mux_init_signal(char *muxname, int val) | 130 | int __init omap_mux_init_signal(const char *muxname, int val) |
131 | { | 131 | { |
132 | struct omap_mux_entry *e; | 132 | struct omap_mux_entry *e; |
133 | char *m0_name = NULL, *mode_name = NULL; | 133 | const char *mode_name; |
134 | int found = 0; | 134 | int found = 0, mode0_len = 0; |
135 | 135 | ||
136 | mode_name = strchr(muxname, '.'); | 136 | mode_name = strchr(muxname, '.'); |
137 | if (mode_name) { | 137 | if (mode_name) { |
138 | *mode_name = '\0'; | 138 | mode0_len = strlen(muxname) - strlen(mode_name); |
139 | mode_name++; | 139 | mode_name++; |
140 | m0_name = muxname; | ||
141 | } else { | 140 | } else { |
142 | mode_name = muxname; | 141 | mode_name = muxname; |
143 | } | 142 | } |
@@ -147,9 +146,11 @@ int __init omap_mux_init_signal(char *muxname, int val) | |||
147 | char *m0_entry = m->muxnames[0]; | 146 | char *m0_entry = m->muxnames[0]; |
148 | int i; | 147 | int i; |
149 | 148 | ||
150 | if (m0_name && strcmp(m0_name, m0_entry)) | 149 | /* First check for full name in mode0.muxmode format */ |
150 | if (mode0_len && strncmp(muxname, m0_entry, mode0_len)) | ||
151 | continue; | 151 | continue; |
152 | 152 | ||
153 | /* Then check for muxmode only */ | ||
153 | for (i = 0; i < OMAP_MUX_NR_MODES; i++) { | 154 | for (i = 0; i < OMAP_MUX_NR_MODES; i++) { |
154 | char *mode_cur = m->muxnames[i]; | 155 | char *mode_cur = m->muxnames[i]; |
155 | 156 | ||