From 3482692415780c844f67bc87f8d82712c2c2e113 Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Sat, 7 Feb 2004 17:43:30 -0800 Subject: [PATCH] [PATCH] cciss: avoid reading PCI config space From: mikem@beardog.cca.cpqcorp.net This patch replaces reading directly form PCI config space where possible. Most of what we need is in the pdev struct. This is in 2.4. --- drivers/block/cciss.c | 27 ++++++--------------------- 1 file changed, 6 insertions(+), 21 deletions(-) diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c index 879d5c825eef2..646466f8007af 100644 --- a/drivers/block/cciss.c +++ b/drivers/block/cciss.c @@ -2121,9 +2121,8 @@ static int find_PCI_BAR_index(struct pci_dev *pdev, static int cciss_pci_init(ctlr_info_t *c, struct pci_dev *pdev) { - ushort vendor_id, device_id, command; - unchar cache_line_size, latency_timer; - unchar irq, revision; + ushort subsystem_vendor_id, subsystem_device_id, command; + unchar irq = pdev->irq; __u32 board_id, scratchpad = 0; __u64 cfg_offset; __u32 cfg_base_addr; @@ -2150,17 +2149,10 @@ static int cciss_pci_init(ctlr_info_t *c, struct pci_dev *pdev) return(-1); } - vendor_id = pdev->vendor; - device_id = pdev->device; - irq = pdev->irq; - - (void) pci_read_config_byte(pdev, PCI_CLASS_REVISION, &revision); - (void) pci_read_config_byte(pdev, PCI_CACHE_LINE_SIZE, - &cache_line_size); - (void) pci_read_config_byte(pdev, PCI_LATENCY_TIMER, - &latency_timer); - (void) pci_read_config_dword(pdev, PCI_SUBSYSTEM_VENDOR_ID, - &board_id); + subsystem_vendor_id = pdev->subsystem_vendor; + subsystem_device_id = pdev->subsystem_device; + board_id = (((__u32) (subsystem_device_id << 16) & 0xffff0000) | + subsystem_vendor_id); /* search for our IO range so we can protect it */ for(i=0; i