From e063f9d59f701fee594706dcfffe6e4b43a7033c Mon Sep 17 00:00:00 2001 From: Michael Gernoth Date: Tue, 6 Sep 2011 22:44:17 +0200 Subject: [PATCH] add (disabled) fixup-handler --- debounce.c | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/debounce.c b/debounce.c index f06cf22..399e97b 100644 --- a/debounce.c +++ b/debounce.c @@ -12,6 +12,7 @@ static unsigned old_flags = 0; static ktime_t old_debounce_delay; static ktime_t old_settle_time; static ktime_t old_poll_time; +static int (*old_sw_fixup)(int index); static struct gpio_event_matrix_info *gpio_evmi = NULL; static int hw_debounce = 0; static int hw_debounce_time = 0; @@ -469,6 +470,21 @@ static DEVICE_ATTR(drive_inactive_flag, (S_IRUGO | S_IWUGO), show_drive_inactive static DEVICE_ATTR(hw_debounce, (S_IRUGO | S_IWUGO), show_hw_debounce, store_hw_debounce); static DEVICE_ATTR(hw_debounce_time, (S_IRUGO | S_IWUGO), show_hw_debounce_time, store_hw_debounce_time); +#if 0 +static int debounce_fixup(int index) +{ + int ret; + + printk(KERN_INFO PREFIX "0x%x\n", index); + + ret = old_sw_fixup(index); + if (!ret) + printk(KERN_INFO PREFIX "IGNORED!\n"); + + return ret; +} +#endif + static void debounce_release(struct device *dev) { } @@ -528,8 +544,12 @@ static int __init debounce_init(void) old_settle_time = gpio_evmi->settle_time; old_poll_time = gpio_evmi->poll_time; old_flags = gpio_evmi->flags; + old_sw_fixup = gpio_evmi->sw_fixup; - printk(KERN_INFO PREFIX "flags: 0x%x\n", gpio_evmi->flags); +#if 0 + printk(KERN_INFO PREFIX "Registering fixup handler\n"); + gpio_evmi->sw_fixup = debounce_fixup; +#endif return 0; } @@ -550,6 +570,11 @@ static void __exit debounce_exit(void) } gpio_evmi->settle_time = old_settle_time; gpio_evmi->poll_time = old_poll_time; + + if (gpio_evmi->sw_fixup != old_sw_fixup) { + printk(KERN_INFO PREFIX "Restoring fixup handler\n"); + gpio_evmi->sw_fixup = old_sw_fixup; + } } hw_debounce_set(0, 0); device_remove_file(&debounce_device, &dev_attr_debounce_delay); -- 2.39.2