From patchwork Thu Dec 13 15:31:47 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kirill A . Shutemov" X-Patchwork-Id: 1875331 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: patchwork-linux-pci@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id B32C0DF2EE for ; Thu, 13 Dec 2012 15:31:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753597Ab2LMPbU (ORCPT ); Thu, 13 Dec 2012 10:31:20 -0500 Received: from mga02.intel.com ([134.134.136.20]:15922 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755811Ab2LMPbS (ORCPT ); Thu, 13 Dec 2012 10:31:18 -0500 Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP; 13 Dec 2012 07:31:17 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.84,274,1355126400"; d="scan'208";a="233501395" Received: from blue.fi.intel.com ([10.237.72.156]) by orsmga001.jf.intel.com with ESMTP; 13 Dec 2012 07:31:13 -0800 Received: by blue.fi.intel.com (Postfix, from userid 1000) id DF1D2E0073; Thu, 13 Dec 2012 17:31:53 +0200 (EET) From: "Kirill A. Shutemov" To: Greg KH Cc: Miles J Penner , John Ronciak , Mika Westerberg , Tushar N Dave , "Kirill A. Shutemov" , "Kirill A. Shutemov" , Bjorn Helgaas , Yinghai Lu , Jesse Barnes , Amos Kong , "Rafael J. Wysocki" , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/3] PCI Hotplug: convert acpiphp_hp_work to use delayed work Date: Thu, 13 Dec 2012 17:31:47 +0200 Message-Id: <1355412708-20046-3-git-send-email-kirill.shutemov@linux.intel.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1355412708-20046-1-git-send-email-kirill.shutemov@linux.intel.com> References: <1355412708-20046-1-git-send-email-kirill.shutemov@linux.intel.com> Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org From: "Kirill A. Shutemov" Some broken ACPI PCI Hotplug implementations notify OS about hotplug before devices ready to be enumerated. Let's convert acpiphp_hp_work to delayed work. It will allow to delay enumeration on broken hardware to workaround the issue. Signed-off-by: Kirill A. Shutemov --- drivers/pci/hotplug/acpiphp_glue.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c index 3d6d4fd..1a2b3ca 100644 --- a/drivers/pci/hotplug/acpiphp_glue.c +++ b/drivers/pci/hotplug/acpiphp_glue.c @@ -1191,7 +1191,7 @@ check_sub_bridges(acpi_handle handle, u32 lvl, void *context, void **rv) } struct acpiphp_hp_work { - struct work_struct work; + struct delayed_work work; acpi_handle handle; u32 type; void *context; @@ -1199,7 +1199,8 @@ struct acpiphp_hp_work { static void alloc_acpiphp_hp_work(acpi_handle handle, u32 type, void *context, - void (*func)(struct work_struct *work)) + void (*func)(struct work_struct *work), + unsigned long delay) { struct acpiphp_hp_work *hp_work; int ret; @@ -1212,8 +1213,8 @@ static void alloc_acpiphp_hp_work(acpi_handle handle, u32 type, hp_work->type = type; hp_work->context = context; - INIT_WORK(&hp_work->work, func); - ret = queue_work(kacpi_hotplug_wq, &hp_work->work); + INIT_DELAYED_WORK(&hp_work->work, func); + ret = queue_delayed_work(kacpi_hotplug_wq, &hp_work->work, delay); if (!ret) kfree(hp_work); } @@ -1230,7 +1231,8 @@ static void _handle_hotplug_event_bridge(struct work_struct *work) acpi_handle handle; u32 type; - hp_work = container_of(work, struct acpiphp_hp_work, work); + hp_work = container_of(to_delayed_work(work), + struct acpiphp_hp_work, work); handle = hp_work->handle; type = hp_work->type; @@ -1334,7 +1336,7 @@ static void handle_hotplug_event_bridge(acpi_handle handle, u32 type, * don't deadlock on hotplug actions. */ alloc_acpiphp_hp_work(handle, type, context, - _handle_hotplug_event_bridge); + _handle_hotplug_event_bridge, 0); } static void _handle_hotplug_event_func(struct work_struct *work) @@ -1348,7 +1350,8 @@ static void _handle_hotplug_event_func(struct work_struct *work) u32 type; void *context; - hp_work = container_of(work, struct acpiphp_hp_work, work); + hp_work = container_of(to_delayed_work(work), + struct acpiphp_hp_work, work); handle = hp_work->handle; type = hp_work->type; context = hp_work->context; @@ -1410,7 +1413,7 @@ static void handle_hotplug_event_func(acpi_handle handle, u32 type, * don't deadlock on hotplug actions. */ alloc_acpiphp_hp_work(handle, type, context, - _handle_hotplug_event_func); + _handle_hotplug_event_func, 0); } static acpi_status