* [PATCH] small time list process error in prom_getenv()
@ 2006-03-27 7:43 Freddy Spierenburg
2006-03-27 8:32 ` Sergei Shtylylov
0 siblings, 1 reply; 8+ messages in thread
From: Freddy Spierenburg @ 2006-03-27 7:43 UTC (permalink / raw)
To: linux-mips
[-- Attachment #1.1: Type: text/plain, Size: 817 bytes --]
Hi,
I found a small time bug in prom_getenv() for which I like to
share the fix with y'all.
prom_envp is an array with two elements per environment variable.
So for instance element 0 is memsize and element 1 is 0x08000000
for the environment variable memsize=0x08000000.
The code for prom_getenv() only skips one element when it's in
search for the next environment variable. It should of course
step two elements.
I found this error in two files and for both I include a patch to
fix the problem.
Signed-off-by: Freddy Spierenburg <freddy@dusktilldawn.nl>
--
$ cat ~/.signature
Freddy Spierenburg <freddy@dusktilldawn.nl> http://freddy.snarl.nl/
GnuPG: 0x7941D1E1=C948 5851 26D2 FA5C 39F1 E588 6F17 FD5D 7941 D1E1
$ # Please read http://www.ietf.org/rfc/rfc2015.txt before complain!
[-- Attachment #1.2: prom.pnx8550.patch --]
[-- Type: text/plain, Size: 442 bytes --]
diff -Naur linux.orig/arch/mips/philips/pnx8550/common/prom.c linux/arch/mips/philips/pnx8550/common/prom.c
--- linux.orig/arch/mips/philips/pnx8550/common/prom.c 2006-03-22 15:25:58.000000000 +0000
+++ linux/arch/mips/philips/pnx8550/common/prom.c 2006-03-22 15:25:23.000000000 +0000
@@ -70,7 +70,7 @@
if(strncmp(envname, env->name, i) == 0) {
return(env->name + strlen(envname) + 1);
}
- env++;
+ env+=2;
}
return(NULL);
}
[-- Attachment #1.3: prom.au1000.patch --]
[-- Type: text/plain, Size: 406 bytes --]
diff -Naur linux.orig/arch/mips/au1000/common/prom.c linux/arch/mips/au1000/common/prom.c
--- linux.orig/arch/mips/au1000/common/prom.c 2006-03-22 15:11:09.000000000 +0000
+++ linux/arch/mips/au1000/common/prom.c 2006-03-22 15:16:22.000000000 +0000
@@ -97,7 +97,7 @@
if(strncmp(envname, env->name, i) == 0) {
return(env->name + strlen(envname) + 1);
}
- env++;
+ env+=2;
}
return(NULL);
}
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 191 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] small time list process error in prom_getenv()
2006-03-27 7:43 [PATCH] small time list process error in prom_getenv() Freddy Spierenburg
@ 2006-03-27 8:32 ` Sergei Shtylylov
2006-03-27 18:44 ` [PATCH] Au1xx0: fix prom_getenv() to handle YAMON style environment Sergei Shtylylov
` (4 more replies)
0 siblings, 5 replies; 8+ messages in thread
From: Sergei Shtylylov @ 2006-03-27 8:32 UTC (permalink / raw)
To: Freddy Spierenburg; +Cc: linux-mips
Hello.
Freddy Spierenburg wrote:
> I found a small time bug in prom_getenv() for which I like to
> share the fix with y'all.
>
> prom_envp is an array with two elements per environment variable.
> So for instance element 0 is memsize and element 1 is 0x08000000
> for the environment variable memsize=0x08000000.
>
> The code for prom_getenv() only skips one element when it's in
> search for the next environment variable. It should of course
> step two elements.
> I found this error in two files and for both I include a patch to
> fix the problem.
I'm seeing such code in 3 files (arch/mips/ite-boards/generic/pmon_prom.c)
but that doesn't mean all of'em are incorrect. Alachemy code is though, since
hose target use YAMON which passes environment args the described way. Though
really, that code may be written this way on purpose -- like to fit both
PMON's and YAMON's way of passing the environment...
> Signed-off-by: Freddy Spierenburg <freddy@dusktilldawn.nl>
NAK. 'val' field of 't_env_var' should be uncommented instead.
> ------------------------------------------------------------------------
>
> diff -Naur linux.orig/arch/mips/philips/pnx8550/common/prom.c linux/arch/mips/philips/pnx8550/common/prom.c
> --- linux.orig/arch/mips/philips/pnx8550/common/prom.c 2006-03-22 15:25:58.000000000 +0000
> +++ linux/arch/mips/philips/pnx8550/common/prom.c 2006-03-22 15:25:23.000000000 +0000
> @@ -70,7 +70,7 @@
> if(strncmp(envname, env->name, i) == 0) {
> return(env->name + strlen(envname) + 1);
> }
> - env++;
> + env+=2;
> }
> return(NULL);
> }
Not sure what loader the Philips target uses...
> ------------------------------------------------------------------------
>
> diff -Naur linux.orig/arch/mips/au1000/common/prom.c linux/arch/mips/au1000/common/prom.c
> --- linux.orig/arch/mips/au1000/common/prom.c 2006-03-22 15:11:09.000000000 +0000
> +++ linux/arch/mips/au1000/common/prom.c 2006-03-22 15:16:22.000000000 +0000
> @@ -97,7 +97,7 @@
> if(strncmp(envname, env->name, i) == 0) {
> return(env->name + strlen(envname) + 1);
return env->val;
> }
> - env++;
> + env+=2;
Should be left alone.
> }
> return(NULL);
> }
WBR, Sergei
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH] Au1xx0: fix prom_getenv() to handle YAMON style environment
2006-03-27 8:32 ` Sergei Shtylylov
@ 2006-03-27 18:44 ` Sergei Shtylylov
2006-03-28 14:54 ` [PATCH] rtc.h: fixes to make genrtc.c compilable Ralf Rösch
` (3 subsequent siblings)
4 siblings, 0 replies; 8+ messages in thread
From: Sergei Shtylylov @ 2006-03-27 18:44 UTC (permalink / raw)
To: linux-mips; +Cc: Freddy Spierenburg, Jordan Crouse, Manish Lachwani
[-- Attachment #1: Type: text/plain, Size: 197 bytes --]
Hello.
Alchemy boards use YAMON which passes the environment variables as the
tuples of strings (the name followed by the value) unlike PMON which passes
"name=<val>" strings.
WBR, Sergei
[-- Attachment #2: Au1xx0-fix-prom_getenv.patch --]
[-- Type: text/plain, Size: 1383 bytes --]
diff --git a/arch/mips/au1000/common/prom.c b/arch/mips/au1000/common/prom.c
index 9c171af..ae7d8c5 100644
--- a/arch/mips/au1000/common/prom.c
+++ b/arch/mips/au1000/common/prom.c
@@ -1,10 +1,9 @@
/*
*
* BRIEF MODULE DESCRIPTION
- * PROM library initialisation code, assuming a version of
- * pmon is the boot code.
+ * PROM library initialisation code, assuming YAMON is the boot loader.
*
- * Copyright 2000,2001 MontaVista Software Inc.
+ * Copyright 2000, 2001, 2006 MontaVista Software Inc.
* Author: MontaVista Software, Inc.
* ppopov@mvista.com or source@mvista.com
*
@@ -49,9 +48,9 @@ extern char **prom_argv, **prom_envp;
typedef struct
{
- char *name;
-/* char *val; */
-}t_env_var;
+ char *name;
+ char *val;
+} t_env_var;
char * prom_getcmdline(void)
@@ -85,21 +84,16 @@ char *prom_getenv(char *envname)
{
/*
* Return a pointer to the given environment variable.
- * Environment variables are stored in the form of "memsize=64".
*/
t_env_var *env = (t_env_var *)prom_envp;
- int i;
-
- i = strlen(envname);
- while(env->name) {
- if(strncmp(envname, env->name, i) == 0) {
- return(env->name + strlen(envname) + 1);
- }
+ while (env->name) {
+ if (strcmp(envname, env->name) == 0)
+ return env->val;
env++;
}
- return(NULL);
+ return NULL;
}
inline unsigned char str2hexnum(unsigned char c)
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH] rtc.h: fixes to make genrtc.c compilable
2006-03-27 8:32 ` Sergei Shtylylov
2006-03-27 18:44 ` [PATCH] Au1xx0: fix prom_getenv() to handle YAMON style environment Sergei Shtylylov
@ 2006-03-28 14:54 ` Ralf Rösch
2006-03-28 15:12 ` Ralf Rösch
` (2 subsequent siblings)
4 siblings, 0 replies; 8+ messages in thread
From: Ralf Rösch @ 2006-03-28 14:54 UTC (permalink / raw)
To: linux-mips
[-- Attachment #1: Type: text/plain, Size: 779 bytes --]
patch below makes genrtc.c compilable again
--
Ralf Roesch
diff --git a/include/asm-mips/rtc.h b/include/asm-mips/rtc.h
index a2abc45..82ad401 100644
--- a/include/asm-mips/rtc.h
+++ b/include/asm-mips/rtc.h
@@ -32,7 +32,7 @@ static inline unsigned int get_rtc_time(
{
unsigned long nowtime;
- nowtime = rtc_get_time();
+ nowtime = rtc_mips_get_time();
to_tm(nowtime, time);
time->tm_year -= 1900;
@@ -47,7 +47,7 @@ static inline int set_rtc_time(struct rt
nowtime = mktime(time->tm_year+1900, time->tm_mon+1,
time->tm_mday, time->tm_hour, time->tm_min,
time->tm_sec);
- ret = rtc_set_time(nowtime);
+ ret = rtc_mips_set_time(nowtime);
return ret;
}
[-- Attachment #2: Au1xx0-fix-prom_getenv.patch --]
[-- Type: text/plain, Size: 1384 bytes --]
diff --git a/arch/mips/au1000/common/prom.c b/arch/mips/au1000/common/prom.c
index 9c171af..ae7d8c5 100644
--- a/arch/mips/au1000/common/prom.c
+++ b/arch/mips/au1000/common/prom.c
@@ -1,10 +1,9 @@
/*
*
* BRIEF MODULE DESCRIPTION
- * PROM library initialisation code, assuming a version of
- * pmon is the boot code.
+ * PROM library initialisation code, assuming YAMON is the boot loader.
*
- * Copyright 2000,2001 MontaVista Software Inc.
+ * Copyright 2000, 2001, 2006 MontaVista Software Inc.
* Author: MontaVista Software, Inc.
* ppopov@mvista.com or source@mvista.com
*
@@ -49,9 +48,9 @@ extern char **prom_argv, **prom_envp;
typedef struct
{
- char *name;
-/* char *val; */
-}t_env_var;
+ char *name;
+ char *val;
+} t_env_var;
char * prom_getcmdline(void)
@@ -85,21 +84,16 @@ char *prom_getenv(char *envname)
{
/*
* Return a pointer to the given environment variable.
- * Environment variables are stored in the form of "memsize=64".
*/
t_env_var *env = (t_env_var *)prom_envp;
- int i;
-
- i = strlen(envname);
- while(env->name) {
- if(strncmp(envname, env->name, i) == 0) {
- return(env->name + strlen(envname) + 1);
- }
+ while (env->name) {
+ if (strcmp(envname, env->name) == 0)
+ return env->val;
env++;
}
- return(NULL);
+ return NULL;
}
inline unsigned char str2hexnum(unsigned char c)
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH] rtc.h: fixes to make genrtc.c compilable
2006-03-27 8:32 ` Sergei Shtylylov
2006-03-27 18:44 ` [PATCH] Au1xx0: fix prom_getenv() to handle YAMON style environment Sergei Shtylylov
2006-03-28 14:54 ` [PATCH] rtc.h: fixes to make genrtc.c compilable Ralf Rösch
@ 2006-03-28 15:12 ` Ralf Rösch
2006-03-28 15:14 ` Sergei Shtylylov
2006-03-30 15:02 ` [PATCH] small time list process error in prom_getenv() Sergei Shtylyov
2006-03-31 21:20 ` [PATCH] Au1550: make OSS drivers look pretty on loading Sergei Shtylyov
4 siblings, 1 reply; 8+ messages in thread
From: Ralf Rösch @ 2006-03-28 15:12 UTC (permalink / raw)
To: linux-mips
!please ignore attached patch from mail before!
patch below makes genrtc.c compilable again
--
Ralf Roesch
diff --git a/include/asm-mips/rtc.h b/include/asm-mips/rtc.h
index a2abc45..82ad401 100644
--- a/include/asm-mips/rtc.h
+++ b/include/asm-mips/rtc.h
@@ -32,7 +32,7 @@ static inline unsigned int get_rtc_time(
{
unsigned long nowtime;
- nowtime = rtc_get_time();
+ nowtime = rtc_mips_get_time();
to_tm(nowtime, time);
time->tm_year -= 1900;
@@ -47,7 +47,7 @@ static inline int set_rtc_time(struct rt
nowtime = mktime(time->tm_year+1900, time->tm_mon+1,
time->tm_mday, time->tm_hour, time->tm_min,
time->tm_sec);
- ret = rtc_set_time(nowtime);
+ ret = rtc_mips_set_time(nowtime);
return ret;
}
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] rtc.h: fixes to make genrtc.c compilable
2006-03-28 15:12 ` Ralf Rösch
@ 2006-03-28 15:14 ` Sergei Shtylylov
0 siblings, 0 replies; 8+ messages in thread
From: Sergei Shtylylov @ 2006-03-28 15:14 UTC (permalink / raw)
To: Ralf Rösch; +Cc: linux-mips
Hello.
Ralf Rösch wrote:
> !please ignore attached patch from mail before!
Please don't follow up with unrelated patches, start another thered. :-)
WBR, Sergei
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] small time list process error in prom_getenv()
2006-03-27 8:32 ` Sergei Shtylylov
` (2 preceding siblings ...)
2006-03-28 15:12 ` Ralf Rösch
@ 2006-03-30 15:02 ` Sergei Shtylyov
2006-03-31 21:20 ` [PATCH] Au1550: make OSS drivers look pretty on loading Sergei Shtylyov
4 siblings, 0 replies; 8+ messages in thread
From: Sergei Shtylyov @ 2006-03-30 15:02 UTC (permalink / raw)
To: Freddy Spierenburg; +Cc: linux-mips
Hello.
Sergei Shtylylov wrote:
>> I found a small time bug in prom_getenv() for which I like to
>> share the fix with y'all.
>> prom_envp is an array with two elements per environment variable.
>> So for instance element 0 is memsize and element 1 is 0x08000000
>> for the environment variable memsize=0x08000000.
>> The code for prom_getenv() only skips one element when it's in
>> search for the next environment variable. It should of course
>> step two elements.
>> I found this error in two files and for both I include a patch to
>> fix the problem.
>> ------------------------------------------------------------------------
>>
>> diff -Naur linux.orig/arch/mips/philips/pnx8550/common/prom.c
>> linux/arch/mips/philips/pnx8550/common/prom.c
>> --- linux.orig/arch/mips/philips/pnx8550/common/prom.c 2006-03-22
>> 15:25:58.000000000 +0000
>> +++ linux/arch/mips/philips/pnx8550/common/prom.c 2006-03-22
>> 15:25:23.000000000 +0000
>> @@ -70,7 +70,7 @@
>> if(strncmp(envname, env->name, i) == 0) {
>> return(env->name + strlen(envname) + 1);
>> }
>> - env++;
>> + env+=2;
>> }
>> return(NULL);
>> }
> Not sure what loader the Philips target uses...
It uses some kind of Philips' own loader, so this code should be better
left alone...
WBR, Sergei
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH] Au1550: make OSS drivers look pretty on loading
2006-03-27 8:32 ` Sergei Shtylylov
` (3 preceding siblings ...)
2006-03-30 15:02 ` [PATCH] small time list process error in prom_getenv() Sergei Shtylyov
@ 2006-03-31 21:20 ` Sergei Shtylyov
4 siblings, 0 replies; 8+ messages in thread
From: Sergei Shtylyov @ 2006-03-31 21:20 UTC (permalink / raw)
To: linux-mips; +Cc: Jordan Crouse, Manish Lachwani
[-- Attachment #1: Type: text/plain, Size: 140 bytes --]
Hello.
Calls to pr_info() without newlines caused the OSS drivers' load time
messages to be printed w/o any spacing...
WBR, Sergei
[-- Attachment #2: Au1550-OSS-print-newlines.patch --]
[-- Type: text/plain, Size: 1405 bytes --]
diff --git a/sound/oss/au1550_ac97.c b/sound/oss/au1550_ac97.c
index f38e082..0ca90a0 100644
--- a/sound/oss/au1550_ac97.c
+++ b/sound/oss/au1550_ac97.c
@@ -1950,7 +1950,7 @@ au1550_probe(void)
goto err_dma2;
}
- pr_info("DAC: DMA%d, ADC: DMA%d", DBDMA_AC97_TX_CHAN, DBDMA_AC97_RX_CHAN);
+ pr_info("DAC: DMA%d, ADC: DMA%d\n", DBDMA_AC97_TX_CHAN, DBDMA_AC97_RX_CHAN);
/* register devices */
@@ -2031,7 +2031,7 @@ au1550_probe(void)
s->codec_base_caps = rdcodec(s->codec, AC97_RESET);
s->codec_ext_caps = rdcodec(s->codec, AC97_EXTENDED_ID);
- pr_info("AC'97 Base/Extended ID = %04x/%04x",
+ pr_info("AC'97 Base/Extended ID = %04x/%04x\n",
s->codec_base_caps, s->codec_ext_caps);
if (!(s->codec_ext_caps & AC97_EXTID_VRA)) {
@@ -2047,7 +2047,7 @@ au1550_probe(void)
s->no_vra = 1;
}
if (s->no_vra)
- pr_info("no VRA, interpolating and decimating");
+ pr_info("no VRA, interpolating and decimating\n");
/* set mic to be the recording source */
val = SOUND_MASK_MIC;
diff --git a/sound/oss/au1550_i2s.c b/sound/oss/au1550_i2s.c
index 529b625..9907ac0 100644
--- a/sound/oss/au1550_i2s.c
+++ b/sound/oss/au1550_i2s.c
@@ -1897,7 +1897,7 @@ au1550_probe(void)
goto err_dma2;
}
- pr_info("DAC: DMA%d, ADC: DMA%d", DBDMA_I2S_TX_CHAN, DBDMA_I2S_RX_CHAN);
+ pr_info("DAC: DMA%d, ADC: DMA%d\n", DBDMA_I2S_TX_CHAN, DBDMA_I2S_RX_CHAN);
/* register devices */
^ permalink raw reply related [flat|nested] 8+ messages in thread
end of thread, other threads:[~2006-03-31 21:11 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-03-27 7:43 [PATCH] small time list process error in prom_getenv() Freddy Spierenburg
2006-03-27 8:32 ` Sergei Shtylylov
2006-03-27 18:44 ` [PATCH] Au1xx0: fix prom_getenv() to handle YAMON style environment Sergei Shtylylov
2006-03-28 14:54 ` [PATCH] rtc.h: fixes to make genrtc.c compilable Ralf Rösch
2006-03-28 15:12 ` Ralf Rösch
2006-03-28 15:14 ` Sergei Shtylylov
2006-03-30 15:02 ` [PATCH] small time list process error in prom_getenv() Sergei Shtylyov
2006-03-31 21:20 ` [PATCH] Au1550: make OSS drivers look pretty on loading Sergei Shtylyov
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.