From: Lee Jones <lee.jones@linaro.org>
To: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Cc: MyungJoo Ham <myungjoo.ham@samsung.com>,
Chanwoo Choi <cw00.choi@samsung.com>,
Samuel Ortiz <sameo@linux.intel.com>,
Anton Vorontsov <anton@enomsg.org>,
David Woodhouse <dwmw2@infradead.org>,
Liam Girdwood <lgirdwood@gmail.com>,
Mark Brown <broonie@kernel.org>,
Grant Likely <grant.likely@linaro.org>,
Rob Herring <rob.herring@calxeda.com>,
linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
Pawel Moll <pawel.moll@arm.com>,
Stephen Warren <swarren@wwwdotorg.org>,
Ian Campbell <ijc+devicetree@hellion.org.uk>,
Rob Landley <rob@landley.net>,
linux-doc@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>,
Marek Szyprowski <m.szyprowski@samsung.com>,
Kyungmin Park <kyungmin.park@samsung.com>
Subject: Re: [PATCH v2 1/5] mfd: max14577: Add max14577 MFD driver core
Date: Thu, 21 Nov 2013 12:20:11 +0000 [thread overview]
Message-ID: <20131121122011.GD23067@lee--X1> (raw)
In-Reply-To: <1385034199.748.21.camel@AMDC1943>
> Thanks for pointing these out however after using regmap_irq_chip whole
> file won't be needed anymore.
That's fine.
> > > +static int max14577_i2c_probe(struct i2c_client *i2c,
> > > + const struct i2c_device_id *id)
> > > +{
> > > + struct max14577 *max14577;
> > > + struct max14577_platform_data *pdata = dev_get_platdata(&i2c->dev);
> > > + u8 reg_data;
> > > + int ret = 0;
> > > +
> > > + if (i2c->dev.of_node) {
> >
> > Can you pull this out. It looks neater as the top as:
> > struct device_node *np = i2c->dev.of_node;
>
> I am not sure if I understand you correctly. You would like to change
> this to:
> -------------------------
> static int max14577_i2c_probe(struct i2c_client *i2c,
> const struct i2c_device_id *id)
> {
> struct max14577 *max14577;
> struct max14577_platform_data *pdata =
> dev_get_platdata(&i2c->dev);
> struct device_node *np = i2c->dev.of_node;
> u8 reg_data;
> int ret = 0;
>
> if (np) {
> pdata = devm_kzalloc(&i2c->dev,
> sizeof(struct max14577_platform_data),
> GFP_KERNEL);
> -------------------------
> The variable 'np' would be used only once.
I know, but it's more in keeping with the rest of the subsystem.
> > > +
> > > + ret = mfd_add_devices(max14577->dev, -1, max14577_devs,
> > > + ARRAY_SIZE(max14577_devs), NULL, 0, NULL);
> >
> > You should be passing the irqdomain as the final parameter here.
>
> I replaced the IRQ handling with regmap_irq_chip so this would look like
> this:
> -------------------------
> ret = mfd_add_devices(max14577->dev, -1, max14577_devs,
> ARRAY_SIZE(max14577_devs), NULL, 0,
> regmap_irq_get_domain(max14577->irq_data));
> -------------------------
> Am I correct?
if regmap_irq_get_domain() returns an irqdomain, then yes.
> > > + return i2c_add_driver(&max14577_i2c_driver);
> > > +}
> > > +subsys_initcall(max14577_i2c_init);
> > > +
> > > +static void __exit max14577_i2c_exit(void)
> > > +{
> > > + i2c_del_driver(&max14577_i2c_driver);
> > > +}
> > > +module_exit(max14577_i2c_exit);
> >
> > >>>>>>>>>>>>>>>>>>>>>>
> >
> > Remove all this and replace with:
> > module_i2c_driver(max14577_i2c_driver);
>
> The subsys_initcall is needed. Marek Szyprowski replied to this here:
> http://thread.gmane.org/gmane.linux.drivers.devicetree/51903/focus=1594651
Okay, but this will need to be changed when USB Gadget starts to
support -EPROBE_DEFER
> > > +struct max14577_regulator_platform_data {
> > > + int id;
> > > + struct regulator_init_data *initdata;
> > > + struct device_node *of_node;
> >
> > Do you ever set this? What's the point of it is it's set in the device?
>
> Do you mean the whole struct max14577_regulator_platform_data or only
> some member of it (of_node?)?
Initially only the of_node. Usually MFD children are able to call back
into their parent to fetch these details. Also mfd_add_device() goes
out of its way to fill in the child's own of_node.
--
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
next prev parent reply other threads:[~2013-11-21 12:20 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-20 14:12 [PATCH v2 0/5] mfd: max14577: Add max14577 MFD drivers Krzysztof Kozlowski
2013-11-20 14:12 ` [PATCH v2 1/5] mfd: max14577: Add max14577 MFD driver core Krzysztof Kozlowski
[not found] ` <1384956732-19526-2-git-send-email-k.kozlowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2013-11-20 15:31 ` Mark Brown
2013-11-21 10:31 ` Krzysztof Kozlowski
2013-11-21 10:34 ` Lee Jones
2013-11-21 11:43 ` Krzysztof Kozlowski
2013-11-21 12:20 ` Lee Jones [this message]
2013-11-21 13:34 ` Krzysztof Kozlowski
2013-11-20 14:12 ` [PATCH v2 2/5] extcon: max14577: Add extcon-max14577 driver to support MUIC device Krzysztof Kozlowski
2013-11-20 14:12 ` [PATCH v2 3/5] charger: max14577: Add charger support for Maxim 14577 Krzysztof Kozlowski
2013-11-20 14:12 ` [PATCH v2 4/5] regulator: max14577: Add regulator driver " Krzysztof Kozlowski
2013-11-20 15:35 ` Mark Brown
2013-11-20 17:54 ` Bartlomiej Zolnierkiewicz
2013-11-20 17:58 ` Bartlomiej Zolnierkiewicz
2013-11-21 14:27 ` Krzysztof Kozlowski
2013-11-20 14:12 ` [PATCH v2 5/5] mfd: max14577: Add device tree bindings document Krzysztof Kozlowski
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=20131121122011.GD23067@lee--X1 \
--to=lee.jones@linaro.org \
--cc=anton@enomsg.org \
--cc=b.zolnierkie@samsung.com \
--cc=broonie@kernel.org \
--cc=cw00.choi@samsung.com \
--cc=devicetree@vger.kernel.org \
--cc=dwmw2@infradead.org \
--cc=grant.likely@linaro.org \
--cc=ijc+devicetree@hellion.org.uk \
--cc=k.kozlowski@samsung.com \
--cc=kyungmin.park@samsung.com \
--cc=lgirdwood@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=m.szyprowski@samsung.com \
--cc=myungjoo.ham@samsung.com \
--cc=pawel.moll@arm.com \
--cc=rob.herring@calxeda.com \
--cc=rob@landley.net \
--cc=sameo@linux.intel.com \
--cc=swarren@wwwdotorg.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;
as well as URLs for NNTP newsgroup(s).