Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp2109519ioo; Mon, 23 May 2022 10:14:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzuaKF4vb4cD+XMKklq4RumWa5cyWCi+f+VduVtKf2dpI5dkuRD4eGB6wLfUJ2vPZFPfESP X-Received: by 2002:a65:61b0:0:b0:3f6:5569:94e4 with SMTP id i16-20020a6561b0000000b003f6556994e4mr18335623pgv.430.1653326096151; Mon, 23 May 2022 10:14:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653326096; cv=none; d=google.com; s=arc-20160816; b=OeFmaXfhOPE0g+upX2xg9AHRac505r7KFUmML7z9H54jVAtpa9pgcFl6Ha7rHuMux9 fOAA2oHii9KLo6l6OT2SYJH0oaZxDpZLqdDFD3jIoaqvmoIu0XU7Mm3Mw1tKitiYUyOd hdJW65N8QxnMz+RVTNnD2WHIhszfrbjdEEbziKkWuBy5a1ky45B/h4JZgbNWVZMuBhCR txHF7z6L0r0QH6omMy+PKNL1w51mhttqz9j2bkoS7rqeRWw4fUKIa5vek3Ys9fEtfUad /7M58TBk8eyu14Lzlk/N+/I0T2MNot55mr0RcHRZHQpMYRRxaegJgmoqVsIYP1awA743 mYyg== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=0xFZqJiFAjckaoQJjqefF9nResCxCMd2kj6H3o8VA7Q=; b=CM7jBRCzO8OppOhmJl4jcSr9Fff4Cbo1UpFesjIvexxurxfSwv3b/Kz6CA+HZJYwYS vcKgYlglBvaRV+E66KF8S/x+IcZlSgKpVE6PUfFufaD9MizNx05SGB73tQU2KS7kxRXV KSYCu7MUT5RbGwT0nxte76Qt2PTom5fz5ItsubnTHjXerZVNbUpgtxvbq2qIaR1f3Gpr KDyH1LuBCyvKMQSW+BEj1rZeKIP1MoDfPZhZRqufm8sC5HpNJRoDvSCl+M/Mx7RqPxkN 9TVhhsGEynGLIv57XbT2Sa9UetwbYpLvHax5afK0mgoEVraHhu1Lfo6/2w3aJw+cW1d4 Z79A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=AlZhi7ky; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id s3-20020a632143000000b003fa67d4197esi248927pgm.124.2022.05.23.10.14.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 May 2022 10:14:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=AlZhi7ky; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 7105C6F484; Mon, 23 May 2022 10:14:34 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239832AbiEWRNH (ORCPT + 99 others); Mon, 23 May 2022 13:13:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35456 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239912AbiEWRL2 (ORCPT ); Mon, 23 May 2022 13:11:28 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 01FE66CA8A; Mon, 23 May 2022 10:10:42 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B49AA6149F; Mon, 23 May 2022 17:10:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B5FCFC385A9; Mon, 23 May 2022 17:10:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1653325816; bh=PtTaFhuG/99yQe8PlTPphxsox6m92HMPQPi+TXuU2x4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AlZhi7kyA5XB2d5KNZHTWTw20Ty3AR0PLVElgk5jtrKNFr7a+ujmvDP8p2wEYHdh4 hraav1bC3sX7SN3Gx/UmMASBjWsnmuNMFWGt6X0xgDGt/2XuNI+OJijbX4dCluUhCV 19uHDMxIly5iLNCnJakVpG8nJHfgYlzjiuIT3u/I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Greg Kroah-Hartman , Ulf Hansson , Florian Fainelli Subject: [PATCH 4.19 20/44] mmc: core: Default to generic_cmd6_time as timeout in __mmc_switch() Date: Mon, 23 May 2022 19:05:04 +0200 Message-Id: <20220523165756.859950133@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220523165752.797318097@linuxfoundation.org> References: <20220523165752.797318097@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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: Ulf Hansson commit 533a6cfe08f96a7b5c65e06d20916d552c11b256 upstream All callers of __mmc_switch() should now be specifying a valid timeout for the CMD6 command. However, just to be sure, let's print a warning and default to use the generic_cmd6_time in case the provided timeout_ms argument is zero. In this context, let's also simplify some of the corresponding code and clarify some related comments. Signed-off-by: Ulf Hansson Link: https://lore.kernel.org/r/20200122142747.5690-4-ulf.hansson@linaro.org Signed-off-by: Florian Fainelli Signed-off-by: Greg Kroah-Hartman --- drivers/mmc/core/mmc_ops.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) --- a/drivers/mmc/core/mmc_ops.c +++ b/drivers/mmc/core/mmc_ops.c @@ -458,10 +458,6 @@ static int mmc_poll_for_busy(struct mmc_ bool expired = false; bool busy = false; - /* We have an unspecified cmd timeout, use the fallback value. */ - if (!timeout_ms) - timeout_ms = MMC_OPS_TIMEOUT_MS; - /* * In cases when not allowed to poll by using CMD13 or because we aren't * capable of polling by using ->card_busy(), then rely on waiting the @@ -534,6 +530,12 @@ int __mmc_switch(struct mmc_card *card, mmc_retune_hold(host); + if (!timeout_ms) { + pr_warn("%s: unspecified timeout for CMD6 - use generic\n", + mmc_hostname(host)); + timeout_ms = card->ext_csd.generic_cmd6_time; + } + /* * If the cmd timeout and the max_busy_timeout of the host are both * specified, let's validate them. A failure means we need to prevent @@ -542,7 +544,7 @@ int __mmc_switch(struct mmc_card *card, * which also means they are on their own when it comes to deal with the * busy timeout. */ - if (!(host->caps & MMC_CAP_NEED_RSP_BUSY) && timeout_ms && + if (!(host->caps & MMC_CAP_NEED_RSP_BUSY) && host->max_busy_timeout && (timeout_ms > host->max_busy_timeout)) use_r1b_resp = false; @@ -554,10 +556,6 @@ int __mmc_switch(struct mmc_card *card, cmd.flags = MMC_CMD_AC; if (use_r1b_resp) { cmd.flags |= MMC_RSP_SPI_R1B | MMC_RSP_R1B; - /* - * A busy_timeout of zero means the host can decide to use - * whatever value it finds suitable. - */ cmd.busy_timeout = timeout_ms; } else { cmd.flags |= MMC_RSP_SPI_R1 | MMC_RSP_R1;