Re: [PATCH 2/2] MAX8997/8966 RTC Driver Initial Release

From: Joe Perches
Date: Fri Mar 04 2011 - 03:58:58 EST


On Fri, 2011-03-04 at 16:48 +0900, MyungJoo Ham wrote:
> This patch adds support for RTC functionality for MAX8997/8966 chips.

just trivial comments here too.

> diff --git a/drivers/rtc/rtc-max8997.c b/drivers/rtc/rtc-max8997.c
[]
> +static void __maybe_unused dump(struct rtc_data *rtc)
> +{
> + int i, j;
> + char buf[256];
> + char *ptr;
> + u8 val;
> +
> + for (i = 0; i < 3; i++) {
> + ptr = buf;
> + ptr += sprintf(ptr, "[%2.2xh] ", i * 16);
> + for (j = 0; j < 16; j++) {
> + max8997_read_reg(rtc->i2c, i * 16 + j, &val);
> + ptr += sprintf(ptr, "%2.2x ", val);
> + }
> + pr_info("%s\n", buf);
> + }
> +}

It might be better to use a loop to read all the registers
and then print_hex_dump. Something like:

static void __maybe_unused dump(struct rtc_data *rtc)
{
int i;
u8 buf[48];

for (i = 0; i < 48; i++)
max8997_read_reg(rtc->i2c, i, &buf[i]);
print_hex_dump(KERN_INFO, "", DUMP_PREFIX_OFFSET, 16, 1,
buf, sizeof(buf), false);
}



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/