910-kobject_uevent.patch 798 B

1234567891011121314151617181920212223242526272829303132
  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. +u64 uevent_next_seqnum(void)
  7. +{
  8. + u64 seq;
  9. +
  10. + spin_lock(&sequence_lock);
  11. + seq = ++uevent_seqnum;
  12. + spin_unlock(&sequence_lock);
  13. +
  14. + return seq;
  15. +}
  16. +EXPORT_SYMBOL_GPL(uevent_next_seqnum);
  17. +
  18. /**
  19. * kobject_action_type - translate action string to numeric type
  20. *
  21. @@ -244,9 +256,7 @@ int kobject_uevent_env(struct kobject *k
  22. kobj->state_remove_uevent_sent = 1;
  23. /* we will send an event, so request a new sequence number */
  24. - spin_lock(&sequence_lock);
  25. - seq = ++uevent_seqnum;
  26. - spin_unlock(&sequence_lock);
  27. + seq = uevent_next_seqnum();
  28. retval = add_uevent_var(env, "SEQNUM=%llu", (unsigned long long)seq);
  29. if (retval)
  30. goto exit;