regmap: Fix regmap_bulk_read in BE mode
authorArun Chandran <achandran@mvista.com>
Mon, 15 Jun 2015 10:29:02 +0000 (15:59 +0530)
committerMark Brown <broonie@kernel.org>
Mon, 15 Jun 2015 15:02:16 +0000 (16:02 +0100)
In big endian mode regmap_bulk_read gives incorrect data
for byte reads.

This is because memcpy of a single byte from an address
after full word read gives different results when
endianness differs. ie. we get little-end in LE and big-end in BE.

Signed-off-by: Arun Chandran <achandran@mvista.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Cc: stable@vger.kernel.org
drivers/base/regmap/regmap.c

index 6273ff072f3eaa4cbd777b1a4f41fb3cf533a42a..9f7f78ede01b1f9580132c8af859988f3258c291 100644 (file)
@@ -2318,7 +2318,7 @@ int regmap_bulk_read(struct regmap *map, unsigned int reg, void *val,
                                          &ival);
                        if (ret != 0)
                                return ret;
-                       memcpy(val + (i * val_bytes), &ival, val_bytes);
+                       map->format.format_val(val + (i * val_bytes), ival, 0);
                }
        }