devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mark Rutland <mark.rutland@arm.com>
To: Sachin Kamat <sachin.kamat@linaro.org>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"sbkim73@samsung.com" <sbkim73@samsung.com>,
	"lee.jones@linaro.org" <lee.jones@linaro.org>,
	"lgirdwood@gmail.com" <lgirdwood@gmail.com>,
	"broonie@kernel.org" <broonie@kernel.org>,
	"patches@linaro.org" <patches@linaro.org>
Subject: Re: [PATCH v2 2/3] regulator: Add support for S2MPA01 regulator
Date: Wed, 12 Feb 2014 18:02:23 +0000	[thread overview]
Message-ID: <20140212180223.GA23630@e106331-lin.cambridge.arm.com> (raw)
In-Reply-To: <1389266554-23463-2-git-send-email-sachin.kamat@linaro.org>

On Thu, Jan 09, 2014 at 11:22:33AM +0000, Sachin Kamat wrote:
> Add support for S2MPA01 voltage and current regulator.
> 
> Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
> ---
> * Addressed comments from Mark Brown
>  - Used module_platform_driver instead of subsys init call
> ---
>  drivers/regulator/Kconfig   |    7 +
>  drivers/regulator/Makefile  |    1 +
>  drivers/regulator/s2mpa01.c |  482 +++++++++++++++++++++++++++++++++++++++++++
>  3 files changed, 490 insertions(+)
>  create mode 100644 drivers/regulator/s2mpa01.c

[...]

> +static int s2mpa01_pmic_probe(struct platform_device *pdev)
> +{
> +       struct sec_pmic_dev *iodev = dev_get_drvdata(pdev->dev.parent);
> +       struct sec_platform_data *pdata = dev_get_platdata(iodev->dev);
> +       struct of_regulator_match rdata[S2MPA01_REGULATOR_MAX];
> +       struct device_node *reg_np = NULL;
> +       struct regulator_config config = { };
> +       struct s2mpa01_info *s2mpa01;
> +       int i, ret;
> +
> +       s2mpa01 = devm_kzalloc(&pdev->dev, sizeof(*s2mpa01), GFP_KERNEL);
> +       if (!s2mpa01)
> +               return -ENOMEM;
> +
> +       for (i = 0; i < S2MPA01_REGULATOR_CNT; i++)
> +               rdata[i].name = regulators[i].name;
> +
> +       if (iodev->dev->of_node) {
> +               reg_np = of_find_node_by_name(iodev->dev->of_node,
> +                                                       "regulators");

This walks the allnodes list, and can thus walk outside of the parent
node.

Use of_get_child_by_name instead.

> +                       if (!reg_np) {
> +                               dev_err(&pdev->dev,
> +                                       "could not find regulators sub-node\n");
> +                               return -EINVAL;
> +                       }
> +
> +               of_regulator_match(&pdev->dev, reg_np, rdata,
> +                                               S2MPA01_REGULATOR_MAX);

Is a reference to reg_np held beyond this? Do you need an
of_node_put(reg_np)?

Thanks,
Mark.

  parent reply	other threads:[~2014-02-12 18:02 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-09 11:22 [PATCH v2 1/3] mfd: Add support for S2MPA01 device Sachin Kamat
     [not found] ` <1389266554-23463-1-git-send-email-sachin.kamat-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2014-01-09 11:22   ` [PATCH v2 2/3] regulator: Add support for S2MPA01 regulator Sachin Kamat
     [not found]     ` <1389266554-23463-2-git-send-email-sachin.kamat-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2014-01-09 12:50       ` Mark Brown
2014-02-12 18:02     ` Mark Rutland [this message]
     [not found]       ` <20140212180223.GA23630-NuALmloUBlrZROr8t4l/smS4ubULX0JqMm0uRHvK7Nw@public.gmane.org>
2014-02-13  5:24         ` Sachin Kamat
2014-01-09 11:22   ` [PATCH v2 3/3] Documentation: mfd: Add binding document for S2MPA01 Sachin Kamat
     [not found]     ` <1389266554-23463-3-git-send-email-sachin.kamat-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2014-01-13  9:28       ` Sachin Kamat
2014-02-06  9:27       ` Sachin Kamat
2014-02-12  9:32     ` Sachin Kamat
2014-02-12 18:10     ` Mark Rutland
     [not found]       ` <20140212181043.GB23630-NuALmloUBlrZROr8t4l/smS4ubULX0JqMm0uRHvK7Nw@public.gmane.org>
2014-02-12 18:21         ` Mark Brown
2014-02-13  6:17         ` Sachin Kamat
2014-01-10 10:03   ` [PATCH v2 1/3] mfd: Add support for S2MPA01 device Lee Jones
2014-01-10 10:15     ` Sachin Kamat
2014-01-10 10:25       ` Lee Jones

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=20140212180223.GA23630@e106331-lin.cambridge.arm.com \
    --to=mark.rutland@arm.com \
    --cc=broonie@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=lee.jones@linaro.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=patches@linaro.org \
    --cc=sachin.kamat@linaro.org \
    --cc=sbkim73@samsung.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;
as well as URLs for NNTP newsgroup(s).