Re: [PATCH V1 1/4] regmap: add function for set/clear bits
From: Mark Brown
Date: Mon May 07 2012 - 06:56:01 EST
On Mon, May 07, 2012 at 01:05:36PM +0530, Laxman Dewangan wrote:
> Add regmap_set_bits() and regmap_clear_bits() for
> setting/clearing bits.
> Although this can be achieve by regmap_update_bits() but
> having these functions gives good readability in driver
> code which uses regmap apis.
I'm not convinced about these for readability in the first place but...
> +int regmap_set_bits(struct regmap *map, unsigned int reg, unsigned int bits)
> +{
> + bool change;
> + return _regmap_update_bits(map, reg, bits, bits, &change);
> +}
> +EXPORT_SYMBOL_GPL(regmap_set_bits);
...clearly they should just be static inlines in the header file,
there's nothing in the actual function.
For readability I find moving the operation being done to the register
value into the function name tends to make it less obvious when scanning
the code what the actual change is (since with a bunch of operations
there's a lot of repeated text on the line and a fairly small amount of
text for the actual change) and can lead to the two operations following
one after another.
Attachment:
signature.asc
Description: Digital signature