Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 27 Apr 2009 18:10:42 +0000 (UTC)
From:      Jung-uk Kim <jkim@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r191573 - head/sys/dev/ata
Message-ID:  <200904271810.n3RIAgoM022134@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jkim
Date: Mon Apr 27 18:10:42 2009
New Revision: 191573
URL: http://svn.freebsd.org/changeset/base/191573

Log:
  Reduce excessive pci_get_devid() and pci_get_revid() calls
  on the same PCI device while device probing.

Modified:
  head/sys/dev/ata/ata-pci.c

Modified: head/sys/dev/ata/ata-pci.c
==============================================================================
--- head/sys/dev/ata/ata-pci.c	Mon Apr 27 17:42:02 2009	(r191572)
+++ head/sys/dev/ata/ata-pci.c	Mon Apr 27 18:10:42 2009	(r191573)
@@ -759,13 +759,17 @@ ata_set_desc(device_t dev)
 struct ata_chip_id *
 ata_match_chip(device_t dev, struct ata_chip_id *index)
 {
+    uint32_t devid;
+    uint8_t revid;
+
+    devid = pci_get_devid(dev);
+    revid = pci_get_revid(dev);
     while (index->chipid != 0) {
-	if (pci_get_devid(dev) == index->chipid &&
-	    pci_get_revid(dev) >= index->chiprev)
-	    return index;
+	if (devid == index->chipid && revid >= index->chiprev)
+	    return (index);
 	index++;
     }
-    return NULL;
+    return (NULL);
 }
 
 struct ata_chip_id *



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200904271810.n3RIAgoM022134>