public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Marek Vasut <marex@denx.de>
To: Sachin Kamat <sachin.kamat@linaro.org>
Cc: linux-kernel@vger.kernel.org, broonie@kernel.org, nm@ti.com,
	ldewangan@nvidia.com, gg@slimlogic.co.uk, yong.shen@linaro.org,
	s.hauer@pengutronix.de, Nancy.Chen@freescale.com
Subject: Re: [PATCH 6/7] regulator: rc5t583: Use devm_regulator_register
Date: Wed, 4 Sep 2013 16:33:32 +0200	[thread overview]
Message-ID: <201309041633.33017.marex@denx.de> (raw)
In-Reply-To: <1378276263-10735-6-git-send-email-sachin.kamat@linaro.org>

Dear Sachin Kamat,

> devm_* simplifies the code.
> 
> Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
> ---
>  drivers/regulator/rc5t583-regulator.c |   22 ++--------------------
>  1 file changed, 2 insertions(+), 20 deletions(-)
> 
> diff --git a/drivers/regulator/rc5t583-regulator.c
> b/drivers/regulator/rc5t583-regulator.c index 5885b45..b58affb 100644
> --- a/drivers/regulator/rc5t583-regulator.c
> +++ b/drivers/regulator/rc5t583-regulator.c
> @@ -173,33 +173,16 @@ skip_ext_pwr_config:
>  		config.driver_data = reg;
>  		config.regmap = rc5t583->regmap;
> 
> -		rdev = regulator_register(&ri->desc, &config);
> +		rdev = devm_regulator_register(&pdev->dev, &ri->desc, &config);
>  		if (IS_ERR(rdev)) {
>  			dev_err(&pdev->dev, "Failed to register regulator %s\n",
>  						ri->desc.name);
> -			ret = PTR_ERR(rdev);
> -			goto clean_exit;
> +			return PTR_ERR(rdev);
>  		}
>  		reg->rdev = rdev;
>  	}
>  	platform_set_drvdata(pdev, regs);
>  	return 0;
> -
> -clean_exit:
> -	while (--id >= 0)
> -		regulator_unregister(regs[id].rdev);
> -
> -	return ret;
> -}
> -
> -static int rc5t583_regulator_remove(struct platform_device *pdev)
> -{
> -	struct rc5t583_regulator *regs = platform_get_drvdata(pdev);
> -	int id;
> -
> -	for (id = 0; id < RC5T583_REGULATOR_MAX; ++id)
> -		regulator_unregister(regs[id].rdev);
> -	return 0;
>  }
> 
>  static struct platform_driver rc5t583_regulator_driver = {
> @@ -208,7 +191,6 @@ static struct platform_driver rc5t583_regulator_driver
> = { .owner	= THIS_MODULE,
>  	},
>  	.probe		= rc5t583_regulator_probe,
> -	.remove		= rc5t583_regulator_remove,
>  };
> 
>  static int __init rc5t583_regulator_init(void)

Next up, you might want to start flipping the regulator drivers to 
module_platform_driver ;-)

Acked-by: Marek Vasut <marex@denx.de>

Best regards,
Marek Vasut

  reply	other threads:[~2013-09-04 14:33 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-04  6:30 [PATCH 1/7] regulator: anatop-regulator: Use devm_regulator_register Sachin Kamat
2013-09-04  6:30 ` [PATCH 2/7] regulator: isl6271a-regulator: " Sachin Kamat
2013-09-04 14:26   ` Marek Vasut
2013-09-04  6:30 ` [PATCH 3/7] regulator: mc13783: " Sachin Kamat
2013-09-04 14:27   ` Marek Vasut
2013-09-04  6:31 ` [PATCH 4/7] regulator: mc13892: " Sachin Kamat
2013-09-04 14:29   ` Marek Vasut
2013-09-04  6:31 ` [PATCH 5/7] regulator: palmas: " Sachin Kamat
2013-09-04 14:32   ` Marek Vasut
2013-09-04 15:14     ` Sachin Kamat
2013-09-04  6:31 ` [PATCH 6/7] regulator: rc5t583: " Sachin Kamat
2013-09-04 14:33   ` Marek Vasut [this message]
2013-09-04  6:31 ` [PATCH 7/7] regulator: ti-abb: " Sachin Kamat
2013-09-04 13:27   ` Nishanth Menon
2013-09-04 15:12     ` Mark Brown
2013-09-04 15:15       ` Nishanth Menon
2013-09-04 16:26     ` Sachin Kamat
2013-09-04 16:33       ` Nishanth Menon
2013-09-04 16:48         ` Sachin Kamat
2013-09-04 17:00           ` Nishanth Menon
2013-09-04 18:03             ` Mark Brown
2013-09-04  9:49 ` [PATCH 1/7] regulator: anatop-regulator: " Mark Brown
2013-09-04 14:25 ` Marek Vasut

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=201309041633.33017.marex@denx.de \
    --to=marex@denx.de \
    --cc=Nancy.Chen@freescale.com \
    --cc=broonie@kernel.org \
    --cc=gg@slimlogic.co.uk \
    --cc=ldewangan@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nm@ti.com \
    --cc=s.hauer@pengutronix.de \
    --cc=sachin.kamat@linaro.org \
    --cc=yong.shen@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox