Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=6c3c22f3cb2b7cd0a42a024b93db76b5c3133d37
Commit:     6c3c22f3cb2b7cd0a42a024b93db76b5c3133d37
Parent:     7293136810936bbde403bcb67ac1b4dbae4dd790
Author:     Sergei Shtylyov <[EMAIL PROTECTED]>
AuthorDate: Tue Sep 11 22:28:36 2007 +0200
Committer:  Bartlomiej Zolnierkiewicz <[EMAIL PROTECTED]>
CommitDate: Tue Sep 11 22:28:36 2007 +0200

    ide: add ide_dev_is_sata() helper (take 2)
    
    Make the SATA drive detection code from eighty_ninty_three() into inline
    ide_dev_is_sata() helper fixing it along the way to be more strict while
    checking word 80 for the reserved values...
    
    Signed-off-by: Sergei Shtylyov <[EMAIL PROTECTED]>
    Signed-off-by: Bartlomiej Zolnierkiewicz <[EMAIL PROTECTED]>
---
 drivers/ide/ide-iops.c |    3 +--
 include/linux/ide.h    |   13 +++++++++++++
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/drivers/ide/ide-iops.c b/drivers/ide/ide-iops.c
index f4cd270..646a54e 100644
--- a/drivers/ide/ide-iops.c
+++ b/drivers/ide/ide-iops.c
@@ -615,8 +615,7 @@ u8 eighty_ninty_three (ide_drive_t *drive)
        if (hwif->cbl != ATA_CBL_PATA80 && !ivb)
                goto no_80w;
 
-       /* Check for SATA but only if we are ATA5 or higher */
-       if (id->hw_config == 0 && (id->major_rev_num & 0x7FE0))
+       if (ide_dev_is_sata(id))
                return 1;
 
        /*
diff --git a/include/linux/ide.h b/include/linux/ide.h
index c792b4f..b9f66c1 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -1378,6 +1378,19 @@ static inline int ide_dev_has_iordy(struct hd_driveid 
*id)
        return ((id->field_valid & 2) && (id->capability & 8)) ? 1 : 0;
 }
 
+static inline int ide_dev_is_sata(struct hd_driveid *id)
+{
+       /*
+        * See if word 93 is 0 AND drive is at least ATA-5 compatible
+        * verifying that word 80 by casting it to a signed type --
+        * this trick allows us to filter out the reserved values of
+        * 0x0000 and 0xffff along with the earlier ATA revisions...
+        */
+       if (id->hw_config == 0 && (short)id->major_rev_num >= 0x0020)
+               return 1;
+       return 0;
+}
+
 u8 ide_dump_status(ide_drive_t *, const char *, u8);
 
 typedef struct ide_pio_timings_s {
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to