atomic use is not atomic?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi!

Can anybody explain this code [1] in terms of atomicity?

  if (!atomic_read(&trig->use_count)) {
    atomic_set(&trig->use_count, CONFIG_IIO_CONSUMERS_PER_TRIGGER);
    ...
  }

AFAIU how atomics are supposed to work the above doesn't do anything
atomically. I.o.w. use_count may be simple int with the same effect.

What did I miss?

[1]: https://elixir.bootlin.com/linux/latest/source/drivers/iio/industrialio-trigger.c#L166

-- 
With Best Regards,
Andy Shevchenko



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux