From patchwork Wed Jul 25 03:41:19 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Len Brown X-Patchwork-Id: 1235021 Return-Path: X-Original-To: patchwork-linux-acpi@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 4A3013FD4F for ; Wed, 25 Jul 2012 03:50:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932903Ab2GYDmu (ORCPT ); Tue, 24 Jul 2012 23:42:50 -0400 Received: from mail-qc0-f174.google.com ([209.85.216.174]:46154 "EHLO mail-qc0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932890Ab2GYDmq (ORCPT ); Tue, 24 Jul 2012 23:42:46 -0400 Received: by mail-qc0-f174.google.com with SMTP id o28so169000qcr.19 for ; Tue, 24 Jul 2012 20:42:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references:in-reply-to:references:reply-to:organization; bh=Iinve9jEr89o25/MUVnnlRO7K3D+kYyp1k5jtYEPj7o=; b=NIOF/oUAE+6kEofAGkvRRlVPgP6nfWsJXna7X8b3N7BFy7rAi9G6z+OFlz+DP6fdPH 4LaCXvc6MJpjsbK2hO2o4eutvbXM2LITgRexEMG54Lj+XWAWN7ra5is7khQb07bW3H9Q Uy/ECRWt0szboCJ/vNlxslNijZYOAOUaPrgQ5azaEVKRLUGKwAZmhg4a/KjJJcxbXpaj h262TvdM2d6eYfLe7BL8/fwztQ/IHoZH4eF9YCNuJgQGzx7p321FU0afqMOMHRYa/W4t v6OqrKQN2u1Vsns49Y8M9E6uPNr9/rN6sj3FS1Hj8sHIRyhOAt2/ptsrCIRsrsiQtoMw WrDA== Received: by 10.224.59.212 with SMTP id m20mr35569606qah.35.1343187765398; Tue, 24 Jul 2012 20:42:45 -0700 (PDT) Received: from x980.localdomain6 (h184-61-125-197.altnnh.dsl.dynamic.tds.net. [184.61.125.197]) by mx.google.com with ESMTPS id et6sm15489186qab.8.2012.07.24.20.42.43 (version=SSLv3 cipher=OTHER); Tue, 24 Jul 2012 20:42:44 -0700 (PDT) From: Len Brown To: linux-acpi@vger.kernel.org, linux-pm@lists.linux-foundation.org Cc: linux-kernel@vger.kernel.org, Toshi Kani , Len Brown Subject: [PATCH 23/52] ACPI: Add _OST support for ACPI memory hotplug Date: Tue, 24 Jul 2012 23:41:19 -0400 Message-Id: X-Mailer: git-send-email 1.7.12.rc0 In-Reply-To: <1343187708-19532-1-git-send-email-lenb@kernel.org> References: <1343187708-19532-1-git-send-email-lenb@kernel.org> In-Reply-To: <6af1c4fc5227af65092ebc848989693562bfa3e8.1343187617.git.len.brown@intel.com> References: <6af1c4fc5227af65092ebc848989693562bfa3e8.1343187617.git.len.brown@intel.com> Reply-To: Len Brown Organization: Intel Open Source Technology Center Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org From: Toshi Kani Changed acpi_memory_device_notify() to call ACPI _OST method when ACPI memory hotplug operation has completed. Signed-off-by: Toshi Kani Signed-off-by: Len Brown --- drivers/acpi/acpi_memhotplug.c | 43 +++++++++++++++++++++++++++++++----------- 1 file changed, 32 insertions(+), 11 deletions(-) diff --git a/drivers/acpi/acpi_memhotplug.c b/drivers/acpi/acpi_memhotplug.c index d985713..24c807f 100644 --- a/drivers/acpi/acpi_memhotplug.c +++ b/drivers/acpi/acpi_memhotplug.c @@ -341,7 +341,7 @@ static void acpi_memory_device_notify(acpi_handle handle, u32 event, void *data) { struct acpi_memory_device *mem_device; struct acpi_device *device; - + u32 ost_code = ACPI_OST_SC_NON_SPECIFIC_FAILURE; /* default */ switch (event) { case ACPI_NOTIFY_BUS_CHECK: @@ -354,15 +354,20 @@ static void acpi_memory_device_notify(acpi_handle handle, u32 event, void *data) "\nReceived DEVICE CHECK notification for device\n")); if (acpi_memory_get_device(handle, &mem_device)) { printk(KERN_ERR PREFIX "Cannot find driver data\n"); - return; + break; } - if (!acpi_memory_check_device(mem_device)) { - if (acpi_memory_enable_device(mem_device)) - printk(KERN_ERR PREFIX - "Cannot enable memory device\n"); + if (acpi_memory_check_device(mem_device)) + break; + + if (acpi_memory_enable_device(mem_device)) { + printk(KERN_ERR PREFIX "Cannot enable memory device\n"); + break; } + + ost_code = ACPI_OST_SC_SUCCESS; break; + case ACPI_NOTIFY_EJECT_REQUEST: ACPI_DEBUG_PRINT((ACPI_DB_INFO, "\nReceived EJECT REQUEST notification for device\n")); @@ -383,19 +388,35 @@ static void acpi_memory_device_notify(acpi_handle handle, u32 event, void *data) * TBD: Can also be disabled by Callback registration * with generic sysfs driver */ - if (acpi_memory_disable_device(mem_device)) - printk(KERN_ERR PREFIX - "Disable memory device\n"); + if (acpi_memory_disable_device(mem_device)) { + printk(KERN_ERR PREFIX "Disable memory device\n"); + /* + * If _EJ0 was called but failed, _OST is not + * necessary. + */ + if (mem_device->state == MEMORY_INVALID_STATE) + return; + + break; + } + /* * TBD: Invoke acpi_bus_remove to cleanup data structures */ - break; + + /* _EJ0 succeeded; _OST is not necessary */ + return; + default: ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Unsupported event [0x%x]\n", event)); - break; + + /* non-hotplug event; possibly handled by other handler */ + return; } + /* Inform firmware that the hotplug operation has completed */ + (void) acpi_evaluate_hotplug_ost(handle, event, ost_code, NULL); return; }