diff options
author | Auke Kok <auke-jan.h.kok@intel.com> | 2007-06-08 18:46:36 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2007-07-11 19:02:10 -0400 |
commit | 44c10138fd4bbc4b6d6bff0873c24902f2a9da65 (patch) | |
tree | 6e16d3ec80c87490dc743f72da086356f2906ace /drivers/pci/hotplug | |
parent | b8a3a5214d7cc115f1ca3a3967b7229d97c46f4a (diff) |
PCI: Change all drivers to use pci_device->revision
Instead of all drivers reading pci config space to get the revision
ID, they can now use the pci_device->revision member.
This exposes some issues where drivers where reading a word or a dword
for the revision number, and adding useless error-handling around the
read. Some drivers even just read it for no purpose of all.
In devices where the revision ID is being copied over and used in what
appears to be the equivalent of hotpath, I have left the copy code
and the cached copy as not to influence the driver's performance.
Compile tested with make all{yes,mod}config on x86_64 and i386.
Signed-off-by: Auke Kok <auke-jan.h.kok@intel.com>
Acked-by: Dave Jones <davej@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/pci/hotplug')
-rw-r--r-- | drivers/pci/hotplug/cpqphp_core.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/drivers/pci/hotplug/cpqphp_core.c b/drivers/pci/hotplug/cpqphp_core.c index 5617cfdadc5c..d590a99930fa 100644 --- a/drivers/pci/hotplug/cpqphp_core.c +++ b/drivers/pci/hotplug/cpqphp_core.c | |||
@@ -796,7 +796,6 @@ static int cpqhpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
796 | u8 num_of_slots = 0; | 796 | u8 num_of_slots = 0; |
797 | u8 hp_slot = 0; | 797 | u8 hp_slot = 0; |
798 | u8 device; | 798 | u8 device; |
799 | u8 rev; | ||
800 | u8 bus_cap; | 799 | u8 bus_cap; |
801 | u16 temp_word; | 800 | u16 temp_word; |
802 | u16 vendor_id; | 801 | u16 vendor_id; |
@@ -823,9 +822,8 @@ static int cpqhpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
823 | } | 822 | } |
824 | dbg("Vendor ID: %x\n", vendor_id); | 823 | dbg("Vendor ID: %x\n", vendor_id); |
825 | 824 | ||
826 | rc = pci_read_config_byte(pdev, PCI_REVISION_ID, &rev); | 825 | dbg("revision: %d\n", pdev->revision); |
827 | dbg("revision: %d\n", rev); | 826 | if ((vendor_id == PCI_VENDOR_ID_COMPAQ) && (!pdev->revision)) { |
828 | if (rc || ((vendor_id == PCI_VENDOR_ID_COMPAQ) && (!rev))) { | ||
829 | err(msg_HPC_rev_error); | 827 | err(msg_HPC_rev_error); |
830 | rc = -ENODEV; | 828 | rc = -ENODEV; |
831 | goto err_disable_device; | 829 | goto err_disable_device; |
@@ -836,7 +834,7 @@ static int cpqhpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
836 | * For Intel, each SSID bit identifies a PHP capability. | 834 | * For Intel, each SSID bit identifies a PHP capability. |
837 | * Also Intel HPC's may have RID=0. | 835 | * Also Intel HPC's may have RID=0. |
838 | */ | 836 | */ |
839 | if ((rev > 2) || (vendor_id == PCI_VENDOR_ID_INTEL)) { | 837 | if ((pdev->revision > 2) || (vendor_id == PCI_VENDOR_ID_INTEL)) { |
840 | // TODO: This code can be made to support non-Compaq or Intel subsystem IDs | 838 | // TODO: This code can be made to support non-Compaq or Intel subsystem IDs |
841 | rc = pci_read_config_word(pdev, PCI_SUBSYSTEM_VENDOR_ID, &subsystem_vid); | 839 | rc = pci_read_config_word(pdev, PCI_SUBSYSTEM_VENDOR_ID, &subsystem_vid); |
842 | if (rc) { | 840 | if (rc) { |
@@ -870,7 +868,7 @@ static int cpqhpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
870 | 868 | ||
871 | switch (subsystem_vid) { | 869 | switch (subsystem_vid) { |
872 | case PCI_VENDOR_ID_COMPAQ: | 870 | case PCI_VENDOR_ID_COMPAQ: |
873 | if (rev >= 0x13) { /* CIOBX */ | 871 | if (pdev->revision >= 0x13) { /* CIOBX */ |
874 | ctrl->push_flag = 1; | 872 | ctrl->push_flag = 1; |
875 | ctrl->slot_switch_type = 1; | 873 | ctrl->slot_switch_type = 1; |
876 | ctrl->push_button = 1; | 874 | ctrl->push_button = 1; |
@@ -1075,7 +1073,7 @@ static int cpqhpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
1075 | memcpy(ctrl->pci_bus, pdev->bus, sizeof(*ctrl->pci_bus)); | 1073 | memcpy(ctrl->pci_bus, pdev->bus, sizeof(*ctrl->pci_bus)); |
1076 | 1074 | ||
1077 | ctrl->bus = pdev->bus->number; | 1075 | ctrl->bus = pdev->bus->number; |
1078 | ctrl->rev = rev; | 1076 | ctrl->rev = pdev->revision; |
1079 | dbg("bus device function rev: %d %d %d %d\n", ctrl->bus, | 1077 | dbg("bus device function rev: %d %d %d %d\n", ctrl->bus, |
1080 | PCI_SLOT(pdev->devfn), PCI_FUNC(pdev->devfn), ctrl->rev); | 1078 | PCI_SLOT(pdev->devfn), PCI_FUNC(pdev->devfn), ctrl->rev); |
1081 | 1079 | ||