From patchwork Wed Mar 23 09:26:34 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lin Ming X-Patchwork-Id: 654721 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p2N9ROvD013802 for ; Wed, 23 Mar 2011 09:29:57 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756019Ab1CWJSv (ORCPT ); Wed, 23 Mar 2011 05:18:51 -0400 Received: from mga14.intel.com ([143.182.124.37]:5458 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755943Ab1CWJSu (ORCPT ); Wed, 23 Mar 2011 05:18:50 -0400 Received: from azsmga001.ch.intel.com ([10.2.17.19]) by azsmga102.ch.intel.com with ESMTP; 23 Mar 2011 02:18:50 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.63,230,1299484800"; d="scan'208";a="407040125" Received: from ant.sh.intel.com ([10.239.97.65]) by azsmga001.ch.intel.com with ESMTP; 23 Mar 2011 02:18:49 -0700 From: Lin Ming To: Len Brown , "Rafael J. Wysocki" , Bob Moore Cc: linux-acpi@vger.kernel.org Subject: [PATCH 1/3] ACPI: osl, add acpi_os_create_lock interface Date: Wed, 23 Mar 2011 17:26:34 +0800 Message-Id: <1300872396-16522-2-git-send-email-ming.m.lin@intel.com> X-Mailer: git-send-email 1.7.3 In-Reply-To: <1300872396-16522-1-git-send-email-ming.m.lin@intel.com> References: <1300872396-16522-1-git-send-email-ming.m.lin@intel.com> Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Wed, 23 Mar 2011 09:29:58 +0000 (UTC) diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index 45ad4ff..52ca964 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c @@ -902,14 +902,6 @@ void acpi_os_wait_events_complete(void *context) EXPORT_SYMBOL(acpi_os_wait_events_complete); -/* - * Deallocate the memory for a spinlock. - */ -void acpi_os_delete_lock(acpi_spinlock handle) -{ - return; -} - acpi_status acpi_os_create_semaphore(u32 max_units, u32 initial_units, acpi_handle * handle) { @@ -1341,6 +1333,31 @@ int acpi_resources_are_enforced(void) EXPORT_SYMBOL(acpi_resources_are_enforced); /* + * Create and initialize a spinlock. + */ +acpi_status +acpi_os_create_lock(acpi_spinlock *out_handle) +{ + spinlock_t *lock; + + lock = ACPI_ALLOCATE(sizeof(spinlock_t)); + if (!lock) + return AE_NO_MEMORY; + spin_lock_init(lock); + *out_handle = lock; + + return AE_OK; +} + +/* + * Deallocate the memory for a spinlock. + */ +void acpi_os_delete_lock(acpi_spinlock handle) +{ + ACPI_FREE(handle); +} + +/* * Acquire a spinlock. * * handle is a pointer to the spinlock_t. diff --git a/include/acpi/acpiosxf.h b/include/acpi/acpiosxf.h index a3252a5..a756bc8 100644 --- a/include/acpi/acpiosxf.h +++ b/include/acpi/acpiosxf.h @@ -98,6 +98,9 @@ acpi_os_table_override(struct acpi_table_header *existing_table, /* * Spinlock primitives */ +acpi_status +acpi_os_create_lock(acpi_spinlock *out_handle); + void acpi_os_delete_lock(acpi_spinlock handle); acpi_cpu_flags acpi_os_acquire_lock(acpi_spinlock handle);