summaryrefslogtreecommitdiff
path: root/drivers/input/keyboard
diff options
context:
space:
mode:
authorNaga Radhesh <naga.radheshy@stericsson.com>2012-01-12 19:20:47 +0530
committerPhilippe Langlais <philippe.langlais@stericsson.com>2012-05-22 11:03:39 +0200
commit7695f8c2b610ae299f05fefd6adc13483e6c9289 (patch)
treed553fa7c16c79d66d52855bdf57b05f05e4cdcc3 /drivers/input/keyboard
parent6f632d895387719785c816c64b3d213f6b80278f (diff)
skekeypad:Release all acquired resources
During remove release the clock,irq's and gpio pins properly. ST-Ericsson ID: 410064 ST-Ericsson Linux next: NA ST-Ericsson FOSS-OUT ID: Trivial Change-Id:I68fdc2fd16ca6476166b8a89e01eed0f02679fd9 Signed-off-by: Naga Radhesh <naga.radheshy@stericsson.com> Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/45282 Reviewed-by: QATOOLS Reviewed-by: QABUILD Reviewed-by: Srinidhi KASAGAR <srinidhi.kasagar@stericsson.com>
Diffstat (limited to 'drivers/input/keyboard')
-rw-r--r--drivers/input/keyboard/nomadik-ske-keypad.c26
1 files changed, 18 insertions, 8 deletions
diff --git a/drivers/input/keyboard/nomadik-ske-keypad.c b/drivers/input/keyboard/nomadik-ske-keypad.c
index 056f8bc1b06..022b474e7ec 100644
--- a/drivers/input/keyboard/nomadik-ske-keypad.c
+++ b/drivers/input/keyboard/nomadik-ske-keypad.c
@@ -683,12 +683,10 @@ static int __init ske_keypad_probe(struct platform_device *pdev)
goto out_unregisterinput;
}
for (i = 0; i < SKE_KPD_MAX_ROWS; i++) {
- keypad->ske_rows[i] = *plat->gpio_input_pins;
- keypad->ske_cols[i] = *plat->gpio_output_pins;
+ keypad->ske_rows[i] = plat->gpio_input_pins[i];
+ keypad->ske_cols[i] = plat->gpio_output_pins[i];
keypad->gpio_input_irq[i] =
NOMADIK_GPIO_TO_IRQ(keypad->ske_rows[i]);
- plat->gpio_input_pins++;
- plat->gpio_output_pins++;
}
for (i = 0; i < keypad->board->krow; i++) {
@@ -755,21 +753,33 @@ static int __devexit ske_keypad_remove(struct platform_device *pdev)
{
struct ske_keypad *keypad = platform_get_drvdata(pdev);
struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+ int i;
cancel_delayed_work_sync(&keypad->gpio_work);
cancel_delayed_work_sync(&keypad->work);
cancel_delayed_work_sync(&keypad->scan_work);
- free_irq(keypad->irq, keypad);
input_unregister_device(keypad->input);
-
sysfs_remove_group(&pdev->dev.kobj, &ske_attr_group);
- clk_disable(keypad->clk);
+ if (keypad->enable)
+ clk_disable(keypad->clk);
clk_put(keypad->clk);
- if (keypad->board->exit)
+ if (keypad->enable && keypad->board->exit)
keypad->board->exit();
+ else {
+ for (i = 0; i < keypad->board->krow; i++) {
+ disable_irq_nosync(keypad->gpio_input_irq[i]);
+ disable_irq_wake(keypad->gpio_input_irq[i]);
+ }
+ }
+ for (i = 0; i < keypad->board->krow; i++)
+ free_irq(keypad->gpio_input_irq[i], keypad);
+
+ for (i = 0; i < SKE_KPD_MAX_ROWS; i++)
+ gpio_free(keypad->ske_rows[i]);
+ free_irq(keypad->irq, keypad);
regulator_put(keypad->regulator);
iounmap(keypad->reg_base);