ide-disk: set_addressing() fixes

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Linux Kernel Mailing List
Date: Monday, October 13, 2008 - 3:26 pm

Gitweb:     http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=35c137...
Commit:     35c137531245118962eb40a550661afe317bec03
Parent:     1ea1031cf92b8b8bfbe796d8e8d38b68300475d2
Author:     Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
AuthorDate: Mon Oct 13 21:39:36 2008 +0200
Committer:  Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
CommitDate: Mon Oct 13 21:39:36 2008 +0200

    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>
---
 drivers/ide/ide-disk.c |   11 +++++------
 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 01846f2..65c499a 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)
 	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;
diff --git a/include/linux/ide.h b/include/linux/ide.h
index 02c4c64..90d53c9 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -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 */
 
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
ide-disk: set_addressing() fixes, Linux Kernel Mailing ..., (Mon Oct 13, 3:26 pm)