[PATCH 1/7] media: aspeed: fix a kernel warning on clk control

Benjamin Herrenschmidt benh at kernel.crashing.org
Thu May 9 12:16:45 AEST 2019


On Wed, 2019-05-08 at 18:19 -0700, Jae Hyun Yoo wrote:
> I changed that from a bool because the maintainer of this code, Eddie
> doesn't like adding of an additional flag. I'll change it back with
> codes in the first submit:
> https://www.spinics.net/lists/linux-media/msg148955.html
> 
> Eddie,
> Please let me know if you have any objection on that.

Ok, so random flags ... ugh.

Well, you can approach it either way. Have them all be bitops or all be
bool.

The tricky thing however is that if they are bitops you need to ensure
that they are *all* manipulated under the same lock. If not you have to
use the atomic bitops variants.

The reason I don't like that is that experience shows that most uses of
such atomic variants in drivers usually are failed attempts at papering
over broken locking.

If everything is covered by a lock, then using the non-atomic versions
is more efficient, but so is using bool (optionally with :1 bitfield
qualifiers to avoid wasting memory), which from a pure C language
perspective I think is more expressive of what you are doing and more
readable.

Cheers,
Ben.



More information about the Linux-aspeed mailing list