From: Lee Jones <lee.jones@linaro.org>
To: Chao Xie <xiechao.mail@gmail.com>
Cc: Chao Xie <chao.xie@marvell.com>,
sameo@linux.intel.com,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 3/4] mfd: 88pm800: add device tree support
Date: Thu, 15 Aug 2013 11:07:19 +0100 [thread overview]
Message-ID: <20130815100719.GB25875@lee--X1> (raw)
In-Reply-To: <CADApbejPaRRX5OM5Ho8-bV2vaKLODOjhOh2Abzb8Auniwdukkw@mail.gmail.com>
> >> +Optional parent device properties:
> >> +- marvell,88pm800-irq-write-clear: inicates whether interrupt status is cleared by write
> >> +- marvell,88pm800-battery-detection: indicats whether need 88pm800 to support battery
> >> + detection or not.
> >
> > Not sure what these are. This is why you need to CC the Device Tree
> > guys.
> >
> It is the 88pm805's own configuration.
> 88pm800-irq-write-clear: when irq happens, the status register is
> write clear or read clear.
> 88pm800-battery-detection: whether the battery is connected to chip.
> It means that whether
> the chip be aware of battery or not.
As you are adding vendor specific bindings, you need to Cc the Device
Tree mailing list.
> >> + if (IS_ENABLED(CONFIG_OF)) {
> >> + if (!pdata) {
> >> + pdata = devm_kzalloc(&client->dev,
> >> + sizeof(*pdata), GFP_KERNEL);
> >> + if (!pdata)
> >> + return -ENOMEM;
> >> + }
> >> + ret = pm800_dt_init(node, &client->dev, pdata);
> >> + if (ret)
> >> + return ret;
> >> + } else if (!pdata) {
> >> + return -EINVAL;
> >> + }
> >
> > Replace with:
> >
> > if (!pdata) {
> > if (node)
> > /* <blah> populate pdata with DT </blah> */
> > else
> > return -EINVAL;
> > }
> >
> The orignial code will cover the following situation.
> 1. DT enabled, and user pass pdata
> 2. DT enabled, but user do not pass pdata
> 3. DT disabled, user pass pdata
> 4. DT disabled, user do not pass pdata.
>
> 88pm805 has a callback for config the it based on platform requirment.
> I do not want to remove this callback now, because it includes so many
> configurations.
> So i allow user can pass pdata with callback if the platform needs to
> configure the chip.
Mixing DT with pdata is a bad idea. If you need to pass a call-back
pointer, then _only_ use pdata i.e. get all of your platform specific
information from pdata, rather than just over-writing sections of it
with information retrieved from Device Tree.
So:
If pdata - use pdata and ignore DT completely
If !pdata:
If DT - use DT
If !DT - return -EINVAL
Out of interest, what does your call-back do?
--
Lee Jones
Linaro ST-Ericsson Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
next prev parent reply other threads:[~2013-08-15 10:07 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-14 8:28 [PATCH 0/4] mfd: 88pn80x: bug fix and device tree support Chao Xie
2013-08-14 8:28 ` [PATCH 1/4] mfd: 88pm800: Fix the bug that pdata may be NULL Chao Xie
2013-08-14 8:28 ` [PATCH 2/4] mfd: 88pm805: " Chao Xie
2013-08-14 8:28 ` [PATCH 3/4] mfd: 88pm800: add device tree support Chao Xie
2013-08-14 17:42 ` Lee Jones
2013-08-15 1:27 ` Chao Xie
2013-08-15 10:07 ` Lee Jones [this message]
2013-08-16 1:28 ` Chao Xie
2013-08-16 8:48 ` Lee Jones
2013-08-14 8:28 ` [PATCH 4/4] mfd: 88pm805: " Chao Xie
2013-08-14 9:52 ` Lee Jones
-- strict thread matches above, loose matches on Subject: below --
2013-07-29 8:29 [PATCH 0/4] mfd: 88pn80x: bug fix and " Chao Xie
2013-07-29 8:29 ` [PATCH 3/4] mfd: 88pm800: add " Chao Xie
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=20130815100719.GB25875@lee--X1 \
--to=lee.jones@linaro.org \
--cc=chao.xie@marvell.com \
--cc=linux-kernel@vger.kernel.org \
--cc=sameo@linux.intel.com \
--cc=xiechao.mail@gmail.com \
/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