ide-disk: set_addressing() fixes
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Mon, 13 Oct 2008 19:39:36 +0000 (21:39 +0200)
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Mon, 13 Oct 2008 19:39:36 +0000 (21:39 +0200)
* 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>
drivers/ide/ide-disk.c
include/linux/ide.h

index 01846f244b40156b3822bcb504f05f7c18b12bd5..65c499aab6641b3c45ef1e4109cc89e7fc5bfb40 100644 (file)
@@ -686,14 +686,13 @@ static int set_addressing(ide_drive_t *drive, int arg)
        if (arg < 0 || arg > 2)
                return -EINVAL;
 
-       drive->addressing =  0;
-
-       if (drive->hwif->host_flags & IDE_HFLAG_NO_LBA48)
-               return 0;
-
-       if (ata_id_lba48_enabled(drive->id) == 0)
+       if (arg && ((drive->hwif->host_flags & IDE_HFLAG_NO_LBA48) ||
+           ata_id_lba48_enabled(drive->id) == 0))
                return -EIO;
 
+       if (arg == 2)
+               arg = 0;
+
        drive->addressing = arg;
 
        return 0;
index 02c4c642e6a549d34505fda6b6515ccc23946fda..90d53c99fe9261b11b159afde6578130ec3b3917 100644 (file)
@@ -509,7 +509,7 @@ struct ide_drive_s {
        unsigned sleeping       : 1;    /* 1=sleeping & sleep field valid */
        unsigned post_reset     : 1;
        unsigned udma33_warned  : 1;
-       unsigned addressing     : 2;    /* 0=28-bit, 1=48-bit, 2=48-bit doing 28-bit */
+       unsigned addressing     : 1;    /* 0=28-bit, 1=48-bit */
        unsigned wcache         : 1;    /* status of write cache */
        unsigned nowerr         : 1;    /* used for ignoring ATA_DF */