Linux MIPS Architecture development
 help / color / mirror / Atom feed
From: Antony Pavlov <antonynpavlov@gmail.com>
To: Antony Pavlov <antonynpavlov@gmail.com>
Cc: linux-mips@linux-mips.org, Ralf Baechle <ralf@linux-mips.org>,
	John Crispin <blogic@openwrt.org>,
	Florian Fainelli <f.fainelli@gmail.com>
Subject: Re: [PATCH v3] MIPS: ZBOOT: gather string functions into string.c
Date: Tue, 14 Jan 2014 11:05:25 +0400	[thread overview]
Message-ID: <20140114110525.cd37b131de060259404bd4c8@gmail.com> (raw)
In-Reply-To: <1389648656-25709-1-git-send-email-antonynpavlov@gmail.com>

On Tue, 14 Jan 2014 01:30:56 +0400
Antony Pavlov <antonynpavlov@gmail.com> wrote:

> In the worst case this adds less then 128 bytes of code

Sorry! I see a typo here.
Please change "then" to "than" before applying.

> but on the other hand this makes code organization more clear.
> 
> Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
> Cc: linux-mips@linux-mips.org
> Cc: Ralf Baechle <ralf@linux-mips.org>
> Cc: John Crispin <blogic@openwrt.org>
> Cc: Florian Fainelli <f.fainelli@gmail.com>
> ---
>  arch/mips/boot/compressed/Makefile     |  4 ++--
>  arch/mips/boot/compressed/decompress.c | 22 ----------------------
>  arch/mips/boot/compressed/string.c     | 28 ++++++++++++++++++++++++++++
>  3 files changed, 30 insertions(+), 24 deletions(-)
>  create mode 100644 arch/mips/boot/compressed/string.c
> 
> diff --git a/arch/mips/boot/compressed/Makefile b/arch/mips/boot/compressed/Makefile
> index ca0c343..61af6b6 100644
> --- a/arch/mips/boot/compressed/Makefile
> +++ b/arch/mips/boot/compressed/Makefile
> @@ -27,10 +27,10 @@ KBUILD_AFLAGS := $(LINUXINCLUDE) $(KBUILD_AFLAGS) -D__ASSEMBLY__ \
>  	-DBOOT_HEAP_SIZE=$(BOOT_HEAP_SIZE) \
>  	-DKERNEL_ENTRY=$(VMLINUX_ENTRY_ADDRESS)
>  
> -targets := head.o decompress.o dbg.o uart-16550.o uart-alchemy.o
> +targets := head.o decompress.o string.o dbg.o uart-16550.o uart-alchemy.o
>  
>  # decompressor objects (linked with vmlinuz)
> -vmlinuzobjs-y := $(obj)/head.o $(obj)/decompress.o $(obj)/dbg.o
> +vmlinuzobjs-y := $(obj)/head.o $(obj)/decompress.o $(obj)/string.o $(obj)/dbg.o
>  
>  ifdef CONFIG_DEBUG_ZBOOT
>  vmlinuzobjs-$(CONFIG_SYS_SUPPORTS_ZBOOT_UART16550) += $(obj)/uart-16550.o
> diff --git a/arch/mips/boot/compressed/decompress.c b/arch/mips/boot/compressed/decompress.c
> index a8c6fd6..c00c4dd 100644
> --- a/arch/mips/boot/compressed/decompress.c
> +++ b/arch/mips/boot/compressed/decompress.c
> @@ -43,33 +43,11 @@ void error(char *x)
>  /* activate the code for pre-boot environment */
>  #define STATIC static
>  
> -#if defined(CONFIG_KERNEL_GZIP) || defined(CONFIG_KERNEL_XZ) || \
> -	defined(CONFIG_KERNEL_LZ4)
> -void *memcpy(void *dest, const void *src, size_t n)
> -{
> -	int i;
> -	const char *s = src;
> -	char *d = dest;
> -
> -	for (i = 0; i < n; i++)
> -		d[i] = s[i];
> -	return dest;
> -}
> -#endif
>  #ifdef CONFIG_KERNEL_GZIP
>  #include "../../../../lib/decompress_inflate.c"
>  #endif
>  
>  #ifdef CONFIG_KERNEL_BZIP2
> -void *memset(void *s, int c, size_t n)
> -{
> -	int i;
> -	char *ss = s;
> -
> -	for (i = 0; i < n; i++)
> -		ss[i] = c;
> -	return s;
> -}
>  #include "../../../../lib/decompress_bunzip2.c"
>  #endif
>  
> diff --git a/arch/mips/boot/compressed/string.c b/arch/mips/boot/compressed/string.c
> new file mode 100644
> index 0000000..9de9885
> --- /dev/null
> +++ b/arch/mips/boot/compressed/string.c
> @@ -0,0 +1,28 @@
> +/*
> + * arch/mips/boot/compressed/string.c
> + *
> + * Very small subset of simple string routines
> + */
> +
> +#include <linux/types.h>
> +
> +void *memcpy(void *dest, const void *src, size_t n)
> +{
> +	int i;
> +	const char *s = src;
> +	char *d = dest;
> +
> +	for (i = 0; i < n; i++)
> +		d[i] = s[i];
> +	return dest;
> +}
> +
> +void *memset(void *s, int c, size_t n)
> +{
> +	int i;
> +	char *ss = s;
> +
> +	for (i = 0; i < n; i++)
> +		ss[i] = c;
> +	return s;
> +}
> -- 
> 1.8.5.2
> 


-- 
-- 
Best regards,
  Antony Pavlov

      parent reply	other threads:[~2014-01-14  6:58 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-13 21:30 [PATCH v3] MIPS: ZBOOT: gather string functions into string.c Antony Pavlov
2014-01-13 21:30 ` Antony Pavlov
2014-01-13 22:20 ` John Crispin
2014-01-14  5:31   ` Antony Pavlov
2014-01-14  5:26     ` Florian Fainelli
2014-01-14  7:05 ` Antony Pavlov [this message]

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=20140114110525.cd37b131de060259404bd4c8@gmail.com \
    --to=antonynpavlov@gmail.com \
    --cc=blogic@openwrt.org \
    --cc=f.fainelli@gmail.com \
    --cc=linux-mips@linux-mips.org \
    --cc=ralf@linux-mips.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