From: Peter Korsgaard <jacmet@sunsite.dk>
To: rpurdie@openedhand.com, linux-mtd@lists.infradead.org
Subject: [PATCH] mtdoops cleanup
Date: Tue, 06 Nov 2007 11:56:02 +0100 [thread overview]
Message-ID: <87wssvve0t.fsf@nanv.dk> (raw)
Use memcpy instead of open coding a copy loop.
Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
---
drivers/mtd/mtdoops.c | 7 ++-----
1 files changed, 2 insertions(+), 5 deletions(-)
diff --git a/drivers/mtd/mtdoops.c b/drivers/mtd/mtdoops.c
index f8af627..20eaf29 100644
--- a/drivers/mtd/mtdoops.c
+++ b/drivers/mtd/mtdoops.c
@@ -286,7 +286,6 @@ mtdoops_console_write(struct console *co, const char *s, unsigned int count)
{
struct mtdoops_context *cxt = co->data;
struct mtd_info *mtd = cxt->mtd;
- int i;
if (!oops_in_progress) {
mtdoops_console_sync();
@@ -305,10 +304,8 @@ mtdoops_console_write(struct console *co, const char *s, unsigned int count)
if ((count + cxt->writecount) > OOPS_PAGE_SIZE)
count = OOPS_PAGE_SIZE - cxt->writecount;
- for (i = 0; i < count; i++, s++)
- *((char *)(cxt->oops_buf) + cxt->writecount + i) = *s;
-
- cxt->writecount = cxt->writecount + count;
+ memcpy(cxt->oops_buf + cxt->writecount, s, count);
+ cxt->writecount += count;
}
static int __init mtdoops_console_setup(struct console *co, char *options)
--
1.5.3.4
--
Bye, Peter Korsgaard
next reply other threads:[~2007-11-06 10:56 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-06 10:56 Peter Korsgaard [this message]
2007-11-21 10:18 ` [PATCH] mtdoops cleanup Peter Korsgaard
2007-11-21 13:20 ` Jörn Engel
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=87wssvve0t.fsf@nanv.dk \
--to=jacmet@sunsite.dk \
--cc=linux-mtd@lists.infradead.org \
--cc=rpurdie@openedhand.com \
/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