generic 2.6.24 support
[openwrt-10.03/.git] / target / linux / generic-2.6 / patches-2.6.24 / 213-kobject_uevent.patch
1 --- linux-2.6.24/lib/kobject_uevent.c   2008-01-24 23:58:37.000000000 +0100
2 +++ linux-2.6.24-owrt/lib/kobject_uevent.c      2008-01-28 12:01:41.000000000 +0100
3 @@ -27,7 +27,8 @@
4  char uevent_helper[UEVENT_HELPER_PATH_LEN] = CONFIG_UEVENT_HELPER_PATH;
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  /* the strings here must match the enum in include/linux/kobject.h */
13 @@ -40,6 +41,18 @@
14         [KOBJ_OFFLINE] =        "offline",
15  };
16  
17 +u64 uevent_next_seqnum(void)
18 +{
19 +       u64 seq;
20 +
21 +       spin_lock(&sequence_lock);
22 +       seq = ++uevent_seqnum;
23 +       spin_unlock(&sequence_lock);
24 +       
25 +       return seq;
26 +}
27 +EXPORT_SYMBOL_GPL(uevent_next_seqnum);
28 +
29  /**
30   * kobject_action_type - translate action string to numeric type
31   *
32 @@ -173,9 +186,7 @@
33         }
34  
35         /* we will send an event, so request a new sequence number */
36 -       spin_lock(&sequence_lock);
37 -       seq = ++uevent_seqnum;
38 -       spin_unlock(&sequence_lock);
39 +       seq = uevent_next_seqnum();
40         retval = add_uevent_var(env, "SEQNUM=%llu", (unsigned long long)seq);
41         if (retval)
42                 goto exit;