[kernel] refresh generic 2.6.25 patches
[10.03/openwrt.git] / target / linux / generic-2.6 / patches-2.6.25 / 213-kobject_uevent.patch
1 Index: linux-2.6.25.4/lib/kobject_uevent.c
2 ===================================================================
3 --- linux-2.6.25.4.orig/lib/kobject_uevent.c
4 +++ linux-2.6.25.4/lib/kobject_uevent.c
5 @@ -27,7 +27,8 @@ u64 uevent_seqnum;
6  char uevent_helper[UEVENT_HELPER_PATH_LEN] = CONFIG_UEVENT_HELPER_PATH;
7  static DEFINE_SPINLOCK(sequence_lock);
8  #if defined(CONFIG_NET)
9 -static struct sock *uevent_sock;
10 +struct sock *uevent_sock = NULL;
11 +EXPORT_SYMBOL_GPL(uevent_sock);
12  #endif
13  
14  /* the strings here must match the enum in include/linux/kobject.h */
15 @@ -40,6 +41,18 @@ static const char *kobject_actions[] = {
16         [KOBJ_OFFLINE] =        "offline",
17  };
18  
19 +u64 uevent_next_seqnum(void)
20 +{
21 +       u64 seq;
22 +
23 +       spin_lock(&sequence_lock);
24 +       seq = ++uevent_seqnum;
25 +       spin_unlock(&sequence_lock);
26 +       
27 +       return seq;
28 +}
29 +EXPORT_SYMBOL_GPL(uevent_next_seqnum);
30 +
31  /**
32   * kobject_action_type - translate action string to numeric type
33   *
34 @@ -192,9 +205,7 @@ int kobject_uevent_env(struct kobject *k
35                 kobj->state_remove_uevent_sent = 1;
36  
37         /* we will send an event, so request a new sequence number */
38 -       spin_lock(&sequence_lock);
39 -       seq = ++uevent_seqnum;
40 -       spin_unlock(&sequence_lock);
41 +       seq = uevent_next_seqnum();
42         retval = add_uevent_var(env, "SEQNUM=%llu", (unsigned long long)seq);
43         if (retval)
44                 goto exit;