Re: [PATCH net-next 1/5] net: ipa: use atomic exchange for suspend reference

David Miller
2020-09-09T03:27:38Z

From: Alex Elder <elder@linaro.org>
Date: Tue, 8 Sep 2020 19:21:23 -0500

> We take a single IPA clock reference to keep the clock running
> until we get a system suspend operation. When a system suspend
> request arrives, we drop that reference, and if that's the last
> reference (likely) we'll proceed with suspending endpoints and
> disabling the IPA core clock and interconnects.
>
> In most places we simply set the reference count to 0 or 1
> atomically. Instead--primarily to catch coding errors--use an
> atomic exchange to update the reference count value, and report
> an error in the event the previous value was unexpected.
>
> In a few cases it's not hard to see that the error message should
> never be reported. Report them anyway, but add some excitement
> to the message by ending it with an exclamation point.
>
> Signed-off-by: Alex Elder <elder@linaro.org>

Please use refcount_t if you're wanting to validate things like
this.

Thank you.