From patchwork Tue Sep 11 11:42:10 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sachin Kamat X-Patchwork-Id: 11306 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 4E35E23F22 for ; Tue, 11 Sep 2012 11:45:18 +0000 (UTC) Received: from mail-ie0-f180.google.com (mail-ie0-f180.google.com [209.85.223.180]) by fiordland.canonical.com (Postfix) with ESMTP id DEC06A18BD9 for ; Tue, 11 Sep 2012 11:45:17 +0000 (UTC) Received: by ieak11 with SMTP id k11so676866iea.11 for ; Tue, 11 Sep 2012 04:45:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:x-gm-message-state; bh=eVPUYXhPfx7P90iuWrDVRsSQ22BYLGrEnFINQ8yKneA=; b=RebWSDAt7tVR2cAb5pBVrsXZDf6UXMJBWWcyQOS3Q/R483K0JJtvEEDwnQpaEgzD1S a4s4bROB9myuJZ3v7pt5OA1unOky/I90HSYonjUhTAFo3IvikM6CYZD/phBxMSuyIL9B /2GFxgzxzm2UZYsuVT+HZlPOfPCvIpYr1oGjsMk0itUtwxBRdn1yavt5SqhJa4Wtsqj9 T9N88jZzBNHk25M+ZLK+zkFvpV1/TgHHuYGabslQjiha0c+u7sjBV6ZtqSoKmYy4dbFJ Iiw/p23w/sAViIb7v5i7yzye2EyDpsgaBFhx9sPRY/MuyvjVUYnKC1xUc2tix3TL7wJy ei0g== Received: by 10.50.242.3 with SMTP id wm3mr15784831igc.0.1347363917301; Tue, 11 Sep 2012 04:45:17 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.50.184.232 with SMTP id ex8csp8679igc; Tue, 11 Sep 2012 04:45:16 -0700 (PDT) Received: by 10.68.229.73 with SMTP id so9mr11141656pbc.66.1347363916320; Tue, 11 Sep 2012 04:45:16 -0700 (PDT) Received: from mail-pz0-f50.google.com (mail-pz0-f50.google.com [209.85.210.50]) by mx.google.com with ESMTPS id ip5si24554876pbc.348.2012.09.11.04.45.15 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 11 Sep 2012 04:45:16 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.210.50 is neither permitted nor denied by best guess record for domain of sachin.kamat@linaro.org) client-ip=209.85.210.50; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.210.50 is neither permitted nor denied by best guess record for domain of sachin.kamat@linaro.org) smtp.mail=sachin.kamat@linaro.org Received: by dade7 with SMTP id e7so328266dad.37 for ; Tue, 11 Sep 2012 04:45:15 -0700 (PDT) Received: by 10.68.223.4 with SMTP id qq4mr10926200pbc.10.1347363915708; Tue, 11 Sep 2012 04:45:15 -0700 (PDT) Received: from localhost.localdomain ([115.113.119.130]) by mx.google.com with ESMTPS id vh7sm9651873pbc.22.2012.09.11.04.45.10 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 11 Sep 2012 04:45:15 -0700 (PDT) From: Sachin Kamat To: linux-leds@vger.kernel.org Cc: bryan.wu@canonical.com, rpurdie@rpsys.net, sachin.kamat@linaro.org, patches@linaro.org Subject: [PATCH] leds-lm3530: Use devm_regulator_get function Date: Tue, 11 Sep 2012 17:12:10 +0530 Message-Id: <1347363730-15459-1-git-send-email-sachin.kamat@linaro.org> X-Mailer: git-send-email 1.7.4.1 X-Gm-Message-State: ALoCoQlgCgVk8NS/PHZoEITVujwB2waT/FyVBQnpLNA+W3AH0I8CYvCcz5RPisTaJ3/P9wPbMcDB Device managed functions are already used in this file. Hence convert regulator_get() too to use it. Signed-off-by: Sachin Kamat --- drivers/leds/leds-lm3530.c | 12 +++--------- 1 files changed, 3 insertions(+), 9 deletions(-) diff --git a/drivers/leds/leds-lm3530.c b/drivers/leds/leds-lm3530.c index 23637bd..1e7ed2a 100644 --- a/drivers/leds/leds-lm3530.c +++ b/drivers/leds/leds-lm3530.c @@ -416,7 +416,7 @@ static int __devinit lm3530_probe(struct i2c_client *client, i2c_set_clientdata(client, drvdata); - drvdata->regulator = regulator_get(&client->dev, "vin"); + drvdata->regulator = devm_regulator_get(&client->dev, "vin"); if (IS_ERR(drvdata->regulator)) { dev_err(&client->dev, "regulator get failed\n"); err = PTR_ERR(drvdata->regulator); @@ -429,15 +429,13 @@ static int __devinit lm3530_probe(struct i2c_client *client, if (err < 0) { dev_err(&client->dev, "Register Init failed: %d\n", err); - err = -ENODEV; - goto err_reg_init; + return -ENODEV; } } err = led_classdev_register(&client->dev, &drvdata->led_dev); if (err < 0) { dev_err(&client->dev, "Register led class failed: %d\n", err); - err = -ENODEV; - goto err_class_register; + return -ENODEV; } err = device_create_file(drvdata->led_dev.dev, &dev_attr_mode); @@ -451,9 +449,6 @@ static int __devinit lm3530_probe(struct i2c_client *client, err_create_file: led_classdev_unregister(&drvdata->led_dev); -err_class_register: -err_reg_init: - regulator_put(drvdata->regulator); return err; } @@ -465,7 +460,6 @@ static int __devexit lm3530_remove(struct i2c_client *client) if (drvdata->enable) regulator_disable(drvdata->regulator); - regulator_put(drvdata->regulator); led_classdev_unregister(&drvdata->led_dev); return 0; }