]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
[PATCH] libata: separate out ata_spd_string()
authorTejun Heo <htejun@gmail.com>
Fri, 31 Mar 2006 16:38:17 +0000 (01:38 +0900)
committerJeff Garzik <jeff@garzik.org>
Sat, 1 Apr 2006 17:33:45 +0000 (12:33 -0500)
Separate out ata_spd_string() from sata_print_link_status().  This
will be used by SATA spd configuration routines.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
drivers/scsi/libata-core.c

index c7ba523fb1eb9d23fb3c77e153ccb51f707a26a8..6a336babf88b769fce9f173394d6d02012085150 100644 (file)
@@ -397,6 +397,18 @@ static const char *ata_mode_string(unsigned int xfer_mask)
        return "<n/a>";
 }
 
+static const char *sata_spd_string(unsigned int spd)
+{
+       static const char * const spd_str[] = {
+               "1.5 Gbps",
+               "3.0 Gbps",
+       };
+
+       if (spd == 0 || (spd - 1) >= ARRAY_SIZE(spd_str))
+               return "<unknown>";
+       return spd_str[spd - 1];
+}
+
 static void ata_dev_disable(struct ata_port *ap, struct ata_device *dev)
 {
        if (ata_dev_present(dev)) {
@@ -1452,7 +1464,6 @@ void ata_port_probe(struct ata_port *ap)
 static void sata_print_link_status(struct ata_port *ap)
 {
        u32 sstatus, tmp;
-       const char *speed;
 
        if (!ap->ops->scr_read)
                return;
@@ -1461,14 +1472,8 @@ static void sata_print_link_status(struct ata_port *ap)
 
        if (sata_dev_present(ap)) {
                tmp = (sstatus >> 4) & 0xf;
-               if (tmp & (1 << 0))
-                       speed = "1.5";
-               else if (tmp & (1 << 1))
-                       speed = "3.0";
-               else
-                       speed = "<unknown>";
-               printk(KERN_INFO "ata%u: SATA link up %s Gbps (SStatus %X)\n",
-                      ap->id, speed, sstatus);
+               printk(KERN_INFO "ata%u: SATA link up %s (SStatus %X)\n",
+                      ap->id, sata_spd_string(tmp), sstatus);
        } else {
                printk(KERN_INFO "ata%u: SATA link down (SStatus %X)\n",
                       ap->id, sstatus);