Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1330970

Re: [PATCH 1/7][RFC] regmap: add regmap_raw_update_bits() and merge all regmap_update_bits_xxx()

From Mark Brown <broonie@kernel.org>
Newsgroups linux.kernel
Subject Re: [PATCH 1/7][RFC] regmap: add regmap_raw_update_bits() and merge all regmap_update_bits_xxx()
Date 2016-02-10 10:40 +0100
Message-ID <r0zpE-pd-7@gated-at.bofh.it> (permalink)
References <r0t0S-4sE-9@gated-at.bofh.it> <r0zpE-pd-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

On Wed, Feb 10, 2016 at 02:44:11AM +0000, Kuninori Morimoto wrote:

> Current regmap has many similar update functions, but the difference is
> very few. This patch adds new regmap_raw_update_bits() and merge all
> update functions into it by macro.

This is a bit hard to review due to the way the diff comes out, it's not
entirely clear what the code comes out looking like and I'm a bit
nervous about what the gains might be since macro conversions often
obscure things (this is making the macros undocumented for example).
Creating the new function and then using it in a separate patch would be
better.

> +int regmap_raw_update_bits(struct regmap *map, unsigned int reg,
> +			   unsigned int mask, unsigned int val,
> +			   bool *change, bool async, bool force)

_raw specifically means something that works with the direct physical
data format within regmap, a different name would be better.

> -	map->async = true;
> +	map->async = async ? true : false;

This is abuse of the ternery operator where a normal if statement would
do, and it's also rewriting a bool into a bool so a simple assignment is
enough.

>  /**
> - * regmap_update_bits_check_async: Perform a read/modify/write cycle on the
> - *                                 register map asynchronously and report if
> - *                                 updated
> + * regmap_write_bits: Perform a read/modify/write cycle on the register map

This looks like it renames update_bits() to write_bits()...

> +#define regmap_update_bits(map, reg, mask, val) \
> +	regmap_raw_update_bits(map, reg, mask, val, NULL, false, false)
> +#define regmap_update_bits_async(map, reg, mask, val)\
> +	regmap_raw_update_bits(map, reg, mask, val, NULL, true, false)
> +#define regmap_update_bits_check(map, reg, mask, val, change)\
> +	regmap_raw_update_bits(map, reg, mask, val, change, false, false)
> +#define regmap_update_bits_check_async(map, reg, mask, val, change)\
> +	regmap_raw_update_bits(map, reg, mask, val, change, true, false)
> +

...but we don't seem to use it?  The new name is also a bit confusing.

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH 0/6][RFC] cleanup regmap write functions Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> - 2016-02-10 03:50 +0100
  Re: [PATCH 1/7][RFC] regmap: add regmap_raw_update_bits() and merge  all regmap_update_bits_xxx() Mark Brown <broonie@kernel.org> - 2016-02-10 10:40 +0100

csiph-web