]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
ide-disk: use ide_get_lba_addr()
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Fri, 25 Jan 2008 21:17:17 +0000 (22:17 +0100)
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Fri, 25 Jan 2008 21:17:17 +0000 (22:17 +0100)
* 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.

Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
drivers/ide/ide-disk.c
drivers/ide/ide-lib.c
include/linux/ide.h

index 3d7127ba67a0e2778956f84cf134e38e4119c908..d8fdd865dea9b3d7f5ca5f41c2169a224e3eef5a 100644 (file)
@@ -326,18 +326,9 @@ static u64 idedisk_read_native_max_address(ide_drive_t *drive, int lba48)
        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;
 }
 
@@ -373,18 +364,9 @@ static u64 idedisk_set_max_address(ide_drive_t *drive, u64 addr_req, int lba48)
        /* 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 d7503c489e99396519a877d648ae785eadc900c2..6b2e810cb9e099382bf27ea1d75c82a78cf99ece 100644 (file)
@@ -479,7 +479,7 @@ static void ide_dump_opcode(ide_drive_t *drive)
                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;
 
@@ -492,6 +492,7 @@ static u64 ide_get_lba_addr(struct ide_taskfile *tf, int lba48)
 
        return ((u64)high << 24) | low;
 }
+EXPORT_SYMBOL_GPL(ide_get_lba_addr);
 
 static void ide_dump_sector(ide_drive_t *drive)
 {
index 67f98c096c032d57f4ed9a7b01f5e327045bf31d..ecaa96e613dc75ffbe4fe0eaab2e0e8566f3e841 100644 (file)
@@ -1238,6 +1238,7 @@ static inline int ide_dev_is_sata(struct hd_driveid *id)
        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 {