From patchwork Fri Jul 2 13:42:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 469552 Delivered-To: patches@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp1400713jao; Fri, 2 Jul 2021 06:42:46 -0700 (PDT) X-Received: by 2002:a2e:91cd:: with SMTP id u13mr3840953ljg.421.1625233366645; Fri, 02 Jul 2021 06:42:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625233366; cv=none; d=google.com; s=arc-20160816; b=q8Uhl8D7oP+90egElvgZsaZiqYHeltBkAtQFzYh9IEaIf5d8FcbTebwLj3rAlvmpEk 8MKlHxuVpMitZXdI5jZ2gdl03ln7FA4HQVyrPKG71lBLLu9glqil6lbXvp8Bsa25u2fE wGHFY5homV5FOKWY1neOj65ZSwMUn1zT89Uxe9/fNOxx+pCsORdOfpdg8Fo9vXvU6ibF S/+F59lbTRDhe/A1daQLGzmcL4EAJRBsdTsBIOPu3Ea22SWADox4R1qnwU3RxNvI6eyy J853B9kNM2wbDkHPZBA7o+xy/k7iJzVzd6tXw94yhTYmAsoLj6wEyJHJf9sLYqymsjW9 rTWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=NoI9BTrBB2j37D3MNXSwVMTEwSv5M2czDJC0Zd1MVQU=; b=ApTCXgN/l5c8ULkvCnZ2autujCfUjPFRXe5q0bjOyy3fgnlpqi7uN8DfM8QPU5hlWa L3jvmSgFBqHi5Yg5RuoNTjS1mmrtQOS84DMBlDM71FEEYyFXiovcX08mKWYsLtxjONiw UqHFnXE8s11q/I1cpiMGKnbjLCtRJreHkN5qaBL7rZi/9rP5lcOXI231nZBWOUL/mihO XOlGg5mmWxSsocgh/svEhFcAJgZ2rl1CjEhgwFwofETDJRtxTjh4H3UqMj7U0Mk6anib qhLwqME5n5H/ppEoB7RQgqncIsS6eB7yshoZLPGQIGJwiE9vBqnCk6UH3phVPUm5Aal1 xujQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kIPiqSzO; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.41 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-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id m11sor822758lfu.93.2021.07.02.06.42.46 for (Google Transport Security); Fri, 02 Jul 2021 06:42:46 -0700 (PDT) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kIPiqSzO; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.41 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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 :mime-version:content-transfer-encoding; bh=NoI9BTrBB2j37D3MNXSwVMTEwSv5M2czDJC0Zd1MVQU=; b=kIPiqSzOvGOz6+vds3ovZUM/np0UiY4usyIqfkwIruTbbiB7jfsb59JXiQvjBOtPG7 AzpyvWEpq3Djr5Yw99qCRr57XT9ZMa7NCMpR2FGFZrldljoYSFp1jCpXGut/679U+xF0 eEkjntEQ7xK5R8sZqdkN6AFpKayx8o8lEqK1u8Y//YLck63gs+iJlwnqBpFvuw5/Btny qMFC8MMIAH+2Adr5iOP1x8pPgsjCeeNGzvU/TZ3HZwSdBtavQbNlVJ/N5J6uS0Fe3CBI z9WONDRhmmi7gnhicE8IHWCDegzJ80MMxx79kaNUaB482viXRKR/fm6Aj6azJZJ3KIJk Xe/g== 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:mime-version:content-transfer-encoding; bh=NoI9BTrBB2j37D3MNXSwVMTEwSv5M2czDJC0Zd1MVQU=; b=hC/P0QcU/52NDfTp4ONduvx53CPbNkXt59bCOcl+ticKf0ju+NuGwsExLyhD49n8s5 hQA6ApdrK41U8jVMv4Ls1wbB4/weQl6tE3y97YfW3/p86s+i0TRP9fDF2wSdRMMkTCtB Q6ApyzqrPJQTraJZAPs10gEM+Ki484wRkyp0deb7GmdGtRy7FHsyVH031P2vWdcnpT5E wolUmgpCHiQ0m0lJt8A0BdIYQ98/0XrwGXg9gy7jroXRDBF7geVQ7xYMC/fnezRV/0se sYTZKbuEWTPQpCFKp50odL8V1Tz8FzMXXNVcc3Jv794dK9FqQEDNRAgLhSAhFe3Xsk28 tzaA== X-Gm-Message-State: AOAM532HjhWHv8PEpLkodTIuS5X/Md+TKQ8vcmuRh1bjSK5y+aCZXpbi AzvVMMTJ2+qr8QbTiWVai3vWjoLr X-Google-Smtp-Source: ABdhPJwJOqCe7efbM/lMcm+PNg0kMxyZmH1OrHYVCdAXAbQ8gwaiTDU8d7GiRNDai6Nn/8fCom5gPg== X-Received: by 2002:ac2:42c1:: with SMTP id n1mr3931436lfl.270.1625233366311; Fri, 02 Jul 2021 06:42:46 -0700 (PDT) Return-Path: Received: from localhost.localdomain (h-155-4-129-146.NA.cust.bahnhof.se. [155.4.129.146]) by smtp.gmail.com with ESMTPSA id u5sm277486lfg.268.2021.07.02.06.42.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Jul 2021 06:42:45 -0700 (PDT) From: Ulf Hansson To: linux-mmc@vger.kernel.org, Ulf Hansson Cc: Adrian Hunter , Linus Walleij , Wolfram Sang , Shawn Lin , Christian Lohle , linux-kernel@vger.kernel.org Subject: [PATCH 2/3] mmc: core: Avoid hogging the CPU while polling for busy for mmc ioctls Date: Fri, 2 Jul 2021 15:42:28 +0200 Message-Id: <20210702134229.357717-3-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210702134229.357717-1-ulf.hansson@linaro.org> References: <20210702134229.357717-1-ulf.hansson@linaro.org> MIME-Version: 1.0 When __mmc_blk_ioctl_cmd() calls card_busy_detect() to verify that the card's states moves back into transfer state, the polling with CMD13 is done without any delays in between the commands being sent. Rather than fixing card_busy_detect() in this regards, let's instead convert into using the common mmc_poll_for_busy(), which also helps us to avoid open-coding. Signed-off-by: Ulf Hansson --- drivers/mmc/core/block.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- 2.25.1 diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c index 1b5576048cdb..0f9044cf3aab 100644 --- a/drivers/mmc/core/block.c +++ b/drivers/mmc/core/block.c @@ -599,7 +599,8 @@ static int __mmc_blk_ioctl_cmd(struct mmc_card *card, struct mmc_blk_data *md, * Ensure RPMB/R1B command has completed by polling CMD13 * "Send Status". */ - err = card_busy_detect(card, MMC_BLK_TIMEOUT_MS, NULL); + err = mmc_poll_for_busy(card, MMC_BLK_TIMEOUT_MS, false, + MMC_BUSY_IO); } return err;