Re: [PATCH 1/2 v5] regmap: Support accelerated noinc operations
From: Linus Walleij
Date: Wed Aug 31 2022 - 09:53:35 EST
On Tue, Aug 30, 2022 at 6:36 PM Andy Shevchenko
<andriy.shevchenko@xxxxxxxxx> wrote:
> On Tue, Aug 16, 2022 at 10:48:31PM +0200, Linus Walleij wrote:
> > + ret = regcache_write(map, reg, lastval);
> > + if (ret != 0)
>
> if (ret) ?
This was done to follow the style of the rest of the .c file.
Could be patched everywhere though.
> > + dev_info(map->dev, "%x %s [", reg, write ? "<=" : "=>");
> > + for (i = 0; i < val_len; i++) {
> > + switch (val_bytes) {
> > + case 1:
> > + pr_cont("%x", u8p[i]);
> > + break;
> > + case 2:
> > + pr_cont("%x", u16p[i]);
> > + break;
> > + case 4:
> > + pr_cont("%x", u32p[i]);
> > + break;
> > +#ifdef CONFIG_64BIT
> > + case 8:
> > + pr_cont("%llx", u64p[i]);
> > + break;
> > +#endif
> > + default:
> > + break;
> > + }
> > + if (i == (val_len - 1))
> > + pr_cont("]\n");
> > + else
> > + pr_cont(",");
> > + }
>
> I'm wondering why we can't use hex_dump_to_buffer() approach? Or even better,
> introduce eventually dev_hex_dump() (as it's done for seq_file and printk)
> and use it.
Hmmmmm this is under regmap_should_log() which turns on
dev_info() simple prints like x <= y and y => x to the console.
e.g. dev_info(map->dev, "%x <= %x\n", reg, val);
It would be rather print_hex_dump() the problem being
that hex_dump_* accessors assumes line oriented
linebufs "must be 16 or 32" (values per line), and here we probably
don't want that:
we want to show what we shoehorned into the FIFO.
Yours,
Linus Walleij