From patchwork Wed Aug 26 23:20:46 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Helgaas X-Patchwork-Id: 44144 X-Patchwork-Delegate: bhelgaas@google.com Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n7QNKYZI005558 for ; Wed, 26 Aug 2009 23:20:44 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753426AbZHZXUl (ORCPT ); Wed, 26 Aug 2009 19:20:41 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753508AbZHZXUl (ORCPT ); Wed, 26 Aug 2009 19:20:41 -0400 Received: from g5t0009.atlanta.hp.com ([15.192.0.46]:21945 "EHLO g5t0009.atlanta.hp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753426AbZHZXUk (ORCPT ); Wed, 26 Aug 2009 19:20:40 -0400 Received: from g1t0039.austin.hp.com (g1t0039.austin.hp.com [16.236.32.45]) by g5t0009.atlanta.hp.com (Postfix) with ESMTP id E13403005C; Wed, 26 Aug 2009 23:20:42 +0000 (UTC) Received: from ldl (linux.corp.hp.com [15.11.146.101]) by g1t0039.austin.hp.com (Postfix) with ESMTP id AF01834079; Wed, 26 Aug 2009 23:20:42 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by ldl (Postfix) with ESMTP id 987CFCF001A; Wed, 26 Aug 2009 17:20:42 -0600 (MDT) Received: from ldl ([127.0.0.1]) by localhost (localhost [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id aGgxK54cqktV; Wed, 26 Aug 2009 17:20:42 -0600 (MDT) Received: from eh.fc.hp.com (eh.fc.hp.com [15.11.146.105]) by ldl (Postfix) with ESMTP id 83338CF000E; Wed, 26 Aug 2009 17:20:42 -0600 (MDT) Received: from bob.kio (localhost [127.0.0.1]) by eh.fc.hp.com (Postfix) with ESMTP id 4EFE326142; Wed, 26 Aug 2009 17:20:46 -0600 (MDT) Subject: [PATCH 2/8] PCI hotplug: acpiphp: don't cache hotplug_params in acpiphp_bridge To: Kristen Carlson Accardi From: Bjorn Helgaas Cc: linux-pci@vger.kernel.org, Gary Hade , Kenji Kaneshige Date: Wed, 26 Aug 2009 17:20:46 -0600 Message-ID: <20090826232046.20840.98723.stgit@bob.kio> In-Reply-To: <20090826231949.20840.99949.stgit@bob.kio> References: <20090826231949.20840.99949.stgit@bob.kio> User-Agent: StGit/0.14.3.386.gb02d MIME-Version: 1.0 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org We always look up hotplug_params with decode_hpp() immediately before using them, so we don't need to save them in the acpiphp_bridge struct. This patch follows the example of program_fw_provided_values() in pciehp_pci.c and shpchp_pci.c by just keeping the params on the stack while we need them. Signed-off-by: Bjorn Helgaas Reviewed-by: Alex Chiang --- drivers/pci/hotplug/acpiphp.h | 3 -- drivers/pci/hotplug/acpiphp_glue.c | 58 +++++++++++++++++------------------- 2 files changed, 27 insertions(+), 34 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/pci/hotplug/acpiphp.h b/drivers/pci/hotplug/acpiphp.h index e68d5f2..7d938df 100644 --- a/drivers/pci/hotplug/acpiphp.h +++ b/drivers/pci/hotplug/acpiphp.h @@ -91,9 +91,6 @@ struct acpiphp_bridge { /* PCI-to-PCI bridge device */ struct pci_dev *pci_dev; - /* ACPI 2.0 _HPP parameters */ - struct hotplug_params hpp; - spinlock_t res_lock; }; diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c index d2f4ce1..1eec666 100644 --- a/drivers/pci/hotplug/acpiphp_glue.c +++ b/drivers/pci/hotplug/acpiphp_glue.c @@ -59,7 +59,7 @@ static DEFINE_SPINLOCK(ioapic_list_lock); static void handle_hotplug_event_bridge (acpi_handle, u32, void *); static void acpiphp_sanitize_bus(struct pci_bus *bus); -static void acpiphp_set_hpp_values(acpi_handle handle, struct pci_bus *bus); +static void acpiphp_set_hpp_values(struct pci_bus *bus); static void handle_hotplug_event_func(acpi_handle handle, u32 type, void *context); /* callback routine to check for the existence of a pci dock device */ @@ -276,23 +276,23 @@ static int detect_ejectable_slots(struct pci_bus *pbus) /* decode ACPI 2.0 _HPP hot plug parameters */ -static void decode_hpp(struct acpiphp_bridge *bridge) +static void decode_hpp(struct pci_dev *dev, struct hotplug_params *hpp) { acpi_status status; - status = acpi_get_hp_params_from_firmware(bridge->pci_bus, &bridge->hpp); + status = acpi_get_hp_params_from_firmware(dev->bus, hpp); if (ACPI_FAILURE(status) || - !bridge->hpp.t0 || (bridge->hpp.t0->revision > 1)) { + !hpp->t0 || (hpp->t0->revision > 1)) { /* use default numbers */ printk(KERN_WARNING "%s: Could not get hotplug parameters. Use defaults\n", __func__); - bridge->hpp.t0 = &bridge->hpp.type0_data; - bridge->hpp.t0->revision = 0; - bridge->hpp.t0->cache_line_size = 0x10; - bridge->hpp.t0->latency_timer = 0x40; - bridge->hpp.t0->enable_serr = 0; - bridge->hpp.t0->enable_perr = 0; + hpp->t0 = &hpp->type0_data; + hpp->t0->revision = 0; + hpp->t0->cache_line_size = 0x10; + hpp->t0->latency_timer = 0x40; + hpp->t0->enable_serr = 0; + hpp->t0->enable_perr = 0; } } @@ -1080,7 +1080,7 @@ static int __ref enable_device(struct acpiphp_slot *slot) pci_bus_assign_resources(bus); acpiphp_sanitize_bus(bus); - acpiphp_set_hpp_values(slot->bridge->handle, bus); + acpiphp_set_hpp_values(bus); list_for_each_entry(func, &slot->funcs, sibling) acpiphp_configure_ioapics(func->handle); pci_enable_bridges(bus); @@ -1291,7 +1291,7 @@ static int acpiphp_check_bridge(struct acpiphp_bridge *bridge) return retval; } -static void program_hpp(struct pci_dev *dev, struct acpiphp_bridge *bridge) +static void program_hpp(struct pci_dev *dev, struct hotplug_params *hpp) { u16 pci_cmd, pci_bctl; struct pci_dev *cdev; @@ -1306,15 +1306,15 @@ static void program_hpp(struct pci_dev *dev, struct acpiphp_bridge *bridge) return; pci_write_config_byte(dev, PCI_CACHE_LINE_SIZE, - bridge->hpp.t0->cache_line_size); + hpp->t0->cache_line_size); pci_write_config_byte(dev, PCI_LATENCY_TIMER, - bridge->hpp.t0->latency_timer); + hpp->t0->latency_timer); pci_read_config_word(dev, PCI_COMMAND, &pci_cmd); - if (bridge->hpp.t0->enable_serr) + if (hpp->t0->enable_serr) pci_cmd |= PCI_COMMAND_SERR; else pci_cmd &= ~PCI_COMMAND_SERR; - if (bridge->hpp.t0->enable_perr) + if (hpp->t0->enable_perr) pci_cmd |= PCI_COMMAND_PARITY; else pci_cmd &= ~PCI_COMMAND_PARITY; @@ -1323,13 +1323,13 @@ static void program_hpp(struct pci_dev *dev, struct acpiphp_bridge *bridge) /* Program bridge control value and child devices */ if ((dev->class >> 8) == PCI_CLASS_BRIDGE_PCI) { pci_write_config_byte(dev, PCI_SEC_LATENCY_TIMER, - bridge->hpp.t0->latency_timer); + hpp->t0->latency_timer); pci_read_config_word(dev, PCI_BRIDGE_CONTROL, &pci_bctl); - if (bridge->hpp.t0->enable_serr) + if (hpp->t0->enable_serr) pci_bctl |= PCI_BRIDGE_CTL_SERR; else pci_bctl &= ~PCI_BRIDGE_CTL_SERR; - if (bridge->hpp.t0->enable_perr) + if (hpp->t0->enable_perr) pci_bctl |= PCI_BRIDGE_CTL_PARITY; else pci_bctl &= ~PCI_BRIDGE_CTL_PARITY; @@ -1337,24 +1337,20 @@ static void program_hpp(struct pci_dev *dev, struct acpiphp_bridge *bridge) if (dev->subordinate) { list_for_each_entry(cdev, &dev->subordinate->devices, bus_list) - program_hpp(cdev, bridge); + program_hpp(cdev, hpp); } } } -static void acpiphp_set_hpp_values(acpi_handle handle, struct pci_bus *bus) +static void acpiphp_set_hpp_values(struct pci_bus *bus) { - struct acpiphp_bridge bridge; struct pci_dev *dev; + struct hotplug_params hpp; - memset(&bridge, 0, sizeof(bridge)); - bridge.handle = handle; - bridge.pci_bus = bus; - bridge.pci_dev = bus->self; - decode_hpp(&bridge); - list_for_each_entry(dev, &bus->devices, bus_list) - program_hpp(dev, &bridge); - + list_for_each_entry(dev, &bus->devices, bus_list) { + decode_hpp(dev, &hpp); + program_hpp(dev, &hpp); + } } /* @@ -1398,7 +1394,7 @@ static int acpiphp_configure_bridge (acpi_handle handle) pci_bus_size_bridges(bus); pci_bus_assign_resources(bus); acpiphp_sanitize_bus(bus); - acpiphp_set_hpp_values(handle, bus); + acpiphp_set_hpp_values(bus); pci_enable_bridges(bus); acpiphp_configure_ioapics(handle); pci_dev_put(dev);