public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Harvey Harrison <harvey.harrison@gmail.com>
To: unsik Kim <donari75@gmail.com>
Cc: Heikki Orsila <shdl@zakalwe.fi>,
	linux-kernel@vger.kernel.org, akpm@linux-foundation.org,
	Alan Cox <alan@lxorguk.ukuu.org.uk>
Subject: [PATCH] mflash: remove small byteswapping function
Date: Mon, 05 Jan 2009 11:26:25 -0800	[thread overview]
Message-ID: <1231183585.11902.6.camel@brick> (raw)
In-Reply-To: <20090105111321.7d210c01@lxorguk.ukuu.org.uk>

Byteswap as we read in the data rather than having a
byteswap in place function that is only used once.

MG_SECTOR_SIZE >> 1 == 256 so this should be a no-op.

Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
---
Also, you always call mg_ide_fixstring with byteswap == 1,
I'd suggest removing that parameter and doing it unconditionally.

 drivers/block/mg_disk.c |   17 +----------------
 1 files changed, 1 insertions(+), 16 deletions(-)

diff --git a/drivers/block/mg_disk.c b/drivers/block/mg_disk.c
index 24edc9a..116f2a3 100644
--- a/drivers/block/mg_disk.c
+++ b/drivers/block/mg_disk.c
@@ -141,20 +141,6 @@ static irqreturn_t mg_irq(int irq, void *dev_id)
 	return IRQ_HANDLED;
 }
 
-static void mg_fix_disk_id(u16 *id)
-{
-#ifndef __LITTLE_ENDIAN
-# ifdef __BIG_ENDIAN
-	int i;
-
-	for (i = 0; i < 256; i++)
-		id[i] = __le16_to_cpu(id[i]);
-# else
-#  error "Please fix <asm/byteorder.h>"
-# endif
-#endif
-}
-
 static void mg_ide_fixstring(u8 *s, const int bytecount, const int byteswap)
 {
 	u8 *p, *end = &s[bytecount & ~1]; /* bytecount must be even */
@@ -194,12 +180,11 @@ static int mg_get_disk_id(struct mg_host *host)
 	err = mg_wait(host, MG_REG_STATUS_BIT_DATA_REQ, 3000);
 	if (!err) {
 		for (i = 0; i < (MG_SECTOR_SIZE >> 1); i++)
-			id[i] = inw(host->dev_base + MG_BUFF_OFFSET + i * 2);
+			id[i] = le16_to_cpu(inw(host->dev_base + MG_BUFF_OFFSET + i * 2));
 
 		outb(MG_CMD_RD_CONF, host->dev_base + MG_REG_COMMAND);
 		err = mg_wait(host, MG_STAT_READY, 3000);
 		if (!err) {
-			mg_fix_disk_id(id);
 			if ((host->id_data.field_valid & 1) == 0) {
 				err = MG_ERR_TRANSLATION;
 			} else {
-- 
1.6.1.71.gd5e04




  parent reply	other threads:[~2009-01-05 19:26 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-05  1:18 [PATCH] mflash linux support unsik Kim
2009-01-05  2:33 ` Heikki Orsila
2009-01-05  9:30   ` unsik Kim
2009-01-05 11:13   ` Alan Cox
2009-01-05 17:40     ` Christoph Hellwig
2009-01-06  4:37       ` unsik Kim
2009-01-05 19:26     ` Harvey Harrison [this message]
2009-01-20  8:25       ` [PATCH] mflash: remove small byteswapping function unsik Kim
2009-01-21  5:55         ` MinChan Kim

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=1231183585.11902.6.camel@brick \
    --to=harvey.harrison@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=donari75@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=shdl@zakalwe.fi \
    /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