public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Jonathan Neuschäfer" <j.neuschaefer@gmx.net>
To: Andreas Kemnade <andreas@kemnade.info>
Cc: "Jonathan Neuschäfer" <j.neuschaefer@gmx.net>,
	lee.jones@linaro.org, linux-kernel@vger.kernel.org,
	"Mark Brown" <broonie@kernel.org>
Subject: Re: [PATCH -next] mfd: ntxec: Support for EC in Tolino Shine 2 HD
Date: Sat, 6 Mar 2021 21:19:38 +0100	[thread overview]
Message-ID: <YEPj2ss13w5p+R4C@latitude> (raw)
In-Reply-To: <20210306204219.6a7eae56@aktux>

[-- Attachment #1: Type: text/plain, Size: 2250 bytes --]

On Sat, Mar 06, 2021 at 08:42:19PM +0100, Andreas Kemnade wrote:
> On Sat, 6 Mar 2021 20:14:46 +0100
> Jonathan Neuschäfer <j.neuschaefer@gmx.net> wrote:
[...]
> > > +/* some firmware versions do not ack written data, add a wrapper */
> > > +static const struct regmap_config regmap_config_noack = {
> > > +	.name = "ntxec_noack",
> > > +	.reg_bits = 8,
> > > +	.val_bits = 16,
> > > +	.cache_type = REGCACHE_NONE,
> > > +	.val_format_endian = REGMAP_ENDIAN_BIG,
> > > +	.reg_write = regmap_ignore_write,
> > > +	.reg_read = regmap_wrap_read  
> > 
> > Is the read wrapper necessary? It seems to me from reading regmap.h
> > that leaving .reg_read set to NULL should do the right thing, but I'm
> > not sure.
> >
> well if we want to read from it, there need to be some function for it.
> But if... I do not see anything worth to read besides of version.

Ok, with the understanding that there will be no read functionality
without the .reg_read callback, I'm fine leaving it in, even when the
particular drivers in existence don't use it.

> I think we can leave ouf val_format_endian because a lot of stuff is
> bypassed if no bus is set in regmap_init().
> There is e.g. a goto skip_format_initialization.

Dropping REGMAP_ENDIAN_BIG sounds reasonable, because this regmap
doesn't go to a byte-wise bus.


> > > +	case NTXEC_VERSION_TOLINO_SHINE2:
> > > +		has_rtc = false;
> > > +		ec->regmap = devm_regmap_init(ec->dev, NULL,
> > > +					      ec->regmap,
> > > +					      &regmap_config_noack);  
> > 
> > Ah— A custom regmap stacked on top of the old regmap… I think this
> > deserves a comment.
> > 
> Yes, devm_regmap_init_i2c() sets a different set of callbacks depending
> on circumstances. Seems to be the easiest way to avoid duplicating too
> much code. I really hope that there are not so much devices requiring
> such a dirty stuff that adding such thing to the generic regmap code
> would be justified.

Ok, please add a short comment here or extend the one above the repmap
config struct, to save interested readers a bit of trouble. I guess "add
a wrapper" goes in right direction, but it didn't make the stacking
obvious to me when I first read it.


Thanks,
Jonathan

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2021-03-06 20:20 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-06 18:13 [PATCH -next] mfd: ntxec: Support for EC in Tolino Shine 2 HD Andreas Kemnade
2021-03-06 19:14 ` Jonathan Neuschäfer
2021-03-06 19:42   ` Andreas Kemnade
2021-03-06 20:19     ` Jonathan Neuschäfer [this message]
2021-03-06 22:06       ` Andreas Kemnade

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YEPj2ss13w5p+R4C@latitude \
    --to=j.neuschaefer@gmx.net \
    --cc=andreas@kemnade.info \
    --cc=broonie@kernel.org \
    --cc=lee.jones@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox