*
* Copyright (C) 2007-2010 Angelo Arrifano <miknix@gmail.com>
*
- * Information gathered from disassebled dsdt and from here:
+ * Information gathered from disassembled dsdt and from here:
* <http://www.microsoft.com/whdc/system/platform/firmware/DirAppLaunch.mspx>
*
* This program is free software; you can redistribute it and/or modify
MODULE_DESCRIPTION("ACPI Direct App Launch driver");
MODULE_LICENSE("GPL");
-#define QUICKSTART_ACPI_DEVICE_NAME "quickstart"
-#define QUICKSTART_ACPI_CLASS "quickstart"
-#define QUICKSTART_ACPI_HID "PNP0C32"
+#define QUICKSTART_ACPI_DEVICE_NAME "quickstart"
+#define QUICKSTART_ACPI_CLASS "quickstart"
+#define QUICKSTART_ACPI_HID "PNP0C32"
-#define QUICKSTART_PF_DRIVER_NAME "quickstart"
-#define QUICKSTART_PF_DEVICE_NAME "quickstart"
-#define QUICKSTART_PF_DEVATTR_NAME "pressed_button"
+#define QUICKSTART_PF_DRIVER_NAME "quickstart"
+#define QUICKSTART_PF_DEVICE_NAME "quickstart"
+#define QUICKSTART_PF_DEVATTR_NAME "pressed_button"
-#define QUICKSTART_MAX_BTN_NAME_LEN 16
+#define QUICKSTART_MAX_BTN_NAME_LEN 16
-/* There will be two events:
- * 0x02 - A hot button was pressed while device was off/sleeping.
- * 0x80 - A hot button was pressed while device was up. */
-#define QUICKSTART_EVENT_WAKE 0x02
-#define QUICKSTART_EVENT_RUNTIME 0x80
+/*
+ * There will be two events:
+ * 0x02 - A hot button was pressed while device was off/sleeping.
+ * 0x80 - A hot button was pressed while device was up.
+ */
+#define QUICKSTART_EVENT_WAKE 0x02
+#define QUICKSTART_EVENT_RUNTIME 0x80
struct quickstart_btn {
char *name;
struct quickstart_btn *pressed;
} quickstart_data;
-/* ACPI driver Structs */
+/* ACPI driver structs */
struct quickstart_acpi {
struct acpi_device *device;
struct quickstart_btn *btn;
};
static int quickstart_acpi_add(struct acpi_device *device);
static int quickstart_acpi_remove(struct acpi_device *device, int type);
-static const struct acpi_device_id quickstart_device_ids[] = {
+static const struct acpi_device_id quickstart_device_ids[] = {
{QUICKSTART_ACPI_HID, 0},
{"", 0},
};
}
};
-/*
- * Platform driver functions
- */
+/* Platform driver functions */
static ssize_t buttons_show(struct device *dev,
- struct device_attribute *attr,
- char *buf)
+ struct device_attribute *attr,
+ char *buf)
{
int count = 0;
struct quickstart_btn *ptr = quickstart_data.btn_lst;
}
static ssize_t pressed_button_show(struct device *dev,
- struct device_attribute *attr,
- char *buf)
+ struct device_attribute *attr,
+ char *buf)
{
return snprintf(buf, PAGE_SIZE, "%s\n",
(quickstart_data.pressed ?
static ssize_t pressed_button_store(struct device *dev,
- struct device_attribute *attr,
- const char *buf, size_t count)
+ struct device_attribute *attr,
+ const char *buf, size_t count)
{
if (count < 2)
return -EINVAL;
return count;
}
-/* Hotstart Helper functions */
+/* Helper functions */
static int quickstart_btnlst_add(struct quickstart_btn **data)
{
struct quickstart_btn **ptr = &quickstart_data.btn_lst;
if (!quickstart)
return;
- /* This returns a buffer telling the button usage ID,
- * and triggers pending notify events (The ones before booting). */
- status = acpi_evaluate_object(quickstart->device->handle,
- "GHID", NULL, &buffer);
+ /*
+ * This returns a buffer telling the button usage ID,
+ * and triggers pending notify events (The ones before booting).
+ */
+ status = acpi_evaluate_object(quickstart->device->handle, "GHID", NULL,
+ &buffer);
if (ACPI_FAILURE(status) || !buffer.pointer) {
printk(KERN_ERR "quickstart: %s GHID method failed.\n",
- quickstart->btn->name);
+ quickstart->btn->name);
return;
}
if (buffer.length < 8)
return;
- /* <<The GHID method can return a BYTE, WORD, or DWORD.
+ /*
+ * <<The GHID method can return a BYTE, WORD, or DWORD.
* The value must be encoded in little-endian byte
- * order (least significant byte first).>> */
+ * order (least significant byte first).>>
+ */
usageid = *((uint32_t *)(buffer.pointer + (buffer.length - 8)));
quickstart->btn->id = usageid;
quickstart = acpi_driver_data(device);
- status = acpi_remove_notify_handler(device->handle,
- ACPI_ALL_NOTIFY,
- quickstart_acpi_notify);
+ status = acpi_remove_notify_handler(device->handle, ACPI_ALL_NOTIFY,
+ quickstart_acpi_notify);
if (ACPI_FAILURE(status))
printk(KERN_ERR "quickstart: Error removing notify handler\n");
-
kfree(quickstart);
return 0;
}
/* Module functions */
-
static void quickstart_exit(void)
{
input_unregister_device(quickstart_input);
acpi_bus_unregister_driver(&quickstart_acpi_driver);
quickstart_btnlst_free();
-
- return;
}
static int __init quickstart_init_input(void)
if (ret)
goto fail_dev_file2;
-
/* Input device */
ret = quickstart_init_input();
if (ret)
goto fail_input;
printk(KERN_INFO "quickstart: ACPI Direct App Launch ver %s\n",
- QUICKSTART_VERSION);
+ QUICKSTART_VERSION);
return 0;
fail_input: