Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933169Ab3GLM4v (ORCPT ); Fri, 12 Jul 2013 08:56:51 -0400 Received: from mga01.intel.com ([192.55.52.88]:61920 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932974Ab3GLM4s (ORCPT ); Fri, 12 Jul 2013 08:56:48 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.89,652,1367996400"; d="scan'208";a="369223487" Date: Fri, 12 Jul 2013 16:01:59 +0300 From: Mika Westerberg To: "Rafael J. Wysocki" Cc: ACPI Devel Maling List , Bjorn Helgaas , LKML , Linux PCI , Yinghai Lu , Jiang Liu Subject: Re: [RFC][PATCH 11/30] ACPI / hotplug / PCI: Register all devices under the given bridge Message-ID: <20130712130159.GJ4898@intel.com> References: <26431283.HJCKsss0rt@vostro.rjw.lan> <3718119.FLASu5DBx8@vostro.rjw.lan> <1910839.UjS2m1ckUq@vostro.rjw.lan> <20130712115420.GH4898@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20130712115420.GH4898@intel.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2966 Lines: 80 On Fri, Jul 12, 2013 at 02:54:20PM +0300, Mika Westerberg wrote: > On Fri, Jul 12, 2013 at 01:50:29AM +0200, Rafael J. Wysocki wrote: > > @@ -1210,6 +1125,35 @@ void acpiphp_enumerate_slots(struct pci_ > > */ > > get_device(&bus->dev); > > > > + if (!pci_is_root_bus(bridge->pci_bus)) { > > + struct acpiphp_context *context; > > + > > + /* > > + * This bridge should have been registered as a hotplug function > > + * under its parent, so the context has to be there. If not, we > > + * are in deep goo. > > + */ > > + mutex_lock(&acpiphp_context_lock); > > + context = acpiphp_get_context(handle); > > + if (WARN_ON(!context || !context->func)) { > > + mutex_unlock(&acpiphp_context_lock); > > + put_device(&bus->dev); > > + kfree(bridge); > > + return; > > + } > > + bridge->context = context; > > + context->bridge = bridge; > > + /* Get a reference to the parent bridge. */ > > + get_bridge(context->func->slot->bridge); > > + mutex_unlock(&acpiphp_context_lock); > > + } > > + > > + status = acpi_get_handle(bridge->handle, "_EJ0", &handle); > > + if (ACPI_SUCCESS(status)) { > > + dbg("found ejectable p2p bridge\n"); > > + bridge->flags |= BRIDGE_HAS_EJ0; > > + } > > + > > /* must be added to the list prior to calling register_slot */ > > mutex_lock(&bridge_mutex); > > list_add(&bridge->list, &bridge_list); > > @@ -1220,34 +1164,9 @@ void acpiphp_enumerate_slots(struct pci_ > > register_slot, NULL, bridge, NULL); > > if (ACPI_FAILURE(status)) { > > acpi_handle_err(bridge->handle, "failed to register slots\n"); > > - goto err; > > - } > > - > > - if (pci_is_root_bus(bridge->pci_bus)) > > - return; > > - > > - status = acpi_get_handle(bridge->handle, "_EJ0", &handle); > > - if (ACPI_SUCCESS(status)) { > > - dbg("found ejectable p2p bridge\n"); > > - bridge->flags |= BRIDGE_HAS_EJ0; > > - } > > - if (context->handler_for_func) { > > - /* Notify handler already installed. */ > > - get_bridge(context->func->slot->bridge); > > - return; > > + cleanup_bridge(bridge); > > + put_bridge(bridge); > > } > > - > > - /* install notify handler for P2P bridges */ > > - status = acpi_install_notify_handler(bridge->handle, ACPI_SYSTEM_NOTIFY, > > - handle_hotplug_event, NULL); > > With this removed we now install notify handlers for the slot objects under > this bridge but not for the bridge itself. > > In case of Thunderbolt the BIOS will send the event for the root port ACPI > device \_SB_.PCI0.RP05 and with the above change we don't handle it > anymore. Actually there was a bug in patch [23/30] that caused this. Once that is fixed I can see that the notify handlers get correctly installed. I'll comment on that patch. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/