Messages in this thread | | | Subject | Re: [PATCH 2/2] MAX8997/8966 RTC Driver Initial Release | From | Joe Perches <> | Date | Fri, 04 Mar 2011 00:58:52 -0800 |
| |
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); }
| |