leds: qti-flash: Fix debug prints, read more than one byte

Print the data instead of the pointer in qti_flash_led_write(), update
the print in qti_flash_led_masked_write(), and fix qti_flash_led_read()
so that it returns a pointer to more than one byte.

Change-Id: Ic9cbc35a6552f8978ff9e36da2aafeec69885b9a
Signed-off-by: Guru Das Srinagesh <gurus@codeaurora.org>
This commit is contained in:
Guru Das Srinagesh 2020-07-07 15:15:01 -07:00 committed by David Collins
parent 5391dbba0e
commit b5379d18b0

View File

@ -235,17 +235,14 @@ static int qti_flash_led_read(struct qti_flash_led *led, u16 offset,
u8 *data, u8 len)
{
int rc;
u32 val;
rc = regmap_bulk_read(led->regmap, (led->base + offset), &val, len);
if (rc < 0) {
rc = regmap_bulk_read(led->regmap, (led->base + offset), data, len);
if (rc < 0)
pr_err("Failed to read from 0x%04X rc = %d\n",
(led->base + offset), rc);
} else {
pr_debug("Read 0x%02X from addr 0x%04X\n", val,
else
pr_debug("Read %*ph from addr %#x\n", len, data,
(led->base + offset));
*data = (u8)val;
}
return rc;
}
@ -261,7 +258,7 @@ static int qti_flash_led_write(struct qti_flash_led *led, u16 offset,
pr_err("Failed to write to 0x%04X rc = %d\n",
(led->base + offset), rc);
else
pr_debug("Wrote 0x%02X to addr 0x%04X\n", data,
pr_debug("Wrote %*ph to addr %#x\n", len, data,
(led->base + offset));
return rc;
@ -278,7 +275,7 @@ static int qti_flash_led_masked_write(struct qti_flash_led *led,
pr_err("Failed to update bits from 0x%04X, rc = %d\n",
(led->base + offset), rc);
else
pr_debug("Wrote 0x%02X to addr 0x%04X\n", data,
pr_debug("Wrote %#x mask %#x to addr %#x\n", data, mask,
(led->base + offset));
return rc;