summaryrefslogtreecommitdiffstats
path: root/drivers/ata/libata-core.c
diff options
context:
space:
mode:
authorTejun Heo2008-03-27 11:14:23 +0100
committerJeff Garzik2008-04-17 21:44:20 +0200
commita5987e0a1b569146ed9cfa0a8c275a21b344fcaa (patch)
tree23c6f0e4ac2e521fdcb87aadf214ad8987b67b22 /drivers/ata/libata-core.c
parent[libata] sata_nv: disable ADMA by default (diff)
downloadkernel-qcow2-linux-a5987e0a1b569146ed9cfa0a8c275a21b344fcaa.tar.gz
kernel-qcow2-linux-a5987e0a1b569146ed9cfa0a8c275a21b344fcaa.tar.xz
kernel-qcow2-linux-a5987e0a1b569146ed9cfa0a8c275a21b344fcaa.zip
libata: make ata_tf_to_lba[48]() generic
ata_tf_to_lba[48]() currently return LBA in tf + 1 for ata_read_native_max_address(). Make them return LBA and make it global so that it can be used to read LBA off TF for other purposes. ata_read_native_max_address() now adds 1 itself. Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/ata/libata-core.c')
-rw-r--r--drivers/ata/libata-core.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 9121cc443be8..4d78f5debb6c 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -1211,7 +1211,7 @@ static u64 ata_id_n_sectors(const u16 *id)
}
}
-static u64 ata_tf_to_lba48(struct ata_taskfile *tf)
+u64 ata_tf_to_lba48(const struct ata_taskfile *tf)
{
u64 sectors = 0;
@@ -1222,10 +1222,10 @@ static u64 ata_tf_to_lba48(struct ata_taskfile *tf)
sectors |= (tf->lbam & 0xff) << 8;
sectors |= (tf->lbal & 0xff);
- return ++sectors;
+ return sectors;
}
-static u64 ata_tf_to_lba(struct ata_taskfile *tf)
+u64 ata_tf_to_lba(const struct ata_taskfile *tf)
{
u64 sectors = 0;
@@ -1234,7 +1234,7 @@ static u64 ata_tf_to_lba(struct ata_taskfile *tf)
sectors |= (tf->lbam & 0xff) << 8;
sectors |= (tf->lbal & 0xff);
- return ++sectors;
+ return sectors;
}
/**
@@ -1279,9 +1279,9 @@ static int ata_read_native_max_address(struct ata_device *dev, u64 *max_sectors)
}
if (lba48)
- *max_sectors = ata_tf_to_lba48(&tf);
+ *max_sectors = ata_tf_to_lba48(&tf) + 1;
else
- *max_sectors = ata_tf_to_lba(&tf);
+ *max_sectors = ata_tf_to_lba(&tf) + 1;
if (dev->horkage & ATA_HORKAGE_HPA_SIZE)
(*max_sectors)--;
return 0;