Received: by 2002:ac2:464d:0:0:0:0:0 with SMTP id s13csp3687790lfo; Mon, 23 May 2022 11:28:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxPe7YlTcWl2Se1W8e95U2+CmZP1xO19l5zk/wQSBwZhR/dWEdk+su8vxdzSK48rq/tejM1 X-Received: by 2002:a17:903:324e:b0:161:385a:c141 with SMTP id ji14-20020a170903324e00b00161385ac141mr24175553plb.154.1653330507267; Mon, 23 May 2022 11:28:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653330507; cv=none; d=google.com; s=arc-20160816; b=N7MnqZPtrvSks4fUy2ov+MyBCUlvD3Lphcd5bunPIUwYqFWk7yqf5c4j+DQjlUvdWz uB+MvijA3QWiR/Aa/NjZyOQFONdDeeW/BzEve6tF7td60tLVr7fdnzzJ0edB4G+fZ3wV Q8CgVOaxMCAu8axJpuMtRBpVcLId6vLaXlOoFtr0MMRXvP96ADYhvm9JfV59oFi4WVx2 0yMfb8LIc2/PR3A019o+rz4dMiSJg9TGBRpG96kM+roDhFD8AKPxt7IQ7o5B1849DUSu WfHyXs+13PavjuQXE66bnIVKucju8sBoO3PPtlXD60pGpk4WgqERE0zctSWAq7FisCvf w+FA== 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=f6zd1aKzl/DkB/3d/c3J5RkGWHS+bLlZeEWJBL6SmqU=; b=qGeXGCE868Y6FEz+8EQMBMbhS92idVZFseb/ZCfW0kEQHglhXBikP/S8/bcIigYG1L cwja3NRVU4fAZkFZjoKmpqmozAYfV8HOBI+WxxYf3eASPXL6S4LBgFcAV5jX+XhdSvqp 5Ulwc8PhaVSGKAp6rWCcHjExwpp4C/RbTNmWOlCLK0ku5oZLN26mWLa3RkAKG0Jsr1uT NWuYgKurtQc2SMz6QsfZggTBxvMZCxtHgbkCCy/NPM6MsCRJMcJusA30LvV7UPQZwu+S FkGYCxOdUP+uQbPxvRxdLAWDA4DhuB9Wq1BCHpnbUl2li/ZiUfLBDyDxx81oIXCwa9bg 66GQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=jxg88mqb; 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 t29-20020a63445d000000b003f2839619e2si10741323pgk.257.2022.05.23.11.28.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 May 2022 11:28:27 -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=jxg88mqb; 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 5A7268A317; Mon, 23 May 2022 11:27:38 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239721AbiEWRKk (ORCPT + 99 others); Mon, 23 May 2022 13:10:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35414 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239524AbiEWRJ3 (ORCPT ); Mon, 23 May 2022 13:09:29 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8273E4EA07; Mon, 23 May 2022 10:09:15 -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 ams.source.kernel.org (Postfix) with ESMTPS id 5FCD0B811F6; Mon, 23 May 2022 17:09:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BD06DC385A9; Mon, 23 May 2022 17:09:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1653325750; bh=cKXq3/EbTX8YVQiuqecQn9SX4Ky7zX2DwSuQqg0oBr0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jxg88mqbLUpQ16rUg0IM4Ac3GchGfiA1jn6ysy5QI9Ng4iwgwXbblM9WNPGPBO5/e wIUkSMU67wOBi8fmU3ZA/g8CrRIJccsm4EJbwNX2MfIN6QkSDq5nfCOU0MdLM8onFT +DdAd6dg4wjZgrwdEG3JNLEtd8ew9wkkHLIHmhtg= 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.14 13/33] mmc: core: Default to generic_cmd6_time as timeout in __mmc_switch() Date: Mon, 23 May 2022 19:05:02 +0200 Message-Id: <20220523165750.023556838@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220523165746.957506211@linuxfoundation.org> References: <20220523165746.957506211@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 | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 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,14 +530,20 @@ 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 * the host from doing hw busy detection, which is done by converting * to a R1 response instead of a R1B. */ - if (timeout_ms && host->max_busy_timeout && - (timeout_ms > host->max_busy_timeout)) + if (host->max_busy_timeout && + (timeout_ms > host->max_busy_timeout)) use_r1b_resp = false; cmd.opcode = MMC_SWITCH; @@ -552,10 +554,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;