diff options
author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2022-09-01 00:27:43 +0300 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2022-09-07 14:42:26 +0300 |
commit | 400dceb6f8b56472b36c5c2c8c3e0cbb7557d019 (patch) | |
tree | 711fe94ee093f47127b024dc0cac878b9bc0d36a /drivers/base | |
parent | 2d4697375dea514be202abf563a9419e74489c25 (diff) | |
download | linux-400dceb6f8b56472b36c5c2c8c3e0cbb7557d019.tar.xz |
regmap: mmio: Use swabXX_array() helpers
Since we have a few helpers to swab elements of a given size in an array
use them instead of open coded variants.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20220831212744.56435-2-andriy.shevchenko@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/base')
-rw-r--r-- | drivers/base/regmap/regmap-mmio.c | 20 |
1 files changed, 4 insertions, 16 deletions
diff --git a/drivers/base/regmap/regmap-mmio.c b/drivers/base/regmap/regmap-mmio.c index b47ee3e8d050..8bd8d42de3fe 100644 --- a/drivers/base/regmap/regmap-mmio.c +++ b/drivers/base/regmap/regmap-mmio.c @@ -10,6 +10,7 @@ #include <linux/module.h> #include <linux/regmap.h> #include <linux/slab.h> +#include <linux/swab.h> #include "internal.h" @@ -345,7 +346,6 @@ static int regmap_mmio_noinc_read(void *context, unsigned int reg, { struct regmap_mmio_context *ctx = context; int ret = 0; - int i; if (!IS_ERR(ctx->clk)) { ret = clk_enable(ctx->clk); @@ -382,27 +382,15 @@ static int regmap_mmio_noinc_read(void *context, unsigned int reg, if (ctx->big_endian && (ctx->val_bytes > 1)) { switch (ctx->val_bytes) { case 2: - { - u16 *valp = (u16 *)val; - for (i = 0; i < val_count; i++) - valp[i] = swab16(valp[i]); + swab16_array(val, val_count); break; - } case 4: - { - u32 *valp = (u32 *)val; - for (i = 0; i < val_count; i++) - valp[i] = swab32(valp[i]); + swab32_array(val, val_count); break; - } #ifdef CONFIG_64BIT case 8: - { - u64 *valp = (u64 *)val; - for (i = 0; i < val_count; i++) - valp[i] = swab64(valp[i]); + swab64_array(val, val_count); break; - } #endif default: ret = -EINVAL; |