[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <201309041633.33017.marex@denx.de>
Date: Wed, 4 Sep 2013 16:33:32 +0200
From: Marek Vasut <marex@...x.de>
To: Sachin Kamat <sachin.kamat@...aro.org>
Cc: linux-kernel@...r.kernel.org, broonie@...nel.org, nm@...com,
ldewangan@...dia.com, gg@...mlogic.co.uk, yong.shen@...aro.org,
s.hauer@...gutronix.de, Nancy.Chen@...escale.com
Subject: Re: [PATCH 6/7] regulator: rc5t583: Use devm_regulator_register
Dear Sachin Kamat,
> devm_* simplifies the code.
>
> Signed-off-by: Sachin Kamat <sachin.kamat@...aro.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@...x.de>
Best regards,
Marek Vasut
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists