213-kobject_uevent.patch 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. --- a/lib/kobject_uevent.c
  2. +++ b/lib/kobject_uevent.c
  3. @@ -27,7 +27,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. /* the strings here must match the enum in include/linux/kobject.h */
  12. @@ -40,6 +41,18 @@ static const char *kobject_actions[] = {
  13. [KOBJ_OFFLINE] = "offline",
  14. };
  15. +u64 uevent_next_seqnum(void)
  16. +{
  17. + u64 seq;
  18. +
  19. + spin_lock(&sequence_lock);
  20. + seq = ++uevent_seqnum;
  21. + spin_unlock(&sequence_lock);
  22. +
  23. + return seq;
  24. +}
  25. +EXPORT_SYMBOL_GPL(uevent_next_seqnum);
  26. +
  27. /**
  28. * kobject_action_type - translate action string to numeric type
  29. *
  30. @@ -173,9 +186,7 @@ int kobject_uevent_env(struct kobject *k
  31. }
  32. /* we will send an event, so request a new sequence number */
  33. - spin_lock(&sequence_lock);
  34. - seq = ++uevent_seqnum;
  35. - spin_unlock(&sequence_lock);
  36. + seq = uevent_next_seqnum();
  37. retval = add_uevent_var(env, "SEQNUM=%llu", (unsigned long long)seq);
  38. if (retval)
  39. goto exit;