| 1 | --- a/lib/kobject_uevent.c |
| 2 | +++ b/lib/kobject_uevent.c |
| 3 | @@ -29,7 +29,8 @@ u64 uevent_seqnum; |
| 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 | @@ -42,6 +43,18 @@ static const char *kobject_actions[] = { |
| 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 | @@ -201,9 +214,7 @@ int kobject_uevent_env(struct kobject *k |
| 33 | kobj->state_remove_uevent_sent = 1; |
| 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; |
| 43 | |