public inbox for devicetree@vger.kernel.org
 help / color / mirror / Atom feed
From: Rask Ingemann Lambertsen <rask-SivP7zSAdNDZaaYASwVUlg@public.gmane.org>
To: Chen-Yu Tsai <wens-jdAy2FN1RRM@public.gmane.org>
Cc: Mark Rutland <mark.rutland-5wv7dgnIgG8@public.gmane.org>,
	devicetree <devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	Liam Girdwood <lgirdwood-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	Rob Herring <robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	linux-kernel
	<linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	Lee Jones <lee.jones-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
	linux-arm-kernel
	<linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org>,
	Maxime Ripard
	<maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
Subject: Re: [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-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

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-SivP7zSAdNDZaaYASwVUlg@public.gmane.org> 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
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

Thread overview: 17+ 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
     [not found] ` <cover.1485456003.git.rask-SivP7zSAdNDZaaYASwVUlg@public.gmane.org>
2017-01-26 21:15   ` [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
     [not found]     ` <abdfbac9a5f363ab6d338dd66d8fb138741f71c7.1485456005.git.rask-SivP7zSAdNDZaaYASwVUlg@public.gmane.org>
2017-02-01 13:26       ` Rob Herring
2017-01-26 21:16   ` [PATCH 2/5] DT: mfd: axp20x: Add binding for the AXP808 Rask Ingemann Lambertsen
     [not found]     ` <abb27901379a19a11608fd37254e1a8f7fa1b199.1485456006.git.rask-SivP7zSAdNDZaaYASwVUlg@public.gmane.org>
2017-02-01 13:27       ` Rob Herring
2017-02-02  7:20         ` Chen-Yu Tsai
2017-01-26 21:49   ` [PATCH 0/5] arm: sun9i: Support AXP808 PMIC and Sunchip CX-A99 board Rask Ingemann Lambertsen
2017-01-26 21:17 ` [PATCH 3/5] mfd: axp20x: Add support for the AXP808 PMIC Rask Ingemann Lambertsen
     [not found]   ` <e1d6d6acfaa95e214b6baa73a7edeaa8e6af3670.1485456006.git.rask-SivP7zSAdNDZaaYASwVUlg@public.gmane.org>
2017-02-02  7:23     ` Chen-Yu Tsai
     [not found]       ` <CAGb2v64O7wax5Pku=VVY3rgS2Ybm-=BDQQT+oB13FSGQHhtkiw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-02-03 21:47         ` Rask Ingemann Lambertsen [this message]
2017-01-26 21:18 ` [PATCH 4/5] regulator: " Rask Ingemann Lambertsen
2017-01-27 11:42   ` Mark Brown
     [not found]     ` <20170127114254.wk4j7lbczwo3g6pn-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
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
     [not found]   ` <82617383a0739458d5c9c95dccaf479675fce593.1485456007.git.rask-SivP7zSAdNDZaaYASwVUlg@public.gmane.org>
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-sivp7zsadndzaayaswvulg@public.gmane.org \
    --cc=broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=lee.jones-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=lgirdwood-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=mark.rutland-5wv7dgnIgG8@public.gmane.org \
    --cc=maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org \
    --cc=robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=wens-jdAy2FN1RRM@public.gmane.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