From: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
To: Stephen Boyd <sboyd@kernel.org>, robh+dt@kernel.org
Cc: Matti Vaittinen <mazziesaccount@gmail.com>,
broonie@kernel.org, lee.jones@linaro.org, lgirdwood@gmail.com,
mark.rutland@arm.com, mturquette@baylibre.com,
linux-clk@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, mikko.mutanen@fi.rohmeurope.com,
heikki.haikola@fi.rohmeurope.com
Subject: Re: [PATCH v5 4/4] clk: bd71837: Add driver for BD71837 PMIC clock
Date: Tue, 31 Jul 2018 11:28:58 +0300 [thread overview]
Message-ID: <20180731073023.GA2956@localhost.localdomain> (raw)
In-Reply-To: <20180626081319.GA2118@localhost.localdomain>
On Tue, Jun 26, 2018 at 11:13:19AM +0300, Matti Vaittinen wrote:
> On Mon, Jun 25, 2018 at 04:44:57PM -0700, Stephen Boyd wrote:
> > Quoting Matti Vaittinen (2018-06-12 01:23:54)
> > > On Tue, Jun 12, 2018 at 12:44:11AM -0700, Stephen Boyd wrote:
> > > > Quoting Matti Vaittinen (2018-06-04 06:19:13)
[snip]
> > > > > + if (rval) {
> > > > > + dev_err(&pdev->dev, "failed to register clkdev for bd71837");
> > > > > + goto err_clean_provider;
> > > > > + }
> > > > > +
> > > > > + platform_set_drvdata(pdev, c);
> > > > > +
> > > > > + return 0;
> > > > > +
> > > > > +err_clean_provider:
> > > > > + of_clk_del_provider(pdev->dev.parent->of_node);
> > > > > +err_out:
> > > > > + return rval;
> > > > > +}
> > > > > +
> > > > > +static int bd71837_clk_remove(struct platform_device *pdev)
> > > > > +{
> > > > > + if (pdev->dev.parent->of_node)
> > > > > + of_clk_del_provider(pdev->dev.parent->of_node);
> > > >
> > > > Use devm so this can go away. Or is devm not used because the parent
> > > > of_node is the provider? That's annoying.
> > >
> > > What would be the correct workaround for this?
> >
> > Smash the clk driver into the overall PMIC node. That should work. Or
> > possibly assign the same of_node to the child device when creating it?
> > I'm not sure if that causes some sort of problem with DT code though, so
> > it would be good to check with Rob H if that's a bad idea or not.
>
> 1. Assign MFD node to subdevice node in MFD when creating the cells.
> 2. Assign parent->of_node to dev.of_node in clk subdevice.
> 3. Create devm_of_clk_add_hw_provider_w_node() which does something
> like (not compiled pseudo) code below
>
> int devm_of_clk_add_hw_provider_w_node(struct device *dev,
> struct clk_hw *(*get)(struct of_phandle_args *clkspec,
> void *data),
> struct device_node *of_node,
> void *data)
> {
> struct device_node **ptr;
> int ret;
> ptr = devres_alloc(devm_of_clk_release_provider, sizeof(*ptr),
> GFP_KERNEL);
> if (!ptr)
> return -ENOMEM;
>
> *ptr = of_node;
> ret = of_clk_add_hw_provider(of_node, get, data);
> if (!ret)
> devres_add(dev, ptr);
> else
> devres_free(ptr);
>
> return ret;
> }
> EXPORT_SYMBOL_GPL(devm_of_clk_add_hw_provider_w_node);
>
> int devm_of_clk_add_hw_provider(struct device *dev,
> struct clk_hw *(*get)(struct of_phandle_args *clkspec,
> void *data),
> void *data)
> {
> return devm_of_clk_add_hw_provider_w_node(dev, get, dev->of_node,
> data);
> }
> EXPORT_SYMBOL_GPL(devm_of_clk_add_hw_provider);
just a friendly reminder, what's your opinion on adding this kind of
function (devm_of_clk_add_hw_provider_w_node)? or solutions 1/2? And are these options safe what comes to
reference counting of of_nodes?
Best regards
Matti Vaittinen
next prev parent reply other threads:[~2018-07-31 8:29 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-04 13:17 [PATCH v5 0/4] mfd/regulator/clk: bd71837: ROHM BD71837 PMIC driver Matti Vaittinen
2018-06-04 13:18 ` [PATCH v5 1/4] mfd: bd71837: mfd driver for ROHM BD71837 PMIC Matti Vaittinen
2018-06-05 7:57 ` Matti Vaittinen
2018-06-04 13:18 ` [PATCH v5 2/4] mfd: bd71837: Devicetree bindings " Matti Vaittinen
2018-06-05 15:47 ` Rob Herring
2018-06-06 5:14 ` Matti Vaittinen
2018-06-04 13:18 ` [PATCH v5 3/4] clk: " Matti Vaittinen
2018-06-05 15:49 ` Rob Herring
2018-06-06 5:10 ` Matti Vaittinen
2018-06-04 13:19 ` [PATCH v5 4/4] clk: bd71837: Add driver for BD71837 PMIC clock Matti Vaittinen
2018-06-12 7:44 ` Stephen Boyd
2018-06-12 8:23 ` Matti Vaittinen
2018-06-13 13:03 ` Matti Vaittinen
2018-06-25 23:46 ` Stephen Boyd
2018-06-27 8:40 ` Matti Vaittinen
2018-07-31 9:05 ` Matti Vaittinen
2018-06-25 23:44 ` Stephen Boyd
2018-06-26 8:13 ` Matti Vaittinen
2018-07-31 8:28 ` Matti Vaittinen [this message]
2018-08-03 8:09 ` Matti Vaittinen
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=20180731073023.GA2956@localhost.localdomain \
--to=matti.vaittinen@fi.rohmeurope.com \
--cc=broonie@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=heikki.haikola@fi.rohmeurope.com \
--cc=lee.jones@linaro.org \
--cc=lgirdwood@gmail.com \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mazziesaccount@gmail.com \
--cc=mikko.mutanen@fi.rohmeurope.com \
--cc=mturquette@baylibre.com \
--cc=robh+dt@kernel.org \
--cc=sboyd@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;
as well as URLs for NNTP newsgroup(s).