From patchwork Thu Jun 8 13:27:45 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 103393 Delivered-To: patches@linaro.org Received: by 10.140.91.77 with SMTP id y71csp2439567qgd; Thu, 8 Jun 2017 06:28:03 -0700 (PDT) X-Received: by 10.46.81.17 with SMTP id f17mr11612451ljb.96.1496928482277; Thu, 08 Jun 2017 06:28:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1496928482; cv=none; d=google.com; s=arc-20160816; b=GemKBFMOVL0/nYelHGZPtXXiMAJ5SsAlTfGfltzPuRK/fDJolY+W3A6ovs8mizgNTO SIsOASH39iXnjF060iQXufytwsz7SFlaojD39/+xINmXme2cNO1Jil6pr2GXvHYxOxBU rqNtnaaod+Uluo1xczlHtTWtcY+7kytiwdN4EQzLyZ7fWBm5v3wQIjczifxiBHj+cJvF QiqbTXbuvL6C/1fmznNHadS2XltYv3C8weP/H80G1/FAGv2U3TyW1F64Hh/bBOqgJVeV 4vLTP08jA2/miHVy+zHKwj1rDfzmVOYP4GzSr7hzz11y2u3u1YJ4HQGck7JAb7vOaRJq g6uA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=61hvngFNBmID7dK9WxOaB7kPPIqB9HXMtO7V4mrOmkM=; b=wChKce6hJiKZ+xtEKI822LvJKk6EK/csYBhnmxQboIcNHjoDZMkOPhdSE7xT+obp/s 4Hs0XjnZ49X3yZB6v67t3A1oqv5oImgE49/TijqxmtS9aRCoCdJfy6CWgcHSLFyztYE+ nGymyU1/v3+wcaGim4qAPkDU8eQJCRLE1NWOmVdJmFbDv/f+IwtBEyPVCuartEh1RjRY YuZtimowdtV0X8At6uzF1MmdpgBznFW49rBqRKh67yDzVJAqgfimUTyCQ6btv+WbaVJi q9BSJmfXv+dr8savk9BlEWxWqgO5kb74cB0zIZXqbE1crSTFj60PtmsU39DCCaLbS3gx cbFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 2a00:1450:4010:c07::22f as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-lf0-x22f.google.com (mail-lf0-x22f.google.com. [2a00:1450:4010:c07::22f]) by mx.google.com with ESMTPS id m188si2508764lfm.86.2017.06.08.06.28.02 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 08 Jun 2017 06:28:02 -0700 (PDT) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 2a00:1450:4010:c07::22f as permitted sender) client-ip=2a00:1450:4010:c07::22f; 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::22f as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: by mail-lf0-x22f.google.com with SMTP id p189so18039386lfe.2 for ; Thu, 08 Jun 2017 06:28:02 -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=61hvngFNBmID7dK9WxOaB7kPPIqB9HXMtO7V4mrOmkM=; b=KQxXyl4jtnsH/FSl6JtIVcNXi97gpv/Pj1Q0/giViy72OYHmg2Zm4ZlAdbMKxp+zjz wafUI0tgLk1CsLwUUY2Wc/Dv8S7pScF2tdK6BHsXDvy+Ea8abYFvOpHw/4uKwGIsucTd R+ltFKTqwGERXnNUdnm87gV2bT5H7ibrPb+CU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=61hvngFNBmID7dK9WxOaB7kPPIqB9HXMtO7V4mrOmkM=; b=n+WL8l3rgjkGu8w/MIhvj97Zzb3sPPkeo79Vk1ik2ep2Xz8OD9+Rj1BhM88LczL9Y1 Hb7FKa6l+9LhbYP/5lPZ6VUwylW0XORGVBAWl9oflrg368JECrO1Za49jJw7oNXWFQh6 iW4NYUTgoenwW/mDHMwEswkEVR0yqvJX45Y/XGzKxoQCZUcotrNEoZDWa2lEg4fApSaU xJg3te0hl8N7r1X1GUxwbWB22Tw1npz77BG7h5vziP+U7O44Emjq3I1jFtUDJi77BseS l7BVCn4pld0HRN4+vT41Amok1Os4nk1z0e3EiCQunL7e6epb6cdvhLJaMVVNh+LybMgL QhcQ== X-Gm-Message-State: AODbwcBJ3jRUcKIZKhezJWH8uklDNb0eA7jFLv/f57BzzsoMdxUvQ7Z0 i8UNhYLv5g6UG5vdbRU= X-Received: by 10.46.20.81 with SMTP id 17mr7553920lju.111.1496928481740; Thu, 08 Jun 2017 06:28:01 -0700 (PDT) Return-Path: Received: from uffe-XPS-13-9360.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id i8sm1025178ljb.55.2017.06.08.06.28.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 08 Jun 2017 06:28:01 -0700 (PDT) From: Ulf Hansson To: linux-mmc@vger.kernel.org, Ulf Hansson Cc: Jaehoon Chung , Adrian Hunter , Linus Walleij Subject: [PATCH 9/9] mmc: core: Clarify code for sending CSD Date: Thu, 8 Jun 2017 15:27:45 +0200 Message-Id: <1496928465-25004-10-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1496928465-25004-1-git-send-email-ulf.hansson@linaro.org> References: <1496928465-25004-1-git-send-email-ulf.hansson@linaro.org> To make the code more consistent and to increase readability, add an mmc_spi_send_csd() function, which gets called from mmc_send_csd() in case of SPI mode. Signed-off-by: Ulf Hansson --- drivers/mmc/core/mmc_ops.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) -- 2.7.4 Reviewed-by: Linus Walleij diff --git a/drivers/mmc/core/mmc_ops.c b/drivers/mmc/core/mmc_ops.c index b60b4da..5f051ea 100644 --- a/drivers/mmc/core/mmc_ops.c +++ b/drivers/mmc/core/mmc_ops.c @@ -291,15 +291,11 @@ mmc_send_cxd_data(struct mmc_card *card, struct mmc_host *host, return 0; } -int mmc_send_csd(struct mmc_card *card, u32 *csd) +static int mmc_spi_send_csd(struct mmc_card *card, u32 *csd) { int ret, i; __be32 *csd_tmp; - if (!mmc_host_is_spi(card->host)) - return mmc_send_cxd_native(card->host, card->rca << 16, - csd, MMC_SEND_CSD); - csd_tmp = kzalloc(16, GFP_KERNEL); if (!csd_tmp) return -ENOMEM; @@ -316,6 +312,15 @@ int mmc_send_csd(struct mmc_card *card, u32 *csd) return ret; } +int mmc_send_csd(struct mmc_card *card, u32 *csd) +{ + if (mmc_host_is_spi(card->host)) + return mmc_spi_send_csd(card, csd); + + return mmc_send_cxd_native(card->host, card->rca << 16, csd, + MMC_SEND_CSD); +} + static int mmc_spi_send_cid(struct mmc_host *host, u32 *cid) { int ret, i;