All of lore.kernel.org
 help / color / mirror / Atom feed
* cmd_line and cmd_preset in arch/ppc/boot/simple/misc.c
@ 2005-01-26 18:55 Leigh Brown
  2005-01-27  0:28 ` Rob Baxter
  0 siblings, 1 reply; 3+ messages in thread
From: Leigh Brown @ 2005-01-26 18:55 UTC (permalink / raw)
  To: linuxppc-dev list

Hi,

Could someone please confirm that I'm not going mad?  At least wrt
this ;-)  We have this code in misc.c:

#ifdef CONFIG_GEMINI
        /*
         * If cmd_line is empty and cmd_preset is not, copy cmd_preset
         * to cmd_line.  This way we can override cmd_preset with the
         * command line from Smon.
         */

        if ( (cmd_line[0] == '\0') && (cmd_preset[0] != '\0'))
                memcpy (cmd_line, cmd_preset, sizeof(cmd_preset));
#endif

        /* Display standard Linux/PPC boot prompt for kernel args */
        puts("\nLinux/PPC load: ");
        cp = cmd_line;
        memcpy (cmd_line, cmd_preset, sizeof(cmd_preset));


Surely the bit in the #ifdef is ineffective?  Also, as cmd_line is
initialised to zeros, I think this is better:

        /*
         * If cmd_line is empty and cmd_preset is not, copy cmd_preset
         * to cmd_line.  This way we can override cmd_preset with the
         * command line from Smon.
         */

        if ( (cmd_line[0] == '\0') && (cmd_preset[0] != '\0'))
                memcpy (cmd_line, cmd_preset, sizeof(cmd_preset));

        /* Display standard Linux/PPC boot prompt for kernel args */
        puts("\nLinux/PPC load: ");
        cp = cmd_line;

As, in the general case, cmd_line[0] will always be zero and
cmd_preset[0] will always be filled, so no need for an #ifdef.

If someone can confirm I'm not mistaken, I can send a patch...

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: cmd_line and cmd_preset in arch/ppc/boot/simple/misc.c
  2005-01-26 18:55 cmd_line and cmd_preset in arch/ppc/boot/simple/misc.c Leigh Brown
@ 2005-01-27  0:28 ` Rob Baxter
  2005-01-27 15:40   ` Leigh Brown
  0 siblings, 1 reply; 3+ messages in thread
From: Rob Baxter @ 2005-01-27  0:28 UTC (permalink / raw)
  To: Leigh Brown; +Cc: linuxppc-dev list


No, you're not going mad...

This piece code, CONFIG_GEMINI, complements a piece code in the GEMINI
specific boot code.  This piece of code is not part of the standard
distribution.  What this compliment piece of code did was to pass an
optional command line from the firmware to misc.c.

Hopes this help,
Rob, A GEMINI Developer

On Wed, Jan 26, 2005 at 06:55:13PM -0000, Leigh Brown wrote:
> Hi,
> 
> Could someone please confirm that I'm not going mad?  At least wrt
> this ;-)  We have this code in misc.c:
> 
> #ifdef CONFIG_GEMINI
>         /*
>          * If cmd_line is empty and cmd_preset is not, copy cmd_preset
>          * to cmd_line.  This way we can override cmd_preset with the
>          * command line from Smon.
>          */
> 
>         if ( (cmd_line[0] == '\0') && (cmd_preset[0] != '\0'))
>                 memcpy (cmd_line, cmd_preset, sizeof(cmd_preset));
> #endif
> 
>         /* Display standard Linux/PPC boot prompt for kernel args */
>         puts("\nLinux/PPC load: ");
>         cp = cmd_line;
>         memcpy (cmd_line, cmd_preset, sizeof(cmd_preset));
> 
> 
> Surely the bit in the #ifdef is ineffective?  Also, as cmd_line is
> initialised to zeros, I think this is better:
> 
>         /*
>          * If cmd_line is empty and cmd_preset is not, copy cmd_preset
>          * to cmd_line.  This way we can override cmd_preset with the
>          * command line from Smon.
>          */
> 
>         if ( (cmd_line[0] == '\0') && (cmd_preset[0] != '\0'))
>                 memcpy (cmd_line, cmd_preset, sizeof(cmd_preset));
> 
>         /* Display standard Linux/PPC boot prompt for kernel args */
>         puts("\nLinux/PPC load: ");
>         cp = cmd_line;
> 
> As, in the general case, cmd_line[0] will always be zero and
> cmd_preset[0] will always be filled, so no need for an #ifdef.
> 
> If someone can confirm I'm not mistaken, I can send a patch...
> 
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-dev

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: cmd_line and cmd_preset in arch/ppc/boot/simple/misc.c
  2005-01-27  0:28 ` Rob Baxter
@ 2005-01-27 15:40   ` Leigh Brown
  0 siblings, 0 replies; 3+ messages in thread
From: Leigh Brown @ 2005-01-27 15:40 UTC (permalink / raw)
  To: Rob Baxter; +Cc: linuxppc-dev list

Rob Baxter said:
> On Wed, Jan 26, 2005 at 06:55:13PM -0000, Leigh Brown wrote:
>> Could someone please confirm that I'm not going mad?  At least wrt
>> this ;-)  We have this code in misc.c:
>>
>> #ifdef CONFIG_GEMINI
>>         /*
>>          * If cmd_line is empty and cmd_preset is not, copy cmd_preset
>>          * to cmd_line.  This way we can override cmd_preset with the
>>          * command line from Smon.
>>          */
>>
>>         if ( (cmd_line[0] == '\0') && (cmd_preset[0] != '\0'))
>>                 memcpy (cmd_line, cmd_preset, sizeof(cmd_preset));
>> #endif
>>
>>         /* Display standard Linux/PPC boot prompt for kernel args */
>>         puts("\nLinux/PPC load: ");
>>         cp = cmd_line;
>>         memcpy (cmd_line, cmd_preset, sizeof(cmd_preset));
>>
>>
>> Surely the bit in the #ifdef is ineffective?  Also, as cmd_line is
>> initialised to zeros, I think this is better:
>>
>>         /*
>>          * If cmd_line is empty and cmd_preset is not, copy cmd_preset
>>          * to cmd_line.  This way we can override cmd_preset with the
>>          * command line from Smon.
>>          */
>>
>>         if ( (cmd_line[0] == '\0') && (cmd_preset[0] != '\0'))
>>                 memcpy (cmd_line, cmd_preset, sizeof(cmd_preset));
>>
>>         /* Display standard Linux/PPC boot prompt for kernel args */
>>         puts("\nLinux/PPC load: ");
>>         cp = cmd_line;
>>
>> As, in the general case, cmd_line[0] will always be zero and
>> cmd_preset[0] will always be filled, so no need for an #ifdef.
>>
>> If someone can confirm I'm not mistaken, I can send a patch...
>
> No, you're not going mad...
>
> This piece code, CONFIG_GEMINI, complements a piece code in the GEMINI
> specific boot code.  This piece of code is not part of the standard
> distribution.  What this compliment piece of code did was to pass an
> optional command line from the firmware to misc.c.

Hi Rob, thanks for the answer.  It was more the suggestion that the
code doesn't work: the bit in the #ifdef doesn't achieve anything
because just a few lines below it will *always* overwrite the
contents of cmd_line with the contents of cmd_preset...

Cheers,

Leigh.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2005-01-27 15:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-01-26 18:55 cmd_line and cmd_preset in arch/ppc/boot/simple/misc.c Leigh Brown
2005-01-27  0:28 ` Rob Baxter
2005-01-27 15:40   ` Leigh Brown

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.