From patchwork Thu Oct 20 08:19:36 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 78439 Delivered-To: patches@linaro.org Received: by 10.140.97.247 with SMTP id m110csp657211qge; Thu, 20 Oct 2016 01:19:54 -0700 (PDT) X-Received: by 10.25.16.210 with SMTP id 79mr10918345lfq.4.1476951594705; Thu, 20 Oct 2016 01:19:54 -0700 (PDT) Return-Path: Received: from mail-lf0-x22c.google.com (mail-lf0-x22c.google.com. [2a00:1450:4010:c07::22c]) by mx.google.com with ESMTPS id l79si5954134lfb.29.2016.10.20.01.19.54 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 20 Oct 2016 01:19:54 -0700 (PDT) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 2a00:1450:4010:c07::22c as permitted sender) client-ip=2a00:1450:4010:c07::22c; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 2a00:1450:4010:c07::22c as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: by mail-lf0-x22c.google.com with SMTP id b75so70033602lfg.3 for ; Thu, 20 Oct 2016 01:19:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=L3pu1vDrp9YDhaJ70pkkIue/EqwnJX7szkFUXYQCXI4=; b=IVYCKqZEUuXtnHyaFzDyWY2ZuPsFWjVCQaHh2cl7mTBixcUj+WUIPWS9Wz6opYKJ0h DRsZQBbMSRDAzn1APOTPfrls9KP9dnl6JftIGpEfZraADBQ1euPXuncz73JtUXzHtuqP 6HhEF85D7EBDnpIqyUQno7FbuAcfV0TRai1wM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=L3pu1vDrp9YDhaJ70pkkIue/EqwnJX7szkFUXYQCXI4=; b=aScLCVY/blV/YoTrnCRfleTAaZrANLqmKpMXW7VwSVUEKxuA+7g8wjuscKtwylhbwk 909WPk3aRye76TJlqKpx5RmSiLXE7M9Wcisu6yC7Wf0Mj3hC7OwI5fznHGhy4jjk2TQH 1s8bWTzsfdN80KtQ0THeqh01rGZ0mTLsioI65PM+6ep3/svUQ96WxnvNxTLa3lvwQR9Y ZPObvfKKdsUGCQGjPCJzkJaXrDYLmMJmF9rlZ9ro2C2Ebk/3rPw7QodRM3w039fCs6EC qMwQ8umAePiQ0xtDVNXfrLwb8uipLA42EcHSJ0jykoZWV50HTf2Jp90fcAsNzItnYo1A eBdQ== X-Gm-Message-State: AA6/9RlNhjKfQW1T7HrFz5VO8G6yWrgwM7rjm92LPuo6s15gRkPIxsG0ROD9oJbLbc5kaYOvt+k= X-Received: by 10.25.43.12 with SMTP id r12mr9587812lfr.104.1476951594202; Thu, 20 Oct 2016 01:19:54 -0700 (PDT) Return-Path: Received: from uffe-Latitude-E6430s.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id h7sm11672584ljh.21.2016.10.20.01.19.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 20 Oct 2016 01:19:53 -0700 (PDT) From: Ulf Hansson To: linux-mmc@vger.kernel.org, Ulf Hansson Cc: Jaehoon Chung , Adrian Hunter , Linus Walleij , Chaotian Jing Subject: [PATCH 1/4] mmc: core: Make mmc_switch_status() available for mmc core Date: Thu, 20 Oct 2016 10:19:36 +0200 Message-Id: <1476951579-26125-2-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1476951579-26125-1-git-send-email-ulf.hansson@linaro.org> References: <1476951579-26125-1-git-send-email-ulf.hansson@linaro.org> Following changes needs mmc_switch_status() to be available both from mmc.c and mmc_ops.c. Allow that by moving its implementation to mmc_ops.c and make it available via mmc_ops.h. Moving mmc_switch_status() to mmc_ops.c, also enables us to turn mmc_switch_status_error() into static function. So let's take the opportunity to change this as well. Signed-off-by: Ulf Hansson --- drivers/mmc/core/mmc.c | 13 ------------- drivers/mmc/core/mmc_ops.c | 15 ++++++++++++++- drivers/mmc/core/mmc_ops.h | 2 +- 3 files changed, 15 insertions(+), 15 deletions(-) -- 1.9.1 diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index 39fc5b2..e811bd9 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c @@ -1000,19 +1000,6 @@ static int mmc_select_bus_width(struct mmc_card *card) return err; } -/* Caller must hold re-tuning */ -static int mmc_switch_status(struct mmc_card *card) -{ - u32 status; - int err; - - err = mmc_send_status(card, &status); - if (err) - return err; - - return mmc_switch_status_error(card->host, status); -} - /* * Switch to the high-speed mode */ diff --git a/drivers/mmc/core/mmc_ops.c b/drivers/mmc/core/mmc_ops.c index ad6e979..f9af1c0 100644 --- a/drivers/mmc/core/mmc_ops.c +++ b/drivers/mmc/core/mmc_ops.c @@ -440,7 +440,7 @@ int mmc_spi_set_crc(struct mmc_host *host, int use_crc) return err; } -int mmc_switch_status_error(struct mmc_host *host, u32 status) +static int mmc_switch_status_error(struct mmc_host *host, u32 status) { if (mmc_host_is_spi(host)) { if (status & R1_SPI_ILLEGAL_COMMAND) @@ -455,6 +455,19 @@ int mmc_switch_status_error(struct mmc_host *host, u32 status) return 0; } +/* Caller must hold re-tuning */ +int mmc_switch_status(struct mmc_card *card) +{ + u32 status; + int err; + + err = mmc_send_status(card, &status); + if (err) + return err; + + return mmc_switch_status_error(card->host, status); +} + /** * __mmc_switch - modify EXT_CSD register * @card: the MMC card associated with the data transfer diff --git a/drivers/mmc/core/mmc_ops.h b/drivers/mmc/core/mmc_ops.h index f1b8e81..7f6c0e9 100644 --- a/drivers/mmc/core/mmc_ops.h +++ b/drivers/mmc/core/mmc_ops.h @@ -27,7 +27,7 @@ int mmc_bus_test(struct mmc_card *card, u8 bus_width); int mmc_send_hpi_cmd(struct mmc_card *card, u32 *status); int mmc_can_ext_csd(struct mmc_card *card); -int mmc_switch_status_error(struct mmc_host *host, u32 status); +int mmc_switch_status(struct mmc_card *card); int __mmc_switch(struct mmc_card *card, u8 set, u8 index, u8 value, unsigned int timeout_ms, bool use_busy_signal, bool send_status, bool ignore_crc);