summaryrefslogtreecommitdiffstats
path: root/drivers/mtd/spi-nor/spi-nor.c
diff options
context:
space:
mode:
authorSergei Shtylyov <sergei.shtylyov@cogentembedded.com>2020-02-01 23:55:08 +0300
committerTudor Ambarus <tudor.ambarus@microchip.com>2020-02-17 01:09:52 +0200
commit5b24efe7d55a4bea6992ae1ee00707d77ec22575 (patch)
tree4e39a29cbcd51202b0f4cd729f29dfbac4fee6fb /drivers/mtd/spi-nor/spi-nor.c
parent11a48a5a18c63fd7621bb050228cebf13566e4d8 (diff)
downloadlinux-5b24efe7d55a4bea6992ae1ee00707d77ec22575.tar.gz
linux-5b24efe7d55a4bea6992ae1ee00707d77ec22575.tar.bz2
linux-5b24efe7d55a4bea6992ae1ee00707d77ec22575.zip
mtd: spi-nor: use le32_to_cpu_array()
The driver calls le32_to_cpu() to convert the little-endian tables to a CPU endianness, where le32_to_cpus() should have been called. Was going to use that one... and then discovered a whole array converter, le32_to_cpu_array()! :-) Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
Diffstat (limited to 'drivers/mtd/spi-nor/spi-nor.c')
-rw-r--r--drivers/mtd/spi-nor/spi-nor.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c
index 4fc632ec18fe..864ed6f49e87 100644
--- a/drivers/mtd/spi-nor/spi-nor.c
+++ b/drivers/mtd/spi-nor/spi-nor.c
@@ -3598,8 +3598,7 @@ static int spi_nor_parse_bfpt(struct spi_nor *nor,
return err;
/* Fix endianness of the BFPT DWORDs. */
- for (i = 0; i < BFPT_DWORD_MAX; i++)
- bfpt.dwords[i] = le32_to_cpu(bfpt.dwords[i]);
+ le32_to_cpu_array(bfpt.dwords, BFPT_DWORD_MAX);
/* Number of address bytes. */
switch (bfpt.dwords[BFPT_DWORD(1)] & BFPT_DWORD1_ADDRESS_BYTES_MASK) {
@@ -4057,7 +4056,7 @@ static int spi_nor_parse_smpt(struct spi_nor *nor,
u32 *smpt;
size_t len;
u32 addr;
- int i, ret;
+ int ret;
/* Read the Sector Map Parameter Table. */
len = smpt_header->length * sizeof(*smpt);
@@ -4071,8 +4070,7 @@ static int spi_nor_parse_smpt(struct spi_nor *nor,
goto out;
/* Fix endianness of the SMPT DWORDs. */
- for (i = 0; i < smpt_header->length; i++)
- smpt[i] = le32_to_cpu(smpt[i]);
+ le32_to_cpu_array(smpt, smpt_header->length);
sector_map = spi_nor_get_map_in_use(nor, smpt, smpt_header->length);
if (IS_ERR(sector_map)) {
@@ -4165,8 +4163,7 @@ static int spi_nor_parse_4bait(struct spi_nor *nor,
goto out;
/* Fix endianness of the 4BAIT DWORDs. */
- for (i = 0; i < SFDP_4BAIT_DWORD_MAX; i++)
- dwords[i] = le32_to_cpu(dwords[i]);
+ le32_to_cpu_array(dwords, SFDP_4BAIT_DWORD_MAX);
/*
* Compute the subset of (Fast) Read commands for which the 4-byte