From patchwork Fri Dec 7 13:32:47 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shawn Guo X-Patchwork-Id: 1850871 Return-Path: X-Original-To: patchwork-linux-mmc@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 106BD3FCD5 for ; Fri, 7 Dec 2012 13:33:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1030366Ab2LGNdO (ORCPT ); Fri, 7 Dec 2012 08:33:14 -0500 Received: from mail-da0-f46.google.com ([209.85.210.46]:43498 "EHLO mail-da0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1030354Ab2LGNdN (ORCPT ); Fri, 7 Dec 2012 08:33:13 -0500 Received: by mail-da0-f46.google.com with SMTP id p5so213931dak.19 for ; Fri, 07 Dec 2012 05:33:13 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:x-gm-message-state; bh=sjNCDX439ZZpBDlfTCnvyakXmBaydX6r+JUr3V/Xc4s=; b=TvPXE6rEXXA7vDW/C7OcV5hZSda3e61S7Eg/eEmCxMx/X8S0FsTG7wVstZ7+M2XgAM 1dTvFliALYCCE0fwKIkpaMdSYhtDE80pJGHOj4vso0cZ/sq0jdd0BZwMbGqeyv4ffUue cKzOh8dnCYZAAkVToXR6hnWMZDnqZpgPqVN78ODrkIkXQDesETKKjErLRj0rr7Hemvyt wM0zff9XoJJZn/QoXZU4+rgdqT3sPIwGOP96O9peKBA2VVCMAXEwu8/s15+HAvkO95OX 5pXNhAV6X0dhoMS8Qg2Mo+UgZFDGf9edaI/gscOT0cDakF3PaJBCmwDkZx6UQyBUepb3 pVEQ== Received: by 10.66.84.134 with SMTP id z6mr13715349pay.1.1354887193380; Fri, 07 Dec 2012 05:33:13 -0800 (PST) Received: from S2101-09.domain ([117.60.178.142]) by mx.google.com with ESMTPS id gq10sm6702566pbc.54.2012.12.07.05.33.01 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 07 Dec 2012 05:33:12 -0800 (PST) From: Shawn Guo To: linux-mmc@vger.kernel.org Cc: Guennadi Liakhovetski , Chris Ball , linux-arm-kernel@lists.infradead.org, Shawn Guo Subject: [PATCH 1/2] mmc: slot-gpio: use devm_* managed functions to ease users Date: Fri, 7 Dec 2012 21:32:47 +0800 Message-Id: <1354887168-3073-1-git-send-email-shawn.guo@linaro.org> X-Mailer: git-send-email 1.7.9.5 X-Gm-Message-State: ALoCoQnKEZy3dG1kMfJ6YV4tTolsZtSnaWH/N/bzIA54/UeTqPrmWFhgt4CXbtu2oA+09BNKL8dp Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org Use devm_* managed functions, so that slot-gpio users do not have to call mmc_gpio_free_ro/cd to free up resources requested in mmc_gpio_request_ro/cd. Signed-off-by: Shawn Guo --- drivers/mmc/core/slot-gpio.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/drivers/mmc/core/slot-gpio.c b/drivers/mmc/core/slot-gpio.c index 16a1c0b..8b55748 100644 --- a/drivers/mmc/core/slot-gpio.c +++ b/drivers/mmc/core/slot-gpio.c @@ -106,7 +106,8 @@ int mmc_gpio_request_ro(struct mmc_host *host, unsigned int gpio) ctx = host->slot.handler_priv; - ret = gpio_request_one(gpio, GPIOF_DIR_IN, ctx->ro_label); + ret = devm_gpio_request_one(&host->class_dev, gpio, GPIOF_DIR_IN, + ctx->ro_label); if (ret < 0) return ret; @@ -128,7 +129,8 @@ int mmc_gpio_request_cd(struct mmc_host *host, unsigned int gpio) ctx = host->slot.handler_priv; - ret = gpio_request_one(gpio, GPIOF_DIR_IN, ctx->cd_label); + ret = devm_gpio_request_one(&host->class_dev, gpio, GPIOF_DIR_IN, + ctx->cd_label); if (ret < 0) /* * don't bother freeing memory. It might still get used by other @@ -146,7 +148,8 @@ int mmc_gpio_request_cd(struct mmc_host *host, unsigned int gpio) irq = -EINVAL; if (irq >= 0) { - ret = request_threaded_irq(irq, NULL, mmc_gpio_cd_irqt, + ret = devm_request_threaded_irq(&host->class_dev, irq, + NULL, mmc_gpio_cd_irqt, IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING | IRQF_ONESHOT, ctx->cd_label, host); if (ret < 0) @@ -175,7 +178,7 @@ void mmc_gpio_free_ro(struct mmc_host *host) gpio = ctx->ro_gpio; ctx->ro_gpio = -EINVAL; - gpio_free(gpio); + devm_gpio_free(&host->class_dev, gpio); } EXPORT_SYMBOL(mmc_gpio_free_ro); @@ -188,13 +191,13 @@ void mmc_gpio_free_cd(struct mmc_host *host) return; if (host->slot.cd_irq >= 0) { - free_irq(host->slot.cd_irq, host); + devm_free_irq(&host->class_dev, host->slot.cd_irq, host); host->slot.cd_irq = -EINVAL; } gpio = ctx->cd_gpio; ctx->cd_gpio = -EINVAL; - gpio_free(gpio); + devm_gpio_free(&host->class_dev, gpio); } EXPORT_SYMBOL(mmc_gpio_free_cd);