diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-10-13 15:39:36 -0400 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-10-13 15:39:36 -0400 |
commit | 35c137531245118962eb40a550661afe317bec03 (patch) | |
tree | 5fa3030baf4fad7a451d3ba991d57b5641a3a094 | |
parent | 1ea1031cf92b8b8bfbe796d8e8d38b68300475d2 (diff) |
ide-disk: set_addressing() fixes
* Return -EIO if arg > 0 and LBA48 is unsupported.
* No need to reset ->addressing.
* Make ->addressing a single bit flag.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
-rw-r--r-- | drivers/ide/ide-disk.c | 11 | ||||
-rw-r--r-- | include/linux/ide.h | 2 |
2 files changed, 6 insertions, 7 deletions
diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c index 01846f244b40..65c499aab664 100644 --- a/drivers/ide/ide-disk.c +++ b/drivers/ide/ide-disk.c | |||
@@ -686,14 +686,13 @@ static int set_addressing(ide_drive_t *drive, int arg) | |||
686 | if (arg < 0 || arg > 2) | 686 | if (arg < 0 || arg > 2) |
687 | return -EINVAL; | 687 | return -EINVAL; |
688 | 688 | ||
689 | drive->addressing = 0; | 689 | if (arg && ((drive->hwif->host_flags & IDE_HFLAG_NO_LBA48) || |
690 | 690 | ata_id_lba48_enabled(drive->id) == 0)) | |
691 | if (drive->hwif->host_flags & IDE_HFLAG_NO_LBA48) | ||
692 | return 0; | ||
693 | |||
694 | if (ata_id_lba48_enabled(drive->id) == 0) | ||
695 | return -EIO; | 691 | return -EIO; |
696 | 692 | ||
693 | if (arg == 2) | ||
694 | arg = 0; | ||
695 | |||
697 | drive->addressing = arg; | 696 | drive->addressing = arg; |
698 | 697 | ||
699 | return 0; | 698 | return 0; |
diff --git a/include/linux/ide.h b/include/linux/ide.h index 02c4c642e6a5..90d53c99fe92 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h | |||
@@ -509,7 +509,7 @@ struct ide_drive_s { | |||
509 | unsigned sleeping : 1; /* 1=sleeping & sleep field valid */ | 509 | unsigned sleeping : 1; /* 1=sleeping & sleep field valid */ |
510 | unsigned post_reset : 1; | 510 | unsigned post_reset : 1; |
511 | unsigned udma33_warned : 1; | 511 | unsigned udma33_warned : 1; |
512 | unsigned addressing : 2; /* 0=28-bit, 1=48-bit, 2=48-bit doing 28-bit */ | 512 | unsigned addressing : 1; /* 0=28-bit, 1=48-bit */ |
513 | unsigned wcache : 1; /* status of write cache */ | 513 | unsigned wcache : 1; /* status of write cache */ |
514 | unsigned nowerr : 1; /* used for ignoring ATA_DF */ | 514 | unsigned nowerr : 1; /* used for ignoring ATA_DF */ |
515 | 515 | ||