]> pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
[PATCH] libata: separate out ata_id_major_version()
authorTejun Heo <htejun@gmail.com>
Sun, 12 Feb 2006 13:47:04 +0000 (22:47 +0900)
committerJeff Garzik <jgarzik@pobox.com>
Sun, 12 Feb 2006 19:24:41 +0000 (14:24 -0500)
Separate out ATA major version calculation from ata_dev_identify()
into ata_id_major_version().  It's preparation for splitting
ata_dev_identify().

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
drivers/scsi/libata-core.c
include/linux/ata.h

index 4df5024c38889f2880f3cc439804fb0b452eecd5..d87854e199f610086efeb1ffaeb4c68816b17d9d 100644 (file)
@@ -927,7 +927,6 @@ static void ata_dev_identify(struct ata_port *ap, unsigned int device)
 {
        struct ata_device *dev = &ap->device[device];
        unsigned int major_version;
-       u16 tmp;
        unsigned long xfer_modes;
        unsigned int using_edd;
        struct ata_taskfile tf;
@@ -1030,10 +1029,7 @@ retry:
                        goto err_out_nosup;
 
                /* get major version */
-               tmp = dev->id[ATA_ID_MAJOR_VER];
-               for (major_version = 14; major_version >= 1; major_version--)
-                       if (tmp & (1 << major_version))
-                               break;
+               major_version = ata_id_major_version(dev->id);
 
                /*
                 * The exact sequence expected by certain pre-ATA4 drives is:
index a8155ca4947fadfda0cc6c09f0b098c6f54628fc..b02a16c435e78b6da13376238bb345aa2ac4ab12 100644 (file)
@@ -267,6 +267,16 @@ struct ata_taskfile {
          ((u64) (id)[(n) + 1] << 16) | \
          ((u64) (id)[(n) + 0]) )
 
+static inline unsigned int ata_id_major_version(const u16 *id)
+{
+       unsigned int mver;
+
+       for (mver = 14; mver >= 1; mver--)
+               if (id[ATA_ID_MAJOR_VER] & (1 << mver))
+                       break;
+       return mver;
+}
+
 static inline int ata_id_current_chs_valid(const u16 *id)
 {
        /* For ATA-1 devices, if the INITIALIZE DEVICE PARAMETERS command