From patchwork Fri Jul 31 21:37:19 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Helgaas X-Patchwork-Id: 38603 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 n6VLbBIB017264 for ; Fri, 31 Jul 2009 21:37:23 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753011AbZGaVhV (ORCPT ); Fri, 31 Jul 2009 17:37:21 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753165AbZGaVhV (ORCPT ); Fri, 31 Jul 2009 17:37:21 -0400 Received: from g1t0026.austin.hp.com ([15.216.28.33]:45121 "EHLO g1t0026.austin.hp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753011AbZGaVhT (ORCPT ); Fri, 31 Jul 2009 17:37:19 -0400 Received: from g1t0038.austin.hp.com (g1t0038.austin.hp.com [16.236.32.44]) by g1t0026.austin.hp.com (Postfix) with ESMTP id 00E49C53E; Fri, 31 Jul 2009 21:37:20 +0000 (UTC) Received: from ldl.fc.hp.com (ldl.fc.hp.com [15.11.146.30]) by g1t0038.austin.hp.com (Postfix) with ESMTP id DCA6E30173; Fri, 31 Jul 2009 21:37:20 +0000 (UTC) Received: from localhost (ldl.fc.hp.com [127.0.0.1]) by ldl.fc.hp.com (Postfix) with ESMTP id AA59B39C009; Fri, 31 Jul 2009 15:37:20 -0600 (MDT) X-Virus-Scanned: Debian amavisd-new at ldl.fc.hp.com Received: from ldl.fc.hp.com ([127.0.0.1]) by localhost (ldl.fc.hp.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Z+UItTEYeUk9; Fri, 31 Jul 2009 15:37:19 -0600 (MDT) Received: from eh.fc.hp.com (eh.fc.hp.com [15.11.146.105]) by ldl.fc.hp.com (Postfix) with ESMTP id 6167D39C008; Fri, 31 Jul 2009 15:37:19 -0600 (MDT) Received: from bob.kio (localhost [127.0.0.1]) by eh.fc.hp.com (Postfix) with ESMTP id 55EA926169; Fri, 31 Jul 2009 15:37:19 -0600 (MDT) Subject: [PATCH 09/19] ACPI: remove acpi_device_set_context() "type" argument To: Len Brown From: Bjorn Helgaas Cc: linux-acpi@vger.kernel.org Date: Fri, 31 Jul 2009 15:37:19 -0600 Message-ID: <20090731213719.29930.23292.stgit@bob.kio> In-Reply-To: <20090731213501.29930.39957.stgit@bob.kio> References: <20090731213501.29930.39957.stgit@bob.kio> User-Agent: StGit/0.14.3.386.gb02d MIME-Version: 1.0 Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org We only pass the "type" to acpi_device_set_context() so we know whether the device has a handle to which we can attach the acpi_device pointer. But it's safer to just check for the handle directly, since it's in the acpi_device already. Signed-off-by: Bjorn Helgaas --- drivers/acpi/scan.c | 32 +++++++++++++++----------------- 1 files changed, 15 insertions(+), 17 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index f563360..4772b43 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c @@ -1119,29 +1119,27 @@ static void acpi_device_set_id(struct acpi_device *device, int type) kfree(buffer.pointer); } -static int acpi_device_set_context(struct acpi_device *device, int type) +static int acpi_device_set_context(struct acpi_device *device) { - acpi_status status = AE_OK; - int result = 0; + acpi_status status; + /* * Context * ------- * Attach this 'struct acpi_device' to the ACPI object. This makes - * resolutions from handle->device very efficient. Note that we need - * to be careful with fixed-feature devices as they all attach to the - * root object. + * resolutions from handle->device very efficient. Fixed hardware + * devices have no handles, so we skip them. */ - if (type != ACPI_BUS_TYPE_POWER_BUTTON && - type != ACPI_BUS_TYPE_SLEEP_BUTTON) { - status = acpi_attach_data(device->handle, - acpi_bus_data_handler, device); + if (!device->handle) + return 0; - if (ACPI_FAILURE(status)) { - printk(KERN_ERR PREFIX "Error attaching device data\n"); - result = -ENODEV; - } - } - return result; + status = acpi_attach_data(device->handle, + acpi_bus_data_handler, device); + if (ACPI_SUCCESS(status)) + return 0; + + printk(KERN_ERR PREFIX "Error attaching device data\n"); + return -ENODEV; } static int acpi_bus_remove(struct acpi_device *dev, int rmdevice) @@ -1262,7 +1260,7 @@ acpi_add_single_object(struct acpi_device **child, * the corresponding ACPI device by the acpi handle in the course * of getting the power/wakeup/performance flags. */ - result = acpi_device_set_context(device, type); + result = acpi_device_set_context(device); if (result) goto end;