From patchwork Wed Apr 8 15:39:49 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Helgaas X-Patchwork-Id: 17220 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 n38FeNWm031591 for ; Wed, 8 Apr 2009 15:40:25 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933822AbZDHPjw (ORCPT ); Wed, 8 Apr 2009 11:39:52 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S932382AbZDHPjv (ORCPT ); Wed, 8 Apr 2009 11:39:51 -0400 Received: from g4t0015.houston.hp.com ([15.201.24.18]:29296 "EHLO g4t0015.houston.hp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933805AbZDHPjt (ORCPT ); Wed, 8 Apr 2009 11:39:49 -0400 Received: from smtp2.fc.hp.com (smtp2.fc.hp.com [15.11.136.114]) by g4t0015.houston.hp.com (Postfix) with ESMTP id 78869808B; Wed, 8 Apr 2009 15:39:49 +0000 (UTC) Received: from localhost.localdomain (lart.fc.hp.com [15.11.146.31]) by smtp2.fc.hp.com (Postfix) with ESMTP id 2BBE52BEA5C; Wed, 8 Apr 2009 15:15:03 +0000 (UTC) Received: from bob.kio (localhost [127.0.0.1]) by localhost.localdomain (Postfix) with ESMTP id 0E4442615F; Wed, 8 Apr 2009 09:39:49 -0600 (MDT) Subject: [PATCH 3/6] ACPI: button: use Linux style for getting driver_data To: Len Brown From: Bjorn Helgaas Cc: linux-acpi@vger.kernel.org Date: Wed, 08 Apr 2009 09:39:49 -0600 Message-ID: <20090408153948.12354.95163.stgit@bob.kio> In-Reply-To: <20090408153427.12354.62167.stgit@bob.kio> References: <20090408153427.12354.62167.stgit@bob.kio> User-Agent: StGit/0.14.3.347.g594a MIME-Version: 1.0 Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org It's typical and slightly more compact to look up the driver_data structure by initializing the automatic variable at its definition. Signed-off-by: Bjorn Helgaas --- drivers/acpi/button.c | 13 ++++--------- 1 files changed, 4 insertions(+), 9 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/button.c b/drivers/acpi/button.c index c463236..8ef8f44 100644 --- a/drivers/acpi/button.c +++ b/drivers/acpi/button.c @@ -162,10 +162,8 @@ static struct proc_dir_entry *acpi_lid_dir; static int acpi_button_add_fs(struct acpi_device *device) { + struct acpi_button *button = acpi_driver_data(device); struct proc_dir_entry *entry = NULL; - struct acpi_button *button; - - button = acpi_driver_data(device); switch (button->type) { case ACPI_BUTTON_TYPE_POWER: @@ -291,9 +289,8 @@ static void acpi_button_notify(struct acpi_device *device, u32 event) static int acpi_button_resume(struct acpi_device *device) { - struct acpi_button *button; + struct acpi_button *button = acpi_driver_data(device); - button = acpi_driver_data(device); if (button->type == ACPI_BUTTON_TYPE_LID) return acpi_lid_send_state(button); return 0; @@ -301,9 +298,9 @@ static int acpi_button_resume(struct acpi_device *device) static int acpi_button_add(struct acpi_device *device) { - int error; struct acpi_button *button; struct input_dev *input; + int error; button = kzalloc(sizeof(struct acpi_button), GFP_KERNEL); if (!button) @@ -419,9 +416,7 @@ static int acpi_button_add(struct acpi_device *device) static int acpi_button_remove(struct acpi_device *device, int type) { - struct acpi_button *button; - - button = acpi_driver_data(device); + struct acpi_button *button = acpi_driver_data(device); acpi_button_remove_fs(device); input_unregister_device(button->input);