[PATCH] mtdoops cleanup
Peter Korsgaard
jacmet at sunsite.dk
Wed Nov 21 05:18:47 EST 2007
>>>>> "Peter" == Peter Korsgaard <jacmet at sunsite.dk> writes:
Comments?
Peter> Use memcpy instead of open coding a copy loop.
Peter> Signed-off-by: Peter Korsgaard <jacmet at sunsite.dk>
Peter> ---
Peter> drivers/mtd/mtdoops.c | 7 ++-----
Peter> 1 files changed, 2 insertions(+), 5 deletions(-)
Peter> diff --git a/drivers/mtd/mtdoops.c b/drivers/mtd/mtdoops.c
Peter> index f8af627..20eaf29 100644
Peter> --- a/drivers/mtd/mtdoops.c
Peter> +++ b/drivers/mtd/mtdoops.c
Peter> @@ -286,7 +286,6 @@ mtdoops_console_write(struct console *co, const char *s, unsigned int count)
Peter> {
Peter> struct mtdoops_context *cxt = co->data;
Peter> struct mtd_info *mtd = cxt->mtd;
Peter> - int i;
Peter> if (!oops_in_progress) {
Peter> mtdoops_console_sync();
Peter> @@ -305,10 +304,8 @@ mtdoops_console_write(struct console *co, const char *s, unsigned int count)
Peter> if ((count + cxt->writecount) > OOPS_PAGE_SIZE)
Peter> count = OOPS_PAGE_SIZE - cxt->writecount;
Peter> - for (i = 0; i < count; i++, s++)
Peter> - *((char *)(cxt->oops_buf) + cxt->writecount + i) = *s;
Peter> -
Peter> - cxt->writecount = cxt->writecount + count;
Peter> + memcpy(cxt->oops_buf + cxt->writecount, s, count);
Peter> + cxt->writecount += count;
Peter> }
Peter> static int __init mtdoops_console_setup(struct console *co, char *options)
Peter> --
Peter> 1.5.3.4
Peter> --
Peter> Bye, Peter Korsgaard
Peter> ______________________________________________________
Peter> Linux MTD discussion mailing list
Peter> http://lists.infradead.org/mailman/listinfo/linux-mtd/
--
Bye, Peter Korsgaard
More information about the linux-mtd
mailing list