public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: rask@formelder.dk (Rask Ingemann Lambertsen)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 3/5] mfd: axp20x: Add support for the AXP808 PMIC
Date: Fri, 3 Feb 2017 22:47:54 +0100	[thread overview]
Message-ID: <20170203214753.rbybkadomljcvtdg@localhost> (raw)
In-Reply-To: <CAGb2v64O7wax5Pku=VVY3rgS2Ybm-=BDQQT+oB13FSGQHhtkiw@mail.gmail.com>

On Thu, Feb 02, 2017 at 03:23:33PM +0800, Chen-Yu Tsai wrote:
> On Fri, Jan 27, 2017 at 5:25 AM, Rask Ingemann Lambertsen
> <rask@formelder.dk> wrote:
[...]
> > diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
> > index 25115fe..2d3383e 100644
> > --- a/drivers/mfd/axp20x.c
> > +++ b/drivers/mfd/axp20x.c
[...]
> > @@ -148,6 +149,13 @@ static const struct regmap_range axp806_writeable_ranges[] = {
> >         regmap_reg_range(AXP806_REG_ADDR_EXT, AXP806_REG_ADDR_EXT),
> >  };
> >
> > +static const struct regmap_range axp808_writeable_ranges[] = {
> > +       regmap_reg_range(AXP20X_DATACACHE(0), AXP20X_DATACACHE(3)),
> > +       regmap_reg_range(AXP806_PWR_OUT_CTRL1, AXP806_CLDO3_V_CTRL),
> > +       regmap_reg_range(AXP20X_IRQ1_EN, AXP20X_IRQ2_EN),
> > +       regmap_reg_range(AXP20X_IRQ1_STATE, AXP20X_IRQ2_STATE),
> > +};
> > +
> >  static const struct regmap_range axp806_volatile_ranges[] = {
> >         regmap_reg_range(AXP20X_IRQ1_STATE, AXP20X_IRQ2_STATE),
> >  };
> > @@ -162,6 +170,11 @@ static const struct regmap_access_table axp806_volatile_table = {
> >         .n_yes_ranges   = ARRAY_SIZE(axp806_volatile_ranges),
> >  };
> >
> > +static const struct regmap_access_table axp808_writeable_table = {
> > +       .yes_ranges     = axp808_writeable_ranges,
> > +       .n_yes_ranges   = ARRAY_SIZE(axp808_writeable_ranges),
> 
> You could probably get away with using axp806_writeable_ranges,
> and pass ARRAY_SIZE(axp808_writeable_ranges) - 1 for .n_yes_ranges.

Assuming that register ranges not supported on the AXP808 are always
at one end of the table, I think it will ease maintenance by avoiding
duplicate data should entries be added or removed in the future. I'll put
a comment above axp806_writeable_ranges to point out what's going on.

> Or maybe the compiler figures out the 2 arrays share common data.

It doesn't as of gcc 6.2.1.

-- 
Rask Ingemann Lambertsen

  reply	other threads:[~2017-02-03 21:47 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-26 21:22 [PATCH 0/5] arm: sun9i: Support AXP808 PMIC and Sunchip CX-A99 board Rask Ingemann Lambertsen
2017-01-26 21:23 ` [PATCH 1/5] DT: mfd: axp20x: Add AXP806 to list of current AXP20x family members Rask Ingemann Lambertsen
2017-01-27  4:38   ` Chen-Yu Tsai
2017-02-01 13:26   ` Rob Herring
2017-01-26 21:24 ` [PATCH 2/5] DT: mfd: axp20x: Add binding for the AXP808 Rask Ingemann Lambertsen
2017-02-01 13:27   ` Rob Herring
2017-02-02  7:20     ` Chen-Yu Tsai
2017-01-26 21:25 ` [PATCH 3/5] mfd: axp20x: Add support for the AXP808 PMIC Rask Ingemann Lambertsen
2017-02-02  7:23   ` Chen-Yu Tsai
2017-02-03 21:47     ` Rask Ingemann Lambertsen [this message]
2017-01-26 21:26 ` [PATCH 4/5] regulator: " Rask Ingemann Lambertsen
2017-01-27 11:42   ` Mark Brown
2017-02-02  7:25     ` Chen-Yu Tsai
2017-01-26 21:27 ` [PATCH 5/5] ARM: dts: sun9i: Initial support for the Sunchip CX-A99 board Rask Ingemann Lambertsen
2017-02-02  7:36   ` Chen-Yu Tsai
2017-02-05 19:23     ` Rask Ingemann Lambertsen

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=20170203214753.rbybkadomljcvtdg@localhost \
    --to=rask@formelder.dk \
    --cc=linux-arm-kernel@lists.infradead.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