• S
    regmap: of_regmap_get_endian() cleanup · 45e1a279
    Stephen Warren 提交于
    Commit d647c199 ("regmap: add DT endianness binding support") had
    some issues. Commit ba1b53fe ("regmap: Fix DT endianess parsing
    logic") fixed the main problem. This patch fixes the other.
    
    Specifically, restore the overall default of REGMAP_ENDIAN_BIG if none of
    the config, DT, or the bus specify any endianness. Without this,
    of_regmap_get_endian() could return REGMAP_ENDIAN_DEFAULT, which the
    calling code can't handle. Since all busses do specify an endianness in
    the current code, this makes no difference right now, but I saw no
    justification in the patch description for removing this final default.
    
    Also, clean up the code a bit:
    
    * s/of_regmap_get_endian/regmap_get_endian/ since the function isn't DT-
      specific, even if the reason it was originally added was to add some
      DT-specific features.
    * After potentially reading an endianess specification from DT, the code
      checks whether DT did specify an endianness, and if so, returns it. Move
      this test outside the whole switch statement so that if the
      REGMAP_ENDIAN_REG case ever modifies *endian, this check will pick that
      up. This partially reverts part of commit ba1b53fe ("regmap: Fix DT
      endianess parsing logic"), while maintaining the bug-fix that commit
      made to this code.
    * Make the comments briefer, and only refer to the specific action taken
      at their location. This makes most of the comments independent of DT,
      and easier to follow.
    
    Cc: Xiubo Li <Li.Xiubo@freescale.com>
    Cc: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
    Cc: Thierry Reding <treding@nvidia.com>
    Fixes: d647c199 ("regmap: add DT endianness binding support")
    Signed-off-by: NStephen Warren <swarren@nvidia.com>
    Signed-off-by: NMark Brown <broonie@linaro.org>
    45e1a279
regmap.c 63.2 KB