Received: by 2002:a05:7412:6592:b0:d7:7d3a:4fe2 with SMTP id m18csp928630rdg; Fri, 11 Aug 2023 04:46:13 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGsXHowIbDabpb78h05BsQyhBI9klpz9h3L5z6GcivTS+V2jxV2PLOm6WAa0bzDuQpmJULl X-Received: by 2002:a05:6a21:9992:b0:10f:1d33:d667 with SMTP id ve18-20020a056a21999200b0010f1d33d667mr2270112pzb.5.1691754372810; Fri, 11 Aug 2023 04:46:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691754372; cv=none; d=google.com; s=arc-20160816; b=iFUoH8+seBpDE4evu4iaJIZMu9da7HnYpBPS8+xP0aVvofUQvyyj+h/LOmyQG2F78k RsZ4IN9N5z7xHyDkRqC3ZNwwk1GktFGVN6KFhkU/P3ps3CS5anR+1c3dNR85vy2FIehB CGDNr4+Gj3lDBHhkxGAbotsDB+lA86g1iyldd3UiZirE57IovKaZrD6oosFghgHNs6Ej +BJdLUYjwNU5rEfevcO6gwBQAMdQ6wQrXdDqjfSgM4NUPbKCKy6FuFIz/NssRqfYUU4T t+mDFJ6mx1BdmD1cC9Wgmeady/sNQ/aM1IH91vBI2sSWwtgwMjDTrQFqlVXNMAQWStyd ts9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=LVi+mii7gitrKtpzMesmKYe+HovpMQt3SZaQ0whSTDk=; fh=vVAzBNcJPt05GwU7HAlEigRcMYa9nDZbBCRgVMuMXDE=; b=MLMr1DQwW/+B94QZZkwsGvBPcQvBhgHlQFn6ERSjSvjNvOD24uD9aVP9C2lbdZhhRk KXCmSK1om0eLtSBZQvAYc/qLR/t6EeJQvuwWW7fTH9DSiVcbr0tKcDSKjGPMMSCVGBMa 7Qmb2Hn48IIew2cC7nZm3ZKw2dgRwrSwgx4ZZj9Vb35u3r0NTcwm1tnLY7fOr/BIaLaX URJMF3ZIRkCwtk0in3f5ymexgb/J84os1pkeUsa62vtX0D2gLnwgrzdZ1zYqyMv91yS0 wPbwOzj3CTyM5JbL6u52U2MGrm8QcD8Yjmkxw5cjjNAHHenHBJYLhqGpGLm9EEGXW9iA V72A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=Tj6KKz3a; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y42-20020a056a00182a00b0068756b49d3dsi3437034pfa.69.2023.08.11.04.46.00; Fri, 11 Aug 2023 04:46:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=Tj6KKz3a; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232046AbjHKKPM (ORCPT + 99 others); Fri, 11 Aug 2023 06:15:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39030 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229546AbjHKKPK (ORCPT ); Fri, 11 Aug 2023 06:15:10 -0400 Received: from mail-pf1-x436.google.com (mail-pf1-x436.google.com [IPv6:2607:f8b0:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 53EC03A85; Fri, 11 Aug 2023 03:14:40 -0700 (PDT) Received: by mail-pf1-x436.google.com with SMTP id d2e1a72fcca58-687ca37628eso1650632b3a.1; Fri, 11 Aug 2023 03:14:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1691748880; x=1692353680; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=LVi+mii7gitrKtpzMesmKYe+HovpMQt3SZaQ0whSTDk=; b=Tj6KKz3auEzGqe+kIqHqjiPerraxl3oUIbr0cdaqVAI0PGpnTaZz7tbxYZWN32SMNX J/YKzNZ8vwzIuZDHi8RGXgb1ERezfe9l/Z46zbBkMIeCreFga2lZiSzPsBDBHE73Okhi bF79vvx71Qvx1+Xfart6GdBioSSXfqZ4VxCgMZ1MkQCBcovZj2EP03gkG5XEVfyHeBnM AGUVxdgGRH0vJZ5W+o0LJUxNS/TW2zE9rKWBM3dhNTku3ZXwWvPnVAb3tZuuCMTyCTse h9oy5VPOAtA5sykKK/TyT2cWZkqx/vOUXlZiwkR95yuMkoD3QTaGKY25aN7bKotMmebu KwOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691748880; x=1692353680; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=LVi+mii7gitrKtpzMesmKYe+HovpMQt3SZaQ0whSTDk=; b=lVhof9qw8Q2jX1oMListsVzST//6AJBxLs/4QTd7knLVn9wtg7PvQnsgxKKk/rk0C0 04I+INNwcfM74m5U1zvNx9igrV2AfrLD1UJPO7vEQx2UkJTsl2rkG2CB5jeVUci+mNHr u8ChC6DPrGH3TBV7APi5SxW+iYJgIXsoEbTggw3EI5hwJrOlo4AsCuRyT9xQic877qzb XVNh7uteLxAd43xnMkehugYEEC9TkEHL20Z818ndtLqqhMc1skqXfjPiuxxRkPOL1fZ9 3Oxg3tOYAUuo98TIEABpbAYvhs7px9vFiZFCm7qFFuRR36Kbs2HPZRXdYGbAbduFyzJU CjVg== X-Gm-Message-State: AOJu0Yx7qIlsir4gxuc76K2+JwIJmCZGXnjYeFBWYxcutk+AHBFtnBwU J30PvbkMMxzZx/51PA8/7/M= X-Received: by 2002:a05:6a00:b84:b0:67e:ca79:36f0 with SMTP id g4-20020a056a000b8400b0067eca7936f0mr1842577pfj.0.1691748879561; Fri, 11 Aug 2023 03:14:39 -0700 (PDT) Received: from localhost.localdomain (2001-b400-e259-ffaa-4fa1-c440-e457-62f5.emome-ip6.hinet.net. [2001:b400:e259:ffaa:4fa1:c440:e457:62f5]) by smtp.gmail.com with ESMTPSA id l2-20020a62be02000000b00653fe2d527esm3010554pff.32.2023.08.11.03.14.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Aug 2023 03:14:39 -0700 (PDT) From: Victor Shih To: ulf.hansson@linaro.org, adrian.hunter@intel.com Cc: linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org, benchuanggli@gmail.com, HL.Liu@genesyslogic.com.tw, Greg.tu@genesyslogic.com.tw, Victor Shih , Victor Shih Subject: [PATCH V1] mmc: core: Cleanup mmc_sd_num_wr_blocks function Date: Fri, 11 Aug 2023 18:14:04 +0800 Message-Id: <20230811101404.4463-1-victorshihgli@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Victor Shih Use mmc_app_cmd function to simplify code in mmc_sd_num_wr_blocks function. Signed-off-by: Victor Shih --- drivers/mmc/core/block.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c index f701efb1fa78..c665b25bffc3 100644 --- a/drivers/mmc/core/block.c +++ b/drivers/mmc/core/block.c @@ -918,17 +918,9 @@ static int mmc_sd_num_wr_blocks(struct mmc_card *card, u32 *written_blocks) struct scatterlist sg; - cmd.opcode = MMC_APP_CMD; - cmd.arg = card->rca << 16; - cmd.flags = MMC_RSP_SPI_R1 | MMC_RSP_R1 | MMC_CMD_AC; - - err = mmc_wait_for_cmd(card->host, &cmd, 0); - if (err) - return err; - if (!mmc_host_is_spi(card->host) && !(cmd.resp[0] & R1_APP_CMD)) - return -EIO; - - memset(&cmd, 0, sizeof(struct mmc_command)); + err = mmc_app_cmd(card->host, card); + if (err) + return err; cmd.opcode = SD_APP_SEND_NUM_WR_BLKS; cmd.arg = 0; -- 2.25.1