]> git.zerfleddert.de Git - ms2-fixes/commitdiff
add (disabled) fixup-handler
authorMichael Gernoth <michael@gernoth.net>
Tue, 6 Sep 2011 20:44:17 +0000 (22:44 +0200)
committerMichael Gernoth <michael@gernoth.net>
Tue, 6 Sep 2011 20:44:17 +0000 (22:44 +0200)
debounce.c

index f06cf2233248219d9e1d3ba78c3d7865ff5a8f6a..399e97bbdb28fdecf0b572fced0dc995487f5cb3 100644 (file)
@@ -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 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;
 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);
 
 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)
 {
 }
 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_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;
 }
 
        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;
                }
                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);
        }
        hw_debounce_set(0, 0);
        device_remove_file(&debounce_device, &dev_attr_debounce_delay);
Impressum, Datenschutz