blob: 4247d60c91861929fd17da303eba9653d3bd993d [file] [log] [blame]
Angelo Arrifano6da4cd42010-07-08 16:20:56 -07001/*
2 * quickstart.c - ACPI Direct App Launch driver
3 *
4 *
5 * Copyright (C) 2007-2010 Angelo Arrifano <miknix@gmail.com>
6 *
Szymon Janc5c9ed5b2012-01-11 23:22:36 +01007 * Information gathered from disassembled dsdt and from here:
Timo von Holtzf94fdea2011-02-08 20:41:19 +01008 * <http://www.microsoft.com/whdc/system/platform/firmware/DirAppLaunch.mspx>
Angelo Arrifano6da4cd42010-07-08 16:20:56 -07009 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 *
24 */
25
Szymon Jancaf5728e2012-02-10 21:05:44 +010026#define QUICKSTART_VERSION "1.04"
Angelo Arrifano6da4cd42010-07-08 16:20:56 -070027
Szymon Janc74eabe42012-01-22 19:50:13 +010028#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
29
Angelo Arrifano6da4cd42010-07-08 16:20:56 -070030#include <linux/kernel.h>
31#include <linux/module.h>
32#include <linux/init.h>
33#include <linux/types.h>
34#include <acpi/acpi_drivers.h>
35#include <linux/platform_device.h>
36#include <linux/input.h>
37
38MODULE_AUTHOR("Angelo Arrifano");
39MODULE_DESCRIPTION("ACPI Direct App Launch driver");
40MODULE_LICENSE("GPL");
41
Szymon Janc5c9ed5b2012-01-11 23:22:36 +010042#define QUICKSTART_ACPI_DEVICE_NAME "quickstart"
43#define QUICKSTART_ACPI_CLASS "quickstart"
44#define QUICKSTART_ACPI_HID "PNP0C32"
Angelo Arrifano6da4cd42010-07-08 16:20:56 -070045
Szymon Janc5c9ed5b2012-01-11 23:22:36 +010046#define QUICKSTART_PF_DRIVER_NAME "quickstart"
47#define QUICKSTART_PF_DEVICE_NAME "quickstart"
Angelo Arrifano6da4cd42010-07-08 16:20:56 -070048
Szymon Janc5c9ed5b2012-01-11 23:22:36 +010049/*
50 * There will be two events:
51 * 0x02 - A hot button was pressed while device was off/sleeping.
52 * 0x80 - A hot button was pressed while device was up.
53 */
54#define QUICKSTART_EVENT_WAKE 0x02
55#define QUICKSTART_EVENT_RUNTIME 0x80
Angelo Arrifano6da4cd42010-07-08 16:20:56 -070056
Szymon Janc3c92e382012-01-11 23:22:49 +010057struct quickstart_button {
Angelo Arrifano6da4cd42010-07-08 16:20:56 -070058 char *name;
59 unsigned int id;
Szymon Janc505d2ad2012-01-11 23:22:47 +010060 struct list_head list;
Angelo Arrifano6da4cd42010-07-08 16:20:56 -070061};
62
Szymon Janc605926ef2012-01-11 23:22:38 +010063struct quickstart_acpi {
64 struct acpi_device *device;
Szymon Janc3c92e382012-01-11 23:22:49 +010065 struct quickstart_button *button;
Szymon Janc605926ef2012-01-11 23:22:38 +010066};
67
Szymon Janc505d2ad2012-01-11 23:22:47 +010068static LIST_HEAD(buttons);
Szymon Janc3c92e382012-01-11 23:22:49 +010069static struct quickstart_button *pressed;
Angelo Arrifano6da4cd42010-07-08 16:20:56 -070070
Szymon Janc1692caa2012-01-11 23:22:39 +010071static struct input_dev *quickstart_input;
Angelo Arrifano6da4cd42010-07-08 16:20:56 -070072
Szymon Janc5c9ed5b2012-01-11 23:22:36 +010073/* Platform driver functions */
Greg Kroah-Hartman3b7cf042013-08-24 10:34:53 -070074static ssize_t buttons_show(struct device *dev, struct device_attribute *attr,
75 char *buf)
Angelo Arrifano6da4cd42010-07-08 16:20:56 -070076{
77 int count = 0;
Szymon Janc3c92e382012-01-11 23:22:49 +010078 struct quickstart_button *b;
Angelo Arrifano6da4cd42010-07-08 16:20:56 -070079
Szymon Janc505d2ad2012-01-11 23:22:47 +010080 if (list_empty(&buttons))
Angelo Arrifano6da4cd42010-07-08 16:20:56 -070081 return snprintf(buf, PAGE_SIZE, "none");
82
Szymon Janc505d2ad2012-01-11 23:22:47 +010083 list_for_each_entry(b, &buttons, list) {
Szymon Janc21c1ddf2012-01-11 23:22:48 +010084 count += snprintf(buf + count, PAGE_SIZE - count, "%u\t%s\n",
Szymon Janc505d2ad2012-01-11 23:22:47 +010085 b->id, b->name);
86
87 if (count >= PAGE_SIZE) {
88 count = PAGE_SIZE;
89 break;
Angelo Arrifano6da4cd42010-07-08 16:20:56 -070090 }
Angelo Arrifano6da4cd42010-07-08 16:20:56 -070091 }
92
93 return count;
94}
95
Greg Kroah-Hartman3b7cf042013-08-24 10:34:53 -070096static ssize_t pressed_button_show(struct device *dev,
97 struct device_attribute *attr, char *buf)
Angelo Arrifano6da4cd42010-07-08 16:20:56 -070098{
Szymon Jance66912a2012-02-10 21:05:42 +010099 return scnprintf(buf, PAGE_SIZE, "%s\n",
Szymon Janc3991eae2012-01-11 23:22:46 +0100100 (pressed ? pressed->name : "none"));
Angelo Arrifano6da4cd42010-07-08 16:20:56 -0700101}
102
103
Greg Kroah-Hartman3b7cf042013-08-24 10:34:53 -0700104static ssize_t pressed_button_store(struct device *dev,
105 struct device_attribute *attr,
106 const char *buf, size_t count)
Angelo Arrifano6da4cd42010-07-08 16:20:56 -0700107{
108 if (count < 2)
109 return -EINVAL;
110
111 if (strncasecmp(buf, "none", 4) != 0)
112 return -EINVAL;
113
Szymon Janc3991eae2012-01-11 23:22:46 +0100114 pressed = NULL;
Angelo Arrifano6da4cd42010-07-08 16:20:56 -0700115 return count;
116}
117
Szymon Janc5c9ed5b2012-01-11 23:22:36 +0100118/* Helper functions */
Szymon Janc3c92e382012-01-11 23:22:49 +0100119static struct quickstart_button *quickstart_buttons_add(void)
Angelo Arrifano6da4cd42010-07-08 16:20:56 -0700120{
Szymon Janc3c92e382012-01-11 23:22:49 +0100121 struct quickstart_button *b;
Angelo Arrifano6da4cd42010-07-08 16:20:56 -0700122
Szymon Janc505d2ad2012-01-11 23:22:47 +0100123 b = kzalloc(sizeof(*b), GFP_KERNEL);
124 if (!b)
125 return NULL;
Angelo Arrifano6da4cd42010-07-08 16:20:56 -0700126
Szymon Janc505d2ad2012-01-11 23:22:47 +0100127 list_add_tail(&b->list, &buttons);
Angelo Arrifano6da4cd42010-07-08 16:20:56 -0700128
Szymon Janc505d2ad2012-01-11 23:22:47 +0100129 return b;
Angelo Arrifano6da4cd42010-07-08 16:20:56 -0700130}
131
Szymon Janc3c92e382012-01-11 23:22:49 +0100132static void quickstart_button_del(struct quickstart_button *data)
Angelo Arrifano6da4cd42010-07-08 16:20:56 -0700133{
Angelo Arrifano6da4cd42010-07-08 16:20:56 -0700134 if (!data)
135 return;
136
Szymon Janc505d2ad2012-01-11 23:22:47 +0100137 list_del(&data->list);
138 kfree(data->name);
139 kfree(data);
Angelo Arrifano6da4cd42010-07-08 16:20:56 -0700140}
141
Szymon Janc505d2ad2012-01-11 23:22:47 +0100142static void quickstart_buttons_free(void)
Angelo Arrifano6da4cd42010-07-08 16:20:56 -0700143{
Szymon Janc3c92e382012-01-11 23:22:49 +0100144 struct quickstart_button *b, *n;
Angelo Arrifano6da4cd42010-07-08 16:20:56 -0700145
Szymon Janc505d2ad2012-01-11 23:22:47 +0100146 list_for_each_entry_safe(b, n, &buttons, list)
147 quickstart_button_del(b);
Angelo Arrifano6da4cd42010-07-08 16:20:56 -0700148}
149
150/* ACPI Driver functions */
151static void quickstart_acpi_notify(acpi_handle handle, u32 event, void *data)
152{
153 struct quickstart_acpi *quickstart = data;
154
155 if (!quickstart)
156 return;
157
Szymon Janc55e40362012-01-11 23:22:44 +0100158 switch (event) {
159 case QUICKSTART_EVENT_WAKE:
Szymon Janc3c92e382012-01-11 23:22:49 +0100160 pressed = quickstart->button;
Szymon Janc55e40362012-01-11 23:22:44 +0100161 break;
162 case QUICKSTART_EVENT_RUNTIME:
Szymon Janc3c92e382012-01-11 23:22:49 +0100163 input_report_key(quickstart_input, quickstart->button->id, 1);
Angelo Arrifano6da4cd42010-07-08 16:20:56 -0700164 input_sync(quickstart_input);
Szymon Janc3c92e382012-01-11 23:22:49 +0100165 input_report_key(quickstart_input, quickstart->button->id, 0);
Angelo Arrifano6da4cd42010-07-08 16:20:56 -0700166 input_sync(quickstart_input);
Szymon Janc55e40362012-01-11 23:22:44 +0100167 break;
168 default:
Szymon Janc74eabe42012-01-22 19:50:13 +0100169 pr_err("Unexpected ACPI event notify (%u)\n", event);
Szymon Janc55e40362012-01-11 23:22:44 +0100170 break;
Angelo Arrifano6da4cd42010-07-08 16:20:56 -0700171 }
Angelo Arrifano6da4cd42010-07-08 16:20:56 -0700172}
173
Szymon Janc2ac16962012-01-11 23:22:40 +0100174static int quickstart_acpi_ghid(struct quickstart_acpi *quickstart)
Angelo Arrifano6da4cd42010-07-08 16:20:56 -0700175{
176 acpi_status status;
177 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
Szymon Janc2ac16962012-01-11 23:22:40 +0100178 int ret = 0;
Angelo Arrifano6da4cd42010-07-08 16:20:56 -0700179
Szymon Janc5c9ed5b2012-01-11 23:22:36 +0100180 /*
181 * This returns a buffer telling the button usage ID,
182 * and triggers pending notify events (The ones before booting).
183 */
184 status = acpi_evaluate_object(quickstart->device->handle, "GHID", NULL,
185 &buffer);
Szymon Janc2ac16962012-01-11 23:22:40 +0100186 if (ACPI_FAILURE(status)) {
Szymon Janc74eabe42012-01-22 19:50:13 +0100187 pr_err("%s GHID method failed\n", quickstart->button->name);
Szymon Janc2ac16962012-01-11 23:22:40 +0100188 return -EINVAL;
Angelo Arrifano6da4cd42010-07-08 16:20:56 -0700189 }
190
Szymon Janc5c9ed5b2012-01-11 23:22:36 +0100191 /*
192 * <<The GHID method can return a BYTE, WORD, or DWORD.
Angelo Arrifano6da4cd42010-07-08 16:20:56 -0700193 * The value must be encoded in little-endian byte
Szymon Janc5c9ed5b2012-01-11 23:22:36 +0100194 * order (least significant byte first).>>
195 */
Szymon Janc2ac16962012-01-11 23:22:40 +0100196 switch (buffer.length) {
197 case 1:
Szymon Janc3c92e382012-01-11 23:22:49 +0100198 quickstart->button->id = *(uint8_t *)buffer.pointer;
Szymon Janc2ac16962012-01-11 23:22:40 +0100199 break;
200 case 2:
Szymon Janc3c92e382012-01-11 23:22:49 +0100201 quickstart->button->id = *(uint16_t *)buffer.pointer;
Szymon Janc2ac16962012-01-11 23:22:40 +0100202 break;
203 case 4:
Szymon Janc3c92e382012-01-11 23:22:49 +0100204 quickstart->button->id = *(uint32_t *)buffer.pointer;
Szymon Janc2ac16962012-01-11 23:22:40 +0100205 break;
206 case 8:
Szymon Janc3c92e382012-01-11 23:22:49 +0100207 quickstart->button->id = *(uint64_t *)buffer.pointer;
Szymon Janc2ac16962012-01-11 23:22:40 +0100208 break;
209 default:
Szymon Janc5f01f7f2012-02-10 21:05:43 +0100210 pr_err("%s GHID method returned buffer of unexpected length %lu\n",
211 quickstart->button->name,
212 (unsigned long)buffer.length);
Szymon Janc2ac16962012-01-11 23:22:40 +0100213 ret = -EINVAL;
214 break;
215 }
Angelo Arrifano6da4cd42010-07-08 16:20:56 -0700216
217 kfree(buffer.pointer);
Szymon Janc2ac16962012-01-11 23:22:40 +0100218
219 return ret;
Angelo Arrifano6da4cd42010-07-08 16:20:56 -0700220}
221
Szymon Jancffe1c052012-01-11 23:22:43 +0100222static int quickstart_acpi_config(struct quickstart_acpi *quickstart)
Angelo Arrifano6da4cd42010-07-08 16:20:56 -0700223{
Szymon Jancffe1c052012-01-11 23:22:43 +0100224 char *bid = acpi_device_bid(quickstart->device);
225 char *name;
Angelo Arrifano6da4cd42010-07-08 16:20:56 -0700226
Szymon Jancffe1c052012-01-11 23:22:43 +0100227 name = kmalloc(strlen(bid) + 1, GFP_KERNEL);
228 if (!name)
229 return -ENOMEM;
230
Szymon Janc505d2ad2012-01-11 23:22:47 +0100231 /* Add new button to list */
Szymon Janc3c92e382012-01-11 23:22:49 +0100232 quickstart->button = quickstart_buttons_add();
233 if (!quickstart->button) {
Szymon Jancffe1c052012-01-11 23:22:43 +0100234 kfree(name);
Szymon Janc505d2ad2012-01-11 23:22:47 +0100235 return -ENOMEM;
Angelo Arrifano6da4cd42010-07-08 16:20:56 -0700236 }
Szymon Jancffe1c052012-01-11 23:22:43 +0100237
Szymon Janc3c92e382012-01-11 23:22:49 +0100238 quickstart->button->name = name;
239 strcpy(quickstart->button->name, bid);
Angelo Arrifano6da4cd42010-07-08 16:20:56 -0700240
241 return 0;
242}
243
244static int quickstart_acpi_add(struct acpi_device *device)
245{
Szymon Jancf27a5512012-01-11 23:22:42 +0100246 int ret;
247 acpi_status status;
248 struct quickstart_acpi *quickstart;
Angelo Arrifano6da4cd42010-07-08 16:20:56 -0700249
250 if (!device)
251 return -EINVAL;
252
Szymon Jancf27a5512012-01-11 23:22:42 +0100253 quickstart = kzalloc(sizeof(*quickstart), GFP_KERNEL);
Angelo Arrifano6da4cd42010-07-08 16:20:56 -0700254 if (!quickstart)
255 return -ENOMEM;
256
257 quickstart->device = device;
Szymon Jancf27a5512012-01-11 23:22:42 +0100258
Angelo Arrifano6da4cd42010-07-08 16:20:56 -0700259 strcpy(acpi_device_name(device), QUICKSTART_ACPI_DEVICE_NAME);
260 strcpy(acpi_device_class(device), QUICKSTART_ACPI_CLASS);
261 device->driver_data = quickstart;
262
263 /* Add button to list and initialize some stuff */
Szymon Jancffe1c052012-01-11 23:22:43 +0100264 ret = quickstart_acpi_config(quickstart);
Szymon Jancf27a5512012-01-11 23:22:42 +0100265 if (ret < 0)
Angelo Arrifano6da4cd42010-07-08 16:20:56 -0700266 goto fail_config;
267
Szymon Jancf27a5512012-01-11 23:22:42 +0100268 status = acpi_install_notify_handler(device->handle, ACPI_ALL_NOTIFY,
Angelo Arrifano6da4cd42010-07-08 16:20:56 -0700269 quickstart_acpi_notify,
270 quickstart);
271 if (ACPI_FAILURE(status)) {
Szymon Janc74eabe42012-01-22 19:50:13 +0100272 pr_err("Notify handler install error\n");
Angelo Arrifano6da4cd42010-07-08 16:20:56 -0700273 ret = -ENODEV;
274 goto fail_installnotify;
275 }
276
Szymon Jancf27a5512012-01-11 23:22:42 +0100277 ret = quickstart_acpi_ghid(quickstart);
278 if (ret < 0)
279 goto fail_ghid;
Angelo Arrifano6da4cd42010-07-08 16:20:56 -0700280
281 return 0;
282
Szymon Jancf27a5512012-01-11 23:22:42 +0100283fail_ghid:
284 acpi_remove_notify_handler(device->handle, ACPI_ALL_NOTIFY,
285 quickstart_acpi_notify);
286
Angelo Arrifano6da4cd42010-07-08 16:20:56 -0700287fail_installnotify:
Szymon Janc3c92e382012-01-11 23:22:49 +0100288 quickstart_button_del(quickstart->button);
Angelo Arrifano6da4cd42010-07-08 16:20:56 -0700289
290fail_config:
291
292 kfree(quickstart);
293
294 return ret;
295}
296
Rafael J. Wysocki51fac832013-01-24 00:24:48 +0100297static int quickstart_acpi_remove(struct acpi_device *device)
Angelo Arrifano6da4cd42010-07-08 16:20:56 -0700298{
Szymon Janc60955f12012-01-11 23:22:41 +0100299 acpi_status status;
300 struct quickstart_acpi *quickstart;
Angelo Arrifano6da4cd42010-07-08 16:20:56 -0700301
Szymon Janc60955f12012-01-11 23:22:41 +0100302 if (!device)
Angelo Arrifano6da4cd42010-07-08 16:20:56 -0700303 return -EINVAL;
304
305 quickstart = acpi_driver_data(device);
Szymon Janc60955f12012-01-11 23:22:41 +0100306 if (!quickstart)
307 return -EINVAL;
Angelo Arrifano6da4cd42010-07-08 16:20:56 -0700308
Szymon Janc5c9ed5b2012-01-11 23:22:36 +0100309 status = acpi_remove_notify_handler(device->handle, ACPI_ALL_NOTIFY,
310 quickstart_acpi_notify);
Angelo Arrifano6da4cd42010-07-08 16:20:56 -0700311 if (ACPI_FAILURE(status))
Szymon Janc74eabe42012-01-22 19:50:13 +0100312 pr_err("Error removing notify handler\n");
Angelo Arrifano6da4cd42010-07-08 16:20:56 -0700313
Angelo Arrifano6da4cd42010-07-08 16:20:56 -0700314 kfree(quickstart);
315
316 return 0;
317}
318
Szymon Janc605926ef2012-01-11 23:22:38 +0100319/* Platform driver structs */
Greg Kroah-Hartman3b7cf042013-08-24 10:34:53 -0700320static DEVICE_ATTR_RW(pressed_button);
321static DEVICE_ATTR_RO(buttons);
Szymon Janc605926ef2012-01-11 23:22:38 +0100322static struct platform_device *pf_device;
323static struct platform_driver pf_driver = {
324 .driver = {
325 .name = QUICKSTART_PF_DRIVER_NAME,
326 .owner = THIS_MODULE,
327 }
328};
329
330static const struct acpi_device_id quickstart_device_ids[] = {
331 {QUICKSTART_ACPI_HID, 0},
332 {"", 0},
333};
334
335static struct acpi_driver quickstart_acpi_driver = {
336 .name = "quickstart",
337 .class = QUICKSTART_ACPI_CLASS,
338 .ids = quickstart_device_ids,
339 .ops = {
340 .add = quickstart_acpi_add,
341 .remove = quickstart_acpi_remove,
342 },
343};
344
Angelo Arrifano6da4cd42010-07-08 16:20:56 -0700345/* Module functions */
Angelo Arrifano6da4cd42010-07-08 16:20:56 -0700346static void quickstart_exit(void)
347{
348 input_unregister_device(quickstart_input);
Angelo Arrifano6da4cd42010-07-08 16:20:56 -0700349
350 device_remove_file(&pf_device->dev, &dev_attr_pressed_button);
351 device_remove_file(&pf_device->dev, &dev_attr_buttons);
352
353 platform_device_unregister(pf_device);
354
355 platform_driver_unregister(&pf_driver);
356
357 acpi_bus_unregister_driver(&quickstart_acpi_driver);
358
Szymon Janc505d2ad2012-01-11 23:22:47 +0100359 quickstart_buttons_free();
Angelo Arrifano6da4cd42010-07-08 16:20:56 -0700360}
361
362static int __init quickstart_init_input(void)
363{
Szymon Janc3c92e382012-01-11 23:22:49 +0100364 struct quickstart_button *b;
Dan Carpenterebba26f2010-11-12 08:04:43 +0300365 int ret;
Angelo Arrifano6da4cd42010-07-08 16:20:56 -0700366
367 quickstart_input = input_allocate_device();
368
369 if (!quickstart_input)
370 return -ENOMEM;
371
372 quickstart_input->name = "Quickstart ACPI Buttons";
373 quickstart_input->id.bustype = BUS_HOST;
374
Szymon Janc505d2ad2012-01-11 23:22:47 +0100375 list_for_each_entry(b, &buttons, list) {
Angelo Arrifano6da4cd42010-07-08 16:20:56 -0700376 set_bit(EV_KEY, quickstart_input->evbit);
Szymon Janc505d2ad2012-01-11 23:22:47 +0100377 set_bit(b->id, quickstart_input->keybit);
Angelo Arrifano6da4cd42010-07-08 16:20:56 -0700378 }
379
Dan Carpenterebba26f2010-11-12 08:04:43 +0300380 ret = input_register_device(quickstart_input);
381 if (ret) {
382 input_free_device(quickstart_input);
383 return ret;
384 }
385
386 return 0;
Angelo Arrifano6da4cd42010-07-08 16:20:56 -0700387}
388
389static int __init quickstart_init(void)
390{
391 int ret;
Angelo Arrifano6da4cd42010-07-08 16:20:56 -0700392
393 /* ACPI Check */
394 if (acpi_disabled)
395 return -ENODEV;
396
397 /* ACPI driver register */
Dan Carpenterf0903862010-08-10 07:42:25 +0200398 ret = acpi_bus_register_driver(&quickstart_acpi_driver);
399 if (ret)
400 return ret;
Angelo Arrifano6da4cd42010-07-08 16:20:56 -0700401
402 /* If existing bus with no devices */
Szymon Janc505d2ad2012-01-11 23:22:47 +0100403 if (list_empty(&buttons)) {
Angelo Arrifano6da4cd42010-07-08 16:20:56 -0700404 ret = -ENODEV;
405 goto fail_pfdrv_reg;
406 }
407
408 /* Platform driver register */
409 ret = platform_driver_register(&pf_driver);
410 if (ret)
411 goto fail_pfdrv_reg;
412
413 /* Platform device register */
414 pf_device = platform_device_alloc(QUICKSTART_PF_DEVICE_NAME, -1);
415 if (!pf_device) {
416 ret = -ENOMEM;
417 goto fail_pfdev_alloc;
418 }
419 ret = platform_device_add(pf_device);
420 if (ret)
421 goto fail_pfdev_add;
422
423 /* Create device sysfs file */
424 ret = device_create_file(&pf_device->dev, &dev_attr_pressed_button);
425 if (ret)
426 goto fail_dev_file;
427
428 ret = device_create_file(&pf_device->dev, &dev_attr_buttons);
429 if (ret)
430 goto fail_dev_file2;
431
Angelo Arrifano6da4cd42010-07-08 16:20:56 -0700432 /* Input device */
433 ret = quickstart_init_input();
434 if (ret)
435 goto fail_input;
436
Szymon Janc74eabe42012-01-22 19:50:13 +0100437 pr_info("ACPI Direct App Launch ver %s\n", QUICKSTART_VERSION);
Angelo Arrifano6da4cd42010-07-08 16:20:56 -0700438
439 return 0;
440fail_input:
441 device_remove_file(&pf_device->dev, &dev_attr_buttons);
442
443fail_dev_file2:
444 device_remove_file(&pf_device->dev, &dev_attr_pressed_button);
445
446fail_dev_file:
447 platform_device_del(pf_device);
448
449fail_pfdev_add:
450 platform_device_put(pf_device);
451
452fail_pfdev_alloc:
453 platform_driver_unregister(&pf_driver);
454
455fail_pfdrv_reg:
456 acpi_bus_unregister_driver(&quickstart_acpi_driver);
457
458 return ret;
459}
460
461module_init(quickstart_init);
462module_exit(quickstart_exit);