All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Boyd <sboyd@codeaurora.org>
To: Bjorn Andersson <bjorn.andersson@sonymobile.com>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Mark Brown <broonie@kernel.org>
Cc: Andy Gross <agross@codeaurora.org>,
	Srinivas Kandagatla <srinivas.kandagatla@linaro.org>,
	linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org
Subject: Re: [PATCH v2 5/5] regulator: qcom: Rework to single platform device
Date: Thu, 02 Apr 2015 16:02:28 -0700	[thread overview]
Message-ID: <551DCA84.5050500@codeaurora.org> (raw)
In-Reply-To: <1427928946-31291-6-git-send-email-bjorn.andersson@sonymobile.com>

On 04/01/15 15:55, Bjorn Andersson wrote:
> +static int rpm_reg_probe(struct platform_device *pdev)
> +{
> +	const struct rpm_regulator_data *reg;
> +	const struct of_device_id *match;
> +	struct regulator_config config = { };
> +	struct regulator_dev *rdev;
> +	struct qcom_rpm_reg *vreg;
>  
> -	ret = rpm_reg_of_parse(pdev->dev.of_node, &vreg->desc, &config);
> -	if (ret)
> -		return ret;
> +	match = of_match_device(rpm_of_match, &pdev->dev);
> +	for (reg = match->data; reg->name; reg++) {
> +		vreg = devm_kmalloc(&pdev->dev, sizeof(*vreg), GFP_KERNEL);
> +		if (!vreg) {
> +			dev_err(&pdev->dev, "failed to allocate vreg\n");

Please remove useless error message on allocation failures.

> +			return -ENOMEM;
> +		}
> +		memcpy(vreg, reg->template, sizeof(*vreg));
> +		mutex_init(&vreg->lock);
> +
> +		vreg->dev = &pdev->dev;
> +		vreg->resource = reg->resource;
> +
> +		vreg->desc.id = -1;
> +		vreg->desc.owner = THIS_MODULE;
> +		vreg->desc.type = REGULATOR_VOLTAGE;
> +		vreg->desc.name = reg->name;
> +		vreg->desc.supply_name = reg->supply;
> +		vreg->desc.of_match = reg->name;
> +		vreg->desc.of_parse_cb = rpm_reg_of_parse;
> +
> +		vreg->rpm = dev_get_drvdata(pdev->dev.parent);
> +		if (!vreg->rpm) {
> +			dev_err(&pdev->dev, "unable to retrieve handle to rpm\n");
> +			return -ENODEV;
> +		}

Was there going to be a patch to lift this out of the loop (although I
hope the compiler can hoist it out).

>  
> -	rdev = devm_regulator_register(&pdev->dev, &vreg->desc, &config);
> -	if (IS_ERR(rdev)) {
> -		dev_err(&pdev->dev, "can't register regulator\n");
> -		return PTR_ERR(rdev);
> +		config.dev = &pdev->dev;
> +		config.driver_data = vreg;
> +		rdev = devm_regulator_register(&pdev->dev, &vreg->desc, &config);
> +		if (IS_ERR(rdev)) {
> +			dev_err(&pdev->dev, "can't register regulator\n");

It'd be nice to know which regulator failed to register.

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

  reply	other threads:[~2015-04-02 23:02 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-01 22:55 [PATCH v2 0/5] Refactor Qualcomm RPM regulator to single platform_device Bjorn Andersson
2015-04-01 22:55 ` Bjorn Andersson
2015-04-01 22:55 ` [PATCH v2 1/5] mfd: devicetree: bindings: Add Qualcomm RPM regulator subnodes Bjorn Andersson
2015-04-01 22:55   ` Bjorn Andersson
2015-04-02  7:18   ` Lee Jones
2015-04-02 22:02   ` Stephen Boyd
2015-04-01 22:55 ` [PATCH v2 2/5] regulator: Introduce property to flag drms Bjorn Andersson
2015-04-01 22:55   ` Bjorn Andersson
     [not found]   ` <1427928946-31291-3-git-send-email-bjorn.andersson-/MT0OVThwyLZJqsBc5GL+g@public.gmane.org>
2015-04-02  8:54     ` Mark Brown
2015-04-02  8:54       ` Mark Brown
2015-04-02 21:35       ` Bjorn Andersson
     [not found]         ` <CAJAp7OhW9SBf5=MmEEFNLGYpZ738Z8=HKxsBTBVvk-GNZq6=bQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-04-06 17:57           ` Mark Brown
2015-04-06 17:57             ` Mark Brown
2015-04-01 22:55 ` [PATCH v2 3/5] regulator: qcom: Don't enable DRMS in driver Bjorn Andersson
2015-04-01 22:55   ` Bjorn Andersson
2015-04-02 22:02   ` Stephen Boyd
2015-04-01 22:55 ` [PATCH v2 4/5] regulator: qcom: Refactor of-parsing code Bjorn Andersson
2015-04-01 22:55   ` Bjorn Andersson
2015-04-02 22:58   ` Stephen Boyd
2015-04-01 22:55 ` [PATCH v2 5/5] regulator: qcom: Rework to single platform device Bjorn Andersson
2015-04-01 22:55   ` Bjorn Andersson
2015-04-02 23:02   ` Stephen Boyd [this message]
2015-04-06 16:59     ` Bjorn Andersson
2015-04-02 22:00 ` [PATCH v2 0/5] Refactor Qualcomm RPM regulator to single platform_device Stephen Boyd
2015-04-02 22:26   ` Mark Brown
2015-04-02 22:57     ` Stephen Boyd
2015-04-06 16:40       ` Bjorn Andersson
2015-04-06 16:51       ` Mark Brown
2015-04-06 17:11         ` Bjorn Andersson
2015-04-06 17:46           ` Mark Brown

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=551DCA84.5050500@codeaurora.org \
    --to=sboyd@codeaurora.org \
    --cc=agross@codeaurora.org \
    --cc=bjorn.andersson@sonymobile.com \
    --cc=broonie@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=srinivas.kandagatla@linaro.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.