From patchwork Mon Nov 26 04:09:29 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sachin Kamat X-Patchwork-Id: 13169 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 C53DC23E17 for ; Mon, 26 Nov 2012 04:16: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 7A5F2A1834A for ; Mon, 26 Nov 2012 04:16:18 +0000 (UTC) Received: by mail-ie0-f180.google.com with SMTP id c10so4007790ieb.11 for ; Sun, 25 Nov 2012 20:16:18 -0800 (PST) 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:in-reply-to:references :x-gm-message-state; bh=UziRodQU2JLskRQiWJ3IkYcjHtj8XfJYA/N6s/XgCNs=; b=LCRz12gouEn2jAFCsK9pvKPs20gUXtpihRjpsDDCMTaUybq+7KDISTiUYO1rotly7S l6cjlA8RoWLVQznErWq6SWlfRa86gfsfyKyk7WAoG1YrY9RotStd6FhbV1IQS61go8Vw PjbfYZNaxCkqwsrnRuI1F+8ikhSVaJCpeUKCGXzxUL1STbC9XtlEJ/bhQ+CcHJk1lWJw FvpwX1fSLLcKqhJuE5HxL5LVR5kCT59sz2tigSH7ZPolkKz+XFEoSKBU4DMr8B9JrCKK DapMjqm5tbVF/z1KizlHpjZsicYT5FMotJN2GbbIyVspLCJvsDZn3irim4OQkmbD+Tix iANw== Received: by 10.43.7.132 with SMTP id oo4mr8717642icb.6.1353903378247; Sun, 25 Nov 2012 20:16:18 -0800 (PST) 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.67.148 with SMTP id n20csp197667igt; Sun, 25 Nov 2012 20:16:17 -0800 (PST) Received: by 10.68.218.97 with SMTP id pf1mr33797734pbc.96.1353903377685; Sun, 25 Nov 2012 20:16:17 -0800 (PST) Received: from mail-pa0-f51.google.com (mail-pa0-f51.google.com [209.85.220.51]) by mx.google.com with ESMTPS id h9si17395771pax.10.2012.11.25.20.16.17 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 25 Nov 2012 20:16:17 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.51 is neither permitted nor denied by best guess record for domain of sachin.kamat@linaro.org) client-ip=209.85.220.51; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.51 is neither permitted nor denied by best guess record for domain of sachin.kamat@linaro.org) smtp.mail=sachin.kamat@linaro.org Received: by mail-pa0-f51.google.com with SMTP id fb11so4778208pad.24 for ; Sun, 25 Nov 2012 20:16:17 -0800 (PST) Received: by 10.68.138.229 with SMTP id qt5mr33407739pbb.122.1353903377419; Sun, 25 Nov 2012 20:16:17 -0800 (PST) Received: from localhost.localdomain ([115.113.119.130]) by mx.google.com with ESMTPS id yi9sm8036353pbc.39.2012.11.25.20.16.13 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 25 Nov 2012 20:16:16 -0800 (PST) From: Sachin Kamat To: linux-leds@vger.kernel.org Cc: cooloney@gmail.com, rpurdie@rpsys.net, patches@linaro.org, sachin.kamat@linaro.org, Raphael Assenat , Trent Piepho Subject: [PATCH 01/16] leds: leds-gpio: use devm_gpio_request_one Date: Mon, 26 Nov 2012 09:39:29 +0530 Message-Id: <1353902984-10728-2-git-send-email-sachin.kamat@linaro.org> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1353902984-10728-1-git-send-email-sachin.kamat@linaro.org> References: <1353902984-10728-1-git-send-email-sachin.kamat@linaro.org> X-Gm-Message-State: ALoCoQmnU39vpVCBru8i4k/iN4KoTiIE4wfp32DLRyRHPFdrB3V8OgiLMpXAf/MpE96ETtj0a2ra devm_gpio_request_one is device managed and makes error handling and cleanup simpler. Cc: Raphael Assenat Cc: Trent Piepho Signed-off-by: Sachin Kamat --- drivers/leds/leds-gpio.c | 8 ++------ 1 files changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/leds/leds-gpio.c b/drivers/leds/leds-gpio.c index 6a21096..77e2e40 100644 --- a/drivers/leds/leds-gpio.c +++ b/drivers/leds/leds-gpio.c @@ -126,7 +126,7 @@ static int __devinit create_gpio_led(const struct gpio_led *template, if (!template->retain_state_suspended) led_dat->cdev.flags |= LED_CORE_SUSPENDRESUME; - ret = gpio_request_one(template->gpio, + ret = devm_gpio_request_one(parent, template->gpio, GPIOF_DIR_OUT | (led_dat->active_low ^ state), template->name); if (ret < 0) @@ -136,12 +136,9 @@ static int __devinit create_gpio_led(const struct gpio_led *template, ret = led_classdev_register(parent, &led_dat->cdev); if (ret < 0) - goto err; + return ret; return 0; -err: - gpio_free(led_dat->gpio); - return ret; } static void delete_gpio_led(struct gpio_led_data *led) @@ -150,7 +147,6 @@ static void delete_gpio_led(struct gpio_led_data *led) return; led_classdev_unregister(&led->cdev); cancel_work_sync(&led->work); - gpio_free(led->gpio); } struct gpio_leds_priv {