aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-01-25 16:17:17 -0500
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-01-25 16:17:17 -0500
commita501633c7d44087e806597d3a213d735346edd51 (patch)
treeb82d583f6e29beae7943860b01a0303985d197ea
parent1c904fcfbb0d8eef92ef42b1da378b4714143e46 (diff)
ide-disk: use ide_get_lba_addr()
* 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>
-rw-r--r--drivers/ide/ide-disk.c26
-rw-r--r--drivers/ide/ide-lib.c3
-rw-r--r--include/linux/ide.h1
3 files changed, 7 insertions, 23 deletions
diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c
index 3d7127ba67a0..d8fdd865dea9 100644
--- a/drivers/ide/ide-disk.c
+++ b/drivers/ide/ide-disk.c
@@ -326,18 +326,9 @@ static u64 idedisk_read_native_max_address(ide_drive_t *drive, int lba48)
326 ide_no_data_taskfile(drive, &args); 326 ide_no_data_taskfile(drive, &args);
327 327
328 /* if OK, compute maximum address value */ 328 /* if OK, compute maximum address value */
329 if ((tf->status & 0x01) == 0) { 329 if ((tf->status & 0x01) == 0)
330 u32 high, low; 330 addr = ide_get_lba_addr(tf, lba48) + 1;
331 331
332 if (lba48)
333 high = (tf->hob_lbah << 16) | (tf->hob_lbam << 8) |
334 tf->hob_lbal;
335 else
336 high = tf->device & 0xf;
337 low = (tf->lbah << 16) | (tf->lbam << 8) | tf->lbal;
338 addr = ((__u64)high << 24) | low;
339 addr++; /* since the return value is (maxlba - 1), we add 1 */
340 }
341 return addr; 332 return addr;
342} 333}
343 334
@@ -373,18 +364,9 @@ static u64 idedisk_set_max_address(ide_drive_t *drive, u64 addr_req, int lba48)
373 /* submit command request */ 364 /* submit command request */
374 ide_no_data_taskfile(drive, &args); 365 ide_no_data_taskfile(drive, &args);
375 /* if OK, compute maximum address value */ 366 /* if OK, compute maximum address value */
376 if ((tf->status & 0x01) == 0) { 367 if ((tf->status & 0x01) == 0)
377 u32 high, low; 368 addr_set = ide_get_lba_addr(tf, lba48) + 1;
378 369
379 if (lba48)
380 high = (tf->hob_lbah << 16) | (tf->hob_lbam << 8) |
381 tf->hob_lbal;
382 else
383 high = tf->device & 0xf;
384 low = (tf->lbah << 16) | (tf->lbam << 8) | tf->lbal;
385 addr_set = ((__u64)high << 24) | low;
386 addr_set++;
387 }
388 return addr_set; 370 return addr_set;
389} 371}
390 372
diff --git a/drivers/ide/ide-lib.c b/drivers/ide/ide-lib.c
index d7503c489e99..6b2e810cb9e0 100644
--- a/drivers/ide/ide-lib.c
+++ b/drivers/ide/ide-lib.c
@@ -479,7 +479,7 @@ static void ide_dump_opcode(ide_drive_t *drive)
479 printk("0x%02x\n", opcode); 479 printk("0x%02x\n", opcode);
480} 480}
481 481
482static u64 ide_get_lba_addr(struct ide_taskfile *tf, int lba48) 482u64 ide_get_lba_addr(struct ide_taskfile *tf, int lba48)
483{ 483{
484 u32 high, low; 484 u32 high, low;
485 485
@@ -492,6 +492,7 @@ static u64 ide_get_lba_addr(struct ide_taskfile *tf, int lba48)
492 492
493 return ((u64)high << 24) | low; 493 return ((u64)high << 24) | low;
494} 494}
495EXPORT_SYMBOL_GPL(ide_get_lba_addr);
495 496
496static void ide_dump_sector(ide_drive_t *drive) 497static void ide_dump_sector(ide_drive_t *drive)
497{ 498{
diff --git a/include/linux/ide.h b/include/linux/ide.h
index 67f98c096c03..ecaa96e613dc 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -1238,6 +1238,7 @@ static inline int ide_dev_is_sata(struct hd_driveid *id)
1238 return 0; 1238 return 0;
1239} 1239}
1240 1240
1241u64 ide_get_lba_addr(struct ide_taskfile *, int);
1241u8 ide_dump_status(ide_drive_t *, const char *, u8); 1242u8 ide_dump_status(ide_drive_t *, const char *, u8);
1242 1243
1243typedef struct ide_pio_timings_s { 1244typedef struct ide_pio_timings_s {