From patchwork Tue Jul 9 00:20:31 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rafael J. Wysocki" X-Patchwork-Id: 257622 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id AD2432C029D for ; Tue, 9 Jul 2013 10:15:24 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753553Ab3GIAPG (ORCPT ); Mon, 8 Jul 2013 20:15:06 -0400 Received: from hydra.sisk.pl ([212.160.235.94]:35121 "EHLO hydra.sisk.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753461Ab3GIANS (ORCPT ); Mon, 8 Jul 2013 20:13:18 -0400 Received: from vostro.rjw.lan (aerm187.neoplus.adsl.tpnet.pl [79.191.194.187]) by hydra.sisk.pl (Postfix) with ESMTPSA id 05B82E3DD5; Tue, 9 Jul 2013 02:09:12 +0200 (CEST) From: "Rafael J. Wysocki" To: ACPI Devel Maling List Cc: Bjorn Helgaas , LKML , Linux PCI , Yinghai Lu , Jiang Liu , Mika Westerberg Subject: [RFC][PATCH 6/8] ACPI / hotplug / PCI: Drop acpiphp_handle_to_bridge() Date: Tue, 09 Jul 2013 02:20:31 +0200 Message-ID: <3804403.VVlzfJfUyu@vostro.rjw.lan> User-Agent: KMail/4.9.5 (Linux/3.10.0+; KDE/4.9.5; x86_64; ; ) In-Reply-To: <26431283.HJCKsss0rt@vostro.rjw.lan> References: <26431283.HJCKsss0rt@vostro.rjw.lan> MIME-Version: 1.0 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org From: Rafael J. Wysocki Using the hotplug context objects introduced previously rework the ACPI-based PCI hotplug (acpiphp) core code to get to acpiphp_bridge objects associated with hotplug bridges from those context objects rather than from the global list of hotplug bridges. After that the acpiphp_handle_to_bridge() is not necessary any more, so drop it. Signed-off-by: Rafael J. Wysocki --- drivers/pci/hotplug/acpiphp_glue.c | 54 +++++++++++++++++-------------------- 1 file changed, 25 insertions(+), 29 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 Index: linux-pm/drivers/pci/hotplug/acpiphp_glue.c =================================================================== --- linux-pm.orig/drivers/pci/hotplug/acpiphp_glue.c +++ linux-pm/drivers/pci/hotplug/acpiphp_glue.c @@ -441,22 +441,6 @@ static int detect_ejectable_slots(acpi_h return found; } -static struct acpiphp_bridge *acpiphp_handle_to_bridge(acpi_handle handle) -{ - struct acpiphp_bridge *bridge; - - mutex_lock(&bridge_mutex); - list_for_each_entry(bridge, &bridge_list, list) - if (bridge->handle == handle) { - get_bridge(bridge); - mutex_unlock(&bridge_mutex); - return bridge; - } - mutex_unlock(&bridge_mutex); - - return NULL; -} - static void cleanup_bridge(struct acpiphp_bridge *bridge) { struct acpiphp_slot *slot; @@ -953,37 +937,49 @@ static void acpiphp_sanitize_bus(struct * ACPI event handlers */ -static acpi_status -check_sub_bridges(acpi_handle handle, u32 lvl, void *context, void **rv) +static acpi_status check_sub_bridges(acpi_handle handle, u32 lvl, void *data, + void **rv) { - struct acpiphp_bridge *bridge; - char objname[64]; - struct acpi_buffer buffer = { .length = sizeof(objname), - .pointer = objname }; + struct acpiphp_context *context = acpiphp_get_context(handle); + + if (!context) + return AE_OK; - bridge = acpiphp_handle_to_bridge(handle); - if (bridge) { + if (context->bridge) { + struct acpiphp_bridge *bridge = context->bridge; + char objname[64]; + struct acpi_buffer buffer = { .length = sizeof(objname), + .pointer = objname }; + + get_bridge(bridge); acpi_get_name(handle, ACPI_FULL_PATHNAME, &buffer); - dbg("%s: re-enumerating slots under %s\n", - __func__, objname); + dbg("%s: re-enumerating slots under %s\n", __func__, objname); acpiphp_check_bridge(bridge); put_bridge(bridge); } + acpiphp_put_context(context); return AE_OK ; } void acpiphp_check_host_bridge(acpi_handle handle) { - struct acpiphp_bridge *bridge; + struct acpiphp_context *context = acpiphp_get_context(handle); - bridge = acpiphp_handle_to_bridge(handle); - if (bridge) { + if (!context) + return; + + if (context->bridge) { + struct acpiphp_bridge *bridge = context->bridge; + + get_bridge(bridge); acpiphp_check_bridge(bridge); put_bridge(bridge); } acpi_walk_namespace(ACPI_TYPE_DEVICE, handle, ACPI_UINT32_MAX, check_sub_bridges, NULL, NULL, NULL); + + acpiphp_put_context(context); } static void _handle_hotplug_event_bridge(struct work_struct *work)