Skip to content

Commit 26cc2a7

Browse files
andy-shevbroonie
authored andcommitted
regmap: spi-avmm: 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-3-andriy.shevchenko@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 400dceb commit 26cc2a7

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

drivers/base/regmap/regmap-spi-avmm.c

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include <linux/module.h>
88
#include <linux/regmap.h>
99
#include <linux/spi/spi.h>
10+
#include <linux/swab.h>
1011

1112
/*
1213
* This driver implements the regmap operations for a generic SPI
@@ -162,19 +163,12 @@ struct spi_avmm_bridge {
162163
/* bridge buffer used in translation between protocol layers */
163164
char trans_buf[TRANS_BUF_SIZE];
164165
char phy_buf[PHY_BUF_SIZE];
165-
void (*swap_words)(char *buf, unsigned int len);
166+
void (*swap_words)(void *buf, unsigned int len);
166167
};
167168

168-
static void br_swap_words_32(char *buf, unsigned int len)
169+
static void br_swap_words_32(void *buf, unsigned int len)
169170
{
170-
u32 *p = (u32 *)buf;
171-
unsigned int count;
172-
173-
count = len / 4;
174-
while (count--) {
175-
*p = swab32p(p);
176-
p++;
177-
}
171+
swab32_array(buf, len / 4);
178172
}
179173

180174
/*

0 commit comments

Comments
 (0)