Re: [RFC][PATCH 11/30] ACPI / hotplug / PCI: Register all devices under the given bridge

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

> -	if (ACPI_SUCCESS(status))
> -		return;
> -
> -	acpi_handle_err(bridge->handle, "failed to register notify handler\n");
> -
> - err:
> -	cleanup_bridge(bridge);
> -	put_bridge(bridge);
>  }
--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux