All of lore.kernel.org
 help / color / mirror / Atom feed
From: Corentin Chary <corentincj@iksaif.net>
To: Len Brown <lenb@kernel.org>
Cc: linux-acpi@vger.kernel.org, Alan Jenkins <alan-jenkins@tuffmail.co.uk>
Subject: [PATCH 18/33] eeepc-laptop: simplify acpi initialization
Date: Thu,  3 Dec 2009 08:45:02 +0100	[thread overview]
Message-ID: <1259826317-18809-19-git-send-email-corentincj@iksaif.net> (raw)
In-Reply-To: <1259826317-18809-18-git-send-email-corentincj@iksaif.net>

From: Alan Jenkins <alan-jenkins@tuffmail.co.uk>

We don't need to store init_flags after using them.  And we don't use
the result of INIT, so we don't need to allocate a buffer for it.

Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
---
 drivers/platform/x86/eeepc-laptop.c |   55 ++++++++++++++++------------------
 1 files changed, 26 insertions(+), 29 deletions(-)

diff --git a/drivers/platform/x86/eeepc-laptop.c b/drivers/platform/x86/eeepc-laptop.c
index 9f33e51..50ceaaf 100644
--- a/drivers/platform/x86/eeepc-laptop.c
+++ b/drivers/platform/x86/eeepc-laptop.c
@@ -136,7 +136,6 @@ struct eeepc_hotk {
 	acpi_handle handle;		/* the handle of the hotk device */
 	u32 cm_supported;		/* the control methods supported
 					   by this BIOS */
-	uint init_flag;			/* Init flags */
 	u16 event_count[128];		/* count for each event */
 	struct input_dev *inputdev;
 	u16 *keycode_map;
@@ -256,8 +255,7 @@ MODULE_LICENSE("GPL");
 /*
  * ACPI Helpers
  */
-static int write_acpi_int(acpi_handle handle, const char *method, int val,
-			  struct acpi_buffer *output)
+static int write_acpi_int(acpi_handle handle, const char *method, int val)
 {
 	struct acpi_object_list params;
 	union acpi_object in_obj;
@@ -268,7 +266,7 @@ static int write_acpi_int(acpi_handle handle, const char *method, int val,
 	in_obj.type = ACPI_TYPE_INTEGER;
 	in_obj.integer.value = val;
 
-	status = acpi_evaluate_object(handle, (char *)method, &params, output);
+	status = acpi_evaluate_object(handle, (char *)method, &params, NULL);
 	return (status == AE_OK ? 0 : -1);
 }
 
@@ -296,7 +294,7 @@ static int set_acpi(int cm, int value)
 	if ((ehotk->cm_supported & (0x1 << cm)) == 0)
 		return -ENODEV;
 
-	if (write_acpi_int(ehotk->handle, method, value, NULL))
+	if (write_acpi_int(ehotk->handle, method, value))
 		pr_warning("Error writing %s\n", method);
 	return 0;
 }
@@ -624,36 +622,36 @@ static void cmsg_quirks(void)
 	cmsg_quirk(CM_ASL_TPD, "TPD");
 }
 
-static int eeepc_hotk_check(void)
+static int eeepc_hotk_init(void)
 {
-	struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
+	unsigned int init_flags;
 	int result;
 
 	result = acpi_bus_get_status(ehotk->device);
 	if (result)
 		return result;
-	if (ehotk->device->status.present) {
-		if (write_acpi_int(ehotk->handle, "INIT", ehotk->init_flag,
-				    &buffer)) {
-			pr_err("Hotkey initialization failed\n");
-			return -ENODEV;
-		} else {
-			pr_notice("Hotkey init flags 0x%x\n", ehotk->init_flag);
-		}
-		/* get control methods supported */
-		if (read_acpi_int(ehotk->handle, "CMSG"
-				   , &ehotk->cm_supported)) {
-			pr_err("Get control methods supported failed\n");
-			return -ENODEV;
-		} else {
-			cmsg_quirks();
-			pr_info("Get control methods supported: 0x%x\n",
-				ehotk->cm_supported);
-		}
-	} else {
+	if (!ehotk->device->status.present) {
 		pr_err("Hotkey device not present, aborting\n");
-		return -EINVAL;
+		return -ENODEV;
 	}
+
+	init_flags = DISABLE_ASL_WLAN | DISABLE_ASL_DISPLAYSWITCH;
+	pr_notice("Hotkey init flags 0x%x\n", init_flags);
+
+	if (write_acpi_int(ehotk->handle, "INIT", init_flags)) {
+		pr_err("Hotkey initialization failed\n");
+		return -ENODEV;
+	}
+
+	/* get control methods supported */
+	if (read_acpi_int(ehotk->handle, "CMSG",
+				&ehotk->cm_supported)) {
+		pr_err("Get control methods supported failed\n");
+		return -ENODEV;
+	}
+	cmsg_quirks();
+	pr_info("Get control methods supported: 0x%x\n", ehotk->cm_supported);
+
 	return 0;
 }
 
@@ -1264,14 +1262,13 @@ static int __devinit eeepc_hotk_add(struct acpi_device *device)
 	ehotk = kzalloc(sizeof(struct eeepc_hotk), GFP_KERNEL);
 	if (!ehotk)
 		return -ENOMEM;
-	ehotk->init_flag = DISABLE_ASL_WLAN | DISABLE_ASL_DISPLAYSWITCH;
 	ehotk->handle = device->handle;
 	strcpy(acpi_device_name(device), EEEPC_HOTK_DEVICE_NAME);
 	strcpy(acpi_device_class(device), EEEPC_HOTK_CLASS);
 	device->driver_data = ehotk;
 	ehotk->device = device;
 
-	result = eeepc_hotk_check();
+	result = eeepc_hotk_init();
 	if (result)
 		goto fail_platform_driver;
 	eeepc_enable_camera();
-- 
1.6.5.3


  reply	other threads:[~2009-12-03  7:44 UTC|newest]

Thread overview: 55+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-03  7:44 [PATCH 00/33] acpi4asus updates for 2.6.33 Corentin Chary
2009-12-03  7:44 ` [PATCH 01/33] eeepc-laptop: disp attribute should be write-only Corentin Chary
2009-12-03  7:44   ` [PATCH 02/33] asus-laptop: Remove redundant NULL checks Corentin Chary
2009-12-03  7:44     ` [PATCH 03/33] asus-acpi: " Corentin Chary
2009-12-03  7:44       ` [PATCH 04/33] asus-laptop: Remove uneccesary acpi_disabled check Corentin Chary
2009-12-03  7:44         ` [PATCH 05/33] asus-acpi: Remove uneccesary acpi_disabled checks Corentin Chary
2009-12-03  7:44           ` [PATCH 06/33] asus-acpi: set acpi_driver.owner Corentin Chary
2009-12-03  7:44             ` [PATCH 07/33] asus-laptop: " Corentin Chary
2009-12-03  7:44               ` [PATCH 08/33] eeepc-laptop: add touchpad led Corentin Chary
2009-12-03  7:44                 ` [PATCH 09/33] eeepc-laptop: Remove redundant NULL checks Corentin Chary
2009-12-03  7:44                   ` [PATCH 10/33] eeepc-laptop: Remove uneccesary acpi_disabled check Corentin Chary
2009-12-03  7:44                     ` [PATCH 11/33] eeepc-laptop: set acpi_driver.owner Corentin Chary
2009-12-03  7:44                       ` [PATCH 12/33] eeepc-laptop: fix value of pwm1_enable to match documentation Corentin Chary
2009-12-03  7:44                         ` [PATCH 13/33] eeepc-laptop: fix led initialization order Corentin Chary
2009-12-03  7:44                           ` [PATCH 14/33] eeepc-laptop: fix potential leak (led_init() failure) Corentin Chary
2009-12-03  7:44                             ` [PATCH 15/33] eeepc-laptop: fix set_acpi() to return non-zero on failure Corentin Chary
2009-12-03  7:45                               ` [PATCH 16/33] eeepc-laptop: remove redundant NULL checks Corentin Chary
2009-12-03  7:45                                 ` [PATCH 17/33] eeepc-laptop: no need to check argument of set_brightness() Corentin Chary
2009-12-03  7:45                                   ` Corentin Chary [this message]
2009-12-03  7:45                                     ` [PATCH 19/33] eeepc-laptop: simplify how the hwmon device reads values from the EC Corentin Chary
2009-12-03  7:45                                       ` [PATCH 20/33] eeepc-laptop: refactor notifications Corentin Chary
2009-12-03  7:45                                         ` [PATCH 21/33] eeepc-laptop: move platform driver registration out of eeepc_hotk_add() Corentin Chary
2009-12-03  7:45                                           ` [PATCH 22/33] eeepc-laptop: move platform device initialisation to a separate function Corentin Chary
2009-12-03  7:45                                             ` [PATCH 23/33] eeepc-laptop: code movement Corentin Chary
2009-12-03  7:45                                               ` [PATCH 24/33] eeepc-laptop: revise names Corentin Chary
2009-12-03  7:45                                                 ` [PATCH 25/33] eeepc-laptop: callbacks should use "driver data" parameter or field Corentin Chary
2009-12-03  7:45                                                   ` [PATCH 26/33] asus-laptop: use KEY_F13 to map "Disable Touchpad" event Corentin Chary
2009-12-03  7:45                                                     ` [PATCH 27/33] asus-laptop: add Lenovo SL hotkey support Corentin Chary
2009-12-03  7:45                                                       ` [PATCH 28/33] asus-laptop: Add wlan switch found on V6V Corentin Chary
2009-12-03  7:45                                                         ` [PATCH 29/33] eeepc-laptop: map keys found on newer eeepc Corentin Chary
2009-12-03  7:45                                                           ` [PATCH 30/33] eeepc-laptop: fix coding style Corentin Chary
2009-12-03  7:45                                                             ` [PATCH 31/33] eeepc-laptop: re-add check for eeepc->backlight == NULL Corentin Chary
2009-12-03  7:45                                                               ` [PATCH 32/33] input: add KEY_WIRELESS_CYCLE Corentin Chary
2009-12-03  7:45                                                                 ` [PATCH 33/33] asus-laptop: schedule display_get and lcd_switch for removal Corentin Chary
2009-12-03  7:54                                                                 ` [PATCH 32/33] input: add KEY_WIRELESS_CYCLE Dmitry Torokhov
2009-12-03  8:12                                                                   ` Corentin Chary
2009-12-03  8:21                                                                     ` Dmitry Torokhov
2009-12-03  8:51                                                                       ` Corentin Chary
2009-12-03  8:57                                                                         ` Dmitry Torokhov
2009-12-03  9:22                                                                           ` Corentin Chary
2009-12-03  9:43                                                                             ` Johannes Berg
2009-12-03 11:23                                                                               ` [Kde-hardware-devel] " Will Stephenson
2009-12-03 11:23                                                                                 ` Will Stephenson
2009-12-03 15:01                                                                             ` Matthew Garrett
2009-12-06  6:58                                                                     ` Andrey Rahmatullin
2009-12-06  7:17                                                                       ` Dmitry Torokhov
2009-12-06  8:21                                                                         ` Corentin Chary
2009-12-06 14:54                                                                           ` Matthew Garrett
2009-12-07 11:47                                                                             ` Henrique de Moraes Holschuh
2009-12-07 12:55                                                                               ` Matthew Garrett
2009-12-07 13:23                                                                                 ` Henrique de Moraes Holschuh
2009-12-07 14:20                                                                                   ` Matthew Garrett
2009-12-07 17:02                                                                                     ` Henrique de Moraes Holschuh
2009-12-03 10:54                                                                   ` Henrique de Moraes Holschuh
2009-12-09 21:04 ` [PATCH 00/33] acpi4asus updates for 2.6.33 Len Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1259826317-18809-19-git-send-email-corentincj@iksaif.net \
    --to=corentincj@iksaif.net \
    --cc=alan-jenkins@tuffmail.co.uk \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.