Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 174255
b: refs/heads/master
c: 6ee88d7
h: refs/heads/master
i:
  174253: 186bcf5
  174251: 76e8104
  174247: 3bb45d2
  174239: bc6a67c
v: v3
  • Loading branch information
Daniel Mack authored and Dmitry Torokhov committed Nov 30, 2009
1 parent d3844ec commit d815d75
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 12 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 21cea58e49cf59e7c77ce2a01be432458e9f99a9
refs/heads/master: 6ee88d713fb75ab191515f66edffa4e866386565
36 changes: 25 additions & 11 deletions trunk/drivers/input/keyboard/gpio_keys.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,8 @@ struct gpio_keys_drvdata {
struct gpio_button_data data[0];
};

static void gpio_keys_report_event(struct work_struct *work)
static void gpio_keys_report_event(struct gpio_button_data *bdata)
{
struct gpio_button_data *bdata =
container_of(work, struct gpio_button_data, work);
struct gpio_keys_button *button = bdata->button;
struct input_dev *input = bdata->input;
unsigned int type = button->type ?: EV_KEY;
Expand All @@ -50,6 +48,14 @@ static void gpio_keys_report_event(struct work_struct *work)
input_sync(input);
}

static void gpio_keys_work_func(struct work_struct *work)
{
struct gpio_button_data *bdata =
container_of(work, struct gpio_button_data, work);

gpio_keys_report_event(bdata);
}

static void gpio_keys_timer(unsigned long _data)
{
struct gpio_button_data *data = (struct gpio_button_data *)_data;
Expand Down Expand Up @@ -81,7 +87,7 @@ static int __devinit gpio_keys_setup_key(struct device *dev,
int irq, error;

setup_timer(&bdata->timer, gpio_keys_timer, (unsigned long)bdata);
INIT_WORK(&bdata->work, gpio_keys_report_event);
INIT_WORK(&bdata->work, gpio_keys_work_func);

error = gpio_request(button->gpio, desc);
if (error < 0) {
Expand Down Expand Up @@ -185,6 +191,11 @@ static int __devinit gpio_keys_probe(struct platform_device *pdev)
goto fail2;
}

/* get current state of buttons */
for (i = 0; i < pdata->nbuttons; i++)
gpio_keys_report_event(&ddata->data[i]);
input_sync(input);

device_init_wakeup(&pdev->dev, wakeup);

return 0;
Expand Down Expand Up @@ -253,18 +264,21 @@ static int gpio_keys_suspend(struct device *dev)
static int gpio_keys_resume(struct device *dev)
{
struct platform_device *pdev = to_platform_device(dev);
struct gpio_keys_drvdata *ddata = platform_get_drvdata(pdev);
struct gpio_keys_platform_data *pdata = pdev->dev.platform_data;
int i;

if (device_may_wakeup(&pdev->dev)) {
for (i = 0; i < pdata->nbuttons; i++) {
struct gpio_keys_button *button = &pdata->buttons[i];
if (button->wakeup) {
int irq = gpio_to_irq(button->gpio);
disable_irq_wake(irq);
}
for (i = 0; i < pdata->nbuttons; i++) {

struct gpio_keys_button *button = &pdata->buttons[i];
if (button->wakeup && device_may_wakeup(&pdev->dev)) {
int irq = gpio_to_irq(button->gpio);
disable_irq_wake(irq);
}

gpio_keys_report_event(&ddata->data[i]);
}
input_sync(ddata->input);

return 0;
}
Expand Down

0 comments on commit d815d75

Please sign in to comment.