linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
To: linux-ide@vger.kernel.org
Cc: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Subject: [PATCH 8/18] ide-disk: use ide_get_lba_addr()
Date: Mon, 5 Nov 2007 00:22:57 +0100	[thread overview]
Message-ID: <200711050022.57478.bzolnier@gmail.com> (raw)


* Export ide_get_lba_addr().

* Convert idedisk_{read_native,set}_max_address() to use ide_get_lba_addr().

* Remove incorrect comment from idedisk_read_native_max_address()
  (noticed by Sergei).

There should be no functionality changes caused by this patch.

Cc: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
 drivers/ide/ide-disk.c |   26 ++++----------------------
 drivers/ide/ide-lib.c  |    3 ++-
 include/linux/ide.h    |    1 +
 3 files changed, 7 insertions(+), 23 deletions(-)

Index: b/drivers/ide/ide-disk.c
===================================================================
--- a/drivers/ide/ide-disk.c
+++ b/drivers/ide/ide-disk.c
@@ -352,18 +352,9 @@ static u64 idedisk_read_native_max_addre
 	ide_no_data_taskfile(drive, &args);
 
 	/* if OK, compute maximum address value */
-	if ((tf->status & 0x01) == 0) {
-		u32 high, low;
+	if ((tf->status & 0x01) == 0)
+		addr = ide_get_lba_addr(tf, lba48) + 1;
 
-		if (lba48)
-			high = (tf->hob_lbah << 16) | (tf->hob_lbam << 8) |
-				tf->hob_lbal;
-		else
-			high = tf->device & 0xf;
-		low  = (tf->lbah << 16) | (tf->lbam << 8) | tf->lbal;
-		addr = ((__u64)high << 24) | low;
-		addr++;	/* since the return value is (maxlba - 1), we add 1 */
-	}
 	return addr;
 }
 
@@ -399,18 +390,9 @@ static u64 idedisk_set_max_address(ide_d
 	/* submit command request */
 	ide_no_data_taskfile(drive, &args);
 	/* if OK, compute maximum address value */
-	if ((tf->status & 0x01) == 0) {
-		u32 high, low;
+	if ((tf->status & 0x01) == 0)
+		addr_set = ide_get_lba_addr(tf, lba48) + 1;
 
-		if (lba48)
-			high = (tf->hob_lbah << 16) | (tf->hob_lbam << 8) |
-				tf->hob_lbal;
-		else
-			high = tf->device & 0xf;
-		low  = (tf->lbah << 16) | (tf->lbam << 8) | tf->lbal;
-		addr_set = ((__u64)high << 24) | low;
-		addr_set++;
-	}
 	return addr_set;
 }
 
Index: b/drivers/ide/ide-lib.c
===================================================================
--- a/drivers/ide/ide-lib.c
+++ b/drivers/ide/ide-lib.c
@@ -476,7 +476,7 @@ static void ide_dump_opcode(ide_drive_t 
 		printk("0x%02x\n", opcode);
 }
 
-static u64 ide_get_lba_addr(struct ide_taskfile *tf, int lba48)
+u64 ide_get_lba_addr(struct ide_taskfile *tf, int lba48)
 {
 	u32 high, low;
 
@@ -489,6 +489,7 @@ static u64 ide_get_lba_addr(struct ide_t
 
 	return ((u64)high << 24) | low;
 }
+EXPORT_SYMBOL_GPL(ide_get_lba_addr);
 
 static void ide_dump_sector(ide_drive_t *drive)
 {
Index: b/include/linux/ide.h
===================================================================
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -1238,6 +1238,7 @@ static inline int ide_dev_is_sata(struct
 	return 0;
 }
 
+u64 ide_get_lba_addr(struct ide_taskfile *, int);
 u8 ide_dump_status(ide_drive_t *, const char *, u8);
 
 typedef struct ide_pio_timings_s {

             reply	other threads:[~2007-11-04 23:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-04 23:22 Bartlomiej Zolnierkiewicz [this message]
2007-11-08 14:05 ` [PATCH 8/18] ide-disk: use ide_get_lba_addr() Sergei Shtylyov

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=200711050022.57478.bzolnier@gmail.com \
    --to=bzolnier@gmail.com \
    --cc=linux-ide@vger.kernel.org \
    --cc=sshtylyov@ru.mvista.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;
as well as URLs for NNTP newsgroup(s).