From b5379d18b01924ee4fa4502ffc5b2b2d67cdadec Mon Sep 17 00:00:00 2001 From: Guru Das Srinagesh Date: Tue, 7 Jul 2020 15:15:01 -0700 Subject: [PATCH] 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 --- drivers/leds/leds-qti-flash.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/drivers/leds/leds-qti-flash.c b/drivers/leds/leds-qti-flash.c index 5a00af910a91..30a669ac2d09 100644 --- a/drivers/leds/leds-qti-flash.c +++ b/drivers/leds/leds-qti-flash.c @@ -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;