[alsa-devel] [PATCH 0/15 v2][RFC] cleanup regmap write functions

Kuninori Morimoto kuninori.morimoto.gx at renesas.com
Mon Feb 15 06:20:36 CET 2016


Hi Mark

Current regmap has many similar functions
        regmap_update_bits()
        regmap_update_bits_async()
        regmap_update_bits_check()
        regmap_update_bits_check_async()
But difference is very few.
And I would like to have _force_ feature on it too.

So, these patches add new regmap_update_bits_base()
which has _check, _async, and _force option.
Above functions are now defined as macro.

I used [RFC], because regmap has big effects.

1), 6), 9) adds new regmap_xxx_update_bits_base() functions
and current each functions are merged into it by macro.

Please review carefully especially 7), 10).
I think using ~0 mask is correct for
regmap_field_write() <-> regmap_field_update_bits_base()

 1) -  5) for regmap_xxx()
 6) -  8) for regmap_field_xxx()
 9) - 11) for regmap_fields_xxx()
12) - 13) adds _force_ macro
14)       remove unused regmap_write_bits() which was one of _force_ function
15)       rsnd driver uses _force_ function for register access

BTW, I noticed #if - #else - #endif on ${LINUX}/include/linux/regmap.h are strange.
Many functions/struct/macro are defined under #ifdef CONFIG_REGMAP,
but few are defined under #else. It can be trouble ?
Do we really need this #if ?

Kuninori Morimoto (15):
       1) regmap: add regmap_update_bits_base()
       2) regmap: merge regmap_update_bits() into macro
       3) regmap: merge regmap_update_bits_async() into macro
       4) regmap: merge regmap_update_bits_check() into macro
       5) regmap: merge regmap_update_bits_check_async() into macro
       6) regmap: add regmap_field_update_bits_base()
       7) regmap: merge regmap_field_write() into macro
       8) regmap: merge regmap_field_update_bits() into macro
       9) regmap: add regmap_fields_update_bits_base()
      10) regmap: merge regmap_fields_write() into macro
      11) regmap: merge regmap_fields_update_bits() into macro
      12) regmap: add regmap_field_force_xxx() macros
      13) regmap: add regmap_fields_force_xxx() macros
      14) regmpa: remove regmap_write_bits()
      15) ASoC: rsnd: rsnd_write() / rsnd_bset() uses regmap _force_ function

 drivers/base/regmap/regmap.c | 217 ++++++++++++++++++++++++-----------------------------------------------------------------------------------------------------------
 include/linux/regmap.h       |  94 ++++++++++++++++++++++++++++-----------------------------
 sound/soc/sh/rcar/gen.c      |  21 ++-----------
 sound/soc/sh/rcar/rsnd.h     |   2 --
 4 files changed, 87 insertions(+), 247 deletions(-)



Best regards
---
Kuninori Morimoto


More information about the Alsa-devel mailing list