flm01/mote/v2/openwrt/patches/310-hotplug_button_jiffies_...

28 lines
786 B
Diff
Raw Normal View History

--- a/arch/mips/ar231x/reset.c
+++ b/arch/mips/ar231x/reset.c
@@ -19,6 +19,7 @@
struct work_struct wq;
int set;
unsigned long jiffies;
+ unsigned long jiffies_prev;
};
static struct timer_list rst_button_timer;
@@ -68,7 +69,7 @@
add_msg(skb, "SUBSYSTEM=button");
add_msg(skb, "BUTTON=reset");
add_msg(skb, (event->set ? "ACTION=pressed" : "ACTION=released"));
- sprintf(buf, "SEEN=%ld", (event->jiffies - seen)/HZ);
+ sprintf(buf, "SEEN=%lu", (event->jiffies - event->jiffies_prev)/HZ);
add_msg(skb, buf);
snprintf(buf, 128, "SEQNUM=%llu", uevent_next_seqnum());
add_msg(skb, buf);
@@ -127,6 +128,7 @@
no_release_workaround = 0;
event->jiffies = jiffies;
+ event->jiffies_prev = seen;
INIT_WORK(&event->wq, hotplug_button);
schedule_work(&event->wq);