From patchwork Tue Oct 21 17:19:08 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 39204 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f200.google.com (mail-lb0-f200.google.com [209.85.217.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id E9B4E2039B for ; Tue, 21 Oct 2014 17:19:39 +0000 (UTC) Received: by mail-lb0-f200.google.com with SMTP id b6sf1069582lbj.7 for ; Tue, 21 Oct 2014 10:19:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:subject:date :message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=a/HRzZ1RjP2cKPvhUxkPveDS//vIbnbikj86epxvlEo=; b=Dx1k1qU5cn/DSJiMQ+L9zU+dGmIYU1tgEAfbwQ0IE/906AOPYE4n1g/NzhWM9yPCB7 TjSOvXBOmtIzz2qyEl4zfrw3qwcTfTvVud8EhIMccEsN8nO82Jn1y2rWrfOQVY6dGmp4 21ojCletKubDmSve56K/+GKr8Z398USWMat3zYfT8JAQYoYlKN51ABLM7BmVcy4AX8VR yoKtPFPM3MI6wU9fnSm46/6WTuLPJ3+qk2oXGz8lRKado5poMC6HfDQtJ0t1eLx/JFqz qMd1BdA78SlXhsThfxT17RboUChao1p6D7OUY7fgVhzzePeTdyrftqTVbGB8eyZmgd/U oYEg== X-Gm-Message-State: ALoCoQlk911R+bU6LIOV7XpDaSb2Jl/Tws+/cR3WGvY842p6Jiwvlz3T8MXZegYvCXZsr0C79nIN X-Received: by 10.152.26.72 with SMTP id j8mr5421979lag.3.1413911978888; Tue, 21 Oct 2014 10:19:38 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.115.207 with SMTP id jq15ls90739lab.49.gmail; Tue, 21 Oct 2014 10:19:38 -0700 (PDT) X-Received: by 10.112.132.34 with SMTP id or2mr4477783lbb.75.1413911978626; Tue, 21 Oct 2014 10:19:38 -0700 (PDT) Received: from mail-la0-f41.google.com (mail-la0-f41.google.com. [209.85.215.41]) by mx.google.com with ESMTPS id p7si19975383lbr.56.2014.10.21.10.19.38 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 21 Oct 2014 10:19:38 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.41 as permitted sender) client-ip=209.85.215.41; Received: by mail-la0-f41.google.com with SMTP id pn19so1492163lab.28 for ; Tue, 21 Oct 2014 10:19:38 -0700 (PDT) X-Received: by 10.152.29.8 with SMTP id f8mr36319592lah.56.1413911978543; Tue, 21 Oct 2014 10:19:38 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.112.84.229 with SMTP id c5csp545266lbz; Tue, 21 Oct 2014 10:19:38 -0700 (PDT) X-Received: by 10.112.146.37 with SMTP id sz5mr36051319lbb.27.1413911977102; Tue, 21 Oct 2014 10:19:37 -0700 (PDT) Received: from mail-la0-f42.google.com (mail-la0-f42.google.com. [209.85.215.42]) by mx.google.com with ESMTPS id jo3si19903329lab.125.2014.10.21.10.19.37 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 21 Oct 2014 10:19:37 -0700 (PDT) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.215.42 as permitted sender) client-ip=209.85.215.42; Received: by mail-la0-f42.google.com with SMTP id gf13so1629005lab.29 for ; Tue, 21 Oct 2014 10:19:37 -0700 (PDT) X-Received: by 10.112.73.37 with SMTP id i5mr648626lbv.83.1413911976991; Tue, 21 Oct 2014 10:19:36 -0700 (PDT) Received: from uffe-Latitude-E6430s.lan (90-231-160-185-no158.tbcn.telia.com. [90.231.160.185]) by mx.google.com with ESMTPSA id uh7sm4791085lac.1.2014.10.21.10.19.35 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 21 Oct 2014 10:19:36 -0700 (PDT) From: Ulf Hansson To: linux-mmc@vger.kernel.org, Ulf Hansson , Chris Ball Subject: [PATCH 10/15] mmc: core: Export mmc_get_ext_csd() Date: Tue, 21 Oct 2014 19:19:08 +0200 Message-Id: <1413911953-19012-11-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1413911953-19012-1-git-send-email-ulf.hansson@linaro.org> References: <1413911953-19012-1-git-send-email-ulf.hansson@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: ulf.hansson@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.41 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Callers of mmc_send_ext_csd() will be able to decrease code duplication by using mmc_get_ext_csd() instead. Let's make it available. Signed-off-by: Ulf Hansson --- drivers/mmc/core/mmc.c | 31 ------------------------------- drivers/mmc/core/mmc_ops.c | 29 +++++++++++++++++++++++++++++ include/linux/mmc/core.h | 1 + 3 files changed, 30 insertions(+), 31 deletions(-) diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index 55757fe..1e022fa 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c @@ -177,37 +177,6 @@ static int mmc_decode_csd(struct mmc_card *card) return 0; } -/* - * Read extended CSD. - */ -static int mmc_get_ext_csd(struct mmc_card *card, u8 **new_ext_csd) -{ - int err; - u8 *ext_csd; - - if (!card || !new_ext_csd) - return -EINVAL; - - if (!mmc_can_ext_csd(card)) - return -EOPNOTSUPP; - - /* - * As the ext_csd is so large and mostly unused, we don't store the - * raw block in mmc_card. - */ - ext_csd = kmalloc(512, GFP_KERNEL); - if (!ext_csd) - return -ENOMEM; - - err = mmc_send_ext_csd(card, ext_csd); - if (err) - kfree(ext_csd); - else - *new_ext_csd = ext_csd; - - return err; -} - static void mmc_select_card_type(struct mmc_card *card) { struct mmc_host *host = card->host; diff --git a/drivers/mmc/core/mmc_ops.c b/drivers/mmc/core/mmc_ops.c index 1db60be4..72e1f9b 100644 --- a/drivers/mmc/core/mmc_ops.c +++ b/drivers/mmc/core/mmc_ops.c @@ -385,6 +385,35 @@ int mmc_send_ext_csd(struct mmc_card *card, u8 *ext_csd) } EXPORT_SYMBOL_GPL(mmc_send_ext_csd); +int mmc_get_ext_csd(struct mmc_card *card, u8 **new_ext_csd) +{ + int err; + u8 *ext_csd; + + if (!card || !new_ext_csd) + return -EINVAL; + + if (!mmc_can_ext_csd(card)) + return -EOPNOTSUPP; + + /* + * As the ext_csd is so large and mostly unused, we don't store the + * raw block in mmc_card. + */ + ext_csd = kmalloc(512, GFP_KERNEL); + if (!ext_csd) + return -ENOMEM; + + err = mmc_send_ext_csd(card, ext_csd); + if (err) + kfree(ext_csd); + else + *new_ext_csd = ext_csd; + + return err; +} +EXPORT_SYMBOL_GPL(mmc_get_ext_csd); + int mmc_spi_read_ocr(struct mmc_host *host, int highcap, u32 *ocrp) { struct mmc_command cmd = {0}; diff --git a/include/linux/mmc/core.h b/include/linux/mmc/core.h index f206e29..0a77d35 100644 --- a/include/linux/mmc/core.h +++ b/include/linux/mmc/core.h @@ -155,6 +155,7 @@ extern int __mmc_switch(struct mmc_card *, u8, u8, u8, unsigned int, bool, bool, bool); extern int mmc_switch(struct mmc_card *, u8, u8, u8, unsigned int); extern int mmc_send_ext_csd(struct mmc_card *card, u8 *ext_csd); +extern int mmc_get_ext_csd(struct mmc_card *card, u8 **new_ext_csd); #define MMC_ERASE_ARG 0x00000000 #define MMC_SECURE_ERASE_ARG 0x80000000