Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755660Ab3IZHs1 (ORCPT ); Thu, 26 Sep 2013 03:48:27 -0400 Received: from mailout3.samsung.com ([203.254.224.33]:44914 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753918Ab3IZHsZ (ORCPT ); Thu, 26 Sep 2013 03:48:25 -0400 X-AuditID: cbfee690-b7f3b6d000007a15-53-5243e6c8e2ae From: Jingoo Han To: "'Mark Brown'" Cc: "'Liam Girdwood'" , linux-kernel@vger.kernel.org, "'Jingoo Han'" , "'Geert Uytterhoeven'" , "'Krystian Garbaciak'" References: <003101ceba8c$88d6a840$9a83f8c0$%han@samsung.com> In-reply-to: <003101ceba8c$88d6a840$9a83f8c0$%han@samsung.com> Subject: [PATCH V3 03/14] regulator: da9063: use devm_regulator_register() Date: Thu, 26 Sep 2013 16:48:23 +0900 Message-id: <003301ceba8c$c71716d0$55454470$%han@samsung.com> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7bit X-Mailer: Microsoft Office Outlook 12.0 Thread-index: Ac66jIjCzH3ID+v5Qym5l1DxbvczrwAACT1Q Content-language: ko X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrHIsWRmVeSWpSXmKPExsVy+t8zQ90Tz5yDDL7PYbeY+vAJm8WzW3uZ LC4vvMRqceTxZzaLb1c6gNxdc9gc2DxWfNL32DnrLrvHplWdbB6HDncwevRtWcXo8XmTXABb FJdNSmpOZllqkb5dAlfG/n6DgrsCFV+fXmFsYLzF28XIySEhYCKx7P9NFghbTOLCvfVsXYxc HEICyxgl/p/+wNzFyAFW1L+eEyI+nVHi54nNjBDOL0aJ/q3fmUG62QTUJL58OcwO0iAioCrx /5U7SA2zwFVGiRPPtoHVCAnYSjR++wu2jVPATmLW/pNgcWEBL4kNc/eygdgsQL2TLs0Fq+EF ql/SNYkNwhaU+DH5HlicWUBLYv3O40wQtrzE5jVvoQ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G9wOwcJMSaWFZcmXuIUYKDWUmE95sRUIg3JbGyKrUoP76oNCe1 +BBjMtCfE5mlRJPzgQkrryTe0NjEzMjSyMzCyMTcnDRhJXHeg63WgUIC6YklqdmpqQWpRTBb mDg4pRoYLUN0Fuq9StBZuEmbNXMPu47GDKmWr7VTH26XC7m4/5HcS53j0xr+qZvazvm889p+ h7NpQZ9cr0Rf1IpMfMGxpIp5398P22TtIj9mzX6ntW6BY9IbFbZ5HRcP93QXOUyzNv8mkL49 3NXZV18tyOu77M+E2ilupwoO/RV03mRzbNohk9jE/gRxJZbijERDLeai4kQAwBZOeE4DAAA= DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2315 Lines: 76 Use devm_regulator_register() to make cleanup paths simpler. Signed-off-by: Jingoo Han --- drivers/regulator/da9063-regulator.c | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/drivers/regulator/da9063-regulator.c b/drivers/regulator/da9063-regulator.c index 3d910f4..56727eb 100644 --- a/drivers/regulator/da9063-regulator.c +++ b/drivers/regulator/da9063-regulator.c @@ -847,13 +847,13 @@ static int da9063_regulator_probe(struct platform_device *pdev) if (da9063_reg_matches) config.of_node = da9063_reg_matches[id].of_node; config.regmap = da9063->regmap; - regl->rdev = regulator_register(®l->desc, &config); + regl->rdev = devm_regulator_register(&pdev->dev, ®l->desc, + &config); if (IS_ERR(regl->rdev)) { dev_err(&pdev->dev, "Failed to register %s regulator\n", regl->desc.name); - ret = PTR_ERR(regl->rdev); - goto err; + return PTR_ERR(regl->rdev); } id++; n++; @@ -862,9 +862,8 @@ static int da9063_regulator_probe(struct platform_device *pdev) /* LDOs overcurrent event support */ irq = platform_get_irq_byname(pdev, "LDO_LIM"); if (irq < 0) { - ret = irq; dev_err(&pdev->dev, "Failed to get IRQ.\n"); - goto err; + return irq; } regulators->irq_ldo_lim = regmap_irq_get_virq(da9063->regmap_irq, irq); @@ -881,27 +880,15 @@ static int da9063_regulator_probe(struct platform_device *pdev) } return 0; - -err: - /* Wind back regulators registeration */ - while (--n >= 0) - regulator_unregister(regulators->regulator[n].rdev); - - return ret; } static int da9063_regulator_remove(struct platform_device *pdev) { struct da9063_regulators *regulators = platform_get_drvdata(pdev); - struct da9063_regulator *regl; free_irq(regulators->irq_ldo_lim, regulators); free_irq(regulators->irq_uvov, regulators); - for (regl = ®ulators->regulator[regulators->n_regulators - 1]; - regl >= ®ulators->regulator[0]; regl--) - regulator_unregister(regl->rdev); - return 0; } -- 1.7.10.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/