lkml.org 
[lkml]   [2011]   [Mar]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 2/2] MAX8997/8966 RTC Driver Initial Release
From
Date
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);
}





\
 
 \ /
  Last update: 2011-03-06 11:09    [W:0.181 / U:0.332 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site