fix an off-by-one error
[openwrt/openwrt.git] / target / linux / generic-2.6 / patches / 213-kobject_uevent.patch
1 --- linux-2.6.22-rc5/lib/kobject_uevent.c.old 2007-06-25 07:34:27.002266528 +0200
2 +++ linux-2.6.22-rc5/lib/kobject_uevent.c 2007-06-25 08:39:53.762308264 +0200
3 @@ -30,9 +30,22 @@
4 char uevent_helper[UEVENT_HELPER_PATH_LEN] = "/sbin/hotplug";
5 static DEFINE_SPINLOCK(sequence_lock);
6 #if defined(CONFIG_NET)
7 -static struct sock *uevent_sock;
8 +struct sock *uevent_sock = NULL;
9 +EXPORT_SYMBOL_GPL(uevent_sock);
10 #endif
11
12 +u64 uevent_next_seqnum(void)
13 +{
14 + u64 seq;
15 +
16 + spin_lock(&sequence_lock);
17 + seq = ++uevent_seqnum;
18 + spin_unlock(&sequence_lock);
19 +
20 + return seq;
21 +}
22 +EXPORT_SYMBOL_GPL(uevent_next_seqnum);
23 +
24 static char *action_to_string(enum kobject_action action)
25 {
26 switch (action) {
27 @@ -169,9 +182,7 @@
28 }
29
30 /* we will send an event, request a new sequence number */
31 - spin_lock(&sequence_lock);
32 - seq = ++uevent_seqnum;
33 - spin_unlock(&sequence_lock);
34 + seq = uevent_next_seqnum();
35 sprintf(seq_buff, "SEQNUM=%llu", (unsigned long long)seq);
36
37 #if defined(CONFIG_NET)