switch to a threaded irq and add a mutex for locking. Locking not done yet, this is just a start.
Signed-off-by: Kristen Carlson Accardi <[email protected]> --- drivers/input/keyboard/intel_mid_keypad.c | 24 +++++++++++++++++++++--- 1 files changed, 21 insertions(+), 3 deletions(-) diff --git a/drivers/input/keyboard/intel_mid_keypad.c b/drivers/input/keyboard/intel_mid_keypad.c index 33c6300..ebfd816 100644 --- a/drivers/input/keyboard/intel_mid_keypad.c +++ b/drivers/input/keyboard/intel_mid_keypad.c @@ -138,6 +138,8 @@ struct mrst_keypad { void __iomem *mmio_base; unsigned int irq; + struct mutex lock; + unsigned int matrix_key_rows; unsigned int matrix_key_cols; unsigned int row_shift; @@ -241,7 +243,20 @@ static irqreturn_t mrst_keypad_irq_handler(int irq, void *dev_id) unsigned long kpc = keypad_readl(KPC); if (kpc & KPC_MI) - mrst_keypad_scan_matrix(keypad); + return IRQ_WAKE_THREAD; + + return IRQ_HANDLED; +} + +static irqreturn_t mrst_keypad_threadfn(int irq, void *dev_id) +{ + struct mrst_keypad *keypad = dev_id; + + mutex_lock(&keypad->lock); + + mrst_keypad_scan_matrix(keypad); + + mutex_unlock(&keypad->lock); return IRQ_HANDLED; } @@ -376,8 +391,11 @@ static int __devinit mrst_keypad_probe(struct pci_dev *pdev, mrst_keypad_build_keycode(keypad); pci_set_drvdata(pdev, keypad); - error = request_irq(pdev->irq, mrst_keypad_irq_handler, IRQF_SHARED, - pci_name(pdev), keypad); + mutex_init(&keypad->lock); + + error = request_threaded_irq(pdev->irq, mrst_keypad_irq_handler, + mrst_keypad_threadfn, IRQF_SHARED, + pci_name(pdev), keypad); if (error) { dev_err(&pdev->dev, "failed to request keyboard IRQ\n"); goto failed_free_iounmap; -- 1.7.3.1 _______________________________________________ MeeGo-kernel mailing list [email protected] http://lists.meego.com/listinfo/meego-kernel
