f15749fa1780d5680c596a302bb9a5b0f942cc66
[openwrt.git] / target / linux / generic / patches-3.3 / 910-kobject_uevent.patch
1 --- a/lib/kobject_uevent.c
2 +++ b/lib/kobject_uevent.c
3 @@ -49,6 +49,18 @@ static const char *kobject_actions[] = {
4         [KOBJ_OFFLINE] =        "offline",
5  };
6  
7 +u64 uevent_next_seqnum(void)
8 +{
9 +       u64 seq;
10 +
11 +       spin_lock(&sequence_lock);
12 +       seq = ++uevent_seqnum;
13 +       spin_unlock(&sequence_lock);
14 +
15 +       return seq;
16 +}
17 +EXPORT_SYMBOL_GPL(uevent_next_seqnum);
18 +
19  /**
20   * kobject_action_type - translate action string to numeric type
21   *
22 @@ -244,9 +256,7 @@ int kobject_uevent_env(struct kobject *k
23                 kobj->state_remove_uevent_sent = 1;
24  
25         /* we will send an event, so request a new sequence number */
26 -       spin_lock(&sequence_lock);
27 -       seq = ++uevent_seqnum;
28 -       spin_unlock(&sequence_lock);
29 +       seq = uevent_next_seqnum();
30         retval = add_uevent_var(env, "SEQNUM=%llu", (unsigned long long)seq);
31         if (retval)
32                 goto exit;