From patchwork Mon Jun 22 03:31:16 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhang Rui X-Patchwork-Id: 31697 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 n5M3UbJ0016127 for ; Mon, 22 Jun 2009 03:30:39 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753184AbZFVDae (ORCPT ); Sun, 21 Jun 2009 23:30:34 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752281AbZFVDae (ORCPT ); Sun, 21 Jun 2009 23:30:34 -0400 Received: from mga11.intel.com ([192.55.52.93]:56781 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753184AbZFVDae (ORCPT ); Sun, 21 Jun 2009 23:30:34 -0400 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga102.fm.intel.com with ESMTP; 21 Jun 2009 20:23:02 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.42,265,1243839600"; d="scan'208";a="701311623" Received: from rzhang-dt.sh.intel.com (HELO localhost.localdomain) ([10.239.36.94]) by fmsmga001.fm.intel.com with ESMTP; 21 Jun 2009 20:33:59 -0700 From: Zhang Rui To: lenb@kernel.org Cc: linux-acpi@vger.kernel.org, Zhang Rui Subject: [PATCH 3/5] run ACPI device hot removal in kacpi_hotplug_wq Date: Mon, 22 Jun 2009 11:31:16 +0800 Message-Id: <1245641478-31805-3-git-send-email-rui.zhang@intel.com> X-Mailer: git-send-email 1.5.4.4 In-Reply-To: <1245641478-31805-2-git-send-email-rui.zhang@intel.com> References: <1245641478-31805-1-git-send-email-rui.zhang@intel.com> <1245641478-31805-2-git-send-email-rui.zhang@intel.com> Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org Run the ACPI device hot removal code in kacpi_hotplug_wq rather than a new kernel thread. Signed-off-by: Zhang Rui --- drivers/acpi/scan.c | 20 ++++++++------------ 1 files changed, 8 insertions(+), 12 deletions(-) diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index 8ff510b..9c6e42e 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c @@ -95,7 +95,7 @@ acpi_device_modalias_show(struct device *dev, struct device_attribute *attr, cha } static DEVICE_ATTR(modalias, 0444, acpi_device_modalias_show, NULL); -static int acpi_bus_hot_remove_device(void *context) +static void acpi_bus_hot_remove_device(void *context) { struct acpi_device *device; acpi_handle handle = context; @@ -104,10 +104,10 @@ static int acpi_bus_hot_remove_device(void *context) acpi_status status = AE_OK; if (acpi_bus_get_device(handle, &device)) - return 0; + return; if (!device) - return 0; + return; ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Hot-removing device %s...\n", dev_name(&device->dev))); @@ -115,7 +115,7 @@ static int acpi_bus_hot_remove_device(void *context) if (acpi_bus_trim(device, 1)) { printk(KERN_ERR PREFIX "Removing device failed\n"); - return -1; + return; } /* power off device */ @@ -142,9 +142,10 @@ static int acpi_bus_hot_remove_device(void *context) */ status = acpi_evaluate_object(handle, "_EJ0", &arg_list, NULL); if (ACPI_FAILURE(status)) - return -ENODEV; + printk(KERN_WARNING PREFIX + "Eject device failed\n"); - return 0; + return; } static ssize_t @@ -155,7 +156,6 @@ acpi_eject_store(struct device *d, struct device_attribute *attr, acpi_status status; acpi_object_type type = 0; struct acpi_device *acpi_device = to_acpi_device(d); - struct task_struct *task; if ((!count) || (buf[0] != '1')) { return -EINVAL; @@ -172,11 +172,7 @@ acpi_eject_store(struct device *d, struct device_attribute *attr, goto err; } - /* remove the device in another thread to fix the deadlock issue */ - task = kthread_run(acpi_bus_hot_remove_device, - acpi_device->handle, "acpi_hot_remove_device"); - if (IS_ERR(task)) - ret = PTR_ERR(task); + acpi_os_hotplug_execute(acpi_bus_hot_remove_device, acpi_device->handle); err: return ret; }