diff options
author | Szymon Janc <szymon@janc.net.pl> | 2012-01-11 17:22:36 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-02-08 20:16:47 -0500 |
commit | 5c9ed5bedf973ab7f4e428f7418d1e72ba3bcbe4 (patch) | |
tree | 259116763621bc6995d88ebb1adc425b75c67191 /drivers | |
parent | b154ff05e1b0d749231a71896c90e38657f8e675 (diff) |
Staging: quickstart: Some style, whitespaces and typos fixes
Signed-off-by: Szymon Janc <szymon@janc.net.pl>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/staging/quickstart/quickstart.c | 80 |
1 files changed, 39 insertions, 41 deletions
diff --git a/drivers/staging/quickstart/quickstart.c b/drivers/staging/quickstart/quickstart.c index c60911c6ab3..d03b89d2c9a 100644 --- a/drivers/staging/quickstart/quickstart.c +++ b/drivers/staging/quickstart/quickstart.c | |||
@@ -4,7 +4,7 @@ | |||
4 | * | 4 | * |
5 | * Copyright (C) 2007-2010 Angelo Arrifano <miknix@gmail.com> | 5 | * Copyright (C) 2007-2010 Angelo Arrifano <miknix@gmail.com> |
6 | * | 6 | * |
7 | * Information gathered from disassebled dsdt and from here: | 7 | * Information gathered from disassembled dsdt and from here: |
8 | * <http://www.microsoft.com/whdc/system/platform/firmware/DirAppLaunch.mspx> | 8 | * <http://www.microsoft.com/whdc/system/platform/firmware/DirAppLaunch.mspx> |
9 | * | 9 | * |
10 | * This program is free software; you can redistribute it and/or modify | 10 | * This program is free software; you can redistribute it and/or modify |
@@ -37,21 +37,23 @@ MODULE_AUTHOR("Angelo Arrifano"); | |||
37 | MODULE_DESCRIPTION("ACPI Direct App Launch driver"); | 37 | MODULE_DESCRIPTION("ACPI Direct App Launch driver"); |
38 | MODULE_LICENSE("GPL"); | 38 | MODULE_LICENSE("GPL"); |
39 | 39 | ||
40 | #define QUICKSTART_ACPI_DEVICE_NAME "quickstart" | 40 | #define QUICKSTART_ACPI_DEVICE_NAME "quickstart" |
41 | #define QUICKSTART_ACPI_CLASS "quickstart" | 41 | #define QUICKSTART_ACPI_CLASS "quickstart" |
42 | #define QUICKSTART_ACPI_HID "PNP0C32" | 42 | #define QUICKSTART_ACPI_HID "PNP0C32" |
43 | 43 | ||
44 | #define QUICKSTART_PF_DRIVER_NAME "quickstart" | 44 | #define QUICKSTART_PF_DRIVER_NAME "quickstart" |
45 | #define QUICKSTART_PF_DEVICE_NAME "quickstart" | 45 | #define QUICKSTART_PF_DEVICE_NAME "quickstart" |
46 | #define QUICKSTART_PF_DEVATTR_NAME "pressed_button" | 46 | #define QUICKSTART_PF_DEVATTR_NAME "pressed_button" |
47 | 47 | ||
48 | #define QUICKSTART_MAX_BTN_NAME_LEN 16 | 48 | #define QUICKSTART_MAX_BTN_NAME_LEN 16 |
49 | 49 | ||
50 | /* There will be two events: | 50 | /* |
51 | * 0x02 - A hot button was pressed while device was off/sleeping. | 51 | * There will be two events: |
52 | * 0x80 - A hot button was pressed while device was up. */ | 52 | * 0x02 - A hot button was pressed while device was off/sleeping. |
53 | #define QUICKSTART_EVENT_WAKE 0x02 | 53 | * 0x80 - A hot button was pressed while device was up. |
54 | #define QUICKSTART_EVENT_RUNTIME 0x80 | 54 | */ |
55 | #define QUICKSTART_EVENT_WAKE 0x02 | ||
56 | #define QUICKSTART_EVENT_RUNTIME 0x80 | ||
55 | 57 | ||
56 | struct quickstart_btn { | 58 | struct quickstart_btn { |
57 | char *name; | 59 | char *name; |
@@ -64,14 +66,14 @@ static struct quickstart_driver_data { | |||
64 | struct quickstart_btn *pressed; | 66 | struct quickstart_btn *pressed; |
65 | } quickstart_data; | 67 | } quickstart_data; |
66 | 68 | ||
67 | /* ACPI driver Structs */ | 69 | /* ACPI driver structs */ |
68 | struct quickstart_acpi { | 70 | struct quickstart_acpi { |
69 | struct acpi_device *device; | 71 | struct acpi_device *device; |
70 | struct quickstart_btn *btn; | 72 | struct quickstart_btn *btn; |
71 | }; | 73 | }; |
72 | static int quickstart_acpi_add(struct acpi_device *device); | 74 | static int quickstart_acpi_add(struct acpi_device *device); |
73 | static int quickstart_acpi_remove(struct acpi_device *device, int type); | 75 | static int quickstart_acpi_remove(struct acpi_device *device, int type); |
74 | static const struct acpi_device_id quickstart_device_ids[] = { | 76 | static const struct acpi_device_id quickstart_device_ids[] = { |
75 | {QUICKSTART_ACPI_HID, 0}, | 77 | {QUICKSTART_ACPI_HID, 0}, |
76 | {"", 0}, | 78 | {"", 0}, |
77 | }; | 79 | }; |
@@ -111,12 +113,10 @@ static struct platform_driver pf_driver = { | |||
111 | } | 113 | } |
112 | }; | 114 | }; |
113 | 115 | ||
114 | /* | 116 | /* Platform driver functions */ |
115 | * Platform driver functions | ||
116 | */ | ||
117 | static ssize_t buttons_show(struct device *dev, | 117 | static ssize_t buttons_show(struct device *dev, |
118 | struct device_attribute *attr, | 118 | struct device_attribute *attr, |
119 | char *buf) | 119 | char *buf) |
120 | { | 120 | { |
121 | int count = 0; | 121 | int count = 0; |
122 | struct quickstart_btn *ptr = quickstart_data.btn_lst; | 122 | struct quickstart_btn *ptr = quickstart_data.btn_lst; |
@@ -137,8 +137,8 @@ static ssize_t buttons_show(struct device *dev, | |||
137 | } | 137 | } |
138 | 138 | ||
139 | static ssize_t pressed_button_show(struct device *dev, | 139 | static ssize_t pressed_button_show(struct device *dev, |
140 | struct device_attribute *attr, | 140 | struct device_attribute *attr, |
141 | char *buf) | 141 | char *buf) |
142 | { | 142 | { |
143 | return snprintf(buf, PAGE_SIZE, "%s\n", | 143 | return snprintf(buf, PAGE_SIZE, "%s\n", |
144 | (quickstart_data.pressed ? | 144 | (quickstart_data.pressed ? |
@@ -147,8 +147,8 @@ static ssize_t pressed_button_show(struct device *dev, | |||
147 | 147 | ||
148 | 148 | ||
149 | static ssize_t pressed_button_store(struct device *dev, | 149 | static ssize_t pressed_button_store(struct device *dev, |
150 | struct device_attribute *attr, | 150 | struct device_attribute *attr, |
151 | const char *buf, size_t count) | 151 | const char *buf, size_t count) |
152 | { | 152 | { |
153 | if (count < 2) | 153 | if (count < 2) |
154 | return -EINVAL; | 154 | return -EINVAL; |
@@ -160,7 +160,7 @@ static ssize_t pressed_button_store(struct device *dev, | |||
160 | return count; | 160 | return count; |
161 | } | 161 | } |
162 | 162 | ||
163 | /* Hotstart Helper functions */ | 163 | /* Helper functions */ |
164 | static int quickstart_btnlst_add(struct quickstart_btn **data) | 164 | static int quickstart_btnlst_add(struct quickstart_btn **data) |
165 | { | 165 | { |
166 | struct quickstart_btn **ptr = &quickstart_data.btn_lst; | 166 | struct quickstart_btn **ptr = &quickstart_data.btn_lst; |
@@ -240,22 +240,26 @@ static void quickstart_acpi_ghid(struct quickstart_acpi *quickstart) | |||
240 | if (!quickstart) | 240 | if (!quickstart) |
241 | return; | 241 | return; |
242 | 242 | ||
243 | /* This returns a buffer telling the button usage ID, | 243 | /* |
244 | * and triggers pending notify events (The ones before booting). */ | 244 | * This returns a buffer telling the button usage ID, |
245 | status = acpi_evaluate_object(quickstart->device->handle, | 245 | * and triggers pending notify events (The ones before booting). |
246 | "GHID", NULL, &buffer); | 246 | */ |
247 | status = acpi_evaluate_object(quickstart->device->handle, "GHID", NULL, | ||
248 | &buffer); | ||
247 | if (ACPI_FAILURE(status) || !buffer.pointer) { | 249 | if (ACPI_FAILURE(status) || !buffer.pointer) { |
248 | printk(KERN_ERR "quickstart: %s GHID method failed.\n", | 250 | printk(KERN_ERR "quickstart: %s GHID method failed.\n", |
249 | quickstart->btn->name); | 251 | quickstart->btn->name); |
250 | return; | 252 | return; |
251 | } | 253 | } |
252 | 254 | ||
253 | if (buffer.length < 8) | 255 | if (buffer.length < 8) |
254 | return; | 256 | return; |
255 | 257 | ||
256 | /* <<The GHID method can return a BYTE, WORD, or DWORD. | 258 | /* |
259 | * <<The GHID method can return a BYTE, WORD, or DWORD. | ||
257 | * The value must be encoded in little-endian byte | 260 | * The value must be encoded in little-endian byte |
258 | * order (least significant byte first).>> */ | 261 | * order (least significant byte first).>> |
262 | */ | ||
259 | usageid = *((uint32_t *)(buffer.pointer + (buffer.length - 8))); | 263 | usageid = *((uint32_t *)(buffer.pointer + (buffer.length - 8))); |
260 | quickstart->btn->id = usageid; | 264 | quickstart->btn->id = usageid; |
261 | 265 | ||
@@ -339,20 +343,17 @@ static int quickstart_acpi_remove(struct acpi_device *device, int type) | |||
339 | 343 | ||
340 | quickstart = acpi_driver_data(device); | 344 | quickstart = acpi_driver_data(device); |
341 | 345 | ||
342 | status = acpi_remove_notify_handler(device->handle, | 346 | status = acpi_remove_notify_handler(device->handle, ACPI_ALL_NOTIFY, |
343 | ACPI_ALL_NOTIFY, | 347 | quickstart_acpi_notify); |
344 | quickstart_acpi_notify); | ||
345 | if (ACPI_FAILURE(status)) | 348 | if (ACPI_FAILURE(status)) |
346 | printk(KERN_ERR "quickstart: Error removing notify handler\n"); | 349 | printk(KERN_ERR "quickstart: Error removing notify handler\n"); |
347 | 350 | ||
348 | |||
349 | kfree(quickstart); | 351 | kfree(quickstart); |
350 | 352 | ||
351 | return 0; | 353 | return 0; |
352 | } | 354 | } |
353 | 355 | ||
354 | /* Module functions */ | 356 | /* Module functions */ |
355 | |||
356 | static void quickstart_exit(void) | 357 | static void quickstart_exit(void) |
357 | { | 358 | { |
358 | input_unregister_device(quickstart_input); | 359 | input_unregister_device(quickstart_input); |
@@ -367,8 +368,6 @@ static void quickstart_exit(void) | |||
367 | acpi_bus_unregister_driver(&quickstart_acpi_driver); | 368 | acpi_bus_unregister_driver(&quickstart_acpi_driver); |
368 | 369 | ||
369 | quickstart_btnlst_free(); | 370 | quickstart_btnlst_free(); |
370 | |||
371 | return; | ||
372 | } | 371 | } |
373 | 372 | ||
374 | static int __init quickstart_init_input(void) | 373 | static int __init quickstart_init_input(void) |
@@ -444,14 +443,13 @@ static int __init quickstart_init(void) | |||
444 | if (ret) | 443 | if (ret) |
445 | goto fail_dev_file2; | 444 | goto fail_dev_file2; |
446 | 445 | ||
447 | |||
448 | /* Input device */ | 446 | /* Input device */ |
449 | ret = quickstart_init_input(); | 447 | ret = quickstart_init_input(); |
450 | if (ret) | 448 | if (ret) |
451 | goto fail_input; | 449 | goto fail_input; |
452 | 450 | ||
453 | printk(KERN_INFO "quickstart: ACPI Direct App Launch ver %s\n", | 451 | printk(KERN_INFO "quickstart: ACPI Direct App Launch ver %s\n", |
454 | QUICKSTART_VERSION); | 452 | QUICKSTART_VERSION); |
455 | 453 | ||
456 | return 0; | 454 | return 0; |
457 | fail_input: | 455 | fail_input: |